Merge up to trunk rev 490505

git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/new_persistence@490613 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java
index b058211..1c63a55 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java
@@ -21,12 +21,11 @@
 package org.apache.qpid.server.exchange;
 
 import org.apache.log4j.Logger;
+import org.apache.qpid.framing.FieldTable;
+import org.apache.qpid.framing.FieldTable;
+import org.apache.qpid.framing.AMQTypedValue;
 
-import java.util.Collections;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.*;
 
 /**
  * Defines binding and matching based on a set of headers.
@@ -35,11 +34,53 @@
 {
     private static final Logger _logger = Logger.getLogger(HeadersBinding.class);
 
-    private final Map _mappings = new HashMap();
-    private final Set<Object> required = new HashSet<Object>();
-    private final Set<Map.Entry> matches = new HashSet<Map.Entry>();
+    private final FieldTable _mappings = new FieldTable();
+    private final Set<String> required = new HashSet<String>();
+    private final Map<String,Object> matches = new HashMap<String,Object>();
     private boolean matchAny;
 
+    private final class MatchesOrProcessor implements FieldTable.FieldTableElementProcessor
+    {
+        private Boolean _result = Boolean.FALSE;
+
+        public boolean processElement(String propertyName, AMQTypedValue value)
+        {
+            if((value != null) && (value.getValue() != null) && value.getValue().equals(matches.get(propertyName)))
+            {
+                _result = Boolean.TRUE;
+                return false;
+            }
+            return true;
+        }
+
+        public Object getResult()
+        {
+            return _result;
+        }
+    }
+
+    private final class RequiredOrProcessor implements FieldTable.FieldTableElementProcessor
+    {
+        Boolean _result = Boolean.FALSE;
+
+        public boolean processElement(String propertyName, AMQTypedValue value)
+        {
+            if(required.contains(propertyName))
+            {
+                _result = Boolean.TRUE;
+                return false;
+            }
+            return true;
+        }
+
+        public Object getResult()
+        {
+            return _result;
+        }
+    }
+
+
+
     /**
      * Creates a binding for a set of mappings. Those mappings whose value is
      * null or the empty string are assumed only to be required headers, with
@@ -47,33 +88,50 @@
      * define a required match of value. 
      * @param mappings the defined mappings this binding should use
      */
-    HeadersBinding(Map mappings)
-    {
-        //noinspection unchecked
-        this(mappings == null ? new HashSet<Map.Entry>() : mappings.entrySet());
-        _mappings.putAll(mappings);
-    }
 
-    private HeadersBinding(Set<Map.Entry> entries)
+    HeadersBinding(FieldTable mappings)
     {
-        for (Map.Entry e : entries)
+        Enumeration propertyNames = mappings.getPropertyNames();
+        while(propertyNames.hasMoreElements())
         {
-            if (isSpecial(e.getKey()))
-            {
-                processSpecial((String) e.getKey(), e.getValue());
-            }
-            else if (e.getValue() == null || e.getValue().equals(""))
-            {
-                required.add(e.getKey());
-            }
-            else
-            {
-                matches.add(e);
-            }
+            String propName = (String) propertyNames.nextElement();
+            _mappings.put(propName, mappings.getObject(propName));
         }
+        initMappings();
     }
 
-    protected Map getMappings()
+    private void initMappings()
+    {
+
+        _mappings.processOverElements(new FieldTable.FieldTableElementProcessor()
+        {
+
+            public boolean processElement(String propertyName, AMQTypedValue value)
+            {
+                if (isSpecial(propertyName))
+                {
+                    processSpecial(propertyName, value.getValue());
+                }
+                else if (value.getValue() == null || value.getValue().equals(""))
+                {
+                    required.add(propertyName);
+                }
+                else
+                {
+                    matches.put(propertyName,value.getValue());
+                }
+
+                return true;
+            }
+
+            public Object getResult()
+            {
+                return null;
+            }
+        });
+    }
+
+    protected FieldTable getMappings()
     {
         return _mappings;
     }
@@ -84,7 +142,7 @@
      * @return true if the headers define any required keys and match any required
      * values
      */
-    public boolean matches(Map headers)
+    public boolean matches(FieldTable headers)
     {
         if(headers == null)
         {
@@ -96,18 +154,37 @@
         }
     }
 
-    private boolean and(Map headers)
+    private boolean and(FieldTable headers)
     {
-        //need to match all the defined mapping rules:
-        return headers.keySet().containsAll(required)
-                && headers.entrySet().containsAll(matches);
+        if(headers.keys().containsAll(required))
+        {
+            for(Map.Entry<String, Object> e : matches.entrySet())
+            {
+                if(!e.getValue().equals(headers.getObject(e.getKey())))
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
+        else
+        {
+            return false;
+        }
     }
 
-    private boolean or(Map headers)
+
+    private boolean or(final FieldTable headers)
     {
-        //only need to match one mapping rule:
-        return !Collections.disjoint(headers.keySet(), required)
-                || !Collections.disjoint(headers.entrySet(), matches);
+        if(required.isEmpty() || !(Boolean) headers.processOverElements(new RequiredOrProcessor()))
+        {
+            return ((!matches.isEmpty()) && (Boolean) headers.processOverElements(new MatchesOrProcessor()))
+                    || (required.isEmpty() && matches.isEmpty());
+        }
+        else
+        {
+            return true;
+        }
     }
 
     private void processSpecial(String key, Object value)
diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersExchange.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersExchange.java
index 97b4ade..dcb64e2 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersExchange.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersExchange.java
@@ -22,10 +22,7 @@
 
 import org.apache.log4j.Logger;
 import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.BasicContentHeaderProperties;
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.framing.FieldTableFactory;
+import org.apache.qpid.framing.*;
 import org.apache.qpid.server.management.MBeanConstructor;
 import org.apache.qpid.server.management.MBeanDescription;
 import org.apache.qpid.server.queue.AMQMessage;
@@ -34,10 +31,7 @@
 
 import javax.management.JMException;
 import javax.management.openmbean.*;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 /**
@@ -119,16 +113,24 @@
                 String queueName = registration.queue.getName();
 
                 HeadersBinding headers = registration.binding;
-                Map<Object, Object> headerMappings = headers.getMappings();
-                List<String> mappingList = new ArrayList<String>();
+                FieldTable headerMappings = headers.getMappings();
+                final List<String> mappingList = new ArrayList<String>();
 
-                for (Map.Entry<Object, Object> en : headerMappings.entrySet())
+                headerMappings.processOverElements(new FieldTable.FieldTableElementProcessor()
                 {
-                    String key = en.getKey().toString();
-                    String value = en.getValue().toString();
 
-                    mappingList.add(key + "=" + value);
-                }
+                    public boolean processElement(String propertyName, AMQTypedValue value)
+                    {
+                        mappingList.add(propertyName + "=" + value.getValue());
+                        return true;
+                    }
+
+                    public Object getResult()
+                    {
+                        return mappingList;
+                    }
+                });
+
 
                 Object[] bindingItemValues = {count++, queueName, mappingList.toArray(new String[0])};
                 CompositeData bindingData = new CompositeDataSupport(_bindingDataType, _bindingItemNames, bindingItemValues);
@@ -155,7 +157,7 @@
             }
 
             String[] bindings  = binding.split(",");
-            FieldTable fieldTable = FieldTableFactory.newFieldTable();
+            FieldTable bindingMap = new FieldTable();
             for (int i = 0; i < bindings.length; i++)
             {
                 String[] keyAndValue = bindings[i].split("=");
@@ -163,10 +165,10 @@
                 {
                     throw new JMException("Format for headers binding should be \"<attribute1>=<value1>,<attribute2>=<value2>\" ");
                 }
-                fieldTable.put(keyAndValue[0], keyAndValue[1]);
+                bindingMap.setString(keyAndValue[0], keyAndValue[1]);
             }
 
-            _bindings.add(new Registration(new HeadersBinding(fieldTable), queue));
+            _bindings.add(new Registration(new HeadersBinding(bindingMap), queue));
         }
 
     } // End of MBean class
@@ -185,7 +187,7 @@
 
     public void route(AMQMessage payload) throws AMQException
     {
-        Map headers = getHeaders(payload.getContentHeaderBody());
+        FieldTable headers = getHeaders(payload.getContentHeaderBody());
         if (_logger.isDebugEnabled())
         {
             _logger.debug("Exchange " + getName() + ": routing message with headers " + headers);
@@ -248,7 +250,7 @@
         return !_bindings.isEmpty();
     }
 
-    protected Map getHeaders(ContentHeaderBody contentHeaderFrame)
+    protected FieldTable getHeaders(ContentHeaderBody contentHeaderFrame)
     {
         //what if the content type is not 'basic'? 'file' and 'stream' content classes also define headers,
         //but these are not yet implemented.
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/BasicCancelMethodHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/BasicCancelMethodHandler.java
index 673556c..198d2c1 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/BasicCancelMethodHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/BasicCancelMethodHandler.java
@@ -54,7 +54,12 @@
         channel.unsubscribeConsumer(protocolSession, body.consumerTag);
         if(!body.nowait)
         {
-            final AMQFrame responseFrame = BasicCancelOkBody.createAMQFrame(evt.getChannelId(), body.consumerTag);
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            final AMQFrame responseFrame = BasicCancelOkBody.createAMQFrame(evt.getChannelId(),
+                (byte)8, (byte)0,	// AMQP version (major, minor)
+                body.consumerTag);	// consumerTag
             protocolSession.writeFrame(responseFrame);
         }
     }
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/BasicConsumeMethodHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/BasicConsumeMethodHandler.java
index 164094a..d3aece9 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/BasicConsumeMethodHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/BasicConsumeMethodHandler.java
@@ -81,7 +81,12 @@
                                                               body.arguments, body.noLocal);
                 if (!body.nowait)
                 {
-                    session.writeFrame(BasicConsumeOkBody.createAMQFrame(channelId, consumerTag));
+                    // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+                    // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+                    // Be aware of possible changes to parameter order as versions change.
+                    session.writeFrame(BasicConsumeOkBody.createAMQFrame(channelId,
+                        (byte)8, (byte)0,	// AMQP version (major, minor)
+                        consumerTag));		// consumerTag
                 }
 
                 //now allow queue to start async processing of any backlog of messages
@@ -90,16 +95,28 @@
             catch (AMQInvalidSelectorException ise)
             {
                 _log.info("Closing connection due to invalid selector");
-                session.writeFrame(ChannelCloseBody.createAMQFrame(channelId, AMQConstant.INVALID_SELECTOR.getCode(),
-                                                                      ise.getMessage(), BasicConsumeBody.CLASS_ID,
-                                                                      BasicConsumeBody.METHOD_ID));
+                // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+                // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+                // Be aware of possible changes to parameter order as versions change.
+                session.writeFrame(ChannelCloseBody.createAMQFrame(channelId,
+                    (byte)8, (byte)0,	// AMQP version (major, minor)
+                    BasicConsumeBody.getClazz((byte)8, (byte)0),	// classId
+                    BasicConsumeBody.getMethod((byte)8, (byte)0),	// methodId
+                    AMQConstant.INVALID_SELECTOR.getCode(),	// replyCode
+                    ise.getMessage()));		// replyText
             }
             catch (ConsumerTagNotUniqueException e)
             {
                 String msg = "Non-unique consumer tag, '" + body.consumerTag + "'";
-                session.writeFrame(ConnectionCloseBody.createAMQFrame(channelId, AMQConstant.NOT_ALLOWED.getCode(), msg,
-                                                                      BasicConsumeBody.CLASS_ID,
-                                                                      BasicConsumeBody.METHOD_ID));
+                // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+                // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+                // Be aware of possible changes to parameter order as versions change.
+                session.writeFrame(ConnectionCloseBody.createAMQFrame(channelId,
+                    (byte)8, (byte)0,	// AMQP version (major, minor)
+                    BasicConsumeBody.getClazz((byte)8, (byte)0),	// classId
+                    BasicConsumeBody.getMethod((byte)8, (byte)0),	// methodId
+                    AMQConstant.NOT_ALLOWED.getCode(),	// replyCode
+                    msg));	// replyText
             }
         }
     }
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/BasicPublishMethodHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/BasicPublishMethodHandler.java
index efdbe7a..423ea5f 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/BasicPublishMethodHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/BasicPublishMethodHandler.java
@@ -64,7 +64,15 @@
             protocolSession.closeChannel(evt.getChannelId());
             // TODO: modify code gen to make getClazz and getMethod public methods rather than protected
             // then we can remove the hardcoded 0,0
-            AMQFrame cf = ChannelCloseBody.createAMQFrame(evt.getChannelId(), 500, "Unknown exchange name", 0, 0);
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            AMQFrame cf = ChannelCloseBody.createAMQFrame(evt.getChannelId(),
+                (byte)8, (byte)0,	// AMQP version (major, minor)
+                ChannelCloseBody.getClazz((byte)8, (byte)0),	// classId
+                ChannelCloseBody.getMethod((byte)8, (byte)0),	// methodId
+                500,	// replyCode
+                "Unknown exchange name");	// replyText
             protocolSession.writeFrame(cf);
         }
         else
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/BasicQosHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/BasicQosHandler.java
index 1357ff1..379ce3d 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/BasicQosHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/BasicQosHandler.java
@@ -44,6 +44,9 @@
                                AMQProtocolSession session, AMQMethodEvent<BasicQosBody> evt) throws AMQException
     {
         session.getChannel(evt.getChannelId()).setPrefetchCount(evt.getMethod().prefetchCount);
-        session.writeFrame(new AMQFrame(evt.getChannelId(), new BasicQosOkBody()));
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        session.writeFrame(new AMQFrame(evt.getChannelId(), new BasicQosOkBody((byte)8, (byte)0)));
     }
 }
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelCloseHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelCloseHandler.java
index 0efe12b..d26f84d 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelCloseHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelCloseHandler.java
@@ -55,7 +55,10 @@
         _logger.info("Received channel close for id " + evt.getChannelId() + " citing class " + body.classId +
                      " and method " + body.methodId);
         protocolSession.closeChannel(evt.getChannelId());
-        AMQFrame response = ChannelCloseOkBody.createAMQFrame(evt.getChannelId());
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        AMQFrame response = ChannelCloseOkBody.createAMQFrame(evt.getChannelId(), (byte)8, (byte)0);
         protocolSession.writeFrame(response);
     }
 }
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java
index 87ccc60..27833ac 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java
@@ -58,6 +58,12 @@
         channel.setSuspended(!body.active);
         _logger.debug("Channel.Flow for channel " + evt.getChannelId() + ", active=" + body.active);
 
-        AMQFrame response = ChannelFlowOkBody.createAMQFrame(evt.getChannelId(), body.active);
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        AMQFrame response = ChannelFlowOkBody.createAMQFrame(evt.getChannelId(),
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            body.active);	// active
         protocolSession.writeFrame(response);
-    }}
+    }
+}
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelOpenHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelOpenHandler.java
index 4cccc77..43d2cae 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelOpenHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelOpenHandler.java
@@ -55,7 +55,10 @@
         final AMQChannel channel = new AMQChannel(evt.getChannelId(), registry.getMessageStore(),
                                                   exchangeRegistry);
         protocolSession.addChannel(channel);
-        AMQFrame response = ChannelOpenOkBody.createAMQFrame(evt.getChannelId());
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        AMQFrame response = ChannelOpenOkBody.createAMQFrame(evt.getChannelId(), (byte)8, (byte)0);
         protocolSession.writeFrame(response);
     }
 }
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionCloseMethodHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionCloseMethodHandler.java
index 7bdb194..d000e3b 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionCloseMethodHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionCloseMethodHandler.java
@@ -62,7 +62,10 @@
         {
             _logger.error("Error closing protocol session: " + e, e);
         }
-        final AMQFrame response = ConnectionCloseOkBody.createAMQFrame(evt.getChannelId());
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        final AMQFrame response = ConnectionCloseOkBody.createAMQFrame(evt.getChannelId(), (byte)8, (byte)0);
         protocolSession.writeFrame(response);
     }
 }
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionOpenMethodHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionOpenMethodHandler.java
index bfcc50e..9f9b029 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionOpenMethodHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionOpenMethodHandler.java
@@ -64,7 +64,12 @@
             contextKey = generateClientID();
         }
         protocolSession.setContextKey(contextKey);
-        AMQFrame response = ConnectionOpenOkBody.createAMQFrame((short)0, contextKey);
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        AMQFrame response = ConnectionOpenOkBody.createAMQFrame((short)0,
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            contextKey);	// knownHosts
         stateManager.changeState(AMQState.CONNECTION_OPEN);
         protocolSession.writeFrame(response);
     }
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java
index c32f5e4..ea93a35 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java
@@ -75,25 +75,43 @@
                 // throw new AMQException(AMQConstant.NOT_ALLOWED.getCode(), AMQConstant.NOT_ALLOWED.getName());
                 _logger.info("Authentication failed");
                 stateManager.changeState(AMQState.CONNECTION_CLOSING);
-                AMQFrame close = ConnectionCloseBody.createAMQFrame(0, AMQConstant.NOT_ALLOWED.getCode(),
-                        AMQConstant.NOT_ALLOWED.getName(),
-                        ConnectionCloseBody.CLASS_ID,
-                        ConnectionCloseBody.METHOD_ID);
+                // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+                // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+                // Be aware of possible changes to parameter order as versions change.
+                AMQFrame close = ConnectionCloseBody.createAMQFrame(0,
+                    (byte)8, (byte)0,	// AMQP version (major, minor)
+                    ConnectionCloseBody.getClazz((byte)8, (byte)0),		// classId
+                    ConnectionCloseBody.getMethod((byte)8, (byte)0),	// methodId
+                    AMQConstant.NOT_ALLOWED.getCode(),	// replyCode
+                    AMQConstant.NOT_ALLOWED.getName());	// replyText
                 protocolSession.writeFrame(close);
                 disposeSaslServer(protocolSession);
                 break;
             case SUCCESS:
                 _logger.info("Connected as: " + ss.getAuthorizationID());
                 stateManager.changeState(AMQState.CONNECTION_NOT_TUNED);
-                AMQFrame tune = ConnectionTuneBody.createAMQFrame(0, Integer.MAX_VALUE,
-                        ConnectionStartOkMethodHandler.getConfiguredFrameSize(),
-                        HeartbeatConfig.getInstance().getDelay());
+                // TODO: Check the value of channelMax here: This should be the max
+                // value of a 2-byte unsigned integer (as channel is only 2 bytes on the wire),
+                // not Integer.MAX_VALUE (which is signed 4 bytes).
+                // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+                // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+                // Be aware of possible changes to parameter order as versions change.
+                AMQFrame tune = ConnectionTuneBody.createAMQFrame(0,
+                    (byte)8, (byte)0,	// AMQP version (major, minor)
+                    Integer.MAX_VALUE,	// channelMax
+                    ConnectionStartOkMethodHandler.getConfiguredFrameSize(),	// frameMax
+                    HeartbeatConfig.getInstance().getDelay());	// heartbeat
                 protocolSession.writeFrame(tune);
                 disposeSaslServer(protocolSession);
                 break;
             case CONTINUE:
                 stateManager.changeState(AMQState.CONNECTION_NOT_AUTH);
-                AMQFrame challenge = ConnectionSecureBody.createAMQFrame(0, authResult.challenge);
+                // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+                // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+                // Be aware of possible changes to parameter order as versions change.
+                AMQFrame challenge = ConnectionSecureBody.createAMQFrame(0,
+                    (byte)8, (byte)0,	// AMQP version (major, minor)
+                    authResult.challenge);	// challenge
                 protocolSession.writeFrame(challenge);
         }
     }
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java
index 79b2e11..9f24100 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java
@@ -92,13 +92,24 @@
                     _logger.info("Connected as: " + ss.getAuthorizationID());
 
                     stateManager.changeState(AMQState.CONNECTION_NOT_TUNED);
-                    AMQFrame tune = ConnectionTuneBody.createAMQFrame(0, Integer.MAX_VALUE, getConfiguredFrameSize(),
-                                                                      HeartbeatConfig.getInstance().getDelay());
+                    // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+                    // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+                    // Be aware of possible changes to parameter order as versions change.
+                    AMQFrame tune = ConnectionTuneBody.createAMQFrame(0,
+                        (byte)8, (byte)0,	// AMQP version (major, minor)
+                        Integer.MAX_VALUE,	// channelMax
+                        getConfiguredFrameSize(),	// frameMax
+                        HeartbeatConfig.getInstance().getDelay());	// heartbeat
                     protocolSession.writeFrame(tune);
                     break;
                 case CONTINUE:
                     stateManager.changeState(AMQState.CONNECTION_NOT_AUTH);
-                    AMQFrame challenge = ConnectionSecureBody.createAMQFrame(0, authResult.challenge);
+                    // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+                    // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+                    // Be aware of possible changes to parameter order as versions change.
+                    AMQFrame challenge = ConnectionSecureBody.createAMQFrame(0,
+                        (byte)8, (byte)0,	// AMQP version (major, minor)
+                        authResult.challenge);	// challenge
                     protocolSession.writeFrame(challenge);
             }
         }
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeBoundHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeBoundHandler.java
index 5aaf78d..30e8990 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeBoundHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeBoundHandler.java
@@ -64,6 +64,11 @@
                                ExchangeRegistry exchangeRegistry, AMQProtocolSession protocolSession,
                                AMQMethodEvent<ExchangeBoundBody> evt) throws AMQException
     {
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        byte major = (byte)8;
+        byte minor = (byte)0;
+        
         ExchangeBoundBody body = evt.getMethod();
 
         String exchangeName = body.exchange;
@@ -77,8 +82,11 @@
         AMQFrame response;
         if (exchange == null)
         {
-            response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(), EXCHANGE_NOT_FOUND,
-                                                             "Exchange " + exchangeName + " not found");
+            // AMQP version change:  Be aware of possible changes to parameter order as versions change.
+            response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
+                major, minor,	// AMQP version (major, minor)
+                EXCHANGE_NOT_FOUND,	// replyCode
+                "Exchange " + exchangeName + " not found");	// replyText
         }
         else if (routingKey == null)
         {
@@ -86,11 +94,19 @@
             {
                 if (exchange.hasBindings())
                 {
-                    response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(), OK, null);
+                    // AMQP version change:  Be aware of possible changes to parameter order as versions change.
+                    response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
+                        major, minor,	// AMQP version (major, minor)
+                        OK,	// replyCode
+                        null);	// replyText
                 }
                 else
                 {
-                    response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(), NO_BINDINGS, null);
+                    // AMQP version change:  Be aware of possible changes to parameter order as versions change.
+                    response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
+                        major, minor,	// AMQP version (major, minor)
+                        NO_BINDINGS,	// replyCode
+                        null);	// replyText
                 }
             }
             else
@@ -98,20 +114,29 @@
                 AMQQueue queue = queueRegistry.getQueue(queueName);
                 if (queue == null)
                 {
-                    response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(), QUEUE_NOT_FOUND,
-                                                                      "Queue " + queueName + " not found");
+                    // AMQP version change:  Be aware of possible changes to parameter order as versions change.
+                    response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
+                        major, minor,	// AMQP version (major, minor)
+                        QUEUE_NOT_FOUND,	// replyCode
+                        "Queue " + queueName + " not found");	// replyText
                 }
                 else
                 {
                     if (exchange.isBound(queue))
                     {
-                        response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(), OK, null);
+                        // AMQP version change:  Be aware of possible changes to parameter order as versions change.
+                        response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
+                            major, minor,	// AMQP version (major, minor)
+                            OK,	// replyCode
+                            null);	// replyText
                     }
                     else
                     {
-                        response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(), QUEUE_NOT_BOUND,
-                                                                      "Queue " + queueName + " not bound to exchange " +
-                                                                      exchangeName);
+                        // AMQP version change:  Be aware of possible changes to parameter order as versions change.
+                        response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
+                            major, minor,	// AMQP version (major, minor)
+                            QUEUE_NOT_BOUND,	// replyCode
+                            "Queue " + queueName + " not bound to exchange " + exchangeName);	// replyText
                     }
                 }
             }
@@ -121,24 +146,30 @@
             AMQQueue queue = queueRegistry.getQueue(queueName);
             if (queue == null)
             {
-                response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(), QUEUE_NOT_FOUND,
-                                                                  "Queue " + queueName + " not found");
+                // AMQP version change:  Be aware of possible changes to parameter order as versions change.
+                response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
+                    major, minor,	// AMQP version (major, minor)
+                    QUEUE_NOT_FOUND,	// replyCode
+                    "Queue " + queueName + " not found");	// replyText
             }
             else
             {
                 if (exchange.isBound(body.routingKey, queue))
                 {
-                    response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(), OK,
-                                                                     null);
+                    // AMQP version change:  Be aware of possible changes to parameter order as versions change.
+                    response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
+                        major, minor,	// AMQP version (major, minor)
+                        OK,	// replyCode
+                        null);	// replyText
                 }
                 else
                 {
+                    // AMQP version change:  Be aware of possible changes to parameter order as versions change.
                     response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
-                                                                     SPECIFIC_QUEUE_NOT_BOUND_WITH_RK,
-                                                                     "Queue " + queueName +
-                                                                     " not bound with routing key " +
-                                                                     body.routingKey + " to exchange " +
-                                                                     exchangeName);
+                        major, minor,	// AMQP version (major, minor)
+                        SPECIFIC_QUEUE_NOT_BOUND_WITH_RK,	// replyCode
+                        "Queue " + queueName + " not bound with routing key " +
+                        body.routingKey + " to exchange " + exchangeName);	// replyText
                 }
             }
         }
@@ -146,16 +177,20 @@
         {
             if (exchange.isBound(body.routingKey))
             {
-                response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(), OK,
-                                                                 null);
+                // AMQP version change:  Be aware of possible changes to parameter order as versions change.
+                response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
+                    major, minor,	// AMQP version (major, minor)
+                    OK,	// replyCode
+                    null);	// replyText
             }
             else
             {
+                // AMQP version change:  Be aware of possible changes to parameter order as versions change.
                 response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
-                                                                 NO_QUEUE_BOUND_WITH_RK,
-                                                                 "No queue bound with routing key " +
-                                                                 body.routingKey + " to exchange " +
-                                                                 exchangeName);
+                    major, minor,	// AMQP version (major, minor)
+                    NO_QUEUE_BOUND_WITH_RK,	// replyCode
+                    "No queue bound with routing key " + body.routingKey +
+                    " to exchange " + exchangeName);	// replyText
             }
         }
         protocolSession.writeFrame(response);
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeclareHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeclareHandler.java
index b7c75e2..7937a9b 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeclareHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeclareHandler.java
@@ -75,7 +75,10 @@
         }
         if(!body.nowait)
         {
-            AMQFrame response = ExchangeDeclareOkBody.createAMQFrame(evt.getChannelId());
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            AMQFrame response = ExchangeDeclareOkBody.createAMQFrame(evt.getChannelId(), (byte)8, (byte)0);
             protocolSession.writeFrame(response);
         }
     }
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeleteHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeleteHandler.java
index 93ef902..153a9de 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeleteHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeleteHandler.java
@@ -53,7 +53,10 @@
         try
         {
             exchangeRegistry.unregisterExchange(body.exchange, body.ifUnused);
-            AMQFrame response = ExchangeDeleteOkBody.createAMQFrame(evt.getChannelId());
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            AMQFrame response = ExchangeDeleteOkBody.createAMQFrame(evt.getChannelId(), (byte)8, (byte)0);
             protocolSession.writeFrame(response);
         }
         catch (ExchangeInUseException e)
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/QueueBindHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/QueueBindHandler.java
index cf9e40a..b7fc786 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/QueueBindHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/QueueBindHandler.java
@@ -90,7 +90,10 @@
         }
         if (!body.nowait)
         {
-            final AMQFrame response = QueueBindOkBody.createAMQFrame(evt.getChannelId());
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            final AMQFrame response = QueueBindOkBody.createAMQFrame(evt.getChannelId(), (byte)8, (byte)0);
             protocolSession.writeFrame(response);
         }
     }
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.java
index b7004de..83f98de 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.java
@@ -102,7 +102,14 @@
         }
         if (!body.nowait)
         {
-            AMQFrame response = QueueDeclareOkBody.createAMQFrame(evt.getChannelId(), body.queue, 0L, 0L);
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            AMQFrame response = QueueDeclareOkBody.createAMQFrame(evt.getChannelId(),
+                (byte)8, (byte)0,	// AMQP version (major, minor)
+                0L, // consumerCount
+                0L, // messageCount
+                body.queue); // queue
             _log.info("Queue " + body.queue + " declared successfully");
             protocolSession.writeFrame(response);
         }
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeleteHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeleteHandler.java
index 0dbc54f..688968b 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeleteHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeleteHandler.java
@@ -81,7 +81,12 @@
         {
             int purged = queue.delete(body.ifUnused, body.ifEmpty);
             _store.removeQueue(queue.getName());
-            session.writeFrame(QueueDeleteOkBody.createAMQFrame(evt.getChannelId(), purged));
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            session.writeFrame(QueueDeleteOkBody.createAMQFrame(evt.getChannelId(),
+                (byte)8, (byte)0,	// AMQP version (major, minor)
+                purged));	// messageCount
         }
     }
 }
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/TxCommitHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/TxCommitHandler.java
index 84e7cd7..c67b86a 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/TxCommitHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/TxCommitHandler.java
@@ -53,7 +53,10 @@
         {
             AMQChannel channel = protocolSession.getChannel(evt.getChannelId());
             channel.commit();
-            protocolSession.writeFrame(TxCommitOkBody.createAMQFrame(evt.getChannelId()));
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            protocolSession.writeFrame(TxCommitOkBody.createAMQFrame(evt.getChannelId(), (byte)8, (byte)0));
             channel.processReturns(protocolSession);
         }
         catch(AMQException e)
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/TxRollbackHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/TxRollbackHandler.java
index 475f6ec..588dc02 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/TxRollbackHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/TxRollbackHandler.java
@@ -51,7 +51,10 @@
         try{
             AMQChannel channel = protocolSession.getChannel(evt.getChannelId());
             channel.rollback();
-            protocolSession.writeFrame(TxRollbackOkBody.createAMQFrame(evt.getChannelId()));
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            protocolSession.writeFrame(TxRollbackOkBody.createAMQFrame(evt.getChannelId(), (byte)8, (byte)0));
             //Now resend all the unacknowledged messages back to the original subscribers.
             //(Must be done after the TxnRollback-ok response).
             channel.resend(protocolSession);
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/TxSelectHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/TxSelectHandler.java
index d5a6d60..f4738ff 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/TxSelectHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/TxSelectHandler.java
@@ -48,6 +48,9 @@
                                AMQMethodEvent<TxSelectBody> evt) throws AMQException
     {
         protocolSession.getChannel(evt.getChannelId()).setLocalTransactional();
-        protocolSession.writeFrame(TxSelectOkBody.createAMQFrame(evt.getChannelId()));
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        protocolSession.writeFrame(TxSelectOkBody.createAMQFrame(evt.getChannelId(), (byte)8, (byte)0));
     }
 }
diff --git a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java
index 8f10a06..4362f64 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java
@@ -164,8 +164,17 @@
                 _minor = pi.protocolMinor;
                 String mechanisms = ApplicationRegistry.getInstance().getAuthenticationManager().getMechanisms();
                 String locales = "en_US";
-                AMQFrame response = ConnectionStartBody.createAMQFrame((short) 0, pi.protocolMajor, pi.protocolMinor, null,
-                                                                       mechanisms.getBytes(), locales.getBytes());
+                // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+                // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+                // Be aware of possible changes to parameter order as versions change.
+                AMQFrame response = ConnectionStartBody.createAMQFrame((short) 0,
+            		(byte)8, (byte)0,	// AMQP version (major, minor)
+                    locales.getBytes(),	// locales
+                    mechanisms.getBytes(),	// mechanisms
+                    null,	// serverProperties
+                	(short)8,	// versionMajor
+                    (short)0	// versionMinor
+                    );
                 _minaProtocolSession.write(response);
             }
             catch (AMQException e)
diff --git a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java
index d284d77..2e95902 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java
@@ -172,7 +172,16 @@
         }
         else
         {
-            protocolSession.write(ConnectionCloseBody.createAMQFrame(0, 200, throwable.getMessage(), 0, 0));
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            protocolSession.write(ConnectionCloseBody.createAMQFrame(0,
+            	(byte)8, (byte)0,	// AMQP version (major, minor)
+            	0,	// classId
+                0,	// methodId
+                200,	// replyCode
+                throwable.getMessage()	// replyText
+                ));
             _logger.error("Exception caught in" + session + ", closing session explictly: " + throwable, throwable);
             protocolSession.close();
         }
diff --git a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java
index d57f9b9..0ceadcb 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java
@@ -193,8 +193,16 @@
     public void closeConnection() throws JMException
     {
         
-        final AMQFrame response = ConnectionCloseBody.createAMQFrame(0, AMQConstant.REPLY_SUCCESS.getCode(),
-                                                      "Broker Management Console has closing the connection.", 0, 0);
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        final AMQFrame response = ConnectionCloseBody.createAMQFrame(0,
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            0,	// classId
+            0,	// methodId
+        	AMQConstant.REPLY_SUCCESS.getCode(),	// replyCode
+            "Broker Management Console has closing the connection."	// replyText
+            );
         _session.writeFrame(response);
 
         try
diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java
index b7dcffe..5091dde 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java
@@ -585,8 +585,8 @@
             throws AMQException
     {
         BasicPublishBody pb = getPublishBody();
-        AMQFrame deliverFrame = BasicDeliverBody.createAMQFrame(channelId, consumerTag,
-                                                                deliveryTag, false, pb.exchange,
+        AMQFrame deliverFrame = BasicDeliverBody.createAMQFrame(channelId, (byte) 8, (byte) 0, consumerTag,
+                                                                deliveryTag, pb.exchange, _messageHandle.isRedelivered(),
                                                                 pb.routingKey);
         ByteBuffer buf = ByteBuffer.allocate((int) deliverFrame.getSize()); // XXX: Could cast be a problem?
         deliverFrame.writePayload(buf);
@@ -596,7 +596,8 @@
 
     private ByteBuffer createEncodedReturnFrame(int channelId, int replyCode, String replyText) throws AMQException
     {
-        AMQFrame returnFrame = BasicReturnBody.createAMQFrame(channelId, replyCode, replyText, getPublishBody().exchange,
+        AMQFrame returnFrame = BasicReturnBody.createAMQFrame(channelId, (byte) 8, (byte) 0, getPublishBody().exchange,
+                                                              replyCode, replyText,                                                             
                                                               getPublishBody().routingKey);
         ByteBuffer buf = ByteBuffer.allocate((int) returnFrame.getSize()); // XXX: Could cast be a problem?
         returnFrame.writePayload(buf);
diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java b/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java
index 67380f0..56f3c03 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java
@@ -373,7 +373,13 @@
         if (!_closed)
         {
             _logger.info("Closing autoclose subscription:" + this);
-            protocolSession.writeFrame(BasicCancelOkBody.createAMQFrame(channel.getChannelId(), consumerTag));
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            protocolSession.writeFrame(BasicCancelOkBody.createAMQFrame(channel.getChannelId(),
+        		(byte)8, (byte)0,	// AMQP version (major, minor)
+            	consumerTag	// consumerTag
+                ));
             _closed = true;
         }
     }
@@ -386,9 +392,17 @@
 
     private ByteBuffer createEncodedDeliverFrame(long deliveryTag, String routingKey, String exchange)
     {
-        AMQFrame deliverFrame = BasicDeliverBody.createAMQFrame(channel.getChannelId(), consumerTag,
-                                                                deliveryTag, false, exchange,
-                                                                routingKey);
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        AMQFrame deliverFrame = BasicDeliverBody.createAMQFrame(channel.getChannelId(),
+        	(byte)8, (byte)0,	// AMQP version (major, minor)
+            consumerTag,	// consumerTag
+        	deliveryTag,	// deliveryTag
+            exchange,	// exchange
+            false,	// redelivered
+            routingKey	// routingKey
+            );
         ByteBuffer buf = ByteBuffer.allocate((int) deliverFrame.getSize()); // XXX: Could cast be a problem?
         deliverFrame.writePayload(buf);
         buf.flip();
diff --git a/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersBindingTest.java b/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersBindingTest.java
index f8c15d9..10aa621 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersBindingTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersBindingTest.java
@@ -24,17 +24,18 @@
 import java.util.HashMap;
 
 import junit.framework.TestCase;
+import org.apache.qpid.framing.FieldTable;
 
 /**
  */
 public class HeadersBindingTest extends TestCase
 {
-    private Map<String, String> bindHeaders = new HashMap<String, String>();
-    private Map<String, String> matchHeaders = new HashMap<String, String>();
+    private FieldTable bindHeaders = new FieldTable();
+    private FieldTable matchHeaders = new FieldTable();
 
     public void testDefault_1()
     {
-        bindHeaders.put("A", "Value of A");
+        bindHeaders.setString("A", "Value of A");
 
         matchHeaders.put("A", "Value of A");
 
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java b/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
index 820b8c3..58ac49d 100644
--- a/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
+++ b/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
@@ -465,12 +465,25 @@
     private void createChannelOverWire(int channelId, int prefetchHigh, int prefetchLow, boolean transacted)
             throws AMQException
     {
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
         _protocolHandler.syncWrite(
-                ChannelOpenBody.createAMQFrame(channelId, null), ChannelOpenOkBody.class);
+            ChannelOpenBody.createAMQFrame(channelId,
+                (byte)8, (byte)0,	// AMQP version (major, minor)
+                null),	// outOfBand
+                ChannelOpenOkBody.class);
 
         //todo send low water mark when protocol allows.
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
         _protocolHandler.syncWrite(
-                BasicQosBody.createAMQFrame(channelId, 0, prefetchHigh, false),
+            BasicQosBody.createAMQFrame(channelId,
+                (byte)8, (byte)0,	// AMQP version (major, minor)
+                false,	// global
+                prefetchHigh,	// prefetchCount
+                0),	// prefetchSize
                 BasicQosOkBody.class);
 
         if (transacted)
@@ -479,7 +492,10 @@
             {
                 _logger.debug("Issuing TxSelect for " + channelId);
             }
-            _protocolHandler.syncWrite(TxSelectBody.createAMQFrame(channelId), TxSelectOkBody.class);
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            _protocolHandler.syncWrite(TxSelectBody.createAMQFrame(channelId, (byte)8, (byte)0), TxSelectOkBody.class);
         }
     }
 
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
index 2136d56..0dfd469 100644
--- a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
+++ b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
@@ -477,7 +477,10 @@
             }
 
             // Commits outstanding messages sent and outstanding acknowledgements.
-            _connection.getProtocolHandler().syncWrite(TxCommitBody.createAMQFrame(_channelId), TxCommitOkBody.class);
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            _connection.getProtocolHandler().syncWrite(TxCommitBody.createAMQFrame(_channelId, (byte)8, (byte)0), TxCommitOkBody.class);
         }
         catch (AMQException e)
         {
@@ -492,8 +495,11 @@
         checkTransacted();
         try
         {
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
             _connection.getProtocolHandler().syncWrite(
-                    TxRollbackBody.createAMQFrame(_channelId), TxRollbackOkBody.class);
+                    TxRollbackBody.createAMQFrame(_channelId, (byte)8, (byte)0), TxRollbackOkBody.class);
         }
         catch (AMQException e)
         {
@@ -516,8 +522,15 @@
                 try
                 {
                     _connection.getProtocolHandler().closeSession(this);
-                    final AMQFrame frame = ChannelCloseBody.createAMQFrame(
-                            getChannelId(), AMQConstant.REPLY_SUCCESS.getCode(), "JMS client closing channel", 0, 0);
+        	        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        	        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        	        // Be aware of possible changes to parameter order as versions change.
+                    final AMQFrame frame = ChannelCloseBody.createAMQFrame(getChannelId(),
+                        (byte)8, (byte)0,	// AMQP version (major, minor)
+                        0,	// classId
+                        0,	// methodId
+                        AMQConstant.REPLY_SUCCESS.getCode(),	// replyCode
+                        "JMS client closing channel");	// replyText
                     _connection.getProtocolHandler().syncWrite(frame, ChannelCloseOkBody.class);
                     // When control resumes at this point, a reply will have been received that
                     // indicates the broker has closed the channel successfully
@@ -707,7 +720,12 @@
         {
             consumer.clearUnackedMessages();
         }
-        _connection.getProtocolHandler().writeFrame(BasicRecoverBody.createAMQFrame(_channelId, false));
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        _connection.getProtocolHandler().writeFrame(BasicRecoverBody.createAMQFrame(_channelId,
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            false));	// requeue
     }
 
     boolean isInRecovery()
@@ -968,7 +986,7 @@
                 //    ft.put("headers", rawSelector.getDataAsBytes());
                 if (rawSelector != null)
                 {
-                    ft.putAll(rawSelector);
+                    ft.addAll(rawSelector);
                 }
                 BasicMessageConsumer consumer = new BasicMessageConsumer(_channelId, _connection, amqd, selector, noLocal,
                                                                          _messageFactoryRegistry, AMQSession.this,
@@ -1039,7 +1057,20 @@
 
     public void declareExchangeSynch(String name, String type) throws AMQException
     {
-        AMQFrame frame = ExchangeDeclareBody.createAMQFrame(_channelId, 0, name, type, false, false, false, false, false, null);
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        AMQFrame frame = ExchangeDeclareBody.createAMQFrame(_channelId,
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            null,	// arguments
+            false,	// autoDelete
+            false,	// durable
+            name,	// exchange
+            false,	// internal
+            false,	// nowait
+            false,	// passive
+            0,	// ticket
+            type);	// type
         _connection.getProtocolHandler().syncWrite(frame, ExchangeDeclareOkBody.class);
     }
 
@@ -1050,7 +1081,20 @@
 
     private void declareExchange(String name, String type, AMQProtocolHandler protocolHandler)
     {
-        AMQFrame exchangeDeclare = ExchangeDeclareBody.createAMQFrame(_channelId, 0, name, type, false, false, false, false, true, null);
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        AMQFrame exchangeDeclare = ExchangeDeclareBody.createAMQFrame(_channelId,
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            null,	// arguments
+            false,	// autoDelete
+            false,	// durable
+            name,	// exchange
+            false,	// internal
+            true,	// nowait
+            false,	// passive
+            0,	// ticket
+            type);	// type
         protocolHandler.writeFrame(exchangeDeclare);
     }
 
@@ -1072,9 +1116,19 @@
             amqd.setQueueName(protocolHandler.generateQueueName());
         }
 
-        AMQFrame queueDeclare = QueueDeclareBody.createAMQFrame(_channelId, 0, amqd.getQueueName(),
-                                                                false, amqd.isDurable(), amqd.isExclusive(),
-                                                                amqd.isAutoDelete(), true, null);
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        AMQFrame queueDeclare = QueueDeclareBody.createAMQFrame(_channelId,
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            null,	// arguments
+            amqd.isAutoDelete(),	// autoDelete
+            amqd.isDurable(),	// durable
+            amqd.isExclusive(),	// exclusive
+            true,	// nowait
+            false,	// passive
+            amqd.getQueueName(),	// queue
+            0);	// ticket
 
         protocolHandler.writeFrame(queueDeclare);
         return amqd.getQueueName();
@@ -1082,9 +1136,17 @@
 
     private void bindQueue(AMQDestination amqd, String queueName, AMQProtocolHandler protocolHandler, FieldTable ft) throws AMQException
     {
-        AMQFrame queueBind = QueueBindBody.createAMQFrame(_channelId, 0,
-                                                          queueName, amqd.getExchangeName(),
-                                                          amqd.getRoutingKey(), true, ft);
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        AMQFrame queueBind = QueueBindBody.createAMQFrame(_channelId,
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            ft,	// arguments
+            amqd.getExchangeName(),	// exchange
+            true,	// nowait
+            queueName,	// queue
+            amqd.getRoutingKey(),	// routingKey
+            0);	// ticket
 
         protocolHandler.writeFrame(queueBind);
     }
@@ -1122,10 +1184,19 @@
 
         try
         {
-            AMQFrame jmsConsume = BasicConsumeBody.createAMQFrame(_channelId, 0,
-                                                                  queueName, tag, consumer.isNoLocal(),
-                                                                  consumer.getAcknowledgeMode() == Session.NO_ACKNOWLEDGE,
-                                                                  consumer.isExclusive(), nowait, arguments);
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            AMQFrame jmsConsume = BasicConsumeBody.createAMQFrame(_channelId,
+                (byte)8, (byte)0,	// AMQP version (major, minor)
+                arguments,	// arguments
+                tag,	// consumerTag
+                consumer.isExclusive(),	// exclusive
+                consumer.getAcknowledgeMode() == Session.NO_ACKNOWLEDGE,	// noAck
+                consumer.isNoLocal(),	// noLocal
+                nowait,	// nowait
+                queueName,	// queue
+                0);	// ticket
             if (nowait)
             {
                 protocolHandler.writeFrame(jmsConsume);
@@ -1302,8 +1373,16 @@
     {
         try
         {
-            AMQFrame queueDeleteFrame = QueueDeleteBody.createAMQFrame(_channelId, 0, queueName, false,
-                                                                       false, true);
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            AMQFrame queueDeleteFrame = QueueDeleteBody.createAMQFrame(_channelId,
+                (byte)8, (byte)0,	// AMQP version (major, minor)
+                false,	// ifEmpty
+                false,	// ifUnused
+                true,	// nowait
+                queueName,	// queue
+                0);	// ticket
             _connection.getProtocolHandler().syncWrite(queueDeleteFrame, QueueDeleteOkBody.class);
         }
         catch (AMQException e)
@@ -1389,8 +1468,14 @@
 
     boolean isQueueBound(String queueName, String routingKey) throws JMSException
     {
-        AMQFrame boundFrame = ExchangeBoundBody.createAMQFrame(_channelId, ExchangeDefaults.TOPIC_EXCHANGE_NAME,
-                                                               routingKey, queueName);
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        AMQFrame boundFrame = ExchangeBoundBody.createAMQFrame(_channelId,
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            ExchangeDefaults.TOPIC_EXCHANGE_NAME,	// exchange
+            queueName,	// queue
+            routingKey);	// routingKey
         AMQMethodEvent response = null;
         try
         {
@@ -1447,7 +1532,13 @@
      */
     public void acknowledgeMessage(long deliveryTag, boolean multiple)
     {
-        final AMQFrame ackFrame = BasicAckBody.createAMQFrame(_channelId, deliveryTag, multiple);
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        final AMQFrame ackFrame = BasicAckBody.createAMQFrame(_channelId,
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            deliveryTag,	// deliveryTag
+            multiple);	// multiple
         if (_logger.isDebugEnabled())
         {
             _logger.debug("Sending ack for delivery tag " + deliveryTag + " on channel " + _channelId);
@@ -1606,14 +1697,24 @@
     private void suspendChannel()
     {
         _logger.warn("Suspending channel");
-        AMQFrame channelFlowFrame = ChannelFlowBody.createAMQFrame(_channelId, false);
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        AMQFrame channelFlowFrame = ChannelFlowBody.createAMQFrame(_channelId,
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            false);	// active
         _connection.getProtocolHandler().writeFrame(channelFlowFrame);
     }
 
     private void unsuspendChannel()
     {
         _logger.warn("Unsuspending channel");
-        AMQFrame channelFlowFrame = ChannelFlowBody.createAMQFrame(_channelId, true);
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        AMQFrame channelFlowFrame = ChannelFlowBody.createAMQFrame(_channelId,
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            true);	// active
         _connection.getProtocolHandler().writeFrame(channelFlowFrame);
     }
 
diff --git a/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java b/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
index cefaca8..1033e82 100644
--- a/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
+++ b/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
@@ -448,7 +448,13 @@
             {
                 if(sendClose)
                 {
-                    final AMQFrame cancelFrame = BasicCancelBody.createAMQFrame(_channelId, _consumerTag, false);
+                    // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+                    // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+                    // Be aware of possible changes to parameter order as versions change.
+                    final AMQFrame cancelFrame = BasicCancelBody.createAMQFrame(_channelId,
+                        (byte)8, (byte)0,	// AMQP version (major, minor)
+                        _consumerTag,	// consumerTag
+                        false);	// nowait
 
                     try
                     {
diff --git a/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java b/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
index 7a5fcbc..d38e461 100644
--- a/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
+++ b/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
@@ -134,9 +134,20 @@
     {
         // Declare the exchange
         // Note that the durable and internal arguments are ignored since passive is set to false
-        AMQFrame declare = ExchangeDeclareBody.createAMQFrame(_channelId, 0, destination.getExchangeName(),
-                                                              destination.getExchangeClass(), false,
-                                                              false, false, false, true, null);
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        AMQFrame declare = ExchangeDeclareBody.createAMQFrame(_channelId,
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            null,	// arguments
+            false,	// autoDelete
+            false,	// durable
+            destination.getExchangeName(),	// exchange
+            false,	// internal
+            true,	// nowait
+            false,	// passive
+            0,	// ticket
+            destination.getExchangeClass());	// type
         _protocolHandler.writeFrame(declare);
     }
 
@@ -512,8 +523,16 @@
         
         AbstractJMSMessage message = convertToNativeMessage(origMessage);
         message.getJmsContentHeaderProperties().getJMSHeaders().setString(CustomJMXProperty.JMSX_QPID_JMSDESTINATIONURL.toString(), destination.toURL());
-        AMQFrame publishFrame = BasicPublishBody.createAMQFrame(_channelId, 0, destination.getExchangeName(),
-                                                                destination.getRoutingKey(), mandatory, immediate);
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        AMQFrame publishFrame = BasicPublishBody.createAMQFrame(_channelId,
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            destination.getExchangeName(),	// exchange
+            immediate,	// immediate
+            mandatory,	// mandatory
+            destination.getRoutingKey(),	// routingKey
+            0);	// ticket
 
         long currentTime = 0;
         if (!_disableTimestamps)
@@ -555,7 +574,9 @@
         }
 
         // weight argument of zero indicates no child content headers, just bodies
-        AMQFrame contentHeaderFrame = ContentHeaderBody.createAMQFrame(_channelId, BasicConsumeBody.CLASS_ID, 0,
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        AMQFrame contentHeaderFrame = ContentHeaderBody.createAMQFrame(_channelId, BasicConsumeBody.getClazz((byte)8, (byte)0), 0,
                                                                        contentHeaderProperties,
                                                                        size);
         if (_logger.isDebugEnabled())
diff --git a/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java b/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java
index fd2968c..278f090 100644
--- a/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java
+++ b/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java
@@ -57,7 +57,10 @@
             _logger.debug("Channel close reply code: " + errorCode + ", reason: " + reason);
         }
 
-        AMQFrame frame = ChannelCloseOkBody.createAMQFrame(evt.getChannelId());
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        AMQFrame frame = ChannelCloseOkBody.createAMQFrame(evt.getChannelId(), (byte)8, (byte)0);
         evt.getProtocolSession().writeFrame(frame);
         if (errorCode != AMQConstant.REPLY_SUCCESS.getCode())
         {
diff --git a/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java b/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java
index dd9fd65..bbfb100 100644
--- a/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java
+++ b/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java
@@ -59,7 +59,10 @@
         String reason = method.replyText;
 
         // TODO: check whether channel id of zero is appropriate
-        evt.getProtocolSession().writeFrame(ConnectionCloseOkBody.createAMQFrame((short)0));
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        evt.getProtocolSession().writeFrame(ConnectionCloseOkBody.createAMQFrame((short)0, (byte)8, (byte)0));
 
         if (errorCode != 200)
         {
diff --git a/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionSecureMethodHandler.java b/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionSecureMethodHandler.java
index fd15faf..153b641 100644
--- a/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionSecureMethodHandler.java
+++ b/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionSecureMethodHandler.java
@@ -54,7 +54,12 @@
         {
             // Evaluate server challenge
             byte[] response = client.evaluateChallenge(body.challenge);
-            AMQFrame responseFrame = ConnectionSecureOkBody.createAMQFrame(evt.getChannelId(), response);
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            AMQFrame responseFrame = ConnectionSecureOkBody.createAMQFrame(evt.getChannelId(),
+                (byte)8, (byte)0,	// AMQP version (major, minor)
+                response);	// response
             evt.getProtocolSession().writeFrame(responseFrame);
         }
         catch (SaslException e)
diff --git a/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java b/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java
index 1e0366e..81f94d9 100644
--- a/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java
+++ b/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java
@@ -127,8 +127,15 @@
             clientProperties.put(ClientProperties.product.toString(), QpidProperties.getProductName());
             clientProperties.put(ClientProperties.version.toString(), QpidProperties.getReleaseVersion());
             clientProperties.put(ClientProperties.platform.toString(), getFullSystemInfo());
-            ps.writeFrame(ConnectionStartOkBody.createAMQFrame(evt.getChannelId(), clientProperties, mechanism,
-                                                               saslResponse, selectedLocale));
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            ps.writeFrame(ConnectionStartOkBody.createAMQFrame(evt.getChannelId(),
+                (byte)8, (byte)0,	// AMQP version (major, minor)
+                clientProperties,	// clientProperties
+                selectedLocale,	// locale
+                mechanism,	// mechanism
+                saslResponse));	// response
         }
         catch (UnsupportedEncodingException e)
         {
diff --git a/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionTuneMethodHandler.java b/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionTuneMethodHandler.java
index 8fee277..3592ee4 100644
--- a/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionTuneMethodHandler.java
+++ b/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionTuneMethodHandler.java
@@ -72,11 +72,25 @@
 
     protected AMQFrame createConnectionOpenFrame(int channel, String path, String capabilities, boolean insist)
     {
-        return ConnectionOpenBody.createAMQFrame(channel, path, capabilities, insist);
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        return ConnectionOpenBody.createAMQFrame(channel,
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            capabilities,	// capabilities
+            insist,	// insist
+            path);	// virtualHost
     }
 
     protected AMQFrame createTuneOkFrame(int channel, ConnectionTuneParameters params)
     {
-        return ConnectionTuneOkBody.createAMQFrame(channel, params.getChannelMax(), params.getFrameMax(), params.getHeartbeat());
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        return ConnectionTuneOkBody.createAMQFrame(channel,
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            params.getChannelMax(),	// channelMax
+            params.getFrameMax(),	// frameMax
+            params.getHeartbeat());	// heartbeat
     }
 }
diff --git a/java/client/src/main/java/org/apache/qpid/client/message/AbstractBytesMessage.java b/java/client/src/main/java/org/apache/qpid/client/message/AbstractBytesMessage.java
index 6935cde..011f7c0 100644
--- a/java/client/src/main/java/org/apache/qpid/client/message/AbstractBytesMessage.java
+++ b/java/client/src/main/java/org/apache/qpid/client/message/AbstractBytesMessage.java
@@ -63,7 +63,7 @@
         }
     }
 
-    private void allocateInitialBuffer()
+    protected void allocateInitialBuffer()
     {
         _data = ByteBuffer.allocate(DEFAULT_BUFFER_INITIAL_SIZE);
         _data.setAutoExpand(true);
diff --git a/java/client/src/main/java/org/apache/qpid/client/message/AbstractBytesTypedMessage.java b/java/client/src/main/java/org/apache/qpid/client/message/AbstractBytesTypedMessage.java
new file mode 100644
index 0000000..b941b9a
--- /dev/null
+++ b/java/client/src/main/java/org/apache/qpid/client/message/AbstractBytesTypedMessage.java
@@ -0,0 +1,774 @@
+package org.apache.qpid.client.message;

+

+import org.apache.mina.common.ByteBuffer;

+import org.apache.qpid.framing.ContentHeaderBody;

+import org.apache.qpid.AMQException;

+

+import javax.jms.*;

+import java.nio.charset.Charset;

+import java.nio.charset.CharacterCodingException;

+

+/**

+ * @author Apache Software Foundation

+ */

+public abstract class AbstractBytesTypedMessage extends AbstractBytesMessage

+{

+

+    protected static final byte BOOLEAN_TYPE = (byte) 1;

+

+    protected static final byte BYTE_TYPE = (byte) 2;

+

+    protected static final byte BYTEARRAY_TYPE = (byte) 3;

+

+    protected static final byte SHORT_TYPE = (byte) 4;

+

+    protected static final byte CHAR_TYPE = (byte) 5;

+

+    protected static final byte INT_TYPE = (byte) 6;

+

+    protected static final byte LONG_TYPE = (byte) 7;

+

+    protected static final byte FLOAT_TYPE = (byte) 8;

+

+    protected static final byte DOUBLE_TYPE = (byte) 9;

+

+    protected static final byte STRING_TYPE = (byte) 10;

+

+    protected static final byte NULL_STRING_TYPE = (byte) 11;

+

+    /**

+     * This is set when reading a byte array. The readBytes(byte[]) method supports multiple calls to read

+     * a byte array in multiple chunks, hence this is used to track how much is left to be read

+     */

+    private int _byteArrayRemaining = -1;

+

+    AbstractBytesTypedMessage()

+    {

+        this(null);

+    }

+

+    /**

+     * Construct a stream message with existing data.

+     *

+     * @param data the data that comprises this message. If data is null, you get a 1024 byte buffer that is

+     *             set to auto expand

+     */

+    AbstractBytesTypedMessage(ByteBuffer data)

+    {

+        super(data); // this instanties a content header

+    }

+

+

+    AbstractBytesTypedMessage(long messageNbr, ContentHeaderBody contentHeader, ByteBuffer data)

+            throws AMQException

+    {

+        super(messageNbr, contentHeader, data);

+    }

+

+

+    protected byte readWireType() throws MessageFormatException, MessageEOFException,

+            MessageNotReadableException

+    {

+        checkReadable();

+        checkAvailable(1);

+        return _data.get();

+    }

+

+    protected void writeTypeDiscriminator(byte type) throws MessageNotWriteableException

+    {

+        checkWritable();

+        _data.put(type);

+        _changedData = true;

+    }

+

+    protected boolean readBoolean() throws JMSException

+    {

+        int position = _data.position();

+        byte wireType = readWireType();

+        boolean result;

+        try

+        {

+            switch (wireType)

+            {

+                case BOOLEAN_TYPE:

+                    checkAvailable(1);

+                    result = readBooleanImpl();

+                    break;

+                case STRING_TYPE:

+                    checkAvailable(1);

+                    result = Boolean.parseBoolean(readStringImpl());

+                    break;

+                default:

+                    _data.position(position);

+                    throw new MessageFormatException("Unable to convert " + wireType + " to a boolean");

+            }

+            return result;

+        }

+        catch (RuntimeException e)

+        {

+            _data.position(position);

+            throw e;

+        }

+    }

+

+    private boolean readBooleanImpl()

+    {

+        return _data.get() != 0;

+    }

+

+    protected byte readByte() throws JMSException

+    {

+        int position = _data.position();

+        byte wireType = readWireType();

+        byte result;

+        try

+        {

+            switch (wireType)

+            {

+                case BYTE_TYPE:

+                    checkAvailable(1);

+                    result = readByteImpl();

+                    break;

+                case STRING_TYPE:

+                    checkAvailable(1);

+                    result = Byte.parseByte(readStringImpl());

+                    break;

+                default:

+                    _data.position(position);

+                    throw new MessageFormatException("Unable to convert " + wireType + " to a byte");

+            }

+        }

+        catch (RuntimeException e)

+        {

+            _data.position(position);

+            throw e;

+        }

+        return result;

+    }

+

+    private byte readByteImpl()

+    {

+        return _data.get();

+    }

+

+    protected short readShort() throws JMSException

+    {

+        int position = _data.position();

+        byte wireType = readWireType();

+        short result;

+        try

+        {

+            switch (wireType)

+            {

+                case SHORT_TYPE:

+                    checkAvailable(2);

+                    result = readShortImpl();

+                    break;

+                case STRING_TYPE:

+                    checkAvailable(1);

+                    result = Short.parseShort(readStringImpl());

+                    break;

+                case BYTE_TYPE:

+                    checkAvailable(1);

+                    result = readByteImpl();

+                    break;

+                default:

+                    _data.position(position);

+                    throw new MessageFormatException("Unable to convert " + wireType + " to a short");

+            }

+        }

+        catch (RuntimeException e)

+        {

+            _data.position(position);

+            throw e;

+        }

+        return result;

+    }

+

+    private short readShortImpl()

+    {

+        return _data.getShort();

+    }

+

+    /**

+     * Note that this method reads a unicode character as two bytes from the stream

+     *

+     * @return the character read from the stream

+     * @throws javax.jms.JMSException

+     */

+    protected char readChar() throws JMSException

+    {

+        int position = _data.position();

+        byte wireType = readWireType();

+        try

+        {

+        	if(wireType == NULL_STRING_TYPE){

+        		throw new NullPointerException();

+        	}

+

+            if (wireType != CHAR_TYPE)

+            {

+                _data.position(position);

+                throw new MessageFormatException("Unable to convert " + wireType + " to a char");

+            }

+            else

+            {

+                checkAvailable(2);

+                return readCharImpl();

+            }

+        }

+        catch (RuntimeException e)

+        {

+            _data.position(position);

+            throw e;

+        }

+    }

+

+    private char readCharImpl()

+    {

+        return _data.getChar();

+    }

+

+    protected int readInt() throws JMSException

+    {

+        int position = _data.position();

+        byte wireType = readWireType();

+        int result;

+        try

+        {

+            switch (wireType)

+            {

+                case INT_TYPE:

+                    checkAvailable(4);

+                    result = readIntImpl();

+                    break;

+                case SHORT_TYPE:

+                    checkAvailable(2);

+                    result = readShortImpl();

+                    break;

+                case STRING_TYPE:

+                    checkAvailable(1);

+                    result = Integer.parseInt(readStringImpl());

+                    break;

+                case BYTE_TYPE:

+                    checkAvailable(1);

+                    result = readByteImpl();

+                    break;

+                default:

+                    _data.position(position);

+                    throw new MessageFormatException("Unable to convert " + wireType + " to an int");

+            }

+            return result;

+        }

+        catch (RuntimeException e)

+        {

+            _data.position(position);

+            throw e;

+        }

+    }

+

+    protected int readIntImpl()

+    {

+        return _data.getInt();

+    }

+

+    protected long readLong() throws JMSException

+    {

+        int position = _data.position();

+        byte wireType = readWireType();

+        long result;

+        try

+        {

+            switch (wireType)

+            {

+                case LONG_TYPE:

+                    checkAvailable(8);

+                    result = readLongImpl();

+                    break;

+                case INT_TYPE:

+                    checkAvailable(4);

+                    result = readIntImpl();

+                    break;

+                case SHORT_TYPE:

+                    checkAvailable(2);

+                    result = readShortImpl();

+                    break;

+                case STRING_TYPE:

+                    checkAvailable(1);

+                    result = Long.parseLong(readStringImpl());

+                    break;

+                case BYTE_TYPE:

+                    checkAvailable(1);

+                    result = readByteImpl();

+                    break;

+                default:

+                    _data.position(position);

+                    throw new MessageFormatException("Unable to convert " + wireType + " to a long");

+            }

+            return result;

+        }

+        catch (RuntimeException e)

+        {

+            _data.position(position);

+            throw e;

+        }

+    }

+

+    private long readLongImpl()

+    {

+        return _data.getLong();

+    }

+

+    protected float readFloat() throws JMSException

+    {

+        int position = _data.position();

+        byte wireType = readWireType();

+        float result;

+        try

+        {

+            switch (wireType)

+            {

+                case FLOAT_TYPE:

+                    checkAvailable(4);

+                    result = readFloatImpl();

+                    break;

+                case STRING_TYPE:

+                    checkAvailable(1);

+                    result = Float.parseFloat(readStringImpl());

+                    break;

+                default:

+                    _data.position(position);

+                    throw new MessageFormatException("Unable to convert " + wireType + " to a float");

+            }

+            return result;

+        }

+        catch (RuntimeException e)

+        {

+            _data.position(position);

+            throw e;

+        }

+    }

+

+    private float readFloatImpl()

+    {

+        return _data.getFloat();

+    }

+

+    protected double readDouble() throws JMSException

+    {

+        int position = _data.position();

+        byte wireType = readWireType();

+        double result;

+        try

+        {

+            switch (wireType)

+            {

+                case DOUBLE_TYPE:

+                    checkAvailable(8);

+                    result = readDoubleImpl();

+                    break;

+                case FLOAT_TYPE:

+                    checkAvailable(4);

+                    result = readFloatImpl();

+                    break;

+                case STRING_TYPE:

+                    checkAvailable(1);

+                    result = Double.parseDouble(readStringImpl());

+                    break;

+                default:

+                    _data.position(position);

+                    throw new MessageFormatException("Unable to convert " + wireType + " to a double");

+            }

+            return result;

+        }

+        catch (RuntimeException e)

+        {

+            _data.position(position);

+            throw e;

+        }

+    }

+

+    private double readDoubleImpl()

+    {

+        return _data.getDouble();

+    }

+

+    protected String readString() throws JMSException

+    {

+        int position = _data.position();

+        byte wireType = readWireType();

+        String result;

+        try

+        {

+            switch (wireType)

+            {

+                case STRING_TYPE:

+                    checkAvailable(1);

+                    result = readStringImpl();

+                    break;

+                case NULL_STRING_TYPE:

+                    result = null;

+                    throw new NullPointerException("data is null");

+                case BOOLEAN_TYPE:

+                    checkAvailable(1);

+                    result = String.valueOf(readBooleanImpl());

+                    break;

+                case LONG_TYPE:

+                    checkAvailable(8);

+                    result = String.valueOf(readLongImpl());

+                    break;

+                case INT_TYPE:

+                    checkAvailable(4);

+                    result = String.valueOf(readIntImpl());

+                    break;

+                case SHORT_TYPE:

+                    checkAvailable(2);

+                    result = String.valueOf(readShortImpl());

+                    break;

+                case BYTE_TYPE:

+                    checkAvailable(1);

+                    result = String.valueOf(readByteImpl());

+                    break;

+                case FLOAT_TYPE:

+                    checkAvailable(4);

+                    result = String.valueOf(readFloatImpl());

+                    break;

+                case DOUBLE_TYPE:

+                    checkAvailable(8);

+                    result = String.valueOf(readDoubleImpl());

+                    break;

+                case CHAR_TYPE:

+                    checkAvailable(2);

+                    result = String.valueOf(readCharImpl());

+                    break;

+                default:

+                    _data.position(position);

+                    throw new MessageFormatException("Unable to convert " + wireType + " to a String");

+            }

+            return result;

+        }

+        catch (RuntimeException e)

+        {

+            _data.position(position);

+            throw e;

+        }

+    }

+

+    protected String readStringImpl() throws JMSException

+    {

+        try

+        {

+            return _data.getString(Charset.forName("UTF-8").newDecoder());

+        }

+        catch (CharacterCodingException e)

+        {

+            JMSException je = new JMSException("Error decoding byte stream as a UTF8 string: " + e);

+            je.setLinkedException(e);

+            throw je;

+        }

+    }

+

+    protected int readBytes(byte[] bytes) throws JMSException

+    {

+        if (bytes == null)

+        {

+            throw new IllegalArgumentException("byte array must not be null");

+        }

+        checkReadable();

+        // first call

+        if (_byteArrayRemaining == -1)

+        {

+            // type discriminator checked separately so you get a MessageFormatException rather than

+            // an EOF even in the case where both would be applicable

+            checkAvailable(1);

+            byte wireType = readWireType();

+            if (wireType != BYTEARRAY_TYPE)

+            {

+                throw new MessageFormatException("Unable to convert " + wireType + " to a byte array");

+            }

+            checkAvailable(4);

+            int size = _data.getInt();

+            // length of -1 indicates null

+            if (size == -1)

+            {

+                return -1;

+            }

+            else

+            {

+                if (size > _data.remaining())

+                {

+                    throw new MessageEOFException("Byte array has stated length " + size + " but message only contains " +

+                                                  _data.remaining() + " bytes");

+                }

+                else

+                {

+                    _byteArrayRemaining = size;

+                }

+            }

+        }

+        else if (_byteArrayRemaining == 0)

+        {

+            _byteArrayRemaining = -1;

+            return -1;

+        }

+

+        int returnedSize = readBytesImpl(bytes);

+        if (returnedSize < bytes.length)

+        {

+            _byteArrayRemaining = -1;

+        }

+        return returnedSize;

+    }

+

+    private int readBytesImpl(byte[] bytes)

+    {

+        int count = (_byteArrayRemaining >= bytes.length ? bytes.length : _byteArrayRemaining);

+        _byteArrayRemaining -= count;

+

+        if (count == 0)

+        {

+            return 0;

+        }

+        else

+        {

+            _data.get(bytes, 0, count);

+            return count;

+        }

+    }

+

+    protected Object readObject() throws JMSException

+    {

+        int position = _data.position();

+        byte wireType = readWireType();

+        Object result = null;

+        try

+        {

+            switch (wireType)

+            {

+                case BOOLEAN_TYPE:

+                    checkAvailable(1);

+                    result = readBooleanImpl();

+                    break;

+                case BYTE_TYPE:

+                    checkAvailable(1);

+                    result = readByteImpl();

+                    break;

+                case BYTEARRAY_TYPE:

+                    checkAvailable(4);

+                    int size = _data.getInt();

+                    if (size == -1)

+                    {

+                        result = null;

+                    }

+                    else

+                    {

+                        _byteArrayRemaining = size;

+                        byte[] bytesResult = new byte[size];

+                        readBytesImpl(bytesResult);

+                        result = bytesResult;

+                    }

+                    break;

+                case SHORT_TYPE:

+                    checkAvailable(2);

+                    result = readShortImpl();

+                    break;

+                case CHAR_TYPE:

+                    checkAvailable(2);

+                    result = readCharImpl();

+                    break;

+                case INT_TYPE:

+                    checkAvailable(4);

+                    result = readIntImpl();

+                    break;

+                case LONG_TYPE:

+                    checkAvailable(8);

+                    result = readLongImpl();

+                    break;

+                case FLOAT_TYPE:

+                    checkAvailable(4);

+                    result = readFloatImpl();

+                    break;

+                case DOUBLE_TYPE:

+                    checkAvailable(8);

+                    result = readDoubleImpl();

+                    break;

+                case NULL_STRING_TYPE:

+                    result = null;

+                    break;

+                case STRING_TYPE:

+                    checkAvailable(1);

+                    result = readStringImpl();

+                    break;

+            }

+            return result;

+        }

+        catch (RuntimeException e)

+        {

+            _data.position(position);

+            throw e;

+        }

+    }

+

+    protected void writeBoolean(boolean b) throws JMSException

+    {

+        writeTypeDiscriminator(BOOLEAN_TYPE);

+        _data.put(b ? (byte) 1 : (byte) 0);

+    }

+

+    protected void writeByte(byte b) throws JMSException

+    {

+        writeTypeDiscriminator(BYTE_TYPE);

+        _data.put(b);

+    }

+

+    protected void writeShort(short i) throws JMSException

+    {

+        writeTypeDiscriminator(SHORT_TYPE);

+        _data.putShort(i);

+    }

+

+    protected void writeChar(char c) throws JMSException

+    {

+        writeTypeDiscriminator(CHAR_TYPE);

+        _data.putChar(c);

+    }

+

+    protected void writeInt(int i) throws JMSException

+    {

+        writeTypeDiscriminator(INT_TYPE);

+        writeIntImpl(i);

+    }

+

+    protected void writeIntImpl(int i)

+    {

+        _data.putInt(i);

+    }

+

+    protected void writeLong(long l) throws JMSException

+    {

+        writeTypeDiscriminator(LONG_TYPE);

+        _data.putLong(l);

+    }

+

+    protected void writeFloat(float v) throws JMSException

+    {

+        writeTypeDiscriminator(FLOAT_TYPE);

+        _data.putFloat(v);

+    }

+

+    protected void writeDouble(double v) throws JMSException

+    {

+        writeTypeDiscriminator(DOUBLE_TYPE);

+        _data.putDouble(v);

+    }

+

+    protected void writeString(String string) throws JMSException

+    {

+        if (string == null)

+        {

+            writeTypeDiscriminator(NULL_STRING_TYPE);

+        }

+        else

+        {

+            writeTypeDiscriminator(STRING_TYPE);

+            try

+            {

+                writeStringImpl(string);

+            }

+            catch (CharacterCodingException e)

+            {

+                JMSException ex = new JMSException("Unable to encode string: " + e);

+                ex.setLinkedException(e);

+                throw ex;

+            }

+        }

+    }

+

+    protected void writeStringImpl(String string)

+            throws CharacterCodingException

+    {

+        _data.putString(string, Charset.forName("UTF-8").newEncoder());

+        // we must write the null terminator ourselves

+        _data.put((byte) 0);

+    }

+

+    protected void writeBytes(byte[] bytes) throws JMSException

+    {

+        writeBytes(bytes, 0, bytes == null ? 0 : bytes.length);

+    }

+

+    protected void writeBytes(byte[] bytes, int offset, int length) throws JMSException

+    {

+        writeTypeDiscriminator(BYTEARRAY_TYPE);

+        if (bytes == null)

+        {

+            _data.putInt(-1);

+        }

+        else

+        {

+            _data.putInt(length);

+            _data.put(bytes, offset, length);

+        }

+    }

+

+    protected void writeObject(Object object) throws JMSException

+    {

+        checkWritable();

+        Class clazz;

+

+        if (object == null)

+        {

+            // string handles the output of null values

+            clazz = String.class;

+        }

+        else

+        {

+            clazz = object.getClass();

+        }

+

+        if (clazz == Byte.class)

+        {

+            writeByte((Byte) object);

+        }

+        else if (clazz == Boolean.class)

+        {

+            writeBoolean((Boolean) object);

+        }

+        else if (clazz == byte[].class)

+        {

+            writeBytes((byte[]) object);

+        }

+        else if (clazz == Short.class)

+        {

+            writeShort((Short) object);

+        }

+        else if (clazz == Character.class)

+        {

+            writeChar((Character) object);

+        }

+        else if (clazz == Integer.class)

+        {

+            writeInt((Integer) object);

+        }

+        else if (clazz == Long.class)

+        {

+            writeLong((Long) object);

+        }

+        else if (clazz == Float.class)

+        {

+            writeFloat((Float) object);

+        }

+        else if (clazz == Double.class)

+        {

+            writeDouble((Double) object);

+        }

+        else if (clazz == String.class)

+        {

+            writeString((String) object);

+        }

+        else

+        {

+            throw new MessageFormatException("Only primitives plus byte arrays and String are valid types");

+        }

+    }

+}

diff --git a/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java b/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java
index 40d8b28..0c29344 100644
--- a/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java
+++ b/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java
@@ -452,10 +452,6 @@
         }
     }
 
-    public Map getUnderlyingMessagePropertiesMap()
-    {
-        return getJmsContentHeaderProperties().getHeaders();
-    }
 
     public void setUnderlyingMessagePropertiesMap(FieldTable messageProperties)
     {
diff --git a/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java b/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java
index a93c4d5..88e78a1 100644
--- a/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java
+++ b/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java
@@ -22,23 +22,23 @@
 
 import org.apache.mina.common.ByteBuffer;
 import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.EncodingUtils;
-import org.apache.qpid.framing.JMSPropertyFieldTable;
-import org.apache.qpid.framing.AMQFrameDecodingException;
 import org.apache.qpid.AMQException;
 import org.apache.log4j.Logger;
 
 import javax.jms.JMSException;
-import java.util.Enumeration;
+import javax.jms.MessageFormatException;
+import java.util.*;
+import java.nio.charset.Charset;
+import java.nio.charset.CharacterCodingException;
 
-public class JMSMapMessage extends JMSBytesMessage implements javax.jms.MapMessage
+public class JMSMapMessage extends AbstractBytesTypedMessage implements javax.jms.MapMessage
 {
     private static final Logger _logger = Logger.getLogger(JMSMapMessage.class);
 
 
     public static final String MIME_TYPE = "jms/map-message";
 
-    private JMSPropertyFieldTable _properties;
+    private Map<String,Object> _map = new HashMap<String, Object>();
 
     JMSMapMessage() throws JMSException
     {
@@ -48,45 +48,30 @@
     JMSMapMessage(ByteBuffer data) throws JMSException
     {
         super(data); // this instantiates a content header
-        _properties = new JMSPropertyFieldTable();
+        populateMapFromData();
     }
 
+
     JMSMapMessage(long messageNbr, ContentHeaderBody contentHeader, ByteBuffer data)
             throws AMQException
     {
         super(messageNbr, contentHeader, data);
-
-        if (data != null)
+        try
         {
-
-            long tableSize = EncodingUtils.readInteger(_data);
-            try
-            {
-                _properties = new JMSPropertyFieldTable(_data, tableSize);
-            }
-            catch (JMSException e)
-            {
-                Exception error = e.getLinkedException();
-                if (error instanceof AMQFrameDecodingException)
-                {
-                    throw(AMQFrameDecodingException) error;
-                }
-                else
-                {
-                    throw new AMQException(e.getMessage(), e);
-                }
-            }
-        }
-        else
+            populateMapFromData();
+        }                                                        
+        catch (JMSException je)
         {
-            _properties = new JMSPropertyFieldTable();
+            throw new AMQException("Error populating MapMessage from ByteBuffer", je);
+            
         }
+
     }
 
 
     public String toBodyString() throws JMSException
     {
-        return _properties.toString();
+        return _map.toString();
     }
 
     public String getMimeType()
@@ -98,161 +83,437 @@
     public ByteBuffer getData()
     {
         //What if _data is null?
-        _properties.writeToBuffer(_data);
+        writeMapToData();
         return super.getData();
     }
 
+
+
     @Override
     public void clearBodyImpl() throws JMSException
     {
         super.clearBodyImpl();
-        _properties.clear();
+        _map.clear();
     }
 
-    public boolean getBoolean(String string) throws JMSException
+    public boolean getBoolean(String propName) throws JMSException
     {
-        return _properties.getBoolean(string);
-    }
+        Object value = _map.get(propName);
 
-    public byte getByte(String string) throws JMSException
-    {
-        return _properties.getByte(string);
-    }
-
-    public short getShort(String string) throws JMSException
-    {
-        return _properties.getShort(string);
-    }
-
-    public char getChar(String string) throws JMSException
-    {
-    	Character result = _properties.getCharacter(string);
-
-        if (result == null)
+        if(value instanceof Boolean)
         {
-            throw new NullPointerException("getChar couldn't find " + string + " item.");
+            return ((Boolean)value).booleanValue();
+        }
+        else if((value instanceof String) || (value == null))
+        {
+            return Boolean.valueOf((String)value);
         }
         else
         {
-            return result;
+            throw new MessageFormatException("Property " + propName + " of type " +
+                                             value.getClass().getName() + " cannot be converted to boolean.");
+        }
+
+    }
+
+    public byte getByte(String propName) throws JMSException
+    {
+        Object value = _map.get(propName);
+
+        if(value instanceof Byte)
+        {
+            return ((Byte)value).byteValue();
+        }
+        else if((value instanceof String) || (value==null))
+        {
+            return Byte.valueOf((String)value).byteValue();
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + propName + " of type " +
+                                             value.getClass().getName() + " cannot be converted to byte.");
         }
     }
 
-    public int getInt(String string) throws JMSException
+    public short getShort(String propName) throws JMSException
     {
-        return _properties.getInteger(string);
+        Object value = _map.get(propName);
+
+        if(value instanceof Short)
+        {
+            return ((Short)value).shortValue();
+        }
+        else if(value instanceof Byte)
+        {
+            return ((Byte)value).shortValue();
+        }
+        else if((value instanceof String) || (value==null))
+        {
+            return Short.valueOf((String)value).shortValue();
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + propName + " of type " +
+                                             value.getClass().getName() + " cannot be converted to short.");
+        }
+
     }
 
-    public long getLong(String string) throws JMSException
+
+    public int getInt(String propName) throws JMSException
     {
-        return _properties.getLong(string);
+        Object value = _map.get(propName);
+
+        if(value instanceof Integer)
+        {
+            return ((Integer)value).intValue();
+        }
+        else if(value instanceof Short)
+        {
+            return ((Short)value).intValue();
+        }
+        else if(value instanceof Byte)
+        {
+            return ((Byte)value).intValue();
+        }
+        else if((value instanceof String) || (value==null))
+        {
+            return Integer.valueOf((String)value).intValue();
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + propName + " of type " +
+                                             value.getClass().getName() + " cannot be converted to int.");
+        }
+
     }
 
-    public float getFloat(String string) throws JMSException
+    public long getLong(String propName) throws JMSException
     {
-        return _properties.getFloat(string);
+        Object value = _map.get(propName);
+
+        if(value instanceof Long)
+        {
+            return ((Long)value).longValue();
+        }
+        else if(value instanceof Integer)
+        {
+            return ((Integer)value).longValue();
+        }
+        if(value instanceof Short)
+        {
+            return ((Short)value).longValue();
+        }
+        if(value instanceof Byte)
+        {
+            return ((Byte)value).longValue();
+        }
+        else if((value instanceof String) || (value==null))
+        {
+            return Long.valueOf((String)value).longValue();
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + propName + " of type " +
+                                             value.getClass().getName() + " cannot be converted to long.");
+        }
+
     }
 
-    public double getDouble(String string) throws JMSException
+    public char getChar(String propName) throws JMSException
     {
-        return _properties.getDouble(string);
+        Object value = _map.get(propName);
+
+        if(!_map.containsKey(propName))
+        {
+            throw new MessageFormatException("Property " + propName + " not present");
+        }
+        else if(value instanceof Character)
+        {
+            return ((Character)value).charValue();
+        }
+        else if (value == null)
+        {
+            throw new NullPointerException("Property " + propName + " has null value and therefore cannot " +
+                                           "be converted to char.");
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + propName + " of type " +
+                                             value.getClass().getName() + " cannot be converted to boolan.");
+        }
+
     }
 
-    public String getString(String string) throws JMSException
+
+
+    public float getFloat(String propName) throws JMSException
     {
-        return _properties.getString(string);
+        Object value = _map.get(propName);
+
+        if(value instanceof Float)
+        {
+            return ((Float)value).floatValue();
+        }
+        else if((value instanceof String) || (value==null))
+        {
+            return Float.valueOf((String)value).floatValue();
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + propName + " of type " +
+                                             value.getClass().getName() + " cannot be converted to float.");
+        }
     }
 
-    public byte[] getBytes(String string) throws JMSException
+    public double getDouble(String propName) throws JMSException
     {
-        return _properties.getBytes(string);
+        Object value = _map.get(propName);
+
+        if(value instanceof Double)
+        {
+            return ((Double)value).doubleValue();
+        }
+        else if(value instanceof Float)
+        {
+            return ((Float)value).doubleValue();
+        }
+        else if((value instanceof String) || (value==null))
+        {
+            return Double.valueOf((String)value).doubleValue();
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + propName + " of type " +
+                                             value.getClass().getName() + " cannot be converted to double.");
+        }
     }
 
-    public Object getObject(String string) throws JMSException
+    public String getString(String propName) throws JMSException
     {
-        return _properties.getObject(string);
+        Object value = _map.get(propName);
+
+        if((value instanceof String) || (value == null))
+        {
+            return (String) value;
+        }
+        else if(value instanceof byte[])
+        {
+            throw new MessageFormatException("Property " + propName + " of type byte[] " +
+                                             "cannot be converted to String.");
+        }
+        else
+        {
+            return value.toString();
+        }
+
+    }
+
+    public byte[] getBytes(String propName) throws JMSException
+    {
+        Object value = _map.get(propName);
+
+        if(!_map.containsKey(propName))
+        {
+            throw new MessageFormatException("Property " + propName + " not present");                        
+        }
+        else if((value instanceof byte[]) || (value == null))
+        {
+            return (byte[])value;
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + propName + " of type " +
+                                             value.getClass().getName() + " cannot be converted to byte[].");
+        }
+    }
+
+    public Object getObject(String propName) throws JMSException
+    {
+        return _map.get(propName);
     }
 
     public Enumeration getMapNames() throws JMSException
     {
-        return _properties.getMapNames();
+        return Collections.enumeration(_map.keySet());
     }
 
 
-    public void setBoolean(String string, boolean b) throws JMSException
+    public void setBoolean(String propName, boolean b) throws JMSException
     {
         checkWritable();
-        _properties.setBoolean(string, b);
+        checkPropertyName(propName);
+        _map.put(propName, b);
     }
 
-    public void setByte(String string, byte b) throws JMSException
+    public void setByte(String propName, byte b) throws JMSException
     {
         checkWritable();
-        _properties.setByte(string, b);
+        checkPropertyName(propName);
+        _map.put(propName, b);
     }
 
-    public void setShort(String string, short i) throws JMSException
+    public void setShort(String propName, short i) throws JMSException
     {
         checkWritable();
-        _properties.setShort(string, i);
+        checkPropertyName(propName);
+        _map.put(propName, i);
     }
 
-    public void setChar(String string, char c) throws JMSException
+    public void setChar(String propName, char c) throws JMSException
     {
         checkWritable();
-        _properties.setChar(string, c);
+        checkPropertyName(propName);
+        _map.put(propName, c);
     }
 
-    public void setInt(String string, int i) throws JMSException
+    public void setInt(String propName, int i) throws JMSException
     {
         checkWritable();
-        _properties.setInteger(string, i);
+        checkPropertyName(propName);
+        _map.put(propName, i);
     }
 
-    public void setLong(String string, long l) throws JMSException
+    public void setLong(String propName, long l) throws JMSException
     {
         checkWritable();
-        _properties.setLong(string, l);
+        checkPropertyName(propName);
+        _map.put(propName, l);
     }
 
-    public void setFloat(String string, float v) throws JMSException
+    public void setFloat(String propName, float v) throws JMSException
     {
         checkWritable();
-        _properties.setFloat(string, v);
+        checkPropertyName(propName);
+        _map.put(propName, v);
     }
 
-    public void setDouble(String string, double v) throws JMSException
+    public void setDouble(String propName, double v) throws JMSException
     {
         checkWritable();
-        _properties.setDouble(string, v);
+        checkPropertyName(propName);
+        _map.put(propName, v);
     }
 
-    public void setString(String string, String string1) throws JMSException
+    public void setString(String propName, String string1) throws JMSException
     {
         checkWritable();
-        _properties.setString(string, string1);
+        checkPropertyName(propName);
+        _map.put(propName, string1);
     }
 
-    public void setBytes(String string, byte[] bytes) throws JMSException
-    {
-        this.setBytes(string, bytes, 0, bytes.length);
-    }
-
-    public void setBytes(String string, byte[] bytes, int i, int i1) throws JMSException
+    public void setBytes(String propName, byte[] bytes) throws JMSException
     {
         checkWritable();
-        _properties.setBytes(string, bytes, i, i1);
+        checkPropertyName(propName);
+        _map.put(propName, bytes);
     }
 
-    public void setObject(String string, Object object) throws JMSException
+    public void setBytes(String propName, byte[] bytes, int offset, int length) throws JMSException
     {
+        if((offset == 0) && (length == bytes.length))
+        {
+            setBytes(propName,bytes);
+        }
+        else
+        {
+            byte[] newBytes = new byte[length];
+            System.arraycopy(bytes,offset,newBytes,0,length);
+            setBytes(propName,newBytes);
+        }
+    }
+
+    public void setObject(String propName, Object value) throws JMSException
+    {                                                                                       
         checkWritable();
-        _properties.setObject(string, object);
+        checkPropertyName(propName);
+        if(value instanceof Boolean
+                || value instanceof Byte
+                || value instanceof Short
+                || value instanceof Integer
+                || value instanceof Long
+                || value instanceof Character
+                || value instanceof Float
+                || value instanceof Double
+                || value instanceof String
+                || value instanceof byte[]                
+                || value == null)
+        {
+            _map.put(propName, value);
+        }
+        else
+        {
+            throw new MessageFormatException("Cannot set property " + propName + " to value " + value +
+                                             "of type " + value.getClass().getName() + ".");
+        }
     }
 
-    public boolean itemExists(String string) throws JMSException
+    private void checkPropertyName(String propName)
     {
-        return _properties.itemExists(string);
+        if(propName == null || propName.equals(""))
+        {
+            throw new IllegalArgumentException("Property name cannot be null, or the empty String.");
+        }
     }
 
+    public boolean itemExists(String propName) throws JMSException
+    {
+        return _map.containsKey(propName);
+    }
+
+
+    private void populateMapFromData() throws JMSException
+    {
+        if(_data != null)
+        {
+            _data.rewind();
+
+            final int entries = readIntImpl();
+            for(int i = 0; i < entries; i++)
+            {
+                String propName = readStringImpl();
+                Object value = readObject();
+                _map.put(propName,value);
+            }
+        }
+        else
+        {
+            _map.clear();
+        }
+    }
+
+    private void writeMapToData()
+    {
+        allocateInitialBuffer();
+        final int size = _map.size();
+        writeIntImpl(size);
+        for(Map.Entry<String, Object> entry : _map.entrySet())
+        {
+            try
+            {
+                writeStringImpl(entry.getKey());
+            }
+            catch (CharacterCodingException e)
+            {
+                throw new IllegalArgumentException("Cannot encode property key name " + entry.getKey(),e);
+
+
+            }
+            try
+            {
+                writeObject(entry.getValue());
+            }
+            catch (JMSException e)
+            {
+                Object value = entry.getValue();
+                throw new IllegalArgumentException("Cannot encode property key name " + entry.getKey() +
+                        " value : " + value + " (type: " + value.getClass().getName() + ").",e);
+            }
+        }
+
+    }
+
+
+
+
 }
diff --git a/java/client/src/main/java/org/apache/qpid/client/message/JMSStreamMessage.java b/java/client/src/main/java/org/apache/qpid/client/message/JMSStreamMessage.java
index 6709ff8..972a5fc 100644
--- a/java/client/src/main/java/org/apache/qpid/client/message/JMSStreamMessage.java
+++ b/java/client/src/main/java/org/apache/qpid/client/message/JMSStreamMessage.java
@@ -31,31 +31,10 @@
 /**
  * @author Apache Software Foundation
  */
-public class JMSStreamMessage extends AbstractBytesMessage implements StreamMessage
+public class JMSStreamMessage extends AbstractBytesTypedMessage implements StreamMessage
 {
     public static final String MIME_TYPE="jms/stream-message";
 
-    private static final byte BOOLEAN_TYPE = (byte) 1;
-
-    private static final byte BYTE_TYPE = (byte) 2;
-
-    private static final byte BYTEARRAY_TYPE = (byte) 3;
-
-    private static final byte SHORT_TYPE = (byte) 4;
-
-    private static final byte CHAR_TYPE = (byte) 5;
-
-    private static final byte INT_TYPE = (byte) 6;
-
-    private static final byte LONG_TYPE = (byte) 7;
-
-    private static final byte FLOAT_TYPE = (byte) 8;
-
-    private static final byte DOUBLE_TYPE = (byte) 9;
-
-    private static final byte STRING_TYPE = (byte) 10;
-
-    private static final byte NULL_STRING_TYPE = (byte) 11;
 
     /**
      * This is set when reading a byte array. The readBytes(byte[]) method supports multiple calls to read
@@ -97,128 +76,22 @@
         return MIME_TYPE;
     }
 
-    private byte readWireType() throws MessageFormatException, MessageEOFException,
-            MessageNotReadableException
-    {
-        checkReadable();
-        checkAvailable(1);
-        return _data.get();
-    }
 
-    private void writeTypeDiscriminator(byte type) throws MessageNotWriteableException
-    {
-        checkWritable();
-        _data.put(type);
-        _changedData = true;
-    }
 
     public boolean readBoolean() throws JMSException
     {
-        int position = _data.position();
-        byte wireType = readWireType();
-        boolean result;
-        try
-        {
-            switch (wireType)
-            {
-                case BOOLEAN_TYPE:
-                    checkAvailable(1);
-                    result = readBooleanImpl();
-                    break;
-                case STRING_TYPE:
-                    checkAvailable(1);
-                    result = Boolean.parseBoolean(readStringImpl());
-                    break;
-                default:
-                    _data.position(position);
-                    throw new MessageFormatException("Unable to convert " + wireType + " to a boolean");
-            }
-            return result;
-        }
-        catch (RuntimeException e)
-        {
-            _data.position(position);
-            throw e;
-        }
+        return super.readBoolean();
     }
 
-    private boolean readBooleanImpl()
-    {
-        return _data.get() != 0;
-    }
 
     public byte readByte() throws JMSException
     {
-        int position = _data.position();
-        byte wireType = readWireType();
-        byte result;
-        try
-        {
-            switch (wireType)
-            {
-                case BYTE_TYPE:
-                    checkAvailable(1);
-                    result = readByteImpl();
-                    break;
-                case STRING_TYPE:
-                    checkAvailable(1);
-                    result = Byte.parseByte(readStringImpl());
-                    break;
-                default:
-                    _data.position(position);
-                    throw new MessageFormatException("Unable to convert " + wireType + " to a byte");
-            }
-        }
-        catch (RuntimeException e)
-        {
-            _data.position(position);
-            throw e;
-        }
-        return result;
-    }
-
-    private byte readByteImpl()
-    {
-        return _data.get();
+        return super.readByte();
     }
 
     public short readShort() throws JMSException
     {
-        int position = _data.position();
-        byte wireType = readWireType();
-        short result;
-        try
-        {
-            switch (wireType)
-            {
-                case SHORT_TYPE:
-                    checkAvailable(2);
-                    result = readShortImpl();
-                    break;
-                case STRING_TYPE:
-                    checkAvailable(1);
-                    result = Short.parseShort(readStringImpl());
-                    break;
-                case BYTE_TYPE:
-                    checkAvailable(1);
-                    result = readByteImpl();
-                    break;
-                default:
-                    _data.position(position);
-                    throw new MessageFormatException("Unable to convert " + wireType + " to a short");
-            }
-        }
-        catch (RuntimeException e)
-        {
-            _data.position(position);
-            throw e;
-        }
-        return result;
-    }
-
-    private short readShortImpl()
-    {
-        return _data.getShort();
+        return super.readShort();
     }
 
     /**
@@ -229,564 +102,102 @@
      */
     public char readChar() throws JMSException
     {
-        int position = _data.position();
-        byte wireType = readWireType();
-        try
-        {
-        	if(wireType == NULL_STRING_TYPE){
-        		throw new NullPointerException();
-        	}
-        	
-            if (wireType != CHAR_TYPE)
-            {
-                _data.position(position);
-                throw new MessageFormatException("Unable to convert " + wireType + " to a char");
-            }
-            else
-            {
-                checkAvailable(2);
-                return readCharImpl();
-            }
-        }
-        catch (RuntimeException e)
-        {
-            _data.position(position);
-            throw e;
-        }
-    }
-
-    private char readCharImpl()
-    {
-        return _data.getChar();
+        return super.readChar();
     }
 
     public int readInt() throws JMSException
     {
-        int position = _data.position();
-        byte wireType = readWireType();
-        int result;
-        try
-        {
-            switch (wireType)
-            {
-                case INT_TYPE:
-                    checkAvailable(4);
-                    result = readIntImpl();
-                    break;
-                case SHORT_TYPE:
-                    checkAvailable(2);
-                    result = readShortImpl();
-                    break;
-                case STRING_TYPE:
-                    checkAvailable(1);
-                    result = Integer.parseInt(readStringImpl());
-                    break;
-                case BYTE_TYPE:
-                    checkAvailable(1);
-                    result = readByteImpl();
-                    break;
-                default:
-                    _data.position(position);
-                    throw new MessageFormatException("Unable to convert " + wireType + " to an int");
-            }
-            return result;
-        }
-        catch (RuntimeException e)
-        {
-            _data.position(position);
-            throw e;
-        }
-    }
-
-    private int readIntImpl()
-    {
-        return _data.getInt();
+        return super.readInt();
     }
 
     public long readLong() throws JMSException
     {
-        int position = _data.position();
-        byte wireType = readWireType();
-        long result;
-        try
-        {
-            switch (wireType)
-            {
-                case LONG_TYPE:
-                    checkAvailable(8);
-                    result = readLongImpl();
-                    break;
-                case INT_TYPE:
-                    checkAvailable(4);
-                    result = readIntImpl();
-                    break;
-                case SHORT_TYPE:
-                    checkAvailable(2);
-                    result = readShortImpl();
-                    break;
-                case STRING_TYPE:
-                    checkAvailable(1);
-                    result = Long.parseLong(readStringImpl());
-                    break;
-                case BYTE_TYPE:
-                    checkAvailable(1);
-                    result = readByteImpl();
-                    break;
-                default:
-                    _data.position(position);
-                    throw new MessageFormatException("Unable to convert " + wireType + " to a long");
-            }
-            return result;
-        }
-        catch (RuntimeException e)
-        {
-            _data.position(position);
-            throw e;
-        }
-    }
-
-    private long readLongImpl()
-    {
-        return _data.getLong();
+        return super.readLong();
     }
 
     public float readFloat() throws JMSException
     {
-        int position = _data.position();
-        byte wireType = readWireType();
-        float result;
-        try
-        {
-            switch (wireType)
-            {
-                case FLOAT_TYPE:
-                    checkAvailable(4);
-                    result = readFloatImpl();
-                    break;
-                case STRING_TYPE:
-                    checkAvailable(1);
-                    result = Float.parseFloat(readStringImpl());
-                    break;
-                default:
-                    _data.position(position);
-                    throw new MessageFormatException("Unable to convert " + wireType + " to a float");
-            }
-            return result;
-        }
-        catch (RuntimeException e)
-        {
-            _data.position(position);
-            throw e;
-        }
-    }
-
-    private float readFloatImpl()
-    {
-        return _data.getFloat();
+        return super.readFloat();
     }
 
     public double readDouble() throws JMSException
     {
-        int position = _data.position();
-        byte wireType = readWireType();
-        double result;
-        try
-        {
-            switch (wireType)
-            {
-                case DOUBLE_TYPE:
-                    checkAvailable(8);
-                    result = readDoubleImpl();
-                    break;
-                case FLOAT_TYPE:
-                    checkAvailable(4);
-                    result = readFloatImpl();
-                    break;
-                case STRING_TYPE:
-                    checkAvailable(1);
-                    result = Double.parseDouble(readStringImpl());
-                    break;
-                default:
-                    _data.position(position);
-                    throw new MessageFormatException("Unable to convert " + wireType + " to a double");
-            }
-            return result;
-        }
-        catch (RuntimeException e)
-        {
-            _data.position(position);
-            throw e;
-        }
-    }
-
-    private double readDoubleImpl()
-    {
-        return _data.getDouble();
+        return super.readDouble();
     }
 
     public String readString() throws JMSException
     {
-        int position = _data.position();
-        byte wireType = readWireType();
-        String result;
-        try
-        {
-            switch (wireType)
-            {
-                case STRING_TYPE:
-                    checkAvailable(1);
-                    result = readStringImpl();
-                    break;
-                case NULL_STRING_TYPE:
-                    result = null;
-                    throw new NullPointerException("data is null");
-                case BOOLEAN_TYPE:
-                    checkAvailable(1);
-                    result = String.valueOf(readBooleanImpl());
-                    break;
-                case LONG_TYPE:
-                    checkAvailable(8);
-                    result = String.valueOf(readLongImpl());
-                    break;
-                case INT_TYPE:
-                    checkAvailable(4);
-                    result = String.valueOf(readIntImpl());
-                    break;
-                case SHORT_TYPE:
-                    checkAvailable(2);
-                    result = String.valueOf(readShortImpl());
-                    break;
-                case BYTE_TYPE:
-                    checkAvailable(1);
-                    result = String.valueOf(readByteImpl());
-                    break;
-                case FLOAT_TYPE:
-                    checkAvailable(4);
-                    result = String.valueOf(readFloatImpl());
-                    break;
-                case DOUBLE_TYPE:
-                    checkAvailable(8);
-                    result = String.valueOf(readDoubleImpl());
-                    break;
-                case CHAR_TYPE:
-                    checkAvailable(2);
-                    result = String.valueOf(readCharImpl());
-                    break;
-                default:
-                    _data.position(position);
-                    throw new MessageFormatException("Unable to convert " + wireType + " to a String");
-            }
-            return result;
-        }
-        catch (RuntimeException e)
-        {
-            _data.position(position);
-            throw e;
-        }
-    }
-
-    private String readStringImpl() throws JMSException
-    {
-        try
-        {
-            return _data.getString(Charset.forName("UTF-8").newDecoder());
-        }
-        catch (CharacterCodingException e)
-        {
-            JMSException je = new JMSException("Error decoding byte stream as a UTF8 string: " + e);
-            je.setLinkedException(e);
-            throw je;
-        }
+        return super.readString();
     }
 
     public int readBytes(byte[] bytes) throws JMSException
     {
-        if (bytes == null)
-        {
-            throw new IllegalArgumentException("byte array must not be null");
-        }
-        checkReadable();
-        // first call
-        if (_byteArrayRemaining == -1)
-        {
-            // type discriminator checked separately so you get a MessageFormatException rather than
-            // an EOF even in the case where both would be applicable
-            checkAvailable(1);
-            byte wireType = readWireType();
-            if (wireType != BYTEARRAY_TYPE)
-            {
-                throw new MessageFormatException("Unable to convert " + wireType + " to a byte array");
-            }
-            checkAvailable(4);
-            int size = _data.getInt();
-            // size of -1 indicates null
-            if (size == -1)
-            {
-                return -1;
-            }
-            else
-            {
-                if (size > _data.remaining())
-                {
-                    throw new MessageEOFException("Byte array has stated size " + size + " but message only contains " +
-                                                  _data.remaining() + " bytes");
-                }
-                else
-                {
-                    _byteArrayRemaining = size;
-                }
-            }
-        }
-        else if (_byteArrayRemaining == 0)
-        {
-            _byteArrayRemaining = -1;
-            return -1;
-        }
-
-        int returnedSize = readBytesImpl(bytes);
-        if (returnedSize < bytes.length)
-        {
-            _byteArrayRemaining = -1;
-        }
-        return returnedSize;
+        return super.readBytes(bytes);
     }
 
-    private int readBytesImpl(byte[] bytes)
-    {
-        int count = (_byteArrayRemaining >= bytes.length ? bytes.length : _byteArrayRemaining);
-        _byteArrayRemaining -= count;
-
-        if (count == 0)
-        {
-            return 0;
-        }
-        else
-        {
-            _data.get(bytes, 0, count);
-            return count;
-        }
-    }
 
     public Object readObject() throws JMSException
     {
-        int position = _data.position();
-        byte wireType = readWireType();
-        Object result = null;
-        try
-        {
-            switch (wireType)
-            {
-                case BOOLEAN_TYPE:
-                    checkAvailable(1);
-                    result = readBooleanImpl();
-                    break;
-                case BYTE_TYPE:
-                    checkAvailable(1);
-                    result = readByteImpl();
-                    break;
-                case BYTEARRAY_TYPE:
-                    checkAvailable(4);
-                    int size = _data.getInt();
-                    if (size == -1)
-                    {
-                        result = null;
-                    }
-                    else
-                    {
-                        _byteArrayRemaining = size;
-                        result = new byte[size];
-                        readBytesImpl(new byte[size]);
-                    }
-                    break;
-                case SHORT_TYPE:
-                    checkAvailable(2);
-                    result = readShortImpl();
-                    break;
-                case CHAR_TYPE:
-                    checkAvailable(2);
-                    result = readCharImpl();
-                    break;
-                case INT_TYPE:
-                    checkAvailable(4);
-                    result = readIntImpl();
-                    break;
-                case LONG_TYPE:
-                    checkAvailable(8);
-                    result = readLongImpl();
-                    break;
-                case FLOAT_TYPE:
-                    checkAvailable(4);
-                    result = readFloatImpl();
-                    break;
-                case DOUBLE_TYPE:
-                    checkAvailable(8);
-                    result = readDoubleImpl();
-                    break;
-                case NULL_STRING_TYPE:
-                    result = null;
-                    break;
-                case STRING_TYPE:
-                    checkAvailable(1);
-                    result = readStringImpl();
-                    break;
-            }
-            return result;
-        }
-        catch (RuntimeException e)
-        {
-            _data.position(position);
-            throw e;
-        }
+        return super.readObject();
     }
 
     public void writeBoolean(boolean b) throws JMSException
     {
-        writeTypeDiscriminator(BOOLEAN_TYPE);
-        _data.put(b ? (byte) 1 : (byte) 0);
+        super.writeBoolean(b);
     }
 
     public void writeByte(byte b) throws JMSException
     {
-        writeTypeDiscriminator(BYTE_TYPE);
-        _data.put(b);
+        super.writeByte(b);
     }
 
     public void writeShort(short i) throws JMSException
     {
-        writeTypeDiscriminator(SHORT_TYPE);
-        _data.putShort(i);
+        super.writeShort(i);
     }
 
     public void writeChar(char c) throws JMSException
     {
-        writeTypeDiscriminator(CHAR_TYPE);
-        _data.putChar(c);
+        super.writeChar(c);
     }
 
     public void writeInt(int i) throws JMSException
     {
-        writeTypeDiscriminator(INT_TYPE);
-        _data.putInt(i);
+        super.writeInt(i);
     }
 
     public void writeLong(long l) throws JMSException
     {
-        writeTypeDiscriminator(LONG_TYPE);
-        _data.putLong(l);
+        super.writeLong(l);
     }
 
     public void writeFloat(float v) throws JMSException
     {
-        writeTypeDiscriminator(FLOAT_TYPE);
-        _data.putFloat(v);
+        super.writeFloat(v);
     }
 
     public void writeDouble(double v) throws JMSException
     {
-        writeTypeDiscriminator(DOUBLE_TYPE);
-        _data.putDouble(v);
+        super.writeDouble(v);
     }
 
     public void writeString(String string) throws JMSException
     {
-        if (string == null)
-        {
-            writeTypeDiscriminator(NULL_STRING_TYPE);
-        }
-        else
-        {
-            writeTypeDiscriminator(STRING_TYPE);
-            try
-            {
-                _data.putString(string, Charset.forName("UTF-8").newEncoder());
-                // we must write the null terminator ourselves
-                _data.put((byte) 0);
-            }
-            catch (CharacterCodingException e)
-            {
-                JMSException ex = new JMSException("Unable to encode string: " + e);
-                ex.setLinkedException(e);
-                throw ex;
-            }
-        }
+        super.writeString(string);
     }
 
     public void writeBytes(byte[] bytes) throws JMSException
     {
-        writeBytes(bytes, 0, bytes == null ? 0 : bytes.length);
+        super.writeBytes(bytes);
     }
 
     public void writeBytes(byte[] bytes, int offset, int length) throws JMSException
     {
-        writeTypeDiscriminator(BYTEARRAY_TYPE);
-        if (bytes == null)
-        {
-            _data.putInt(-1);
-        }
-        else
-        {
-            _data.putInt(length);
-            _data.put(bytes, offset, length);
-        }
+        super.writeBytes(bytes,offset,length);
     }
 
     public void writeObject(Object object) throws JMSException
     {
-        checkWritable();
-        Class clazz = null;
-        if (object == null)
-        {
-            // string handles the output of null values
-            clazz = String.class;
-        }
-        else
-        {
-            clazz = object.getClass();
-        }
-
-        if (clazz == Byte.class)
-        {
-            writeByte((Byte) object);
-        }
-        else if (clazz == Boolean.class)
-        {
-            writeBoolean((Boolean) object);
-        }
-        else if (clazz == byte[].class)
-        {
-            writeBytes((byte[]) object);
-        }
-        else if (clazz == Short.class)
-        {
-            writeShort((Short) object);
-        }
-        else if (clazz == Character.class)
-        {
-            writeChar((Character) object);
-        }
-        else if (clazz == Integer.class)
-        {
-            writeInt((Integer) object);
-        }
-        else if (clazz == Long.class)
-        {
-            writeLong((Long) object);
-        }
-        else if (clazz == Float.class)
-        {
-            writeFloat((Float) object);
-        }
-        else if (clazz == Double.class)
-        {
-            writeDouble((Double) object);
-        }
-        else if (clazz == String.class)
-        {
-            writeString((String) object);
-        }
-        else
-        {
-            throw new MessageFormatException("Only primitives plus byte arrays and String are valid types");
-        }
+        super.writeObject(object);
     }
 }
diff --git a/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java b/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
index eab9084..f37af83 100644
--- a/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
+++ b/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
@@ -472,8 +472,15 @@
     {
         _stateManager.changeState(AMQState.CONNECTION_CLOSING);
 
-        final AMQFrame frame = ConnectionCloseBody.createAMQFrame(
-                0, AMQConstant.REPLY_SUCCESS.getCode(), "JMS client is closing the connection.", 0, 0);
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        // Be aware of possible changes to parameter order as versions change.
+        final AMQFrame frame = ConnectionCloseBody.createAMQFrame(0,
+            (byte)8, (byte)0,	// AMQP version (major, minor)
+            0,	// classId
+            0,	// methodId
+            AMQConstant.REPLY_SUCCESS.getCode(),	// replyCode
+            "JMS client is closing the connection.");	// replyText
         syncWrite(frame, ConnectionCloseOkBody.class);
 
         _protocolSession.closeProtocolSession();
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/basic/MapMessageTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/basic/MapMessageTest.java
index 02a98f6..bc2def1 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/basic/MapMessageTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/basic/MapMessageTest.java
@@ -81,7 +81,7 @@
     {
         _connection = connection;
         _destination = destination;
-        _session = (AMQSession) connection.createSession(false, AMQSession.AUTO_ACKNOWLEDGE);
+        _session = (AMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
         //set up a slow consumer
         _session.createConsumer(destination).setMessageListener(this);
@@ -1112,6 +1112,9 @@
         }
     }
 
+    
+
+
     private void testMapValues(JMSMapMessage m, int count) throws JMSException
     {
         //Test get<Primiative>
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/message/JMSDestinationTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/message/JMSDestinationTest.java
index 27736ac..c14b531 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/message/JMSDestinationTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/message/JMSDestinationTest.java
@@ -11,7 +11,6 @@
 import org.apache.qpid.url.BindingURL;

 import org.apache.qpid.exchange.ExchangeDefaults;

 import org.apache.qpid.framing.FieldTable;

-import org.apache.qpid.framing.PropertyFieldTable;

 

 import javax.jms.*;

 

diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/message/StreamMessageTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/message/StreamMessageTest.java
index 8396982..184d7cb 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/message/StreamMessageTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/message/StreamMessageTest.java
@@ -17,7 +17,6 @@
 import org.apache.qpid.client.transport.TransportConnection;
 import org.apache.qpid.exchange.ExchangeDefaults;
 import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.framing.PropertyFieldTable;
 import org.apache.qpid.url.AMQBindingURL;
 import org.apache.qpid.url.BindingURL;
 
@@ -53,7 +52,7 @@
 
 
         AMQHeadersExchange queue = new AMQHeadersExchange(new AMQBindingURL(ExchangeDefaults.HEADERS_EXCHANGE_CLASS+"://"+ExchangeDefaults.HEADERS_EXCHANGE_NAME+"/test/queue1?"+ BindingURL.OPTION_ROUTING_KEY+"='F0000=1'"));
-        FieldTable ft = new PropertyFieldTable();
+        FieldTable ft = new FieldTable();
         ft.setString("F1000","1");
         MessageConsumer consumer = consumerSession.createConsumer(queue, AMQSession.DEFAULT_PREFETCH_LOW_MARK, AMQSession.DEFAULT_PREFETCH_HIGH_MARK, false, false, (String)null, ft);
 
diff --git a/java/cluster/src/main/java/org/apache/qpid/server/cluster/DefaultGroupManager.java b/java/cluster/src/main/java/org/apache/qpid/server/cluster/DefaultGroupManager.java
index 4efe0b8..5f08378 100644
--- a/java/cluster/src/main/java/org/apache/qpid/server/cluster/DefaultGroupManager.java
+++ b/java/cluster/src/main/java/org/apache/qpid/server/cluster/DefaultGroupManager.java
@@ -103,7 +103,9 @@
 
     private void ping(Broker b) throws AMQException
     {
-        ClusterPingBody ping = new ClusterPingBody();
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        ClusterPingBody ping = new ClusterPingBody((byte)8, (byte)0);
         ping.broker = _group.getLocal().getDetails();
         ping.responseRequired = true;
         ping.load = _loadTable.getLocalLoad();
@@ -149,7 +151,9 @@
 
         Broker leader = connectToLeader(member);
         _logger.info(new LogMessage("Connected to {0}. joining", leader));
-        ClusterJoinBody join = new ClusterJoinBody();
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        ClusterJoinBody join = new ClusterJoinBody((byte)8, (byte)0);
         join.broker = _group.getLocal().getDetails();
         send(leader, new SimpleBodySendable(join));
     }
@@ -168,7 +172,9 @@
 
     public void leave() throws AMQException
     {
-        ClusterLeaveBody leave = new ClusterLeaveBody();
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        ClusterLeaveBody leave = new ClusterLeaveBody((byte)8, (byte)0);
         leave.broker = _group.getLocal().getDetails();
         send(getLeader(), new SimpleBodySendable(leave));
     }
@@ -189,7 +195,9 @@
         }
         else
         {
-            ClusterSuspectBody suspect = new ClusterSuspectBody();
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            ClusterSuspectBody suspect = new ClusterSuspectBody((byte)8, (byte)0);
             suspect.broker = broker.getDetails();
             send(getLeader(), new SimpleBodySendable(suspect));
         }
@@ -211,7 +219,9 @@
         else
         {
             //pass request on to leader:
-            ClusterJoinBody request = new ClusterJoinBody();
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            ClusterJoinBody request = new ClusterJoinBody((byte)8, (byte)0);
             request.broker = member.getDetails();
             Broker leader = getLeader();
             send(leader, new SimpleBodySendable(request));
@@ -256,7 +266,9 @@
 
     private ClusterMembershipBody createAnnouncement(String membership)
     {
-        ClusterMembershipBody announce = new ClusterMembershipBody();
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        ClusterMembershipBody announce = new ClusterMembershipBody((byte)8, (byte)0);
         //TODO: revise this way of converting String to bytes...
         announce.members = membership.getBytes();
         return announce;
diff --git a/java/cluster/src/main/java/org/apache/qpid/server/cluster/handler/RemoteConsumeHandler.java b/java/cluster/src/main/java/org/apache/qpid/server/cluster/handler/RemoteConsumeHandler.java
index 24ce408..80e1357 100644
--- a/java/cluster/src/main/java/org/apache/qpid/server/cluster/handler/RemoteConsumeHandler.java
+++ b/java/cluster/src/main/java/org/apache/qpid/server/cluster/handler/RemoteConsumeHandler.java
@@ -45,7 +45,13 @@
         if (queue instanceof ClusteredQueue)
         {
             ((ClusteredQueue) queue).addRemoteSubcriber(ClusteredProtocolSession.getSessionPeer(session));
-            session.writeFrame(BasicConsumeOkBody.createAMQFrame(evt.getChannelId(), evt.getMethod().queue));
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            // Be aware of possible changes to parameter order as versions change.
+            session.writeFrame(BasicConsumeOkBody.createAMQFrame(evt.getChannelId(),
+            	(byte)8, (byte)0,	// AMQP version (major, minor)
+            	evt.getMethod().queue	// consumerTag
+                ));
         }
         else
         {
diff --git a/java/cluster/src/main/java/org/apache/qpid/server/cluster/replay/ConsumerCounts.java b/java/cluster/src/main/java/org/apache/qpid/server/cluster/replay/ConsumerCounts.java
index 7ba5110..b170468 100644
--- a/java/cluster/src/main/java/org/apache/qpid/server/cluster/replay/ConsumerCounts.java
+++ b/java/cluster/src/main/java/org/apache/qpid/server/cluster/replay/ConsumerCounts.java
@@ -48,7 +48,9 @@
     {
         for(String queue : _counts.keySet())
         {
-            BasicConsumeBody m = new BasicConsumeBody();
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            BasicConsumeBody m = new BasicConsumeBody((byte)8, (byte)0);
             m.queue = queue;
             m.consumerTag = queue;
             replay(m, messages);
diff --git a/java/cluster/src/main/java/org/apache/qpid/server/cluster/replay/RecordingMethodHandlerFactory.java b/java/cluster/src/main/java/org/apache/qpid/server/cluster/replay/RecordingMethodHandlerFactory.java
index 638ec64..d0c4649 100644
--- a/java/cluster/src/main/java/org/apache/qpid/server/cluster/replay/RecordingMethodHandlerFactory.java
+++ b/java/cluster/src/main/java/org/apache/qpid/server/cluster/replay/RecordingMethodHandlerFactory.java
@@ -41,15 +41,19 @@
 
 public class RecordingMethodHandlerFactory extends WrappingMethodHandlerFactory
 {
+    // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+    // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+    private final byte major = (byte)8;
+    private final byte minor = (byte)0;
     private final Iterable<FrameDescriptor> _frames = Arrays.asList(new FrameDescriptor[]
             {
-                    new FrameDescriptor(QueueDeclareBody.class, new QueueDeclareBody()),
-                    new FrameDescriptor(QueueDeleteBody.class, new QueueDeleteBody()),
-                    new FrameDescriptor(QueueBindBody.class, new QueueBindBody()),
-                    new FrameDescriptor(ExchangeDeclareBody.class, new ExchangeDeclareBody()),
-                    new FrameDescriptor(ExchangeDeleteBody.class, new ExchangeDeleteBody()),
-                    new FrameDescriptor(BasicConsumeBody.class, new BasicConsumeBody()),
-                    new FrameDescriptor(BasicCancelBody.class, new BasicCancelBody())
+                    new FrameDescriptor(QueueDeclareBody.class, new QueueDeclareBody(major, minor)),
+                    new FrameDescriptor(QueueDeleteBody.class, new QueueDeleteBody(major, minor)),
+                    new FrameDescriptor(QueueBindBody.class, new QueueBindBody(major, minor)),
+                    new FrameDescriptor(ExchangeDeclareBody.class, new ExchangeDeclareBody(major, minor)),
+                    new FrameDescriptor(ExchangeDeleteBody.class, new ExchangeDeleteBody(major, minor)),
+                    new FrameDescriptor(BasicConsumeBody.class, new BasicConsumeBody(major, minor)),
+                    new FrameDescriptor(BasicCancelBody.class, new BasicCancelBody(major, minor))
             });
 
 
diff --git a/java/cluster/src/main/java/org/apache/qpid/server/cluster/replay/ReplayStore.java b/java/cluster/src/main/java/org/apache/qpid/server/cluster/replay/ReplayStore.java
index 66bd8e0..196f2f7 100644
--- a/java/cluster/src/main/java/org/apache/qpid/server/cluster/replay/ReplayStore.java
+++ b/java/cluster/src/main/java/org/apache/qpid/server/cluster/replay/ReplayStore.java
@@ -121,7 +121,9 @@
             }
         }
         _consumers.replay(methods);
-        methods.add(new ClusterSynchBody());
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        methods.add(new ClusterSynchBody((byte)8, (byte)0));
         return methods;
     }
 
diff --git a/java/cluster/src/main/java/org/apache/qpid/server/queue/ClusteredQueue.java b/java/cluster/src/main/java/org/apache/qpid/server/queue/ClusteredQueue.java
index d0d6a30..adae209 100644
--- a/java/cluster/src/main/java/org/apache/qpid/server/queue/ClusteredQueue.java
+++ b/java/cluster/src/main/java/org/apache/qpid/server/queue/ClusteredQueue.java
@@ -72,7 +72,9 @@
             delete();
 
             //send deletion request to all other members:
-            QueueDeleteBody request = new QueueDeleteBody();
+        	// AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        	// TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            QueueDeleteBody request = new QueueDeleteBody((byte)8, (byte)0);
             request.queue = getName();
             _groupMgr.broadcast(new SimpleBodySendable(request));
         }
@@ -84,7 +86,9 @@
         super.unregisterProtocolSession(ps, channel, consumerTag);
 
         //signal other members:
-        BasicCancelBody request = new BasicCancelBody();
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        BasicCancelBody request = new BasicCancelBody((byte)8, (byte)0);
         request.consumerTag = getName();
         _groupMgr.broadcast(new SimpleBodySendable(request));
     }
diff --git a/java/cluster/src/main/java/org/apache/qpid/server/queue/PrivateQueue.java b/java/cluster/src/main/java/org/apache/qpid/server/queue/PrivateQueue.java
index 7940ef0..ba74da4 100644
--- a/java/cluster/src/main/java/org/apache/qpid/server/queue/PrivateQueue.java
+++ b/java/cluster/src/main/java/org/apache/qpid/server/queue/PrivateQueue.java
@@ -54,7 +54,9 @@
         super.autodelete();
 
         //send delete request to peers:
-        QueueDeleteBody request = new QueueDeleteBody();
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+        QueueDeleteBody request = new QueueDeleteBody((byte)8, (byte)0);
         request.queue = getName();
         _groupMgr.broadcast(new SimpleBodySendable(request));
     }
diff --git a/java/cluster/src/test/java/org/apache/qpid/server/cluster/BrokerTest.java b/java/cluster/src/test/java/org/apache/qpid/server/cluster/BrokerTest.java
index 9bee19a..864551d 100644
--- a/java/cluster/src/test/java/org/apache/qpid/server/cluster/BrokerTest.java
+++ b/java/cluster/src/test/java/org/apache/qpid/server/cluster/BrokerTest.java
@@ -148,6 +148,9 @@
 
         TestMethod(Object id)
         {
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
+            super((byte)8, (byte)0);
             this.id = id;
         }
 
diff --git a/java/common/pom.xml b/java/common/pom.xml
index 653b2a8..f30d81f 100644
--- a/java/common/pom.xml
+++ b/java/common/pom.xml
@@ -35,14 +35,12 @@
 
     <properties>
         <topDirectoryLocation>..</topDirectoryLocation>
-        <cluster.asl>${basedir}/src/main/xsl/cluster.asl</cluster.asl>
-        <spec.stylesheet>${basedir}/src/main/xsl/framing.xsl</spec.stylesheet>
-        <registry.stylesheet>${basedir}/src/main/xsl/registry.xsl</registry.stylesheet>
-        <registry.template>${basedir}/src/main/xsl/registry.template</registry.template>
+        <gentools.home>${topDirectoryLocation}/../gentools</gentools.home>
         <generated.path>${project.build.directory}/generated-sources/xsl</generated.path>
         <generated.package>org/apache/qpid/framing</generated.package>
         <generated.dir>${generated.path}/${generated.package}</generated.dir>
         <specs.dir>${topDirectoryLocation}/../specs</specs.dir>
+        <cluster.asl>${basedir}/src/main/xsl/cluster.asl</cluster.asl>
     </properties>
 
     <build>
@@ -57,13 +55,9 @@
                         <configuration>
                             <tasks>
                                 <ant antfile="protocol-version.xml">
-                                    <property name="cluster.asl" value="${cluster.asl}"/>
-                                    <property name="spec.stylesheet" value="${spec.stylesheet}"/>
-                                    <property name="registry.stylesheet" value="${registry.stylesheet}"/>
-                                    <property name="registry.template" value="${registry.template}"/>
+									<property name="gentools.home" value="${gentools.home}"/>
                                     <property name="generated.dir" value="${generated.dir}"/>
-                                    <property name="proto_version" value="${generated.dir}/ProtocolVersionList.java"/>
-                                    <property name="specs.dir" value="${specs.dir}"/>
+                                    <property name="xml.spec.list" value="${specs.dir}/amqp.0-8.xml ${specs.dir}/cluster.0-8.xml"/>
                                 </ant>
                             </tasks>
                             <sourceRoot>${generated.path}</sourceRoot>
diff --git a/java/common/protocol-version.xml b/java/common/protocol-version.xml
index 96ce348..d81a948 100644
--- a/java/common/protocol-version.xml
+++ b/java/common/protocol-version.xml
@@ -20,102 +20,13 @@
  -->
 <project name="Qpid Common Protocol Versions" default="generate">
 
-  <property name="saxon.jar" value="lib/saxon/saxon8.jar"/>
-  <!-- temporarily hard-wired XML spec version for build avoidance -->
-  <property name="amqp.xml" value="${specs.dir}/amqp-8.0.xml"/>
-  
-  <macrodef name="saxon">
-    <attribute name="out"/>
-    <attribute name="src"/>
-    <attribute name="xsl"/>
-    <element name="args" implicit="true" optional="true"/>
-    <sequential>
-      <java jar="${saxon.jar}" fork="true">
-        <arg value="-o"/>
-        <arg value="@{out}"/>
-        <arg value="@{src}"/>
-        <arg value="@{xsl}"/>
-        <args/>
-      </java>
-    </sequential>
-  </macrodef>
-
-  <macrodef name="amqp">
-    <attribute name="ver"/>
-    <sequential>
-      <!-- Check for the existence of the AMQP specification file -->
-      <property name="amqpspecfile-@{ver}" value="${specs.dir}/amqp-@{ver}.xml"/>
-      <available file="${specs.dir}/amqp-@{ver}.xml"
-              property="amqpspecfile.present-@{ver}"/>
-      <fail unless="amqpspecfile.present-@{ver}"
-              message="ERROR: AMQP specification file ${specs.dir}/amqp-@{ver}.xml not found."/>
-      
-      <!-- Read in the file as a set of properties; extract the amqp version -->
-      <xmlproperty prefix="@{ver}" file="${specs.dir}/amqp-@{ver}.xml"/>
-      <echo>Found AMQP specification file "${specs.dir}/amqp-@{ver}.xml"; major=${@{ver}.amqp(major)} minor=${@{ver}.amqp(minor)}</echo>
-
-      <!-- Add the version to the ProtocolVersionList.java file -->
-      <replaceregexp file="${proto_version}" match=" // !VER!"
-              replace=",${line.separator}        {${@{ver}.amqp(major)}, ${@{ver}.amqp(minor)}} // !VER!"
-              flags="s" byline="true"/>
-      <replaceregexp file="${proto_version}" match=" // !VER1!"
-              replace="{${@{ver}.amqp(major)}, ${@{ver}.amqp(minor)}} // !VER!"
-              flags="s" byline="true"/>
-
-      <!-- Create directory; generate from specification file -->
-      <saxon out="${generated.dir}/results.out"
-             src="${specs.dir}/amqp-@{ver}.xml" 
-             xsl="${spec.stylesheet}">
-        <arg value="major=${@{ver}.amqp(major)}"/>
-        <arg value="minor=${@{ver}.amqp(minor)}"/>
-        <arg value="registry_name=MainRegistry"/>
-      </saxon>
-      <!--  -->
-      <saxon out="${generated.dir}/cluster.out"
-             src="${cluster.asl}"
-             xsl="${spec.stylesheet}">
-        <arg value="major=${@{ver}.amqp(major)}"/>
-        <arg value="minor=${@{ver}.amqp(minor)}"/>
-        <arg value="registry_name=ClusterRegistry"/>
-      </saxon>
-      <saxon out="${generated.dir}/registry.out"
-             src="${registry.template}"
-             xsl="${registry.stylesheet}">
-        <arg value="major=${@{ver}.amqp(major)}"/>
-        <arg value="minor=${@{ver}.amqp(minor)}"/>
-      </saxon>
-    </sequential>
-  </macrodef>
-
-  <uptodate property="generated" targetfile="${generated.dir}/results.out"
-            srcfile="${amqp.xml}"/>
-
-  <target name="generate" unless="generated">
+  <target name="generate">
     <mkdir dir="${generated.dir}"/>
-    <copy file="src/main/versions/ProtocolVersionList.java.tmpl" tofile="${proto_version}"
-            overwrite="true"/>
-    <!--
-    NOTE: Set the AMQP version numbers to be supported in this build here.
-    The last version in this list will be the version returned when a protocol
-    ProtocolInitiation NAK frame is returned by the broker. Usually this is the
-    highest or most recent version.
-    -->
-    <!-- <amqp ver="0.8"/>
-    <amqp ver="0.9"/>
-    <amqp ver="0.10"/> -->
-    <amqp ver="8.0"/>
-    
-<!--     <saxon out="${generated.dir}/results.out" src="${amqp.xml}"
-           xsl="${stylesheet}">
-      <arg value="asl_base=${asl.base}"/>
-      <arg value="registry_name=MainRegistry"/>
-    </saxon>
-    <saxon out="${generated.dir}/cluster.out" src="${cluster.asl}"
-           xsl="${stylesheet}">
-      <arg value="registry_name=ClusterRegistry"/>
-    </saxon>
-    <saxon out="${generated.dir}/registry.out" src="${registry_template}"
-           xsl="${registry_stylesheet}"/> -->
+<!--    <exec dir="${gentools.home}/src" executable="pwd" />-->
+    <echo>XML files to be processed: ${xml.spec.list}</echo>
+    <java classname="org.apache.qpid.gentools.Main" fork="true" dir="${gentools.home}/src">
+    	<arg line="-j -o ${generated.dir} -t ${gentools.home}/templ.java ${xml.spec.list}"/>
+    </java>
   </target>
 
   <target name="precompile" depends="generate"/>
diff --git a/java/common/src/main/java/org/apache/qpid/AMQChannelException.java b/java/common/src/main/java/org/apache/qpid/AMQChannelException.java
index 4d604f8..2ead0a0 100644
--- a/java/common/src/main/java/org/apache/qpid/AMQChannelException.java
+++ b/java/common/src/main/java/org/apache/qpid/AMQChannelException.java
@@ -27,23 +27,30 @@
 {
     private final int _classId;
     private final int _methodId;
+    /* AMQP version for which exception ocurred */
+    private final byte major;
+    private final byte minor;
 
-    public AMQChannelException(int errorCode, String msg, int classId, int methodId, Throwable t)
+    public AMQChannelException(int errorCode, String msg, int classId, int methodId, byte major, byte minor, Throwable t)
     {
         super(errorCode, msg, t);
         _classId = classId;
         _methodId = methodId;
+        this.major = major;
+        this.minor = minor;
     }
 
-    public AMQChannelException(int errorCode, String msg, int classId, int methodId)
+    public AMQChannelException(int errorCode, String msg, int classId, int methodId, byte major, byte minor)
     {
         super(errorCode, msg);
         _classId = classId;
         _methodId = methodId;
+        this.major = major;
+        this.minor = minor;
     }
 
     public AMQFrame getCloseFrame(int channel)
     {
-        return ChannelCloseBody.createAMQFrame(channel, getErrorCode(), getMessage(), _classId, _methodId);
+        return ChannelCloseBody.createAMQFrame(channel, major, minor, _classId, _methodId, getErrorCode(), getMessage());
     }
 }
diff --git a/java/common/src/main/java/org/apache/qpid/framing/AMQBody.java b/java/common/src/main/java/org/apache/qpid/framing/AMQBody.java
index d829144..36287d2 100644
--- a/java/common/src/main/java/org/apache/qpid/framing/AMQBody.java
+++ b/java/common/src/main/java/org/apache/qpid/framing/AMQBody.java
@@ -34,5 +34,6 @@
     
     protected abstract void writePayload(ByteBuffer buffer);
     
-    protected abstract void populateFromBuffer(ByteBuffer buffer, long size) throws AMQFrameDecodingException;        
+    protected abstract void populateFromBuffer(ByteBuffer buffer, long size)
+        throws AMQFrameDecodingException, AMQProtocolVersionException;        
 }
diff --git a/java/common/src/main/java/org/apache/qpid/framing/AMQDataBlockDecoder.java b/java/common/src/main/java/org/apache/qpid/framing/AMQDataBlockDecoder.java
index 438bfa8..2a999fe 100644
--- a/java/common/src/main/java/org/apache/qpid/framing/AMQDataBlockDecoder.java
+++ b/java/common/src/main/java/org/apache/qpid/framing/AMQDataBlockDecoder.java
@@ -81,7 +81,7 @@
     }
 
     protected Object createAndPopulateFrame(ByteBuffer in)
-                    throws AMQFrameDecodingException
+                    throws AMQFrameDecodingException, AMQProtocolVersionException
     {
         final byte type = in.get();
         if (!isSupportedFrameType(type))
diff --git a/java/common/src/main/java/org/apache/qpid/framing/AMQFrame.java b/java/common/src/main/java/org/apache/qpid/framing/AMQFrame.java
index e75f37d..6af691f 100644
--- a/java/common/src/main/java/org/apache/qpid/framing/AMQFrame.java
+++ b/java/common/src/main/java/org/apache/qpid/framing/AMQFrame.java
@@ -62,7 +62,7 @@
      * @throws AMQFrameDecodingException
      */
     public void populateFromBuffer(ByteBuffer buffer, int channel, long bodySize, BodyFactory bodyFactory)
-            throws AMQFrameDecodingException
+        throws AMQFrameDecodingException, AMQProtocolVersionException
     {
         this.channel = channel;
         bodyFrame = bodyFactory.createBody(buffer);
diff --git a/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBody.java b/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBody.java
index 6659b4f..5ccc900 100644
--- a/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBody.java
+++ b/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBody.java
@@ -26,6 +26,20 @@
 public abstract class AMQMethodBody extends AMQBody
 {
     public static final byte TYPE = 1;    
+    
+    /**
+     * AMQP version
+     */
+    protected byte major;
+    protected byte minor;
+    public byte getMajor() { return major; }
+    public byte getMinor() { return minor; }
+    
+    public AMQMethodBody(byte major, byte minor)
+    {
+        this.major = major;
+        this.minor = minor;
+    }
 
     /** unsigned short */
     protected abstract int getBodySize();
@@ -80,11 +94,11 @@
      */
     public AMQChannelException getChannelException(int code, String message)
     {
-        return new AMQChannelException(code, message, getClazz(), getMethod());
+        return new AMQChannelException(code, message, getClazz(), getMethod(), major, minor);
     }
 
     public AMQChannelException getChannelException(int code, String message, Throwable cause)
     {
-        return new AMQChannelException(code, message, getClazz(), getMethod(), cause);
+        return new AMQChannelException(code, message, getClazz(), getMethod(), major, minor, cause);
     }
 }
diff --git a/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyFactory.java b/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyFactory.java
index 107af67..da0909d 100644
--- a/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyFactory.java
+++ b/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyFactory.java
@@ -41,6 +41,11 @@
 
     public AMQBody createBody(ByteBuffer in) throws AMQFrameDecodingException
     {
-        return MethodBodyDecoderRegistry.get(in.getUnsignedShort(), in.getUnsignedShort());        
+        // AMQP version change: MethodBodyDecoderRegistry is obsolete, since all the XML
+        // segments generated together are now handled by MainRegistry. The Cluster class,
+        // if generated together with amqp.xml is a part of MainRegistry.
+        // TODO: Connect with version acquired from ProtocolInitiation class.
+        return MainRegistry.get((short)in.getUnsignedShort(), (short)in.getUnsignedShort(),
+            (byte)8, (byte)0);        
     }
 }
diff --git a/java/common/src/main/java/org/apache/qpid/framing/AMQType.java b/java/common/src/main/java/org/apache/qpid/framing/AMQType.java
new file mode 100644
index 0000000..4bce1ca
--- /dev/null
+++ b/java/common/src/main/java/org/apache/qpid/framing/AMQType.java
@@ -0,0 +1,688 @@
+/*

+ *

+ * 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.framing;

+

+import org.apache.mina.common.ByteBuffer;

+

+public enum AMQType

+{

+

+

+    //AMQP FieldTable Wire Types

+

+    DECIMAL('D')

+    {

+

+        public int getEncodingSize(Object value)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+        public Object toNativeValue(Object value)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+    },

+

+    UNSIGNED_SHORT('S')

+    {

+

+        public int getEncodingSize(Object value)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+        public Object toNativeValue(Object value)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+    },

+

+    UNSIGNED_INT('I')

+    {

+

+        public int getEncodingSize(Object value)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+

+        public Object toNativeValue(Object value)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+    },

+

+    UNSIGNED_LONG('L')

+    {

+

+        public int getEncodingSize(Object value)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+

+        public Long toNativeValue(Object value)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+    },

+

+    EXTTENDED('D')

+    {

+

+        public int getEncodingSize(Object value)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+

+        public Object toNativeValue(Object value)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+    },

+

+    TIMESTAMP('T')

+    {

+

+        public int getEncodingSize(Object value)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+

+        public Object toNativeValue(Object value)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            // TODO : fixme

+            throw new UnsupportedOperationException();

+        }

+    },

+

+    BINARY('x')

+    {

+        public int getEncodingSize(Object value)

+        {

+            return 1 + (value == null ? 0 : ((byte[]) value).length);

+        }

+

+

+        public Object toNativeValue(Object value)

+        {

+            if((value instanceof byte[]) || (value == null))

+            {

+                return value;

+            }

+            else

+            {

+                throw new IllegalArgumentException("Value: " + value + " (" + value.getClass().getName() +

+                                                    ") cannot be converted to byte[]");

+            }

+        }

+

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            EncodingUtils.writeBytes(buffer, (byte[]) value);            

+        }

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            return EncodingUtils.readBytes(buffer);

+        }

+

+    },

+

+    ASCII_STRING('c')

+    {

+        public int getEncodingSize(Object value)

+        {

+            return EncodingUtils.encodedLongStringLength((String) value);

+        }

+

+

+        public String toNativeValue(Object value)

+        {

+            if (value != null)

+            {

+                return value.toString();

+            }

+            else

+            {

+                throw new NullPointerException("Cannot convert: null to String.");

+            }

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            EncodingUtils.writeLongStringBytes(buffer, (String) value);

+        }

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            return EncodingUtils.readLongString(buffer);

+        }

+

+    },

+

+    WIDE_STRING('C')

+    {

+        public int getEncodingSize(Object value)

+        {

+            // FIXME: use proper charset encoder

+            return EncodingUtils.encodedLongStringLength((String) value);

+        }

+

+

+        public String toNativeValue(Object value)

+        {

+            if (value != null)

+            {

+                return value.toString();

+            }

+            else

+            {

+                throw new NullPointerException("Cannot convert: null to String.");

+            }

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            EncodingUtils.writeLongStringBytes(buffer, (String) value);

+        }

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            return EncodingUtils.readLongString(buffer);

+        }

+    },

+

+    NULL_STRING('n')

+    {

+

+        public int getEncodingSize(Object value)

+        {

+            return 0;

+        }

+

+

+        public String toNativeValue(Object value)

+        {

+            if (value == null)

+            {

+                return null;

+            }

+            else

+            {

+                throw new NumberFormatException("Cannot convert: " + value + "(" +

+                                                value.getClass().getName() + ") to null String.");

+            }

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+        }

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            return null;

+        }

+    },

+

+    BOOLEAN('t')

+    {

+        public int getEncodingSize(Object value)

+        {

+            return EncodingUtils.encodedBooleanLength();

+        }

+

+

+        public Object toNativeValue(Object value)

+        {

+            if (value instanceof Boolean)

+            {

+                return (Boolean) value;

+            }

+            else if ((value instanceof String) || (value == null))

+            {

+                return Boolean.valueOf((String)value);

+            }

+            else

+            {

+                throw new NumberFormatException("Cannot convert: " + value + "(" +

+                                                value.getClass().getName() + ") to boolean.");

+            }

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            EncodingUtils.writeBoolean(buffer, (Boolean) value);

+        }

+

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            return EncodingUtils.readBoolean(buffer);

+        }

+    },

+

+    BYTE('b')

+    {

+        public int getEncodingSize(Object value)

+        {

+            return EncodingUtils.encodedByteLength();

+        }

+

+

+        public Byte toNativeValue(Object value)

+        {

+            if (value instanceof Byte)

+            {

+                return (Byte) value;

+            }

+            else if ((value instanceof String) || (value == null))

+            {

+                return Byte.valueOf((String)value);

+            }

+            else

+            {

+                throw new NumberFormatException("Cannot convert: " + value + "(" +

+                                                value.getClass().getName() + ") to byte.");

+            }

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            EncodingUtils.writeByte(buffer, (Byte) value);

+        }

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            return EncodingUtils.readByte(buffer);

+        }

+    },

+

+    ASCII_CHARACTER('k')

+    {

+        public int getEncodingSize(Object value)

+        {

+            return EncodingUtils.encodedCharLength();

+        }

+

+

+        public Character toNativeValue(Object value)

+        {

+            if (value instanceof Character)

+            {

+                return (Character) value;

+            }

+            else if (value == null)

+            {

+                throw new NullPointerException("Cannot convert null into char");

+            }

+            else

+            {

+                throw new NumberFormatException("Cannot convert: " + value + "(" +

+                                                value.getClass().getName() + ") to char.");

+            }

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            EncodingUtils.writeChar(buffer, (Character) value);

+        }

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            return EncodingUtils.readChar(buffer);

+        }

+

+    },

+

+    SHORT('s')

+    {

+

+        public int getEncodingSize(Object value)

+        {

+            return EncodingUtils.encodedShortLength();

+        }

+

+

+        public Short toNativeValue(Object value)

+        {

+            if (value instanceof Short)

+            {

+                return (Short) value;

+            }

+            else if (value instanceof Byte)

+            {

+                return ((Byte) value).shortValue();

+            }

+            else if ((value instanceof String) || (value == null))

+            {

+                return Short.valueOf((String)value);

+            }

+

+            else

+            {

+                throw new NumberFormatException("Cannot convert: " + value + "(" +

+                                                value.getClass().getName() + ") to short.");

+            }

+

+

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            EncodingUtils.writeShort(buffer, (Short) value);

+        }

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            return EncodingUtils.readShort(buffer);

+        }

+    },

+

+    INT('i')

+    {

+        public int getEncodingSize(Object value)

+        {

+            return EncodingUtils.encodedIntegerLength();

+        }

+

+        public Integer toNativeValue(Object value)

+        {

+            if (value instanceof Integer)

+            {

+                return (Integer) value;

+            }

+            else if (value instanceof Short)

+            {

+                return ((Short) value).intValue();

+            }

+            else if (value instanceof Byte)

+            {

+                return ((Byte) value).intValue();

+            }

+            else if ((value instanceof String) || (value == null))

+            {

+                return Integer.valueOf((String)value);

+            }

+            else

+            {

+                throw new NumberFormatException("Cannot convert: " + value + "(" +

+                                                value.getClass().getName() + ") to int.");

+            }

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            EncodingUtils.writeInteger(buffer, (Integer) value);

+        }

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            return EncodingUtils.readInteger(buffer);

+        }

+    },

+

+    LONG('l')

+    {

+

+        public int getEncodingSize(Object value)

+        {

+            return EncodingUtils.encodedLongLength();

+        }

+

+        public Object toNativeValue(Object value)

+        {

+            if(value instanceof Long)

+            {

+                return (Long) value;

+            }

+            else if (value instanceof Integer)

+            {

+                return ((Integer) value).longValue();

+            }

+            else if (value instanceof Short)

+            {

+                return ((Short) value).longValue();

+            }

+            else if (value instanceof Byte)

+            {

+                return ((Byte) value).longValue();

+            }

+            else if ((value instanceof String) || (value == null))

+            {

+                return Long.valueOf((String)value);

+            }

+            else

+            {

+                throw new NumberFormatException("Cannot convert: " + value + "(" +

+                                                value.getClass().getName() + ") to long.");

+            }

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            EncodingUtils.writeLong(buffer, (Long) value);

+        }

+

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            return EncodingUtils.readLong(buffer);

+        }

+    },

+

+    FLOAT('f')

+    {

+        public int getEncodingSize(Object value)

+        {

+            return EncodingUtils.encodedFloatLength();

+        }

+

+

+        public Float toNativeValue(Object value)

+        {

+            if (value instanceof Float)

+            {

+                return (Float) value;

+            }

+            else if ((value instanceof String) || (value == null))

+            {

+                return Float.valueOf((String)value);

+            }

+            else

+            {

+                throw new NumberFormatException("Cannot convert: " + value + "(" +

+                                                value.getClass().getName() + ") to float.");

+            }

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            EncodingUtils.writeFloat(buffer, (Float) value);

+        }

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            return EncodingUtils.readFloat(buffer);

+        }

+    },

+

+    DOUBLE('d')

+    {

+

+        public int getEncodingSize(Object value)

+        {

+            return EncodingUtils.encodedDoubleLength();

+        }

+

+

+        public Double toNativeValue(Object value)

+        {

+            if (value instanceof Double)

+            {

+                return (Double) value;

+            }

+            else if (value instanceof Float)

+            {

+                return ((Float) value).doubleValue();

+            }

+            else if ((value instanceof String) || (value == null))

+            {

+                return Double.valueOf((String)value);

+            }

+            else

+            {

+                throw new NumberFormatException("Cannot convert: " + value + "(" +

+                                                value.getClass().getName() + ") to double.");

+            }

+        }

+

+        public void writeValueImpl(Object value, ByteBuffer buffer)

+        {

+            EncodingUtils.writeDouble(buffer, (Double) value);

+        }

+

+        public Object readValueFromBuffer(ByteBuffer buffer)

+        {

+            return EncodingUtils.readDouble(buffer);

+        }

+    };

+

+    private final byte _identifier;

+

+    AMQType(char identifier)

+    {

+        _identifier = (byte) identifier;

+    }

+

+    public final byte identifier()

+    {

+        return _identifier;

+    }

+

+

+    public abstract int getEncodingSize(Object value);

+

+    public abstract Object toNativeValue(Object value);

+

+    public AMQTypedValue asTypedValue(Object value)

+    {

+        return new AMQTypedValue(this, toNativeValue(value));

+    }

+

+    public void writeToBuffer(Object value, ByteBuffer buffer)

+    {

+        buffer.put((byte)identifier());

+        writeValueImpl(value, buffer);

+    }

+

+    abstract void writeValueImpl(Object value, ByteBuffer buffer);

+

+    abstract Object readValueFromBuffer(ByteBuffer buffer);

+}

diff --git a/java/common/src/main/versions/ProtocolVersionList.java.tmpl b/java/common/src/main/java/org/apache/qpid/framing/AMQTypeMap.java
similarity index 66%
rename from java/common/src/main/versions/ProtocolVersionList.java.tmpl
rename to java/common/src/main/java/org/apache/qpid/framing/AMQTypeMap.java
index 301c428..e24fd7e 100644
--- a/java/common/src/main/versions/ProtocolVersionList.java.tmpl
+++ b/java/common/src/main/java/org/apache/qpid/framing/AMQTypeMap.java
@@ -1,4 +1,4 @@
-/**

+/*

  *

  * Licensed to the Apache Software Foundation (ASF) under one

  * or more contributor license agreements.  See the NOTICE file

@@ -7,9 +7,9 @@
  * 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

@@ -18,23 +18,26 @@
  * under the License.

  *

  */

-

-/**

- * This class is autogenerated, do not modify.

- */

-

 package org.apache.qpid.framing;

 

-/**

- * NOTE: Don't remove the line containing the token VER or VER1 - these are

- * markers for code generation.

- */

+import java.util.Map;

+import java.util.HashMap;

 

-public interface ProtocolVersionList

+public class AMQTypeMap

 {

-    public final int PROTOCOL_MAJOR = 0;

-    public final int PROTOCOL_MINOR = 1;

-    public final byte pv[][] = {

-         // !VER1!

-        };

+    public static Map<Byte, AMQType> _reverseTypeMap = new HashMap<Byte, AMQType>();

+

+    static

+    {

+        for(AMQType type : AMQType.values())

+        {

+            _reverseTypeMap.put(type.identifier(), type);

+        }

+    }

+

+    public static AMQType getType(Byte identifier)

+    {

+        return _reverseTypeMap.get(identifier);

+    }

+

 }

diff --git a/java/common/src/main/java/org/apache/qpid/framing/AMQTypedValue.java b/java/common/src/main/java/org/apache/qpid/framing/AMQTypedValue.java
new file mode 100644
index 0000000..b29c23c
--- /dev/null
+++ b/java/common/src/main/java/org/apache/qpid/framing/AMQTypedValue.java
@@ -0,0 +1,54 @@
+package org.apache.qpid.framing;

+

+import org.apache.mina.common.ByteBuffer;

+

+public class AMQTypedValue

+{

+    private final AMQType _type;

+    private final Object _value;

+

+

+    public AMQTypedValue(AMQType type, Object value)

+    {

+        if(type == null)

+        {

+            throw new NullPointerException("Cannot create a typed value with null type");

+        }

+        _type = type;

+        _value = type.toNativeValue(value);

+    }

+

+    private AMQTypedValue(AMQType type, ByteBuffer buffer)

+    {

+        _type = type;

+        _value = type.readValueFromBuffer( buffer );

+    }

+

+

+    public AMQType getType()

+    {

+        return _type;

+    }

+

+    public Object getValue()

+    {

+        return _value;

+    }

+

+

+    public void writeToBuffer(ByteBuffer buffer)

+    {

+        _type.writeToBuffer(_value,buffer);

+    }

+

+    public int getEncodingSize()

+    {

+        return _type.getEncodingSize(_value);

+    }

+

+    public static AMQTypedValue readFromBuffer(ByteBuffer buffer)

+    {

+        AMQType type = AMQTypeMap.getType(buffer.get());

+        return new AMQTypedValue(type, buffer);

+    }

+}

diff --git a/java/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java b/java/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java
index 61837f6..fc80d93 100644
--- a/java/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java
+++ b/java/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java
@@ -245,7 +245,7 @@
     }
 
     public void populatePropertiesFromBuffer(ByteBuffer buffer, int propertyFlags, int size)
-            throws AMQFrameDecodingException
+        throws AMQFrameDecodingException, AMQProtocolVersionException
     {
         _propertyFlags = propertyFlags;
 
diff --git a/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java b/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java
index a59869b..4ee36ee 100644
--- a/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java
+++ b/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java
@@ -58,7 +58,8 @@
         return TYPE;
     }
 
-    protected void populateFromBuffer(ByteBuffer buffer, long size) throws AMQFrameDecodingException
+    protected void populateFromBuffer(ByteBuffer buffer, long size)
+        throws AMQFrameDecodingException, AMQProtocolVersionException
     {
         classId = buffer.getUnsignedShort();
         weight = buffer.getUnsignedShort();
@@ -75,7 +76,8 @@
      * @return
      * @throws AMQFrameDecodingException
      */
-    public static ContentHeaderBody createFromBuffer(ByteBuffer buffer, long size) throws AMQFrameDecodingException
+    public static ContentHeaderBody createFromBuffer(ByteBuffer buffer, long size)
+        throws AMQFrameDecodingException, AMQProtocolVersionException
     {
         ContentHeaderBody body = new ContentHeaderBody();
         body.populateFromBuffer(buffer, size);
diff --git a/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderProperties.java b/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderProperties.java
index 561d785..88bdefc 100644
--- a/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderProperties.java
+++ b/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderProperties.java
@@ -41,7 +41,7 @@
      * @throws AMQFrameDecodingException when the buffer does not contain valid data
      */
     void populatePropertiesFromBuffer(ByteBuffer buffer, int propertyFlags, int size)
-        throws AMQFrameDecodingException;
+        throws AMQFrameDecodingException, AMQProtocolVersionException;
 
     /**
      * @return the size of the encoded property list in bytes.
diff --git a/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderPropertiesFactory.java b/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderPropertiesFactory.java
index cec413c..cfcc5db 100644
--- a/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderPropertiesFactory.java
+++ b/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderPropertiesFactory.java
@@ -37,16 +37,19 @@
 
     public ContentHeaderProperties createContentHeaderProperties(int classId, int propertyFlags,
                                                                  ByteBuffer buffer, int size)
-             throws AMQFrameDecodingException
+             throws AMQFrameDecodingException, AMQProtocolVersionException
     {
         ContentHeaderProperties properties;
-        switch (classId)
+        // AMQP version change: "Hardwired" version to major=8, minor=0
+        // TODO: Change so that the actual version is obtained from
+        // the ProtocolInitiation object for this session.
+        if (classId == BasicConsumeBody.getClazz((byte)8, (byte)0))
         {
-            case BasicConsumeBody.CLASS_ID:
-                properties = new BasicContentHeaderProperties();
-                break;
-            default:
-                throw new AMQFrameDecodingException("Unsupport content header class id: " + classId);
+        	properties = new BasicContentHeaderProperties();
+        }
+        else
+        {
+        	throw new AMQFrameDecodingException("Unsupport content header class id: " + classId);
         }
         properties.populatePropertiesFromBuffer(buffer, propertyFlags, size);
         return properties;
diff --git a/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java b/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java
index 46dff9f..ebda2c5 100644
--- a/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java
+++ b/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java
@@ -88,12 +88,12 @@
     {
         if (table == null)
         {
-            // size is encoded as 4 octets
+            // length is encoded as 4 octets
             return 4;
         }
         else
         {
-            // size of the table plus 4 octets for the size
+            // length of the table plus 4 octets for the length
             return (int) table.getEncodedSize() + 4;
         }
     }
@@ -104,6 +104,7 @@
         return 0;
     }
 
+ 
     public static void writeShortStringBytes(ByteBuffer buffer, String s)
     {
         if (s != null)
@@ -448,7 +449,7 @@
         byte[] from = new byte[size];
 
         // Is this not the same.
-        //bb.get(from, 0, size);
+        //bb.get(from, 0, length);
         for (int i = 0; i < size; i++)
         {
             from[i] = bb.get(i);
diff --git a/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java b/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java
index 193c7ad..4d88009 100644
--- a/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java
+++ b/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java
@@ -1,98 +1,612 @@
 /*
- *  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
+ * 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
  *
- *  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.    
+ *   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.framing;
 
+import org.apache.log4j.Logger;
 import org.apache.mina.common.ByteBuffer;
+import org.apache.qpid.AMQPInvalidClassException;
 
-import java.util.Map;
-import java.util.Enumeration;
+import java.util.*;
 
-public interface FieldTable extends Map
+//extends FieldTable
+public class FieldTable
 {
-    void writeToBuffer(ByteBuffer buffer);
+    private static final Logger _logger = Logger.getLogger(FieldTable.class);
 
-    void setFromBuffer(ByteBuffer buffer, long length) throws AMQFrameDecodingException;    
+    private LinkedHashMap<String, AMQTypedValue> _properties;
 
-    byte[] getDataAsBytes();
+    public FieldTable()
+    {
+        super();
+        _properties = new LinkedHashMap<String, AMQTypedValue>();
 
-    public long getEncodedSize();
-
-    Object put(Object key, Object value);
-
-    Object remove(Object key);
+    }
 
 
-    public Enumeration getPropertyNames();
 
-    public boolean propertyExists(String propertyName);
+    /**
+     * Construct a new field table.
+     *
+     * @param buffer the buffer from which to read data. The length byte must be read already
+     * @param length the length of the field table. Must be > 0.
+     * @throws AMQFrameDecodingException if there is an error decoding the table
+     */
+    public FieldTable(ByteBuffer buffer, long length) throws AMQFrameDecodingException
+    {
+        this();
+        setFromBuffer(buffer, length);
+    }
 
-    //Getters
 
-    public Boolean getBoolean(String string);
 
-    public Byte getByte(String string);
+    public Boolean getBoolean(String string)
+    {
+        AMQTypedValue value = _properties.get(string);
+        if (value != null && (value.getType() == AMQType.BOOLEAN))
+        {
+            return (Boolean) value.getValue();
+        }
+        else
+        {
+            return null;
+        }
+    }
 
-    public Short getShort(String string);
+    public Byte getByte(String string)
+    {
+        AMQTypedValue value = _properties.get(string);
+        if (value != null && (value.getType() == AMQType.BYTE))
+        {
+            return (Byte) value.getValue();
+        }
+        else
+        {
+            return null;
+        }
+    }
 
-    public Integer getInteger(String string);
+    public Short getShort(String string)
+    {
+        AMQTypedValue value = _properties.get(string);
+        if (value != null && (value.getType() == AMQType.SHORT))
+        {
+            return (Short) value.getValue();
+        }
+        else
+        {
+            return null;
+        }
+    }
 
-    public Long getLong(String string);
+    public Integer getInteger(String string)
+    {
+        AMQTypedValue value = _properties.get(string);
+        if (value != null && (value.getType() == AMQType.INT))
+        {
+            return (Integer) value.getValue();
+        }
+        else
+        {
+            return null;
+        }
+    }
 
-    public Float getFloat(String string);
+    public Long getLong(String string)
+    {
+        AMQTypedValue value = _properties.get(string);
+        if (value != null && (value.getType() == AMQType.LONG))
+        {
+            return (Long) value.getValue();
+        }
+        else
+        {
+            return null;
+        }
+    }
 
-    public Double getDouble(String string);
+    public Float getFloat(String string)
+    {
+        AMQTypedValue value = _properties.get(string);
+        if (value != null && (value.getType() == AMQType.FLOAT))
+        {
+            return (Float) value.getValue();
+        }
+        else
+        {
+            return null;
+        }
+    }
 
-    public String getString(String string);
+    public Double getDouble(String string)
+    {
+        AMQTypedValue value = _properties.get(string);
+        if (value != null && (value.getType() == AMQType.DOUBLE))
+        {
+            return (Double) value.getValue();
+        }
+        else
+        {
+            return null;
+        }
+    }
 
-    public Character getCharacter(String string);
+    public String getString(String string)
+    {
+        AMQTypedValue value = _properties.get(string);
+        if ((value != null) && ((value.getType() == AMQType.WIDE_STRING) ||
+                                (value.getType() == AMQType.ASCII_STRING)))
+        {
+            return (String) value.getValue();
+        }
 
-    public byte[] getBytes(String string);
+        else if ((value != null) && (value.getValue() != null) && !(value.getValue() instanceof byte[]))
+        {
+            return String.valueOf(value.getValue());
+        }
+        else
+        {
+            return null;
+        }
 
-    public Object getObject(String string);
+    }
 
-    // Setters
-    public Object setBoolean(String string, boolean b);
+    public Character getCharacter(String string)
+    {
+        AMQTypedValue value = _properties.get(string);
+        if (value != null && (value.getType() == AMQType.ASCII_CHARACTER))
+        {
+            return (Character) value.getValue();
+        }
+        else
+        {
+            return null;
+        }
+    }
 
-    public Object setByte(String string, byte b);
+    public byte[] getBytes(String string)
+    {
+        AMQTypedValue value = _properties.get(string);
+        if (value != null && (value.getType() == AMQType.BINARY))
+        {
+            return (byte[]) value.getValue();
+        }
+        else
+        {
+            return null;
+        }
+    }
 
-    public Object setShort(String string, short i);
+    public Object getObject(String string)
+    {
+        AMQTypedValue value = _properties.get(string);
+        if(value != null)
+        {
+            return value.getValue();
+        }
+        else
+        {
+            return value;
+        }
 
-    public Object setInteger(String string, int i);
+    }
 
-    public Object setLong(String string, long l);
+    // ************  Setters
 
-    public Object setFloat(String string, float v);
+    public Object setBoolean(String string, boolean b)
+    {
+        checkPropertyName(string);
+        return _properties.put(string, AMQType.BOOLEAN.asTypedValue(b));
+    }
 
-    public Object setDouble(String string, double v);
+    public Object setByte(String string, byte b)
+    {
+        checkPropertyName(string);
+        return _properties.put(string, AMQType.BYTE.asTypedValue(b));
+    }
 
-    public Object setString(String string, String string1);
+    public Object setShort(String string, short i)
+    {
+        checkPropertyName(string);
+        return _properties.put(string, AMQType.SHORT.asTypedValue(i));
+    }
 
-    public Object setChar(String string, char c);
+    public Object setInteger(String string, int i)
+    {
+        checkPropertyName(string);
+        return _properties.put(string, AMQType.INT.asTypedValue(i));
+    }
 
-    public Object setBytes(String string, byte[] bytes);
+    public Object setLong(String string, long l)
+    {
+        checkPropertyName(string);
+        return _properties.put(string, AMQType.LONG.asTypedValue(l));
+    }
 
-    public Object setBytes(String string, byte[] bytes, int start, int length);
+    public Object setFloat(String string, float v)
+    {
+        checkPropertyName(string);
+        return _properties.put(string, AMQType.FLOAT.asTypedValue(v));
+    }
 
-    public Object setObject(String string, Object object);
+    public Object setDouble(String string, double v)
+    {
+        checkPropertyName(string);
+        return _properties.put(string, AMQType.DOUBLE.asTypedValue(v));
+    }
 
-    public boolean isNullStringValue(String name);
+    public Object setString(String string, String value)
+    {
+        checkPropertyName(string);
+        if (value == null)
+        {
+            return _properties.put(string, AMQType.NULL_STRING.asTypedValue(null));
+        }
+        else
+        {
+            //FIXME: determine string encoding and set either WIDE or ASCII string
+//            if ()
+            {
+                return _properties.put(string, AMQType.WIDE_STRING.asTypedValue(value));
+            }
+//            else
+//            {
+//                return _properties.put(string, AMQType.ASCII_STRING.asTypedValue(value));
+//            }
+        }
+    }
+
+    public Object setChar(String string, char c)
+    {
+        checkPropertyName(string);
+        return _properties.put(string, AMQType.ASCII_CHARACTER.asTypedValue(c));
+    }
+
+    public Object setBytes(String string, byte[] bytes)
+    {
+        checkPropertyName(string);
+        return _properties.put(string, AMQType.BINARY.asTypedValue(bytes));
+    }
+
+    public Object setBytes(String string, byte[] bytes, int start, int length)
+    {
+        checkPropertyName(string);
+        byte[] newBytes = new byte[length];
+        System.arraycopy(bytes,start,newBytes,0,length);
+        return setBytes(string, bytes);
+    }
+
+
+    public Object setObject(String string, Object object)
+    {
+        if (object instanceof Boolean)
+        {
+            return setBoolean(string, (Boolean) object);
+        }
+        else if (object instanceof Byte)
+        {
+            return setByte(string, (Byte) object);
+        }
+        else if (object instanceof Short)
+        {
+            return setShort(string, (Short) object);
+        }
+        else if (object instanceof Integer)
+        {
+            return setInteger(string, (Integer) object);
+        }
+        else if (object instanceof Long)
+        {
+            return setLong(string, (Long) object);
+        }
+        else if (object instanceof Float)
+        {
+            return setFloat(string, (Float) object);
+        }
+        else if (object instanceof Double)
+        {
+            return setDouble(string, (Double) object);
+        }
+        else if (object instanceof String)
+        {
+            return setString(string, (String) object);
+        }
+        else if (object instanceof Character)
+        {
+            return setChar(string, (Character) object);
+        }
+        else if (object instanceof byte[])
+        {
+            return setBytes(string, (byte[]) object);
+        }
+
+        throw new AMQPInvalidClassException("Only Primatives objects allowed Object is:" + object.getClass());
+    }
+
+
+    public boolean isNullStringValue(String name)
+    {
+        AMQTypedValue value = _properties.get(name);
+        return (value != null) && (value.getType() == AMQType.NULL_STRING);
+    }
+
+    // ***** Methods
+
+    public Enumeration getPropertyNames()
+    {
+        return Collections.enumeration(_properties.keySet());
+    }
+
+    public boolean propertyExists(String propertyName)
+    {
+        return itemExists(propertyName);
+    }
+
+    public boolean itemExists(String string)
+    {
+        return _properties.containsKey(string);
+    }
+
+    public String toString()
+    {
+        return _properties.toString();
+    }
+
+
+
+    private void checkPropertyName(String propertyName)
+    {
+        if (propertyName == null)
+        {
+            throw new IllegalArgumentException("Property name must not be null");
+        }
+        else if ("".equals(propertyName))
+        {
+            throw new IllegalArgumentException("Property name must not be the empty string");
+        }
+
+        checkIdentiferFormat(propertyName);
+    }
+
+
+    protected static void checkIdentiferFormat(String propertyName)
+    {
+//        AMQP Spec: 4.2.5.5 Field Tables
+//        Guidelines for implementers:
+//           * Field names MUST start with a letter, '$' or '#' and may continue with
+//             letters, '$' or '#', digits, or underlines, to a maximum length of 128
+//             characters.
+//           * The server SHOULD validate field names and upon receiving an invalid
+//             field name, it SHOULD signal a connection exception with reply code
+//             503 (syntax error). Conformance test: amq_wlp_table_01.
+//           * A peer MUST handle duplicate fields by using only the first instance.
+
+
+        // AMQP length limit
+        if (propertyName.length() > 128)
+        {
+            throw new IllegalArgumentException("AMQP limits property names to 128 characters");
+        }
+
+        // AMQ start character
+        if (!(Character.isLetter(propertyName.charAt(0))
+              || propertyName.charAt(0) == '$'
+              || propertyName.charAt(0) == '#'
+              || propertyName.charAt(0) == '_')) // Not official AMQP added for JMS.
+        {
+            throw new IllegalArgumentException("Identifier '" + propertyName + "' does not start with a valid AMQP start character");
+        }
+    }
+
+ 
+    // *************************  Byte Buffer Processing
+
+    public void writeToBuffer(ByteBuffer buffer)
+    {
+        final boolean trace = _logger.isTraceEnabled();
+
+        if (trace)
+        {
+            _logger.trace("FieldTable::writeToBuffer: Writing encoded length of " + getEncodedSize() + "...");
+        }
+
+        EncodingUtils.writeUnsignedInteger(buffer, getEncodedSize());
+
+        putDataInBuffer(buffer);
+    }
+
+    public byte[] getDataAsBytes()
+    {
+        final int encodedSize = (int) getEncodedSize();
+        final ByteBuffer buffer = ByteBuffer.allocate(encodedSize); // FIXME XXX: Is cast a problem?
+
+        putDataInBuffer(buffer);
+
+        final byte[] result = new byte[encodedSize];
+        buffer.flip();
+        buffer.get(result);
+        buffer.release();
+        return result;
+    }
+
+    public long getEncodedSize()
+    {
+        int encodedSize = 0;
+        for(Map.Entry<String,AMQTypedValue> e : _properties.entrySet())
+        {
+            encodedSize += EncodingUtils.encodedShortStringLength(e.getKey());
+            encodedSize++; // the byte for the encoding Type
+            encodedSize += e.getValue().getEncodingSize();
+
+        }
+        return encodedSize;
+    }
+
+    public void addAll(FieldTable fieldTable)
+    {
+        _properties.putAll(fieldTable._properties);
+    }
+
+
+    public static interface FieldTableElementProcessor
+    {
+        public boolean processElement(String propertyName, AMQTypedValue value);
+        public Object getResult();
+    }
+
+    public Object processOverElements(FieldTableElementProcessor processor)
+    {
+        for(Map.Entry<String,AMQTypedValue> e : _properties.entrySet())
+        {
+            boolean result = processor.processElement(e.getKey(), e.getValue());
+            if(!result)
+            {
+                break;
+            }
+        }
+        return processor.getResult();
+    }
+
+
+    public int size()
+    {
+        return _properties.size();
+    }
+
+    public boolean isEmpty()
+    {
+        return _properties.isEmpty();
+    }
+
+    public boolean containsKey(String key)
+    {
+        return _properties.containsKey(key);
+    }
+
+    public Set<String> keys()
+    {
+        return _properties.keySet();
+    }
+
+
+    public Object get(Object key)
+    {
+
+        return getObject((String)key);
+    }
+
+
+    public Object put(Object key, Object value)
+    {
+        return setObject(key.toString(), value);
+    }
+
+    
+    public Object remove(String key)
+    {
+        AMQTypedValue value = _properties.remove(key);
+        return value == null ? null : value.getValue();
+    }
+
+
+
+    public void clear()
+    {
+        _properties.clear();
+    }
+
+    public Set keySet()
+    {
+        return _properties.keySet();
+    }
+
+    private void putDataInBuffer(ByteBuffer buffer)
+    {
+
+        final Iterator<Map.Entry<String,AMQTypedValue>> it = _properties.entrySet().iterator();
+
+        //If there are values then write out the encoded Size... could check _encodedSize != 0
+        // write out the total length, which we have kept up to date as data is added
+
+
+        while (it.hasNext())
+        {
+            final Map.Entry<String,AMQTypedValue> me = it.next();
+            try
+            {
+                if (_logger.isTraceEnabled())
+                {
+                    _logger.trace("Writing Property:" + me.getKey() +
+                                  " Type:" + me.getValue().getType() +
+                                  " Value:" + me.getValue().getValue());
+                    _logger.trace("Buffer Position:" + buffer.position() +
+                                  " Remaining:" + buffer.remaining());
+                }
+
+
+
+                //Write the actual parameter name
+                EncodingUtils.writeShortStringBytes(buffer, me.getKey());
+                me.getValue().writeToBuffer(buffer);
+            }
+            catch (Exception e)
+            {
+                if (_logger.isTraceEnabled())
+                {
+                    _logger.trace("Exception thrown:" + e);
+                    _logger.trace("Writing Property:" + me.getKey() +
+                                  " Type:" + me.getValue().getType() +
+                                  " Value:" + me.getValue().getValue());
+                    _logger.trace("Buffer Position:" + buffer.position() +
+                                  " Remaining:" + buffer.remaining());
+                }
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+
+    public void setFromBuffer(ByteBuffer buffer, long length) throws AMQFrameDecodingException
+    {
+        final boolean trace = _logger.isTraceEnabled();
+
+        int sizeRead = 0;
+        while (sizeRead < length)
+        {
+            int sizeRemaining = buffer.remaining();
+            final String key = EncodingUtils.readShortString(buffer);
+            AMQTypedValue value = AMQTypedValue.readFromBuffer(buffer);
+            sizeRead += (sizeRemaining - buffer.remaining());
+
+            if (trace)
+            {
+                _logger.trace("FieldTable::PropFieldTable(buffer," + length + "): Read type '" + value.getType() + "', key '" + key + "', value '" + value.getValue() + "' (now read " + sizeRead + " of " + length + " encoded bytes)...");
+            }
+
+            _properties.put(key,value);
+        }
+
+        if (trace)
+        {
+            _logger.trace("FieldTable::FieldTable(buffer," + length + "): Done.");
+        }
+    }
 
 }
diff --git a/java/common/src/main/java/org/apache/qpid/framing/FieldTableFactory.java b/java/common/src/main/java/org/apache/qpid/framing/FieldTableFactory.java
index b1fcd8a..e9d7513 100644
--- a/java/common/src/main/java/org/apache/qpid/framing/FieldTableFactory.java
+++ b/java/common/src/main/java/org/apache/qpid/framing/FieldTableFactory.java
@@ -26,16 +26,13 @@
 {
     public static FieldTable newFieldTable()
     {
-        return new PropertyFieldTable();
+        return new FieldTable();
     }
 
     public static FieldTable newFieldTable(ByteBuffer byteBuffer, long length) throws AMQFrameDecodingException
     {
-        return new PropertyFieldTable(byteBuffer, length);
+        return new FieldTable(byteBuffer, length);
     }
 
-    public static FieldTable newFieldTable(String text)
-    {
-        return new PropertyFieldTable(text);
-    }
+
 }
diff --git a/java/common/src/main/java/org/apache/qpid/framing/JMSPropertyFieldTable.java b/java/common/src/main/java/org/apache/qpid/framing/JMSPropertyFieldTable.java
index 142a689..d78034c 100644
--- a/java/common/src/main/java/org/apache/qpid/framing/JMSPropertyFieldTable.java
+++ b/java/common/src/main/java/org/apache/qpid/framing/JMSPropertyFieldTable.java
@@ -32,29 +32,11 @@
 {
     private FieldTable _fieldtable;
 
-    public JMSPropertyFieldTable()
-    {
-        _fieldtable = new PropertyFieldTable();
-    }
-
     public JMSPropertyFieldTable(FieldTable table)
     {
         _fieldtable = table;
     }
 
-    public JMSPropertyFieldTable(ByteBuffer buffer, long length) throws JMSException
-    {
-        try
-        {
-            _fieldtable = new PropertyFieldTable(buffer, length);
-        }
-        catch (AMQFrameDecodingException e)
-        {
-            JMSException error = new JMSException(e.getMessage());
-            error.setLinkedException(e);
-            throw error;
-        }
-    }
 
     private void checkPropertyName(String propertyName)
     {
diff --git a/java/common/src/main/java/org/apache/qpid/framing/PropertyFieldTable.java b/java/common/src/main/java/org/apache/qpid/framing/PropertyFieldTable.java
deleted file mode 100644
index 4b8f56e..0000000
--- a/java/common/src/main/java/org/apache/qpid/framing/PropertyFieldTable.java
+++ /dev/null
@@ -1,1281 +0,0 @@
-/*
- *
- * 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.framing;
-
-import org.apache.log4j.Logger;
-import org.apache.mina.common.ByteBuffer;
-import org.apache.qpid.AMQPInvalidClassException;
-
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.Vector;
-import java.util.HashMap;
-
-//extends FieldTable
-public class PropertyFieldTable implements FieldTable
-{
-    private static final Logger _logger = Logger.getLogger(PropertyFieldTable.class);
-
-    private static final String BOOLEAN = "boolean";
-    private static final String BYTE = "byte";
-    private static final String BYTES = "bytes";
-    private static final String SHORT = "short";
-    private static final String INT = "int";
-    private static final String LONG = "long";
-    private static final String FLOAT = "float";
-    private static final String DOUBLE = "double";
-    private static final String STRING = "string";
-    private static final String NULL_STRING = "nullstring";
-    private static final String CHAR = "char";
-    private static final String UNKNOWN = "unknown type";
-
-    private static final String PROPERTY_FIELD_TABLE_CLOSE_XML = "</PropertyFieldTable>";
-    private static final String PROPERTY_FIELD_TABLE_OPEN_XML = "<PropertyFieldTable>";
-    private static final String BYTES_CLOSE_XML = "</" + BYTES + ">";
-    private static final String BYTES_OPEN_XML_START = "<" + BYTES;
-
-    public static enum Prefix
-    {
-        //AMQP FieldTable Wire Types
-        AMQP_DECIMAL_PROPERTY_PREFIX('D'),
-        AMQP_UNSIGNED_SHORT_PROPERTY_PREFIX('S'),
-        AMQP_UNSIGNED_INT_PROPERTY_PREFIX('I'),
-        AMQP_UNSIGNED_LONG_PROPERTY_PREFIX('L'),
-        AMQP_DOUBLE_EXTTENDED_PROPERTY_PREFIX('D'),
-
-        AMQP_TIMESTAMP_PROPERTY_PREFIX('T'),
-        AMQP_BINARY_PROPERTY_PREFIX('x'),
-
-        //Strings
-        AMQP_ASCII_STRING_PROPERTY_PREFIX('c'),
-        AMQP_WIDE_STRING_PROPERTY_PREFIX('C'),
-        AMQP_NULL_STRING_PROPERTY_PREFIX('n'),
-
-        //Java Primative Types
-        AMQP_BOOLEAN_PROPERTY_PREFIX('t'),
-        AMQP_BYTE_PROPERTY_PREFIX('b'),
-        AMQP_ASCII_CHARACTER_PROPERTY_PREFIX('k'),
-        AMQP_SHORT_PROPERTY_PREFIX('s'),
-        AMQP_INT_PROPERTY_PREFIX('i'),
-        AMQP_LONG_PROPERTY_PREFIX('l'),
-        AMQP_FLOAT_PROPERTY_PREFIX('f'),
-        AMQP_DOUBLE_PROPERTY_PREFIX('d');
-
-        private final char _identifier;
-
-        Prefix(char identifier)
-        {
-            _identifier = identifier;
-            //_reverseTypeMap.put(identifier, this);
-        }
-
-        public final char identifier()
-        {
-            return _identifier;
-        }
-
-    }
-
-    public static Map<Character, Prefix> _reverseTypeMap = new HashMap<Character, Prefix>();
-
-    static
-    {
-        for (Prefix p : Prefix.values())
-        {
-            _reverseTypeMap.put(p.identifier(), p);
-        }
-    }
-
-    private LinkedHashMap<String, Object> _properties;
-    private LinkedHashMap<String, Prefix> _propertyNamesTypeMap;
-    private long _encodedSize = 0;
-
-    public PropertyFieldTable()
-    {
-        super();
-        _properties = new LinkedHashMap<String, Object>();
-        _propertyNamesTypeMap = new LinkedHashMap<String, Prefix>();
-    }
-
-    public PropertyFieldTable(String textFormat)
-    {
-        this();
-        try
-        {
-            parsePropertyFieldTable(textFormat);
-        }
-        catch (Exception e)
-        {
-            _logger.warn("Unable to decode PropertyFieldTable format:" + textFormat);
-            throw new IllegalArgumentException("Unable to decode PropertyFieldTable format:" + textFormat);
-        }
-    }
-
-    /**
-     * Construct a new field table.
-     *
-     * @param buffer the buffer from which to read data. The length byte must be read already
-     * @param length the length of the field table. Must be > 0.
-     * @throws AMQFrameDecodingException if there is an error decoding the table
-     */
-    public PropertyFieldTable(ByteBuffer buffer, long length) throws AMQFrameDecodingException
-    {
-        this();
-        setFromBuffer(buffer, length);
-    }
-
-    // ************  Getters
-    private Object get(String propertyName, Prefix prefix)
-    {
-        //Retrieve the type associated with this name
-        Prefix type = _propertyNamesTypeMap.get(propertyName);
-
-        if (type == null)
-        {
-            return null;
-        }
-
-        if (type.equals(prefix))
-        {
-            return _properties.get(propertyName);
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    public Boolean getBoolean(String string)
-    {
-        Object o = get(string, Prefix.AMQP_BOOLEAN_PROPERTY_PREFIX);
-        if (o != null && o instanceof Boolean)
-        {
-            return (Boolean) o;
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    public Byte getByte(String string)
-    {
-        Object o = get(string, Prefix.AMQP_BYTE_PROPERTY_PREFIX);
-        if (o != null)
-        {
-            return (Byte) o;
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    public Short getShort(String string)
-    {
-        Object o = get(string, Prefix.AMQP_SHORT_PROPERTY_PREFIX);
-        if (o != null)
-        {
-            return (Short) o;
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    public Integer getInteger(String string)
-    {
-        Object o = get(string, Prefix.AMQP_INT_PROPERTY_PREFIX);
-        if (o != null)
-        {
-            return (Integer) o;
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    public Long getLong(String string)
-    {
-        Object o = get(string, Prefix.AMQP_LONG_PROPERTY_PREFIX);
-        if (o != null)
-        {
-            return (Long) o;
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    public Float getFloat(String string)
-    {
-        Object o = get(string, Prefix.AMQP_FLOAT_PROPERTY_PREFIX);
-        if (o != null)
-        {
-            return (Float) o;
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    public Double getDouble(String string)
-    {
-        Object o = get(string, Prefix.AMQP_DOUBLE_PROPERTY_PREFIX);
-        if (o != null)
-        {
-            return (Double) o;
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    public String getString(String string)
-    {
-        Object o = get(string, Prefix.AMQP_ASCII_STRING_PROPERTY_PREFIX);
-        if (o != null)
-        {
-            return (String) o;
-        }
-        else
-        {
-            o = get(string, Prefix.AMQP_WIDE_STRING_PROPERTY_PREFIX);
-            if (o != null)
-            {
-                return (String) o;
-            }
-            else
-            {
-
-                Prefix type = _propertyNamesTypeMap.get(string);
-
-                if (type == null || type.equals(Prefix.AMQP_NULL_STRING_PROPERTY_PREFIX))
-                {
-                    return null;
-                }
-                else
-                {
-                    switch (type)
-                    {
-                        case AMQP_ASCII_STRING_PROPERTY_PREFIX:
-                        case AMQP_WIDE_STRING_PROPERTY_PREFIX:
-                        case AMQP_BINARY_PROPERTY_PREFIX:
-                            return null;
-                        default:
-                        case AMQP_BYTE_PROPERTY_PREFIX:
-                        case AMQP_BOOLEAN_PROPERTY_PREFIX:
-                        case AMQP_SHORT_PROPERTY_PREFIX:
-                        case AMQP_INT_PROPERTY_PREFIX:
-                        case AMQP_LONG_PROPERTY_PREFIX:
-                        case AMQP_FLOAT_PROPERTY_PREFIX:
-                        case AMQP_DOUBLE_PROPERTY_PREFIX:
-                            return String.valueOf(_properties.get(string));
-                        case AMQP_ASCII_CHARACTER_PROPERTY_PREFIX:
-                            Object value = _properties.get(string);
-                            if (value == null)
-                            {
-                                throw new NullPointerException("null char cannot be converted to String");
-                            }
-                            else
-                            {
-                                return String.valueOf(value);
-                            }
-                    }
-                }
-            }
-        }
-    }
-
-    public Character getCharacter(String string)
-    {
-        Object o = get(string, Prefix.AMQP_ASCII_CHARACTER_PROPERTY_PREFIX);
-        if (o != null)
-        {
-            return (Character) o;
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    public byte[] getBytes(String string)
-    {
-        Object o = get(string, Prefix.AMQP_BINARY_PROPERTY_PREFIX);
-        if (o != null)
-        {
-            return (byte[]) o;
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    public Object getObject(String string)
-    {
-        return _properties.get(string);
-    }
-
-    // ************  Setters
-
-    public Object setBoolean(String string, boolean b)
-    {
-        return put(Prefix.AMQP_BOOLEAN_PROPERTY_PREFIX, string, b);
-    }
-
-    public Object setByte(String string, byte b)
-    {
-        return put(Prefix.AMQP_BYTE_PROPERTY_PREFIX, string, b);
-    }
-
-    public Object setShort(String string, short i)
-    {
-        return put(Prefix.AMQP_SHORT_PROPERTY_PREFIX, string, i);
-    }
-
-    public Object setInteger(String string, int i)
-    {
-        return put(Prefix.AMQP_INT_PROPERTY_PREFIX, string, i);
-    }
-
-    public Object setLong(String string, long l)
-    {
-        return put(Prefix.AMQP_LONG_PROPERTY_PREFIX, string, l);
-    }
-
-    public Object setFloat(String string, float v)
-    {
-        return put(Prefix.AMQP_FLOAT_PROPERTY_PREFIX, string, v);
-    }
-
-    public Object setDouble(String string, double v)
-    {
-        return put(Prefix.AMQP_DOUBLE_PROPERTY_PREFIX, string, v);
-    }
-
-    public Object setString(String string, String string1)
-    {
-        if (string1 == null)
-        {
-            return put(Prefix.AMQP_NULL_STRING_PROPERTY_PREFIX, string, null);
-        }
-        else
-        {
-            //FIXME: determine string encoding and set either WIDE or ASCII string
-//            if ()
-            {
-                return put(Prefix.AMQP_WIDE_STRING_PROPERTY_PREFIX, string, string1);
-            }
-//            else
-//            {
-//                return put(Prefix.AMQP_ASCII_STRING_PROPERTY_PREFIX, string, string1);
-//            }
-        }
-    }
-
-    public Object setChar(String string, char c)
-    {
-        return put(Prefix.AMQP_ASCII_CHARACTER_PROPERTY_PREFIX, string, c);
-    }
-
-    public Object setBytes(String string, byte[] bytes)
-    {
-        return setBytes(string, bytes, 0, bytes.length);
-    }
-
-    public Object setBytes(String string, byte[] bytes, int start, int length)
-    {
-        return put(Prefix.AMQP_BINARY_PROPERTY_PREFIX, string, sizeByteArray(bytes, start, length));
-    }
-
-    private byte[] sizeByteArray(byte[] bytes, int start, int length)
-    {
-        byte[] resized = new byte[length];
-        int newIndex = 0;
-        for (int oldIndex = start; oldIndex < length; oldIndex++)
-        {
-            resized[newIndex] = bytes[oldIndex];
-            newIndex++;
-        }
-
-        return resized;
-    }
-
-
-    public Object setObject(String string, Object object)
-    {
-        if (object instanceof Boolean)
-        {
-            return setBoolean(string, (Boolean) object);
-        }
-        else if (object instanceof Byte)
-        {
-            return setByte(string, (Byte) object);
-        }
-        else if (object instanceof Short)
-        {
-            return setShort(string, (Short) object);
-        }
-        else if (object instanceof Integer)
-        {
-            return setInteger(string, (Integer) object);
-        }
-        else if (object instanceof Long)
-        {
-            return setLong(string, (Long) object);
-        }
-        else if (object instanceof Float)
-        {
-            return setFloat(string, (Float) object);
-        }
-        else if (object instanceof Double)
-        {
-            return setDouble(string, (Double) object);
-        }
-        else if (object instanceof String)
-        {
-            return setString(string, (String) object);
-        }
-        else if (object instanceof Character)
-        {
-            return setChar(string, (Character) object);
-        }
-        else if (object instanceof byte[])
-        {
-            return setBytes(string, (byte[]) object);
-        }
-
-        throw new AMQPInvalidClassException("Only Primatives objects allowed Object is:" + object.getClass());
-    }
-
-
-    public boolean isNullStringValue(String name)
-    {
-        return _properties.containsKey(name) && (_properties.get(name) == null) &&
-               _propertyNamesTypeMap.get(name).equals(Prefix.AMQP_NULL_STRING_PROPERTY_PREFIX);
-
-
-    }
-
-    // ***** Methods
-
-    public Enumeration getPropertyNames()
-    {
-        Vector<String> names = new Vector<String>();
-
-        Iterator keys = _properties.keySet().iterator();
-
-        while (keys.hasNext())
-        {
-            String key = (String) keys.next();
-
-            names.add(key);
-        }
-
-        return names.elements();
-    }
-
-    public boolean propertyExists(String propertyName)
-    {
-        return itemExists(propertyName);
-    }
-
-    public boolean itemExists(String string)
-    {
-        return _properties.containsKey(string);
-    }
-
-    public String toString()
-    {
-        return valueOf(this);
-    }
-
-    public static String valueOf(PropertyFieldTable table)
-    {
-        StringBuffer buf = new StringBuffer(PROPERTY_FIELD_TABLE_OPEN_XML);
-
-        final Iterator it = table._properties.entrySet().iterator();
-
-        while (it.hasNext())
-        {
-            final Map.Entry entry = (Map.Entry) it.next();
-            final String propertyName = (String) entry.getKey();
-
-            buf.append('\n');
-            buf.append(valueAsXML(table._propertyNamesTypeMap.get(propertyName), propertyName, entry.getValue()));
-        }
-        buf.append("\n");
-        buf.append(PROPERTY_FIELD_TABLE_CLOSE_XML);
-
-        return buf.toString();
-    }
-
-    private static String valueAsXML(Prefix type, String propertyName, Object value)
-    {
-        StringBuffer buf = new StringBuffer();
-        // Start Tag
-        buf.append(propertyXML(type, propertyName, true));
-
-        // Value
-        if (type.equals(Prefix.AMQP_BINARY_PROPERTY_PREFIX))
-        {
-            //remove '>'
-            buf.deleteCharAt(buf.length() - 1);
-
-            byte[] bytes = (byte[]) value;
-            buf.append(" length='").append(bytes.length).append("'>");
-
-            buf.append(byteArrayToXML(propertyName, bytes));
-        }
-        else
-        {
-            if (!type.equals(Prefix.AMQP_NULL_STRING_PROPERTY_PREFIX))
-            {
-                buf.append(String.valueOf(value));
-            }
-        }
-        //End Tag
-        buf.append(propertyXML(type, propertyName, false));
-
-        return buf.toString();
-    }
-
-    private void checkPropertyName(String propertyName)
-    {
-        if (propertyName == null)
-        {
-            throw new IllegalArgumentException("Property name must not be null");
-        }
-        else if ("".equals(propertyName))
-        {
-            throw new IllegalArgumentException("Property name must not be the empty string");
-        }
-
-        checkIdentiferFormat(propertyName);
-    }
-
-
-    protected static void checkIdentiferFormat(String propertyName)
-    {
-//        AMQP Spec: 4.2.5.5 Field Tables
-//        Guidelines for implementers:
-//           * Field names MUST start with a letter, '$' or '#' and may continue with
-//             letters, '$' or '#', digits, or underlines, to a maximum length of 128
-//             characters.
-//           * The server SHOULD validate field names and upon receiving an invalid
-//             field name, it SHOULD signal a connection exception with reply code
-//             503 (syntax error). Conformance test: amq_wlp_table_01.
-//           * A peer MUST handle duplicate fields by using only the first instance.
-
-        // AMQP length limit
-        if (propertyName.length() > 128)
-        {
-            throw new IllegalArgumentException("AMQP limits property names to 128 characters");
-        }
-
-        // AMQ start character
-        if (!(Character.isLetter(propertyName.charAt(0))
-              || propertyName.charAt(0) == '$'
-              || propertyName.charAt(0) == '#'
-              || propertyName.charAt(0) == '_')) // Not official AMQP added for JMS.
-        {
-            throw new IllegalArgumentException("Identifier '" + propertyName + "' does not start with a valid AMQP start character");
-        }
-    }
-
-    private static String propertyXML(Prefix type, String propertyName, boolean start)
-    {
-        StringBuffer buf = new StringBuffer();
-
-        if (start)
-        {
-            buf.append("<");
-        }
-        else
-        {
-            buf.append("</");
-        }
-
-        switch (type)
-        {
-            case AMQP_BOOLEAN_PROPERTY_PREFIX:
-                buf.append(BOOLEAN);
-                break;
-            case AMQP_BYTE_PROPERTY_PREFIX:
-                buf.append(BYTE);
-                break;
-            case AMQP_BINARY_PROPERTY_PREFIX:
-                buf.append(BYTES);
-                break;
-            case AMQP_SHORT_PROPERTY_PREFIX:
-                buf.append(SHORT);
-                break;
-            case AMQP_INT_PROPERTY_PREFIX:
-                buf.append(INT);
-                break;
-            case AMQP_LONG_PROPERTY_PREFIX:
-                buf.append(LONG);
-                break;
-            case AMQP_FLOAT_PROPERTY_PREFIX:
-                buf.append(FLOAT);
-                break;
-            case AMQP_DOUBLE_PROPERTY_PREFIX:
-                buf.append(DOUBLE);
-                break;
-            case AMQP_NULL_STRING_PROPERTY_PREFIX:
-                buf.append(NULL_STRING);
-                break;
-            case AMQP_ASCII_STRING_PROPERTY_PREFIX:
-            case AMQP_WIDE_STRING_PROPERTY_PREFIX:
-                buf.append(STRING);
-                break;
-            case AMQP_ASCII_CHARACTER_PROPERTY_PREFIX:
-                buf.append(CHAR);
-                break;
-            default:
-                buf.append(UNKNOWN + " (identifier ").append(type.identifier()).append(")");
-                break;
-        }
-
-        if (start)
-        {
-            buf.append(" name='").append(propertyName).append("'");
-        }
-
-        buf.append(">");
-
-        return buf.toString();
-    }
-
-    private static String byteArrayToXML(String propertyName, byte[] bytes)
-    {
-        StringBuffer buf = new StringBuffer();
-
-        for (int index = 0; index < bytes.length; index++)
-        {
-            buf.append("\n");
-            buf.append(propertyXML(Prefix.AMQP_BYTE_PROPERTY_PREFIX, propertyName + "[" + index + "]", true));
-            buf.append(bytes[index]);
-            buf.append(propertyXML(Prefix.AMQP_BYTE_PROPERTY_PREFIX, propertyName + "[" + index + "]", false));
-        }
-        buf.append("\n");
-        return buf.toString();
-    }
-
-    private void processBytesXMLLine(String xmlline)
-    {
-        String propertyName = xmlline.substring(xmlline.indexOf('\'') + 1,
-                                                xmlline.indexOf('\'', xmlline.indexOf('\'') + 1));
-        String value = xmlline.substring(xmlline.indexOf(">") + 1,
-                                         xmlline.indexOf("</"));
-
-        Integer index = Integer.parseInt(propertyName.substring(propertyName.lastIndexOf("[") + 1,
-                                                                propertyName.lastIndexOf("]")));
-        propertyName = propertyName.substring(0, propertyName.lastIndexOf("["));
-
-        getBytes(propertyName)[index] = Byte.parseByte(value);
-    }
-
-    private void parsePropertyFieldTable(String textFormat)
-    {
-        StringTokenizer tokenizer = new StringTokenizer(textFormat, "\n");
-
-        boolean finished = false;
-        boolean processing = false;
-
-        boolean processing_bytes = false;
-
-        if (!tokenizer.hasMoreTokens())
-        {
-            throw new IllegalArgumentException("XML has no tokens to parse.");
-        }
-
-        while (tokenizer.hasMoreTokens())
-        {
-            String token = tokenizer.nextToken();
-
-            if (token.equals(PROPERTY_FIELD_TABLE_CLOSE_XML))
-            {
-                processing = false;
-                finished = true;
-            }
-            if (token.equals(BYTES_CLOSE_XML))
-            {
-                processing = false;
-            }
-
-            if (token.equals(BYTES_CLOSE_XML))
-            {
-                processing_bytes = false;
-            }
-
-            if (processing)
-            {
-                processXMLLine(token);
-            }
-            else if (processing_bytes)
-            {
-                processBytesXMLLine(token);
-            }
-
-            if (token.startsWith(BYTES_OPEN_XML_START))
-            {
-                processing_bytes = true;
-                processing = false;
-            }
-
-            if (token.equals(PROPERTY_FIELD_TABLE_OPEN_XML) ||
-                token.equals(BYTES_CLOSE_XML))
-            {
-                processing = true;
-            }
-        }
-
-        if (!finished)
-        {
-            throw new IllegalArgumentException("XML was not in a valid format.");
-        }
-
-    }
-
-    private void processXMLLine(String xmlline)
-    {
-        // <<type> name='<property>'><value></<type>>
-        // <string name='message' >Message 99</string >
-
-        String type = xmlline.substring(1, xmlline.indexOf(" "));
-
-        String propertyName = xmlline.substring(xmlline.indexOf('\'') + 1,
-                                                xmlline.indexOf('\'', xmlline.indexOf('\'') + 1));
-
-        String value = "";
-
-        if (!type.equals(BYTES))
-        {
-            value = xmlline.substring(xmlline.indexOf(">") + 1,
-                                      xmlline.indexOf("</"));
-        }
-
-        if (type.equals(BOOLEAN))
-        {
-            setBoolean(propertyName, Boolean.parseBoolean(value));
-        }
-        if (type.equals(BYTE))
-        {
-            setByte(propertyName, Byte.parseByte(value));
-        }
-        if (type.equals(BYTES))
-        {
-            int headerEnd = xmlline.indexOf('>');
-            String bytesHeader = xmlline.substring(0, headerEnd);
-
-            //Extract length value
-            Integer length = Integer.parseInt(bytesHeader.substring(
-                    bytesHeader.lastIndexOf("=") + 2
-                    , bytesHeader.lastIndexOf("'")));
-
-
-            byte[] bytes = new byte[length];
-            setBytes(propertyName, bytes);
-
-            //Check if the line contains all the byte values
-            // This is needed as the XMLLine sent across the wire is the bytes value
-
-            int byteStart = xmlline.indexOf('<', headerEnd);
-
-            //Don't think this is required.
-            if (byteStart > 0)
-            {
-                while (!xmlline.startsWith(BYTES_CLOSE_XML, byteStart))
-                {
-                    //This should be the next byte line
-                    int bytePrefixEnd = xmlline.indexOf('>', byteStart) + 1;
-                    int byteEnd = xmlline.indexOf('>', bytePrefixEnd) + 1;
-
-                    String byteline = xmlline.substring(byteStart, byteEnd);
-
-                    processBytesXMLLine(byteline);
-
-                    byteStart = xmlline.indexOf('<', byteEnd);
-                }
-            }
-
-        }
-        if (type.equals(SHORT))
-        {
-            setShort(propertyName, Short.parseShort(value));
-        }
-        if (type.equals(INT))
-        {
-            setInteger(propertyName, Integer.parseInt(value));
-        }
-        if (type.equals(LONG))
-        {
-            setLong(propertyName, Long.parseLong(value));
-        }
-        if (type.equals(FLOAT))
-        {
-            setFloat(propertyName, Float.parseFloat(value));
-        }
-        if (type.equals(DOUBLE))
-        {
-            setDouble(propertyName, Double.parseDouble(value));
-        }
-        if (type.equals(STRING) || type.equals(NULL_STRING))
-        {
-            if (type.equals(NULL_STRING))
-            {
-                value = null;
-            }
-            setString(propertyName, value);
-        }
-        if (type.equals(CHAR))
-        {
-            setChar(propertyName, value.charAt(0));
-        }
-        if (type.equals(UNKNOWN))
-        {
-            _logger.warn("Ignoring unknown property value:" + xmlline);
-        }
-    }
-
-    // *************************  Byte Buffer Processing
-
-    public void writeToBuffer(ByteBuffer buffer)
-    {
-        final boolean trace = _logger.isTraceEnabled();
-
-        if (trace)
-        {
-            _logger.trace("FieldTable::writeToBuffer: Writing encoded size of " + _encodedSize + "...");
-        }
-
-        EncodingUtils.writeUnsignedInteger(buffer, _encodedSize);
-
-        putDataInBuffer(buffer);
-    }
-
-    public byte[] getDataAsBytes()
-    {
-        final ByteBuffer buffer = ByteBuffer.allocate((int) _encodedSize); // FIXME XXX: Is cast a problem?
-
-        putDataInBuffer(buffer);
-
-        final byte[] result = new byte[(int) _encodedSize];
-        buffer.flip();
-        buffer.get(result);
-        buffer.release();
-        return result;
-    }
-
-
-    public int size()
-    {
-        return _properties.size();
-    }
-
-    public boolean isEmpty()
-    {
-        return _properties.isEmpty();
-    }
-
-    public boolean containsKey(Object key)
-    {
-        return _properties.containsKey(key);
-    }
-
-    public boolean containsValue(Object value)
-    {
-        return _properties.containsValue(value);
-    }
-
-    public Object get(Object key)
-    {
-        return _properties.get(key);
-    }
-
-
-    public Object put(Object key, Object value)
-    {
-        return setObject(key.toString(), value);
-    }
-
-    protected Object put(Prefix type, String propertyName, Object value)
-    {
-        checkPropertyName(propertyName);
-
-        //remove the previous value
-        Object previous = remove(propertyName);
-
-
-        if (_logger.isTraceEnabled())
-        {
-            int valueSize = 0;
-            if (value != null)
-            {
-                valueSize = getEncodingSize(type, value);
-            }
-            _logger.trace("Put:" + propertyName +
-                          " encoding size Now:" + _encodedSize +
-                          " name size= " + EncodingUtils.encodedShortStringLength(propertyName) +
-                          " value size= " + valueSize);
-        }
-
-        //Add the size of the propertyName plus one for the type identifier
-        _encodedSize += EncodingUtils.encodedShortStringLength(propertyName) + 1;
-
-        if (value != null)
-        {
-            //Add the size of the content
-            _encodedSize += getEncodingSize(type, value);
-        }
-
-        //Store new values
-        _propertyNamesTypeMap.put(propertyName, type);
-        _properties.put(propertyName, value);
-
-        return previous;
-    }
-
-    public Object remove(Object key)
-    {
-        if (_properties.containsKey(key))
-        {
-            final Object value = _properties.remove(key);
-            Prefix type = _propertyNamesTypeMap.remove(key);
-            // plus one for the type
-            _encodedSize -= EncodingUtils.encodedShortStringLength(((String) key)) + 1;
-
-            // This check is, for now, unnecessary (we don't store null values).
-            if (value != null)
-            {
-                _encodedSize -= getEncodingSize(type, value);
-            }
-            return value;
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    public void putAll(Map t)
-    {
-        Iterator it = t.keySet().iterator();
-
-        while (it.hasNext())
-        {
-            Object key = it.next();
-            put(key, t.get(key));
-        }
-    }
-
-    public void clear()
-    {
-        _encodedSize = 0;
-        _properties.clear();
-        _propertyNamesTypeMap.clear();
-    }
-
-    public Set keySet()
-    {
-        return _properties.keySet();
-    }
-
-    public Collection values()
-    {
-        return _properties.values();
-    }
-
-    public Set entrySet()
-    {
-        return _properties.entrySet();
-    }
-
-    public long getEncodedSize()
-    {
-        return _encodedSize;
-    }
-
-
-    private void putDataInBuffer(ByteBuffer buffer)
-    {
-
-        final Iterator it = _properties.entrySet().iterator();
-
-        //If there are values then write out the encoded Size... could check _encodedSize != 0
-        // write out the total length, which we have kept up to date as data is added
-
-
-        while (it.hasNext())
-        {
-            Map.Entry me = (Map.Entry) it.next();
-            String propertyName = (String) me.getKey();
-
-            //The type value
-            Prefix type = _propertyNamesTypeMap.get(propertyName);
-
-            Object value = me.getValue();
-            try
-            {
-                if (_logger.isTraceEnabled())
-                {
-                    _logger.trace("Writing Property:" + propertyName +
-                                  " Type:" + type +
-                                  " Value:" + value);
-                    _logger.trace("Buffer Position:" + buffer.position() +
-                                  " Remaining:" + buffer.remaining());
-                }
-
-                //Write the actual parameter name
-                EncodingUtils.writeShortStringBytes(buffer, propertyName);
-
-                switch (type)
-                {
-                    case AMQP_BOOLEAN_PROPERTY_PREFIX:
-                        buffer.put((byte) Prefix.AMQP_BOOLEAN_PROPERTY_PREFIX.identifier());
-                        EncodingUtils.writeBoolean(buffer, (Boolean) value);
-                        break;
-                    case AMQP_BYTE_PROPERTY_PREFIX:
-                        buffer.put((byte) Prefix.AMQP_BYTE_PROPERTY_PREFIX.identifier());
-                        EncodingUtils.writeByte(buffer, (Byte) value);
-                        break;
-                    case AMQP_SHORT_PROPERTY_PREFIX:
-                        buffer.put((byte) Prefix.AMQP_SHORT_PROPERTY_PREFIX.identifier());
-                        EncodingUtils.writeShort(buffer, (Short) value);
-                        break;
-                    case AMQP_INT_PROPERTY_PREFIX:
-                        buffer.put((byte) Prefix.AMQP_INT_PROPERTY_PREFIX.identifier());
-                        EncodingUtils.writeInteger(buffer, (Integer) value);
-                        break;
-                    case AMQP_UNSIGNED_INT_PROPERTY_PREFIX: // Currently we don't create these
-                        buffer.put((byte) Prefix.AMQP_UNSIGNED_INT_PROPERTY_PREFIX.identifier());
-                        EncodingUtils.writeUnsignedInteger(buffer, (Long) value);
-                        break;
-                    case AMQP_LONG_PROPERTY_PREFIX:
-                        buffer.put((byte) Prefix.AMQP_LONG_PROPERTY_PREFIX.identifier());
-                        EncodingUtils.writeLong(buffer, (Long) value);
-                        break;
-                    case AMQP_FLOAT_PROPERTY_PREFIX:
-                        buffer.put((byte) Prefix.AMQP_FLOAT_PROPERTY_PREFIX.identifier());
-                        EncodingUtils.writeFloat(buffer, (Float) value);
-                        break;
-                    case AMQP_DOUBLE_PROPERTY_PREFIX:
-                        buffer.put((byte) Prefix.AMQP_DOUBLE_PROPERTY_PREFIX.identifier());
-                        EncodingUtils.writeDouble(buffer, (Double) value);
-                        break;
-                    case AMQP_NULL_STRING_PROPERTY_PREFIX:
-                        buffer.put((byte) Prefix.AMQP_NULL_STRING_PROPERTY_PREFIX.identifier());
-                        break;
-                    case AMQP_WIDE_STRING_PROPERTY_PREFIX:
-                        buffer.put((byte) Prefix.AMQP_WIDE_STRING_PROPERTY_PREFIX.identifier());
-                        // FIXME: use proper charset encoder
-                        EncodingUtils.writeLongStringBytes(buffer, (String) value);
-                        break;
-                    case AMQP_ASCII_STRING_PROPERTY_PREFIX:
-                        //This is a simple ASCII string
-                        buffer.put((byte) Prefix.AMQP_ASCII_STRING_PROPERTY_PREFIX.identifier());
-                        EncodingUtils.writeLongStringBytes(buffer, (String) value);
-                        break;
-                    case AMQP_ASCII_CHARACTER_PROPERTY_PREFIX:
-                        buffer.put((byte) Prefix.AMQP_ASCII_CHARACTER_PROPERTY_PREFIX.identifier());
-                        EncodingUtils.writeChar(buffer, (Character) value);
-                        break;
-                    case AMQP_BINARY_PROPERTY_PREFIX:
-                        buffer.put((byte) Prefix.AMQP_BINARY_PROPERTY_PREFIX.identifier());
-                        EncodingUtils.writeBytes(buffer, (byte[]) value);
-                        break;
-                    default:
-                    {
-                        // Should never get here
-                        throw new IllegalArgumentException("Key '" + propertyName + "': Unsupported type in field table, type: " + ((value == null) ? "null-object" : value.getClass()));
-                    }
-                }
-            }
-            catch (Exception e)
-            {
-                if (_logger.isTraceEnabled())
-                {
-                    _logger.trace("Exception thrown:" + e);
-                    _logger.trace("Writing Property:" + propertyName +
-                                  " Type:" + type +
-                                  " Value:" + value);
-                    _logger.trace("Buffer Position:" + buffer.position() +
-                                  " Remaining:" + buffer.remaining());
-                }
-                throw new RuntimeException(e);
-            }
-        }
-    }
-
-
-    public void setFromBuffer(ByteBuffer buffer, long length) throws AMQFrameDecodingException
-    {
-        final boolean trace = _logger.isTraceEnabled();
-
-        int sizeRead = 0;
-        while (sizeRead < length)
-        {
-            int sizeRemaining = buffer.remaining();
-            final String key = EncodingUtils.readShortString(buffer);
-
-            byte iType = buffer.get();
-
-            Character mapKey = new Character((char) iType);
-            Prefix type = _reverseTypeMap.get(mapKey);
-
-            if (type == null)
-            {
-                String msg = "Field '" + key + "' - unsupported field table type: " + type + ".";
-                //some extra trace information...
-                msg += " (" + iType + "), length=" + length + ", sizeRead=" + sizeRead + ", sizeRemaining=" + sizeRemaining;
-                throw new AMQFrameDecodingException(msg);
-            }
-            Object value;
-
-            switch (type)
-            {
-                case AMQP_BOOLEAN_PROPERTY_PREFIX:
-                    value = EncodingUtils.readBoolean(buffer);
-                    break;
-                case AMQP_BYTE_PROPERTY_PREFIX:
-                    value = EncodingUtils.readByte(buffer);
-                    break;
-                case AMQP_SHORT_PROPERTY_PREFIX:
-                    value = EncodingUtils.readShort(buffer);
-                    break;
-                case AMQP_INT_PROPERTY_PREFIX:
-                    value = EncodingUtils.readInteger(buffer);
-                    break;
-                case AMQP_UNSIGNED_INT_PROPERTY_PREFIX:// This will only fit in a long
-                    //Change this type for java lookups
-                    type = Prefix.AMQP_LONG_PROPERTY_PREFIX;
-                case AMQP_LONG_PROPERTY_PREFIX:
-                    value = EncodingUtils.readLong(buffer);
-                    break;
-                case AMQP_FLOAT_PROPERTY_PREFIX:
-                    value = EncodingUtils.readFloat(buffer);
-                    break;
-                case AMQP_DOUBLE_PROPERTY_PREFIX:
-                    value = EncodingUtils.readDouble(buffer);
-                    break;
-                case AMQP_WIDE_STRING_PROPERTY_PREFIX:
-                    // FIXME: use proper charset encoder
-                case AMQP_ASCII_STRING_PROPERTY_PREFIX:
-                    value = EncodingUtils.readLongString(buffer);
-                    break;
-                case AMQP_NULL_STRING_PROPERTY_PREFIX:
-                    value = null;
-                    break;
-                case AMQP_ASCII_CHARACTER_PROPERTY_PREFIX:
-                    value = EncodingUtils.readChar((buffer));
-                    break;
-                case AMQP_BINARY_PROPERTY_PREFIX:
-                    value = EncodingUtils.readBytes(buffer);
-                    break;
-                default:
-                    String msg = "Internal error, the following type identifier is not handled: " + type;
-                    throw new AMQFrameDecodingException(msg);
-            }
-
-            sizeRead += (sizeRemaining - buffer.remaining());
-
-            if (trace)
-            {
-                _logger.trace("FieldTable::PropFieldTable(buffer," + length + "): Read type '" + type + "', key '" + key + "', value '" + value + "' (now read " + sizeRead + " of " + length + " encoded bytes)...");
-            }
-
-            put(type, key, value);
-        }
-
-        if (trace)
-        {
-            _logger.trace("FieldTable::FieldTable(buffer," + length + "): Done.");
-        }
-    }
-
-    /**
-     * @param type  the type to calucluate encoding for
-     * @param value the property value
-     * @return integer
-     */
-    private static int getEncodingSize(Prefix type, Object value)
-    {
-        int encodingSize = 0;
-
-        switch (type)
-        {
-            case AMQP_BOOLEAN_PROPERTY_PREFIX:
-                encodingSize = EncodingUtils.encodedBooleanLength();
-                break;
-            case AMQP_BYTE_PROPERTY_PREFIX:
-                encodingSize = EncodingUtils.encodedByteLength();
-                break;
-            case AMQP_SHORT_PROPERTY_PREFIX:
-                encodingSize = EncodingUtils.encodedShortLength();
-                break;
-            case AMQP_INT_PROPERTY_PREFIX:
-                encodingSize = EncodingUtils.encodedIntegerLength();
-                break;
-            case AMQP_LONG_PROPERTY_PREFIX:
-                encodingSize = EncodingUtils.encodedLongLength();
-                break;
-            case AMQP_FLOAT_PROPERTY_PREFIX:
-                encodingSize = EncodingUtils.encodedFloatLength();
-                break;
-            case AMQP_DOUBLE_PROPERTY_PREFIX:
-                encodingSize = EncodingUtils.encodedDoubleLength();
-                break;
-            case AMQP_WIDE_STRING_PROPERTY_PREFIX:
-                // FIXME: use proper charset encoder
-            case AMQP_ASCII_STRING_PROPERTY_PREFIX:
-                encodingSize = EncodingUtils.encodedLongStringLength((String) value);
-                break;
-//            This is not required as this method is never called if the value is null
-//            case AMQP_NULL_STRING_PROPERTY_PREFIX:
-//                // There is no need for additional size beyond the prefix
-//                break;
-            case AMQP_ASCII_CHARACTER_PROPERTY_PREFIX:
-                encodingSize = EncodingUtils.encodedCharLength();
-                break;
-            case AMQP_BINARY_PROPERTY_PREFIX:
-                encodingSize = 1 + ((byte[]) value).length;
-                break;
-            default:
-                throw new IllegalArgumentException("Unsupported type in field table: " + value.getClass());
-        }
-
-        // the extra byte for the type indicator is calculated in the name
-        return encodingSize;
-    }
-}
diff --git a/java/common/src/main/xsl/cluster.asl b/java/common/src/main/xsl/cluster.asl
deleted file mode 100644
index 40ca937..0000000
--- a/java/common/src/main/xsl/cluster.asl
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0"?>
-<!--
- -
- - 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.
- -
- -->
-
-<amqp major="8" minor="0" port="5672" comment="AMQ protocol 0.80">
-
-<class name = "cluster" index = "101">
-
-<doc>
-    An extension that allows brokers to communicate in order to
-    provide a clustered service to clients.  
-</doc>
-
-<method name = "join">
-  <field name = "broker" type = "shortstr" />
-</method>
-
-<method name = "membership">
-  <field name = "members" type = "longstr" />
-</method>
-
-<method name = "synch">
-</method>
-
-<method name = "leave">
-  <field name = "broker" type = "shortstr" />
-</method>
-
-<method name = "suspect">
-  <field name = "broker" type = "shortstr" />
-</method>
-
-<method name = "ping">
-  <field name = "broker" type = "shortstr" />
-  <field name = "load" type = "long" />
-  <field name = "response required" type = "bit" />
-</method>
-
-</class>
-
-</amqp>
diff --git a/java/common/src/main/xsl/framing.xsl b/java/common/src/main/xsl/framing.xsl
deleted file mode 100644
index b8ae20a..0000000
--- a/java/common/src/main/xsl/framing.xsl
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version='1.0'?> 
-<!--
- -
- - 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.
- -
- -->
-<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:amq="http://amq.org"> 
-
-<xsl:import href="prepare1.xsl"/>
-<xsl:import href="prepare2.xsl"/>
-<xsl:import href="prepare3.xsl"/>
-<xsl:import href="java.xsl"/>
-
-<xsl:output indent="yes"/> 
-<xsl:output method="text" indent="yes" name="textFormat"/> 
-
-<xsl:template match="/">
-    <xsl:variable name="prepare1">
-        <xsl:apply-templates mode="prepare1" select="."/>
-    </xsl:variable>
-
-    <xsl:variable name="prepare2">
-        <xsl:apply-templates mode="prepare2" select="$prepare1"/>
-    </xsl:variable>
-
-    <xsl:variable name="model">
-        <xsl:apply-templates mode="prepare3" select="$prepare2"/>
-    </xsl:variable>
-
-    <xsl:apply-templates mode="generate-multi" select="$model"/>
-    <xsl:apply-templates mode="list-registry" select="$model"/>
-
-    <!-- dump out the intermediary files for debugging -->
-    <!--
-    <xsl:result-document href="prepare1.out">
-        <xsl:copy-of select="$prepare1"/> 
-    </xsl:result-document>
-
-    <xsl:result-document href="prepare2.out">
-        <xsl:copy-of select="$prepare2"/> 
-    </xsl:result-document>
-
-    <xsl:result-document href="model.out">
-        <xsl:copy-of select="$model"/> 
-    </xsl:result-document>
-    -->
-</xsl:template>
-
-</xsl:stylesheet> 
diff --git a/java/common/src/main/xsl/java.xsl b/java/common/src/main/xsl/java.xsl
deleted file mode 100644
index 948415f..0000000
--- a/java/common/src/main/xsl/java.xsl
+++ /dev/null
@@ -1,248 +0,0 @@
-<?xml version='1.0'?> 
-<!--
- -
- - 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.
- -
- -->
-<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:amq="http://amq.org"> 
-
-<!-- this class contains the templates for generating java source code for a given framing model -->
-<xsl:import href="utils.xsl"/>
-<xsl:output method="text" indent="yes" name="textFormat"/> 
-
-<xsl:param name="major"/>
-<xsl:param name="minor"/>
-<xsl:param name="registry_name"/>
-<xsl:param name="version_list_name"/>
-
-<xsl:template match="/"> 
-    <xsl:apply-templates mode="generate-multi" select="frames"/>
-    <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')"/> 
-    wrote <xsl:value-of select="$uri"/> 
-    <xsl:result-document href="{$uri}" format="textFormat"> 
-    <xsl:call-template name="generate-class">
-        <xsl:with-param name="f" select="."/>
-    </xsl:call-template>
-    </xsl:result-document> 
-</xsl:template> 
-
-<!-- main class generation template -->
-<xsl:template name="generate-class"> 
-    <xsl:param name="f"/>
-    <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;
-
-import org.apache.mina.common.ByteBuffer;
-import org.apache.qpid.framing.AMQFrame;
-import org.apache.qpid.framing.AMQFrameDecodingException;
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.framing.EncodableAMQDataBlock;
-
-/**
- * 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 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"/>;
-    }
-   
-    protected int getMethod()
-    {
-        return <xsl:value-of select="$f/@method-id"/>;
-    }
-
-    protected int getBodySize()
-    {
-        <xsl:choose> 
-        <xsl:when test="$f/field">
-        return
-        <xsl:for-each select="$f/field">
-            <xsl:if test="position() != 1">+
-            </xsl:if>
-            <xsl:value-of select="amq:field-length(.)"/>
-        </xsl:for-each>		 
-        ;
-        </xsl:when>
-        <xsl:otherwise>return 0;</xsl:otherwise>
-        </xsl:choose> 
-    }
-
-    protected void writeMethodPayload(ByteBuffer buffer)
-    {
-        <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:if>
-        </xsl:for-each>		 
-    }
-
-    public void populateMethodBodyFromBuffer(ByteBuffer buffer) throws AMQFrameDecodingException
-    {
-        <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> 
-
-<xsl:template match="/" mode="generate-registry">
-     <xsl:text>Matching root for registry mode!</xsl:text>
-     <xsl:value-of select="."/> 
-     <xsl:apply-templates select="frames" mode="generate-registry"/>
-</xsl:template>
-
-<xsl:template match="registries" mode="generate-registry">
-Wrote MethodBodyDecoderRegistry.java
-    <xsl:result-document href="MethodBodyDecoderRegistry.java" 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;
-
-import java.util.Map;
-import java.util.HashMap;
-import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.AMQFrameDecodingException;
-import org.apache.qpid.framing.AMQMethodBody;
-
-/**
- * This class is autogenerated, do not modify.
- */
-public final class MethodBodyDecoderRegistry
-{
-    private static final Logger _log = Logger.getLogger(MethodBodyDecoderRegistry.class);
-
-    private static final Map _classMethodProductToMethodBodyMap = new HashMap();
-
-    static
-    {
-        <xsl:for-each select="registry">
-            <xsl:value-of select="concat(@name, '.register(_classMethodProductToMethodBodyMap)')"/>;         
-        </xsl:for-each>
-    }
-
-    public static AMQMethodBody get(int clazz, int method) throws AMQFrameDecodingException
-    {
-	Class bodyClass = (Class) _classMethodProductToMethodBodyMap.get(new Integer(clazz * 1000 + method));
-	if (bodyClass != null)
-	{
-	    try
-	    {
-	        return (AMQMethodBody) bodyClass.newInstance();
-	    }
-	    catch (Exception e)
-	    {
-	    	throw new AMQFrameDecodingException(_log,
-                    "Unable to instantiate body class for class " + clazz + " and method " + method + ": " + e, e);
-	    }
-	}
-	else
-	{
-	    throw new AMQFrameDecodingException(_log,
-                "Unable to find a suitable decoder for class " + clazz + " and method " + method);
-	}    
-    }
-}
-</xsl:result-document>
-</xsl:template>
-
-<xsl:template match="frames" mode="list-registry">	
-    <xsl:if test="$registry_name">
-
-    <xsl:variable name="file" select="concat($registry_name, '.java')"/> 
-    wrote <xsl:value-of select="$file"/> 
-    <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;
-
-import java.util.Map;
-
-/**
- * This class is autogenerated, do not modify. [From <xsl:value-of select="@protocol"/>]
- */
-class <xsl:value-of select="$registry_name"/>
-{
-    static void register(Map map)
-    {
-        <xsl:for-each select="frame">
-            <xsl:text>map.put(new Integer(</xsl:text>
-            <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:for-each>
-    }
-}
-    </xsl:result-document>
-
-    </xsl:if>
-</xsl:template>
-
-</xsl:stylesheet>
diff --git a/java/common/src/main/xsl/prepare1.xsl b/java/common/src/main/xsl/prepare1.xsl
deleted file mode 100644
index 03e1fa7..0000000
--- a/java/common/src/main/xsl/prepare1.xsl
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version='1.0'?> 
-<!--
- -
- - 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.
- -
- -->
-<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:amq="http://amq.org"> 
-
-<xsl:import href="utils.xsl"/>
-
-<xsl:output indent="yes"/> 
-<xsl:param name="asl_base"/>
-
-<!-- pre-process, phase 1 -->
-
-<xsl:template match="/">
-    <xsl:apply-templates select="protocol" mode="prepare1"/> 
-</xsl:template> 
-
-<xsl:template match="amqp"  mode="prepare1"> 
-    <frames>
-        <xsl:attribute name="protocol">
-            <xsl:value-of select="@comment"/>
-            <xsl:text> (</xsl:text>
-                <xsl:text>major=</xsl:text><xsl:value-of select="@major"/>
-                <xsl:text>, minor=</xsl:text><xsl:value-of select="@minor"/> 
-            <xsl:text>)</xsl:text>
-        </xsl:attribute>  
-        <xsl:attribute name="major">
-            <xsl:value-of select="@major"/>
-        </xsl:attribute>  
-        <xsl:attribute name="minor">
-            <xsl:value-of select="@minor"/>
-        </xsl:attribute>  
-        <xsl:apply-templates mode="prepare1" select="inherit"/> 
-        <xsl:apply-templates mode="prepare1" select="include"/> 
-        <xsl:apply-templates mode="prepare1" select="domain"/> 
-        <xsl:apply-templates mode="prepare1" select="class"/> 
-    </frames> 
-</xsl:template> 
-
-<xsl:template match="include" mode="prepare1"> 
-    <xsl:if test="@filename != 'asl_constants.asl'">
-        <!-- skip asl_constants.asl, we don't need it and it is not well formed so causes error warnings -->   
-        <xsl:apply-templates select="document(@filename)" mode="prepare1"/> 
-    </xsl:if> 
-</xsl:template> 
-
-<xsl:template match="inherit" mode="prepare1"> 
-    <xsl:variable name="ibase" select="concat('file:///', $asl_base, '/', @name, '.asl')"/>
-    <xsl:choose>
-        <xsl:when test="document($ibase)">  
-            <xsl:apply-templates select="document($ibase)" mode="prepare1"/>         
-        </xsl:when> 
-        <xsl:otherwise>
-            <xsl:message>
-            Could not inherit from <xsl:value-of select="$ibase"/>; file not found.
-            </xsl:message>
-        </xsl:otherwise>
-    </xsl:choose>
-</xsl:template> 
-
-<xsl:template match="class[@index]" mode="prepare1"> 
-    <xsl:apply-templates select="method" mode="prepare1"/> 
-</xsl:template> 
-
-<xsl:template match="method" mode="prepare1">
-    <xsl:if test="parent::class[@index]"><!-- there is a template class that has no index, which we want to skip -->
-    <frame>
-        <xsl:attribute name="name"><xsl:value-of select="amq:class-name(parent::class/@name, @name)"/></xsl:attribute>
-        <xsl:attribute name="class-id"><xsl:value-of select="parent::class/@index"/></xsl:attribute>
-        <xsl:if test="@index">
-            <xsl:attribute name="method-id"><xsl:value-of select="@index"/></xsl:attribute>
-        </xsl:if>
-        <xsl:if test="not(@index)">
-            <xsl:attribute name="method-id"><xsl:number count="method"/></xsl:attribute>
-        </xsl:if>
-
-        <xsl:apply-templates select="field" mode="prepare1"/>
-    </frame>
-    </xsl:if>
-</xsl:template>
-
-<xsl:template match="domain" mode="prepare1"> 
-    <domain> 
-        <name><xsl:value-of select="@name"/></name> 
-        <type><xsl:value-of select="@type"/></type> 
-    </domain> 
-</xsl:template> 
-
-<xsl:template match="field" mode="prepare1">
-    <field>
-        <xsl:copy-of select="@name"/>
-        <xsl:copy-of select="@type"/>
-        <xsl:copy-of select="@domain"/>
-    </field>
-</xsl:template>
-
-</xsl:stylesheet> 
diff --git a/java/common/src/main/xsl/prepare2.xsl b/java/common/src/main/xsl/prepare2.xsl
deleted file mode 100644
index 14f4f33..0000000
--- a/java/common/src/main/xsl/prepare2.xsl
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version='1.0'?> 
-<!--
- -
- - 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.
- -
- -->
-<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:amq="http://amq.org"> 
-
-<xsl:import href="utils.xsl"/>
-
-<xsl:output indent="yes"/> 
-
-<!-- pre-process, phase 2 -->
-
-<xsl:key name="domain-lookup" match="domain" use="name"/>
-
-<xsl:template match="/"> 
-    <xsl:apply-templates mode="prepare2" select="frames"/> 
-</xsl:template> 
-
-<xsl:template match="field[@domain]" mode="prepare2">
-     <field> 
-         <xsl:variable name="t1" select="key('domain-lookup', @domain)/type"/>
-         <xsl:attribute name="name"><xsl:value-of select="amq:field-name(@name)"/></xsl:attribute>
-         <xsl:attribute name="type"><xsl:value-of select="$t1"/></xsl:attribute>
-     </field> 
-</xsl:template> 
-
-<xsl:template match="field[@type]" mode="prepare2">
-     <field> 
-         <xsl:attribute name="name"><xsl:value-of select="amq:field-name(@name)"/></xsl:attribute>
-         <xsl:attribute name="type"><xsl:value-of select="@type"/></xsl:attribute>
-     </field> 
-</xsl:template> 
-
-<xsl:template match="frames" mode="prepare2">
-    <frames>
-        <xsl:copy-of select="@protocol"/>
-        <xsl:copy-of select="@major"/>
-        <xsl:copy-of select="@minor"/>
-        <xsl:apply-templates mode="prepare2"/>
-    </frames>
-</xsl:template>
-
-<xsl:template match="frame" mode="prepare2">
-    <xsl:element name="{name()}">
-        <xsl:copy-of select="@*"/>
-        <xsl:apply-templates mode="prepare2" select="field"/>  
-    </xsl:element>
-</xsl:template>
-
-<xsl:template match="domain" mode="prepare2"></xsl:template> 
-
-</xsl:stylesheet> 
diff --git a/java/common/src/main/xsl/prepare3.xsl b/java/common/src/main/xsl/prepare3.xsl
deleted file mode 100644
index f8cf0c8..0000000
--- a/java/common/src/main/xsl/prepare3.xsl
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version='1.0'?> 
-<!--
- -
- - 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.
- -
- -->
-<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:amq="http://amq.org"> 
-
-<xsl:import href="utils.xsl"/>
-
-<xsl:output indent="yes"/> 
-
-<!-- final preparation of the model -->
-
-<xsl:template match="/">
-    <xsl:apply-templates mode="prepare3"/>
-</xsl:template>
-
-<xsl:template match="frames" mode="prepare3">
-    <frames>
-        <xsl:copy-of select="@protocol"/>
-        <xsl:copy-of select="@major"/>
-        <xsl:copy-of select="@minor"/>
-        <xsl:apply-templates mode="prepare3"/>
-    </frames>
-</xsl:template>
-
-<xsl:template match="frame" mode="prepare3">
-    <xsl:element name="frame">
-        <xsl:copy-of select="@*"/>
-	<xsl:if test="field[@type='bit']"><xsl:attribute name="has-bit-field">true</xsl:attribute></xsl:if>
-        <xsl:apply-templates mode="prepare3"/>
-    </xsl:element>
-</xsl:template>
-
-
-<xsl:template match="field" mode="prepare3">
-     <field>
-         <xsl:attribute name="type"><xsl:value-of select="@type"/></xsl:attribute>
-         <!-- ensure the field name is processed to be a valid java name -->
-         <xsl:attribute name="name"><xsl:value-of select="amq:field-name(@name)"/></xsl:attribute>
-         <!-- add some attributes to make code generation easier -->
-         <xsl:attribute name="java-type"><xsl:value-of select="amq:java-type(@type)"/></xsl:attribute>
-         <xsl:if test="@type='bit'">
-             <xsl:attribute name="boolean-index"><xsl:number count="field[@type='bit']"/></xsl:attribute>
-         </xsl:if>
-     </field>
-</xsl:template>
-
-</xsl:stylesheet> 
diff --git a/java/common/src/main/xsl/readme.txt b/java/common/src/main/xsl/readme.txt
deleted file mode 100644
index b373055..0000000
--- a/java/common/src/main/xsl/readme.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-This directory contains the xsl stylesheets used to generate the code from the
-AMQP protocol specification. They require an XSLT2.0 processor, currently 
-Saxon 8 is used.
-
-The generation process is controlled by the framing.xsl stylesheet. This performs
-several phases of transformation, using the other stylesheets. The transformation
-in each phase is defined in a separate file, and these are designed to also allow
-then to be run individually. 
-
-The generation takes the amq.asl as input, it also requires that the path to the 
-directory where the base asl definitions reside (those definitions that the main
-amq.asl defintion inherits from) be passed in via a paramter called asl_base.
-
-The files involved are as follows:
-
-    framing.xsl    The control file for the entire generation process
-
-    prepare1.xsl   Resolves the separate files that make up the protocol 
-                   definition, building a single tree containing all the
-                   information as a set of 'frame' elements, each of which
-                   has attributes for its name, and ids for the class and
-                   method it refers to and contains zero or more field 
-                   elements. 
-
-                   A method id is generated based on the order of the 
-                   method elements within the class elements in the original
-                   specification. The class id is taken from the enclosing
-                   class element.  
-
-    prepare2.xsl   Resolves domains into their corresponding types. (This is
-                   much easier when all the information is in a single tree, 
-                   hence the separate frame). 
-
-    prepare3.xsl   Converts names into valid java names and augments the
-                   tree to include information that makes the subsequent
-                   generation phase simpler e.g. the index of boolean 
-                   fields as several boolean flags are combined into a
-                   single byte. (This is easier once the domains have been
-                   resolved, hence the separate phase).
-
-    java.xsl       Generates java classes for each frame, and a registry of 
-                   all the frames to a 'magic' number generated from their 
-                   class and method id.
-
-    utils.xsl      Contains some utility methods for e.g. producing valid
-                   java names.
-
-For debugging the framing.xsl can output the intermediary files. This can be
-enabled by uncommenting the relevant lines (a comment explaining this is
-provided inline).     
- 
- 
\ No newline at end of file
diff --git a/java/common/src/main/xsl/registry.template b/java/common/src/main/xsl/registry.template
deleted file mode 100644
index 87c5afc..0000000
--- a/java/common/src/main/xsl/registry.template
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
- -
- - 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.
- -
- -->
-<registries>
-    <registry name="MainRegistry"/>
-    <registry name="ClusterRegistry"/>
-</registries>
diff --git a/java/common/src/main/xsl/registry.xsl b/java/common/src/main/xsl/registry.xsl
deleted file mode 100644
index c70dbe2..0000000
--- a/java/common/src/main/xsl/registry.xsl
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version='1.0'?> 
-<!--
- -
- - 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.
- -
- -->
-<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:amq="http://amq.org"> 
-
-<xsl:import href="java.xsl"/>
-
-<xsl:output method="text" indent="yes" name="textFormat"/> 
-
-<xsl:template match="/">
-    <xsl:apply-templates mode="generate-registry" select="registries"/>
-</xsl:template>
-
-</xsl:stylesheet> 
diff --git a/java/common/src/main/xsl/utils.xsl b/java/common/src/main/xsl/utils.xsl
deleted file mode 100644
index 95e15c6..0000000
--- a/java/common/src/main/xsl/utils.xsl
+++ /dev/null
@@ -1,207 +0,0 @@
-<?xml version='1.0'?>
-<!--
- -
- - 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.
- -
- -->
-<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:amq="http://amq.org">
-
-<!-- This file contains functions that are used in the generation of the java classes for framing -->
-
-<!-- create copyright notice for generated files -->
-<xsl:function name="amq:copyright">/**
-*
-* 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.
-*
-*/
-</xsl:function>
-
-<!-- retrieve the java type of a given amq type -->
-<xsl:function name="amq:java-type">
-    <xsl:param name="t"/>
-    <xsl:choose>
-	 <xsl:when test="$t='char'">char</xsl:when> 		 		 
-	 <xsl:when test="$t='octet'">short</xsl:when> 		 		 
-	 <xsl:when test="$t='short'">int</xsl:when> 		 		 
-	 <xsl:when test="$t='shortstr'">String</xsl:when> 		 		 
-	 <xsl:when test="$t='longstr'">byte[]</xsl:when> 		 		 
-	 <xsl:when test="$t='bit'">boolean</xsl:when> 		 		 
-	 <xsl:when test="$t='long'">long</xsl:when> 		 		 
-	 <xsl:when test="$t='longlong'">long</xsl:when> 		 		 
-	 <xsl:when test="$t='table'">FieldTable</xsl:when> 		 		 
-         <xsl:otherwise>Object /*WARNING: undefined type*/</xsl:otherwise>
-    </xsl:choose>
-</xsl:function>
-
-<!-- retrieve the code to get the field size of a given amq type -->
-<xsl:function name="amq:field-length">
-    <xsl:param name="f"/>
-    <xsl:choose>
-        <xsl:when test="$f/@type='bit' and $f/@boolean-index=1">
-            <xsl:value-of select="concat('1 /*', $f/@name, '*/')"/>
-        </xsl:when>
-        <xsl:when test="$f/@type='bit' and $f/@boolean-index &gt; 1">
-            <xsl:value-of select="concat('0 /*', $f/@name, '*/')"/>
-        </xsl:when>
-        <xsl:when test="$f/@type='char'">
-            <xsl:value-of select="concat('1 /*', $f/@name, '*/')"/>
-        </xsl:when>
-        <xsl:when test="$f/@type='octet'">
-            <xsl:value-of select="concat('1 /*', $f/@name, '*/')"/>
-        </xsl:when>
-	<xsl:when test="$f/@type='short'">
-            <xsl:value-of select="concat('2 /*', $f/@name, '*/')"/>
-        </xsl:when>
-        <xsl:when test="$f/@type='long'">
-            <xsl:value-of select="concat('4 /*', $f/@name, '*/')"/>
-        </xsl:when>
-        <xsl:when test="$f/@type='longlong'">
-            <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:when> 		 		 
-	<xsl:when test="$f/@type='longstr'">
-            <xsl:value-of select="concat('4 + (', $f/@name, ' == null ? 0 : ', $f/@name, '.length)')"/>
-        </xsl:when> 		 		 
-	<xsl:when test="$f/@type='table'">
-            <xsl:value-of select="concat('EncodingUtils.encodedFieldTableLength(', $f/@name, ')')"/>
-        </xsl:when> 		 		 
-        <xsl:otherwise><xsl:text>/* WARNING: COULD NOT DETERMINE FIELD SIZE */</xsl:text></xsl:otherwise>
-    </xsl:choose>    
-</xsl:function>
-
-<!-- retrieve the code to encode a field of a given amq type -->
-<!-- Note:
-     This method will not provide an encoder for a bit field. 
-     Bit fields should be encoded together separately. -->
-
-<xsl:function name="amq:encoder">
-    <xsl:param name="f"/>
-    <xsl:choose>
-        <xsl:when test="$f/@type='char'">
-            <xsl:value-of select="concat('EncodingUtils.writeChar(buffer, ', $f/@name, ')')"/>
-        </xsl:when>
-        <xsl:when test="$f/@type='octet'">
-            <xsl:value-of select="concat('EncodingUtils.writeUnsignedByte(buffer, ', $f/@name, ')')"/>
-        </xsl:when>
-	<xsl:when test="$f/@type='short'">
-            <xsl:value-of select="concat('EncodingUtils.writeUnsignedShort(buffer, ', $f/@name, ')')"/>
-        </xsl:when>
-        <xsl:when test="$f/@type='long'">
-            <xsl:value-of select="concat('EncodingUtils.writeUnsignedInteger(buffer, ', $f/@name, ')')"/>
-        </xsl:when>
-        <xsl:when test="$f/@type='longlong'">
-            <xsl:value-of select="concat('buffer.putLong(', $f/@name, ')')"/>
-        </xsl:when>
-	<xsl:when test="$f/@type='shortstr'">
-            <xsl:value-of select="concat('EncodingUtils.writeShortStringBytes(buffer, ', $f/@name, ')')"/>
-        </xsl:when> 		 		 
-	<xsl:when test="$f/@type='longstr'">
-            <xsl:value-of select="concat('EncodingUtils.writeLongstr(buffer, ', $f/@name, ')')"/>
-        </xsl:when> 		 		 
-	<xsl:when test="$f/@type='table'">
-            <xsl:value-of select="concat('EncodingUtils.writeFieldTableBytes(buffer, ', $f/@name, ')')"/>
-        </xsl:when> 		 		 
-        <xsl:otherwise><xsl:text>/* WARNING: COULD NOT DETERMINE ENCODER */</xsl:text></xsl:otherwise>
-    </xsl:choose>    
-</xsl:function>
-
-<!-- retrieve the code to decode a field of a given amq type -->
-<xsl:function name="amq:decoder">
-    <xsl:param name="f"/>
-    <xsl:choose>
-        <xsl:when test="$f/@type='bit'">
-            <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:when>
-        <xsl:when test="$f/@type='char'">
-            <xsl:value-of select="concat($f/@name, ' = buffer.getChar()')"/>
-        </xsl:when>
-        <xsl:when test="$f/@type='octet'">
-            <xsl:value-of select="concat($f/@name, ' = buffer.getUnsigned()')"/>
-        </xsl:when>
-        <xsl:when test="$f/@type='short'">
-            <xsl:value-of select="concat($f/@name, ' = buffer.getUnsignedShort()')"/>
-        </xsl:when>
-        <xsl:when test="$f/@type='long'">
-            <xsl:value-of select="concat($f/@name, ' = buffer.getUnsignedInt()')"/>
-        </xsl:when>
-        <xsl:when test="$f/@type='longlong'">
-            <xsl:value-of select="concat($f/@name, ' = buffer.getLong()')"/>
-        </xsl:when>
-        <xsl:when test="$f/@type='shortstr'">
-            <xsl:value-of select="concat($f/@name, ' = EncodingUtils.readShortString(buffer)')"/>
-        </xsl:when>
-        <xsl:when test="$f/@type='longstr'">
-            <xsl:value-of select="concat($f/@name, ' = EncodingUtils.readLongstr(buffer)')"/>
-        </xsl:when>
-        <xsl:when test="$f/@type='table'">
-            <xsl:value-of select="concat($f/@name, ' = EncodingUtils.readFieldTable(buffer)')"/>
-        </xsl:when>
-        <xsl:otherwise><xsl:text>/* WARNING: COULD NOT DETERMINE DECODER */</xsl:text></xsl:otherwise>
-    </xsl:choose>    
-</xsl:function>
-
-<!-- create the class name for a frame, based on class and method (passed in) -->
-<xsl:function name="amq:class-name">
-    <xsl:param name="class"/>
-    <xsl:param name="method"/>
-    <xsl:value-of select="concat(amq:upper-first($class),amq:upper-first(amq:field-name($method)), 'Body')"/>
-</xsl:function>
-
-<!-- get a valid field name, processing spaces and '-'s where appropriate -->
-<xsl:function name="amq:field-name">
-    <xsl:param name="name"/>
-    <xsl:choose>
-        <xsl:when test="contains($name, ' ')">
-            <xsl:value-of select="concat(substring-before($name, ' '), amq:upper-first(substring-after($name, ' ')))"/>
-        </xsl:when>
-        <xsl:when test="contains($name, '-')">
-            <xsl:value-of select="concat(substring-before($name, '-'), amq:upper-first(substring-after($name, '-')))"/>
-        </xsl:when>
-        <xsl:otherwise>
-            <xsl:value-of select="$name"/>
-        </xsl:otherwise>
-    </xsl:choose>
-</xsl:function>
-
-<!-- convert the first character of the input to upper-case -->
-<xsl:function name="amq:upper-first">
-    <xsl:param name="in"/>
-    <xsl:value-of select="concat(upper-case(substring($in, 1, 1)), substring($in, 2))"/>
-</xsl:function>
-
-</xsl:stylesheet>
diff --git a/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java b/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java
index 66dd1b1..ffbdf73 100644
--- a/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java
+++ b/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java
@@ -31,7 +31,7 @@
 {
 
     BasicContentHeaderProperties _testProperties;
-    PropertyFieldTable _testTable;
+    FieldTable _testTable;
     String _testString = "This is a test string";
     int _testint = 666;
 
@@ -45,11 +45,9 @@
 
     public void setUp()
     {
-        HashMap _testMap = new HashMap(10);
-        _testMap.put("TestString", _testString);
-        _testMap.put("Testint", _testint);
-        _testTable = new PropertyFieldTable();
-        _testTable.putAll(_testMap);
+        _testTable = new FieldTable();
+        _testTable.setString("TestString", _testString);
+        _testTable.setInteger("Testint", _testint);
         _testProperties = new BasicContentHeaderProperties();
         _testProperties.setHeaders(_testTable);
     }
@@ -57,7 +55,7 @@
     public void testGetPropertyListSize()
     {
         //needs a better test but at least we're exercising the code !
-         // FT size is encoded in an int
+         // FT length is encoded in an int
         int expectedSize = EncodingUtils.encodedIntegerLength();
 
         expectedSize += EncodingUtils.encodedShortStringLength("TestInt");
diff --git a/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java b/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java
index 9cad317..94c97ef 100644
--- a/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java
+++ b/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java
@@ -51,7 +51,7 @@
      */
     public void testReplacement() throws JMSException
     {
-        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable(new FieldTable());
         //Set a boolean value
         table1.setBoolean("value", true);
 
@@ -73,7 +73,7 @@
 
     public void testRemoval() throws JMSException
     {
-        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable(new FieldTable());
         //Set a boolean value
         table1.setBoolean("value", true);
 
@@ -99,7 +99,7 @@
      */
     public void testBoolean() throws JMSException
     {
-        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable(new FieldTable());
         table1.setBoolean("value", true);
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -184,7 +184,7 @@
         //but after a remove it doesn't
         Assert.assertFalse(table1.propertyExists("value"));
 
-        // Table should now have zero size for encoding
+        // Table should now have zero length for encoding
         checkEmpty(table1);
 
         //Looking up an invalid value will return false
@@ -197,7 +197,7 @@
      */
     public void testByte() throws JMSException
     {
-        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable(new FieldTable());
         table1.setByte("value", Byte.MAX_VALUE);
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -243,7 +243,7 @@
         //but after a remove it doesn't
         Assert.assertFalse(table1.propertyExists("value"));
 
-        // Table should now have zero size for encoding
+        // Table should now have zero length for encoding
         checkEmpty(table1);
 
         //Looking up an invalid value returns null
@@ -266,7 +266,7 @@
      */
     public void testShort() throws JMSException
     {
-        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable(new FieldTable());
         table1.setShort("value", Short.MAX_VALUE);
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -323,7 +323,7 @@
         //but after a remove it doesn't
         Assert.assertFalse(table1.propertyExists("value"));
 
-        // Table should now have zero size for encoding
+        // Table should now have zero length for encoding
         checkEmpty(table1);
 
         //Looking up an invalid value returns null
@@ -345,7 +345,7 @@
      */
     public void testDouble() throws JMSException
     {
-        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable(new FieldTable());
         table1.setDouble("value", Double.MAX_VALUE);
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -414,7 +414,7 @@
         //but after a remove it doesn't
         Assert.assertFalse(table1.propertyExists("value"));
 
-        // Table should now have zero size for encoding
+        // Table should now have zero length for encoding
         checkEmpty(table1);
 
         //Looking up an invalid value returns null
@@ -437,7 +437,7 @@
      */
     public void testFloat() throws JMSException
     {
-        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable(new FieldTable());
         table1.setFloat("value", Float.MAX_VALUE);
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -500,7 +500,7 @@
         //but after a remove it doesn't
         Assert.assertFalse(table1.propertyExists("value"));
 
-        // Table should now have zero size for encoding
+        // Table should now have zero length for encoding
         checkEmpty(table1);
 
         //Looking up an invalid value returns null
@@ -522,7 +522,7 @@
      */
     public void testInt() throws JMSException
     {
-        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable(new FieldTable());
         table1.setInteger("value", Integer.MAX_VALUE);
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -586,7 +586,7 @@
         //but after a remove it doesn't
         Assert.assertFalse(table1.propertyExists("value"));
 
-        // Table should now have zero size for encoding
+        // Table should now have zero length for encoding
         checkEmpty(table1);
 
         //Looking up an invalid value returns null
@@ -608,7 +608,7 @@
      */
     public void testLong() throws JMSException
     {
-        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable(new FieldTable());
         table1.setLong("value", Long.MAX_VALUE);
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -679,7 +679,7 @@
         //but after a remove it doesn't
         Assert.assertFalse(table1.propertyExists("value"));
 
-        // Table should now have zero size for encoding
+        // Table should now have zero length for encoding
         checkEmpty(table1);
 
         //Looking up an invalid value
@@ -700,7 +700,7 @@
      * Calls all methods that can be used to check the table is empty
      * - getEncodedSize
      * - isEmpty
-     * - size
+     * - length
      *
      * @param table to check is empty
      */
@@ -716,7 +716,7 @@
      */
     public void testString() throws JMSException
     {
-        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table1 = new JMSPropertyFieldTable(new FieldTable());
         table1.setString("value", "Hello");
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -799,7 +799,7 @@
 
     public void testValues() throws JMSException
     {
-        JMSPropertyFieldTable table = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table = new JMSPropertyFieldTable(new FieldTable());
         table.setBoolean("bool", true);
         table.setDouble("double", Double.MAX_VALUE);
         table.setFloat("float", Float.MAX_VALUE);
@@ -842,7 +842,7 @@
      */
     public void testCheckPropertyNameasNull() throws JMSException
     {
-        JMSPropertyFieldTable table = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table = new JMSPropertyFieldTable(new FieldTable());
 
         try
         {
@@ -862,7 +862,7 @@
      */
     public void testCheckPropertyNameasEmptyString() throws JMSException
     {
-        JMSPropertyFieldTable table = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table = new JMSPropertyFieldTable(new FieldTable());
 
         try
         {
@@ -882,7 +882,7 @@
      */
     public void testCheckPropertyNamehasMaxLength() throws JMSException
     {
-        JMSPropertyFieldTable table = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table = new JMSPropertyFieldTable(new FieldTable());
 
         StringBuffer longPropertyName = new StringBuffer(129);
 
@@ -910,7 +910,7 @@
      */
     public void testCheckPropertyNameStartCharacterIsLetter() throws JMSException
     {
-        JMSPropertyFieldTable table = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table = new JMSPropertyFieldTable(new FieldTable());
 
         //Try a name that starts with a number
         try
@@ -931,7 +931,7 @@
      */
     public void testCheckPropertyNameContainsInvalidCharacter() throws JMSException
     {
-        JMSPropertyFieldTable table = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table = new JMSPropertyFieldTable(new FieldTable());
 
         //Try a name that starts with a number
         try
@@ -953,7 +953,7 @@
      */
     public void testCheckPropertyNameIsInvalid() throws JMSException
     {
-        JMSPropertyFieldTable table = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table = new JMSPropertyFieldTable(new FieldTable());
 
         //Try a name that starts with a number
         try
@@ -995,7 +995,7 @@
     public void testSets()
     {
 
-        JMSPropertyFieldTable table = new JMSPropertyFieldTable();
+        JMSPropertyFieldTable table = new JMSPropertyFieldTable(new FieldTable());
 
         table.put("n1", "1");
         table.put("n2", "2");
diff --git a/java/common/src/test/java/org/apache/qpid/framing/PropertyFieldTableTest.java b/java/common/src/test/java/org/apache/qpid/framing/PropertyFieldTableTest.java
index 5256c62..c259d3e 100644
--- a/java/common/src/test/java/org/apache/qpid/framing/PropertyFieldTableTest.java
+++ b/java/common/src/test/java/org/apache/qpid/framing/PropertyFieldTableTest.java
@@ -37,39 +37,23 @@
 
     private static final Logger _logger = Logger.getLogger(PropertyFieldTableTest.class);
 
-    /**
-     * Test that modifying a byte[] after setting property doesn't change property
-     */
-    public void testByteModification()
-    {
-        PropertyFieldTable table = new PropertyFieldTable();
-        byte[] bytes = {99, 98, 97, 96, 95};
-        table.setBytes("bytes", bytes);
-        bytes[0] = 1;
-        bytes[1] = 2;
-        bytes[2] = 3;
-        bytes[3] = 4;
-        bytes[4] = 5;
-
-        assertBytesNotEqual(bytes, table.getBytes("bytes"));
-    }
 
     /**
      * Test that setting a similar named value replaces any previous value set on that name
      */
     public void testReplacement()
     {
-        PropertyFieldTable table1 = new PropertyFieldTable();
+        FieldTable table1 = new FieldTable();
         //Set a boolean value
         table1.setBoolean("value", true);
-        //Check size of table is correct (<Value length> + <type> + <Boolean length>)
+        //Check length of table is correct (<Value length> + <type> + <Boolean length>)
         int size = EncodingUtils.encodedShortStringLength("value") + 1 + EncodingUtils.encodedBooleanLength();
         Assert.assertEquals(size, table1.getEncodedSize());
 
         // reset value to an integer
         table1.setInteger("value", Integer.MAX_VALUE);
 
-        // Check the size has changed accordingly   (<Value length> + <type> + <Integer length>)
+        // Check the length has changed accordingly   (<Value length> + <type> + <Integer length>)
         size = EncodingUtils.encodedShortStringLength("value") + 1 + EncodingUtils.encodedIntegerLength();
         Assert.assertEquals(size, table1.getEncodedSize());
 
@@ -86,7 +70,7 @@
      */
     public void testBoolean()
     {
-        PropertyFieldTable table1 = new PropertyFieldTable();
+        FieldTable table1 = new FieldTable();
         table1.setBoolean("value", true);
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -107,19 +91,9 @@
         //except value as a string
         Assert.assertEquals("true", table1.getString("value"));
 
-        //Try setting a null value and read it back
-        table1.put(PropertyFieldTable.Prefix.AMQP_BOOLEAN_PROPERTY_PREFIX, "value", null);
-
-        // Should be able to get the null back
-        Assert.assertEquals(null, table1.getBoolean("value"));
-        //but still contains the value
-        Assert.assertTrue(table1.containsKey("value"));
-
         table1.remove("value");
-        //but after a remove it doesn't
-        Assert.assertFalse(table1.containsKey("value"));
 
-        // Table should now have zero size for encoding
+        // Table should now have zero length for encoding
         checkEmpty(table1);
 
         //Looking up an invalid value returns null
@@ -132,7 +106,7 @@
      */
     public void testByte()
     {
-        PropertyFieldTable table1 = new PropertyFieldTable();
+        FieldTable table1 = new FieldTable();
         table1.setByte("value", Byte.MAX_VALUE);
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -151,20 +125,8 @@
         //... and a the string value of it.
         Assert.assertEquals("" + Byte.MAX_VALUE, table1.getString("value"));
 
-        //Try setting a null value and read it back
-        table1.put(PropertyFieldTable.Prefix.AMQP_BYTE_PROPERTY_PREFIX, "value", null);
-
-        // Should be able to get the null back
-        Assert.assertEquals(null, table1.getByte("value"));
-
-        //but still contains the value
-        Assert.assertTrue(table1.containsKey("value"));
-
         table1.remove("value");
-        //but after a remove it doesn't
-        Assert.assertFalse(table1.containsKey("value"));
-
-        // Table should now have zero size for encoding
+        // Table should now have zero length for encoding
         checkEmpty(table1);
 
         //Looking up an invalid value returns null
@@ -177,7 +139,7 @@
      */
     public void testShort()
     {
-        PropertyFieldTable table1 = new PropertyFieldTable();
+        FieldTable table1 = new FieldTable();
         table1.setShort("value", Short.MAX_VALUE);
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -196,20 +158,8 @@
         //... and a the string value of it.
         Assert.assertEquals("" + Short.MAX_VALUE, table1.getString("value"));
 
-        //Try setting a null value and read it back
-        table1.put(PropertyFieldTable.Prefix.AMQP_SHORT_PROPERTY_PREFIX, "value", null);
-
-        // Should be able to get the null back
-        Assert.assertEquals(null, table1.getShort("value"));
-
-        //but still contains the value
-        Assert.assertTrue(table1.containsKey("value"));
-
         table1.remove("value");
-        //but after a remove it doesn't
-        Assert.assertFalse(table1.containsKey("value"));
-
-        // Table should now have zero size for encoding
+        // Table should now have zero length for encoding
         checkEmpty(table1);
 
         //Looking up an invalid value returns null
@@ -223,7 +173,7 @@
      */
     public void testChar()
     {
-        PropertyFieldTable table1 = new PropertyFieldTable();
+        FieldTable table1 = new FieldTable();
         table1.setChar("value", 'c');
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -242,26 +192,9 @@
         //... and a the string value of it.
         Assert.assertEquals("c", table1.getString("value"));
 
-        //Try setting a null value and read it back
-        table1.put(PropertyFieldTable.Prefix.AMQP_ASCII_CHARACTER_PROPERTY_PREFIX, "value", null);
-
-        try
-        {
-            table1.getString("value");
-            fail("Should throw NullPointerException");
-        }
-        catch (NullPointerException npe)
-        {
-            //Normal Path
-        }
-        //but still contains the value
-        Assert.assertTrue(table1.containsKey("value"));
-
         table1.remove("value");
-        //but after a remove it doesn't
-        Assert.assertFalse(table1.containsKey("value"));
 
-        // Table should now have zero size for encoding
+        // Table should now have zero length for encoding
         checkEmpty(table1);
 
         //Looking up an invalid value returns null
@@ -275,7 +208,7 @@
      */
     public void testDouble()
     {
-        PropertyFieldTable table1 = new PropertyFieldTable();
+        FieldTable table1 = new FieldTable();
         table1.setDouble("value", Double.MAX_VALUE);
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -293,20 +226,11 @@
 
         //... and a the string value of it.
         Assert.assertEquals("" + Double.MAX_VALUE, table1.getString("value"));
-
-        //Try setting a null value and read it back
-        table1.put(PropertyFieldTable.Prefix.AMQP_DOUBLE_PROPERTY_PREFIX, "value", null);
-
-        Assert.assertEquals(null, table1.getDouble("value"));
-
-        //but still contains the value
-        Assert.assertTrue(table1.containsKey("value"));
-
         table1.remove("value");
         //but after a remove it doesn't
         Assert.assertFalse(table1.containsKey("value"));
 
-        // Table should now have zero size for encoding
+        // Table should now have zero length for encoding
         checkEmpty(table1);
 
         //Looking up an invalid value returns null
@@ -320,7 +244,7 @@
      */
     public void testFloat()
     {
-        PropertyFieldTable table1 = new PropertyFieldTable();
+        FieldTable table1 = new FieldTable();
         table1.setFloat("value", Float.MAX_VALUE);
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -339,19 +263,12 @@
         //... and a the string value of it.
         Assert.assertEquals("" + Float.MAX_VALUE, table1.getString("value"));
 
-        //Try setting a null value and read it back
-        table1.put(PropertyFieldTable.Prefix.AMQP_FLOAT_PROPERTY_PREFIX, "value", null);
-
-        Assert.assertEquals(null, table1.getFloat("value"));
-
-        //but still contains the value
-        Assert.assertTrue(table1.containsKey("value"));
 
         table1.remove("value");
         //but after a remove it doesn't
         Assert.assertFalse(table1.containsKey("value"));
 
-        // Table should now have zero size for encoding
+        // Table should now have zero length for encoding
         checkEmpty(table1);
 
         //Looking up an invalid value returns null
@@ -365,7 +282,7 @@
      */
     public void testInt()
     {
-        PropertyFieldTable table1 = new PropertyFieldTable();
+        FieldTable table1 = new FieldTable();
         table1.setInteger("value", Integer.MAX_VALUE);
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -384,19 +301,12 @@
         //... and a the string value of it.
         Assert.assertEquals("" + Integer.MAX_VALUE, table1.getString("value"));
 
-        //Try setting a null value and read it back
-        table1.put(PropertyFieldTable.Prefix.AMQP_INT_PROPERTY_PREFIX, "value", null);
-
-        Assert.assertEquals(null, table1.getInteger("value"));
-
-        //but still contains the value
-        Assert.assertTrue(table1.containsKey("value"));
 
         table1.remove("value");
         //but after a remove it doesn't
         Assert.assertFalse(table1.containsKey("value"));
 
-        // Table should now have zero size for encoding
+        // Table should now have zero length for encoding
         checkEmpty(table1);
 
         //Looking up an invalid value returns null
@@ -410,7 +320,7 @@
      */
     public void testLong()
     {
-        PropertyFieldTable table1 = new PropertyFieldTable();
+        FieldTable table1 = new FieldTable();
         table1.setLong("value", Long.MAX_VALUE);
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -429,19 +339,12 @@
         //... and a the string value of it.
         Assert.assertEquals("" + Long.MAX_VALUE, table1.getString("value"));
 
-        //Try setting a null value and read it back
-        table1.put(PropertyFieldTable.Prefix.AMQP_LONG_PROPERTY_PREFIX, "value", null);
-
-        Assert.assertEquals(null, table1.getLong("value"));
-
-        //but still contains the value
-        Assert.assertTrue(table1.containsKey("value"));
 
         table1.remove("value");
         //but after a remove it doesn't
         Assert.assertFalse(table1.containsKey("value"));
 
-        // Table should now have zero size for encoding
+        // Table should now have zero length for encoding
         checkEmpty(table1);
 
         //Looking up an invalid value returns null
@@ -457,7 +360,7 @@
     {
         byte[] bytes = {99, 98, 97, 96, 95};
 
-        PropertyFieldTable table1 = new PropertyFieldTable();
+        FieldTable table1 = new FieldTable();
         table1.setBytes("value", bytes);
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -476,19 +379,11 @@
         //... and a the string value of it is null
         Assert.assertEquals(null, table1.getString("value"));
 
-        //Try setting a null value and read it back
-        table1.put(PropertyFieldTable.Prefix.AMQP_BINARY_PROPERTY_PREFIX, "value", null);
-
-        Assert.assertEquals(null, table1.getBytes("value"));
-
-        //but still contains the value
-        Assert.assertTrue(table1.containsKey("value"));
-
         table1.remove("value");
         //but after a remove it doesn't
         Assert.assertFalse(table1.containsKey("value"));
 
-        // Table should now have zero size for encoding
+        // Table should now have zero length for encoding
         checkEmpty(table1);
 
         //Looking up an invalid value returns null
@@ -499,19 +394,17 @@
      * Calls all methods that can be used to check the table is empty
      * - getEncodedSize
      * - isEmpty
-     * - size
+     * - length
      *
      * @param table to check is empty
      */
-    private void checkEmpty(PropertyFieldTable table)
+    private void checkEmpty(FieldTable table)
     {
         Assert.assertEquals(0, table.getEncodedSize());
         Assert.assertTrue(table.isEmpty());
         Assert.assertEquals(0, table.size());
 
         Assert.assertEquals(0, table.keySet().size());
-        Assert.assertEquals(0, table.values().size());
-        Assert.assertEquals(0, table.entrySet().size());
     }
 
 
@@ -521,7 +414,7 @@
      */
     public void testString()
     {
-        PropertyFieldTable table1 = new PropertyFieldTable();
+        FieldTable table1 = new FieldTable();
         table1.setString("value", "Hello");
         Assert.assertTrue(table1.propertyExists("value"));
 
@@ -562,79 +455,11 @@
     }
 
 
-    /**
-     * Test that the generated XML can be used to create a field table with the same values.
-     */
-    public void testValidXML()
-    {
-        PropertyFieldTable table1 = new PropertyFieldTable();
-        table1.setBoolean("bool", true);
-        table1.setByte("byte", Byte.MAX_VALUE);
-        byte[] bytes = {99, 98, 97, 96, 95};
-        table1.setBytes("bytes", bytes);
-        table1.setChar("char", 'c');
-        table1.setDouble("double", Double.MAX_VALUE);
-        table1.setFloat("float", Float.MAX_VALUE);
-        table1.setInteger("int", Integer.MAX_VALUE);
-        table1.setLong("long", Long.MAX_VALUE);
-        table1.setShort("short", Short.MAX_VALUE);
-        table1.setString("string", "Hello");
-        table1.setString("null-string", null);
-
-        table1.setObject("object-bool", true);
-        table1.setObject("object-byte", Byte.MAX_VALUE);
-        table1.setObject("object-bytes", bytes);
-        table1.setObject("object-char", 'c');
-        table1.setObject("object-double", Double.MAX_VALUE);
-        table1.setObject("object-float", Float.MAX_VALUE);
-        table1.setObject("object-int", Integer.MAX_VALUE);
-        table1.setObject("object-long", Long.MAX_VALUE);
-        table1.setObject("object-short", Short.MAX_VALUE);
-        table1.setObject("object-string", "Hello");
-
-        Assert.assertEquals(21, table1.size());
-
-        String table1XML = table1.toString();
-
-        PropertyFieldTable table2 = new PropertyFieldTable(table1XML);
-
-        Assert.assertEquals(table1XML, table2.toString());
-
-        //Check that when bytes is written out as a string with no new line between items that it is read in ok.
-
-    }
-
-    /**
-     * Test that invalid input throws the correct Exception
-     */
-    public void testInvalidXML()
-    {
-        try
-        {
-            _logger.warn("Testing Invalid XML expecting IllegalArgumentException");
-            new PropertyFieldTable("Rubbish");
-            fail("IllegalArgumentException expected");
-        }
-        catch (IllegalArgumentException iae)
-        {
-            //normal path
-        }
-        try
-        {
-            _logger.warn("Testing Invalid XML expecting IllegalArgumentException");
-            new PropertyFieldTable("");
-            fail("IllegalArgumentException expected");
-        }
-        catch (IllegalArgumentException iae)
-        {
-            //normal path
-        }
-    }
-
+    
 
     public void testKeyEnumeration()
     {
-        PropertyFieldTable table = new PropertyFieldTable();
+        FieldTable table = new FieldTable();
         table.setLong("one", 1L);
         table.setLong("two", 2L);
         table.setLong("three", 3L);
@@ -652,7 +477,7 @@
 
     public void testValues()
     {
-        PropertyFieldTable table = new PropertyFieldTable();
+        FieldTable table = new FieldTable();
         table.setBoolean("bool", true);
         table.setByte("byte", Byte.MAX_VALUE);
         byte[] bytes = {99, 98, 97, 96, 95};
@@ -707,7 +532,7 @@
     {
         byte[] bytes = {99, 98, 97, 96, 95};
 
-        PropertyFieldTable table = new PropertyFieldTable();
+        FieldTable table = new FieldTable();
         table.setBoolean("bool", true);
         table.setByte("byte", Byte.MAX_VALUE);
 
@@ -732,7 +557,7 @@
 
         try
         {
-            PropertyFieldTable table2 = new PropertyFieldTable(buffer, length);
+            FieldTable table2 = new FieldTable(buffer, length);
 
             Assert.assertEquals((Boolean) true, table2.getBoolean("bool"));
             Assert.assertEquals((Byte) Byte.MAX_VALUE, table2.getByte("byte"));
@@ -756,7 +581,7 @@
 
     public void testEncodingSize()
     {
-        PropertyFieldTable result = new PropertyFieldTable();
+        FieldTable result = new FieldTable();
         int size = 0;
 
         result.setBoolean("boolean", true);
@@ -847,31 +672,31 @@
 //    public void testEncodingSize1()
 //    {
 //                PropertyFieldTable table = new PropertyFieldTable();
-//        int size = 0;
+//        int length = 0;
 //        result.put("one", 1L);
-//        size = EncodingUtils.encodedShortStringLength("one");
-//        size += 1 + EncodingUtils.encodedLongLength();
-//        assertEquals(size, result.getEncodedSize());
+//        length = EncodingUtils.encodedShortStringLength("one");
+//        length += 1 + EncodingUtils.encodedLongLength();
+//        assertEquals(length, result.getEncodedSize());
 //
 //        result.put("two", 2L);
-//        size += EncodingUtils.encodedShortStringLength("two");
-//        size += 1 + EncodingUtils.encodedLongLength();
-//        assertEquals(size, result.getEncodedSize());
+//        length += EncodingUtils.encodedShortStringLength("two");
+//        length += 1 + EncodingUtils.encodedLongLength();
+//        assertEquals(length, result.getEncodedSize());
 //
 //        result.put("three", 3L);
-//        size += EncodingUtils.encodedShortStringLength("three");
-//        size += 1 + EncodingUtils.encodedLongLength();
-//        assertEquals(size, result.getEncodedSize());
+//        length += EncodingUtils.encodedShortStringLength("three");
+//        length += 1 + EncodingUtils.encodedLongLength();
+//        assertEquals(length, result.getEncodedSize());
 //
 //        result.put("four", 4L);
-//        size += EncodingUtils.encodedShortStringLength("four");
-//        size += 1 + EncodingUtils.encodedLongLength();
-//        assertEquals(size, result.getEncodedSize());
+//        length += EncodingUtils.encodedShortStringLength("four");
+//        length += 1 + EncodingUtils.encodedLongLength();
+//        assertEquals(length, result.getEncodedSize());
 //
 //        result.put("five", 5L);
-//        size += EncodingUtils.encodedShortStringLength("five");
-//        size += 1 + EncodingUtils.encodedLongLength();
-//        assertEquals(size, result.getEncodedSize());
+//        length += EncodingUtils.encodedShortStringLength("five");
+//        length += 1 + EncodingUtils.encodedLongLength();
+//        assertEquals(length, result.getEncodedSize());
 //
 //        //fixme should perhaps be expanded to incorporate all types.
 //
@@ -907,7 +732,7 @@
      */
     public void testSetObject()
     {
-        PropertyFieldTable table = new PropertyFieldTable();
+        FieldTable table = new FieldTable();
 
         //Try setting a non primative object
 
@@ -920,7 +745,7 @@
         {
             //normal path
         }
-        // so size should be zero
+        // so length should be zero
         Assert.assertEquals(0, table.getEncodedSize());
     }
 
@@ -929,7 +754,7 @@
      */
     public void testCheckPropertyNameasNull()
     {
-        PropertyFieldTable table = new PropertyFieldTable();
+        FieldTable table = new FieldTable();
 
         try
         {
@@ -940,7 +765,7 @@
         {
             //normal path
         }
-        // so size should be zero
+        // so length should be zero
         Assert.assertEquals(0, table.getEncodedSize());
     }
 
@@ -950,7 +775,7 @@
      */
     public void testCheckPropertyNameasEmptyString()
     {
-        PropertyFieldTable table = new PropertyFieldTable();
+        FieldTable table = new FieldTable();
 
         try
         {
@@ -961,7 +786,7 @@
         {
             //normal path
         }
-        // so size should be zero
+        // so length should be zero
         Assert.assertEquals(0, table.getEncodedSize());
     }
 
@@ -971,7 +796,7 @@
      */
     public void testCheckPropertyNamehasMaxLength()
     {
-        PropertyFieldTable table = new PropertyFieldTable();
+        FieldTable table = new FieldTable();
 
         StringBuffer longPropertyName = new StringBuffer(129);
 
@@ -989,7 +814,7 @@
         {
             //normal path
         }
-        // so size should be zero
+        // so length should be zero
         Assert.assertEquals(0, table.getEncodedSize());
     }
 
@@ -999,7 +824,7 @@
      */
     public void testCheckPropertyNameStartCharacterIsLetter()
     {
-        PropertyFieldTable table = new PropertyFieldTable();
+        FieldTable table = new FieldTable();
 
         //Try a name that starts with a number
         try
@@ -1011,7 +836,7 @@
         {
             //normal path
         }
-        // so size should be zero
+        // so length should be zero
         Assert.assertEquals(0, table.getEncodedSize());
     }
 
@@ -1021,7 +846,7 @@
      */
     public void testCheckPropertyNameStartCharacterIsHashorDollar()
     {
-        PropertyFieldTable table = new PropertyFieldTable();
+        FieldTable table = new FieldTable();
 
         //Try a name that starts with a number
         try
@@ -1041,12 +866,10 @@
      */
     public void testContents()
     {
-        PropertyFieldTable table = new PropertyFieldTable();
+        FieldTable table = new FieldTable();
 
         table.put("StringProperty", "String");
 
-        Assert.assertTrue(table.containsValue("String"));
-
         Assert.assertEquals("String", table.get("StringProperty"));
 
         //Test Clear
@@ -1062,7 +885,7 @@
     public void testSets()
     {
 
-        PropertyFieldTable table = new PropertyFieldTable();
+        FieldTable table = new FieldTable();
 
         table.put("n1", "1");
         table.put("n2", "2");
@@ -1075,64 +898,10 @@
         Assert.assertFalse(iterator.hasNext());
 
 
-        iterator = table.values().iterator();
-        Assert.assertEquals("1", iterator.next());
-        Assert.assertEquals("2", iterator.next());
-        Assert.assertEquals("3", iterator.next());
-        Assert.assertFalse(iterator.hasNext());
-
-
-        iterator = table.entrySet().iterator();
-        Map.Entry entry = (Map.Entry) iterator.next();
-        Assert.assertEquals("n1", entry.getKey());
-        Assert.assertEquals("1", entry.getValue());
-        entry = (Map.Entry) iterator.next();
-        Assert.assertEquals("n2", entry.getKey());
-        Assert.assertEquals("2", entry.getValue());
-        entry = (Map.Entry) iterator.next();
-        Assert.assertEquals("n3", entry.getKey());
-        Assert.assertEquals("3", entry.getValue());
-        Assert.assertFalse(iterator.hasNext());
-
 
     }
 
 
-    /**
-     * Test that all the values are preserved after a putAll
-     */
-    public void testPutAll()
-    {
-        Map map = new HashMap();
-
-        map.put("char", 'c');
-        map.put("double", Double.MAX_VALUE);
-        map.put("float", Float.MAX_VALUE);
-        map.put("int", Integer.MAX_VALUE);
-        map.put("long", Long.MAX_VALUE);
-        map.put("short", Short.MAX_VALUE);
-
-        PropertyFieldTable table = new PropertyFieldTable();
-
-        table.putAll(map);
-
-        Assert.assertEquals(6, table.size());
-
-        Assert.assertTrue(table.containsKey("char"));
-        Assert.assertEquals('c', (char) table.getCharacter("char"));
-        Assert.assertTrue(table.containsKey("double"));
-        Assert.assertEquals(Double.MAX_VALUE, table.getDouble("double"));
-        Assert.assertTrue(table.containsKey("float"));
-        Assert.assertEquals(Float.MAX_VALUE, table.getFloat("float"));
-        Assert.assertTrue(table.containsKey("int"));
-        Assert.assertEquals(Integer.MAX_VALUE, (int) table.getInteger("int"));
-        Assert.assertTrue(table.containsKey("long"));
-        Assert.assertEquals(Long.MAX_VALUE, (long) table.getLong("long"));
-        Assert.assertTrue(table.containsKey("short"));
-        Assert.assertEquals(Short.MAX_VALUE, (short) table.getShort("short"));
-        Assert.assertEquals(Short.MAX_VALUE, (short) table.getShort("short"));
-    }
-
 
     private void assertBytesEqual(byte[] expected, byte[] actual)
     {
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
index 7a5217d..36e808a 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
@@ -520,7 +520,7 @@
                 Composite composite = new Composite(parent, SWT.BORDER);
                 composite.setLayout(new GridLayout());
                 composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-                ViewUtility.createTabularDataHolder(composite,(TabularDataSupport)attribute.getValue());
+                ViewUtility.createTabularDataHolder(_toolkit, composite,(TabularDataSupport)attribute.getValue());
             }
             else
             {
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
index d951642..58349ab 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
@@ -492,11 +492,11 @@
     {
         if (result instanceof TabularDataSupport)
         {
-            ViewUtility.createTabularDataHolder(parent, (TabularDataSupport)result);
+            ViewUtility.createTabularDataHolder(_toolkit, parent, (TabularDataSupport)result);
         }
         else if (result instanceof CompositeDataSupport)
         {
-            ViewUtility.populateCompositeDataHolder(parent, (CompositeDataSupport)result);
+            ViewUtility.populateCompositeDataHolder(_toolkit, parent, (CompositeDataSupport)result);
         }
     }  
     
@@ -521,6 +521,9 @@
      */
     private void clearParameterValues(Composite control)
     {
+        if (control == null)
+            return;
+        
         Control[] controls = control.getChildren();
         if (controls == null || controls.length == 0)
             return;
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java
index 995206f..ae3eef1 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java
@@ -51,6 +51,7 @@
 import org.eclipse.swt.widgets.MessageBox;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
 
 public class ViewUtility
 {
@@ -75,13 +76,11 @@
         SUPPORTED_ARRAY_DATATYPES.add("java.lang.Double");
         SUPPORTED_ARRAY_DATATYPES.add("java.util.Date");
     }
-
+    
     @SuppressWarnings("unchecked")
-    public static void createTabularDataHolder(Composite parent, TabularDataSupport tabularData)
+    public static void createTabularDataHolder(FormToolkit toolkit, Composite parent, TabularDataSupport tabularData)
     {
-        Composite composite = new Composite(parent, SWT.BORDER);
-        //composite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
-        //composite.setBackground(parent.getBackground());
+        Composite composite = toolkit.createComposite(parent, SWT.BORDER);
         GridLayout layout = new GridLayout(4, true);
         layout.horizontalSpacing = 0;
         layout.marginWidth = 0;
@@ -94,28 +93,27 @@
         ArrayList<Map.Entry> list = new ArrayList<Map.Entry>(entrySet);
         if (list.size() == 0)
         {
-            Text text = new Text(composite, SWT.CENTER | SWT.SINGLE | SWT.READ_ONLY);
-            text.setText(" No records ");
-            //text.setBackground(parent.getBackground());
+            Text text = toolkit.createText(composite, " No records ", SWT.CENTER | SWT.SINGLE | SWT.READ_ONLY);
             GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1);
             text.setLayoutData(layoutData);
             return;
         }  
-        // Attach the tabular record to be retrieve and shown
+        // Attach the tabular record to be retrieved and shown later when record is traversed
+        // using first/next/previous/last buttons
         composite.setData(list);
         
         // Create button and the composite for CompositeData
-        Composite compositeDataHolder = createCompositeDataHolder(composite,
+        Composite compositeDataHolder = createCompositeDataHolder(toolkit, composite,
                                         tabularData.getTabularType().getRowType());
 
         // display the first record
         CompositeData data = (CompositeData)(list.get(0)).getValue();
         composite.setData(INDEX, 0);
-        populateCompositeDataHolder(compositeDataHolder, data);
+        populateCompositeDataHolder(toolkit, compositeDataHolder, data);
         enableOrDisableTraversalButtons(composite);
     }
 
-    public static void enableOrDisableTraversalButtons(Composite composite)
+    private static void enableOrDisableTraversalButtons(Composite composite)
     {
         int index = (Integer)composite.getData(INDEX);
         int size = ((List)composite.getData()).size();
@@ -137,40 +135,36 @@
         }
     }
 
-    public static Composite createCompositeDataHolder(final Composite dataHolder, CompositeType compositeType)
+    public static Composite createCompositeDataHolder(final FormToolkit toolkit, final Composite dataHolder, CompositeType compositeType)
     {        
-        Label description = new Label(dataHolder, SWT.CENTER);
-        description.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false, 4, 1));
         String desc = compositeType.getDescription();
+        Label description = toolkit.createLabel(dataHolder, desc, SWT.CENTER);
+        description.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false, 4, 1));       
         // TODO nameLabel.setFont(font);
         description.setText(desc);
 
         // Add traversal buttons
-        final Button firstRecordButton = new Button(dataHolder, SWT.PUSH);
-        firstRecordButton.setText(FIRST);
+        final Button firstRecordButton = toolkit.createButton(dataHolder, FIRST, SWT.PUSH);
         GridData layoutData = new GridData (GridData.HORIZONTAL_ALIGN_END);
         layoutData.widthHint = 80;
         firstRecordButton.setLayoutData(layoutData);
 
-        final Button nextRecordButton = new Button(dataHolder, SWT.PUSH);
-        nextRecordButton.setText(NEXT);
+        final Button nextRecordButton = toolkit.createButton(dataHolder, NEXT, SWT.PUSH);
         layoutData = new GridData (GridData.HORIZONTAL_ALIGN_END);
         layoutData.widthHint = 80;
         nextRecordButton.setLayoutData(layoutData);
 
-        final Button previousRecordButton = new Button(dataHolder, SWT.PUSH);
-        previousRecordButton.setText(PREV);
+        final Button previousRecordButton = toolkit.createButton(dataHolder, PREV, SWT.PUSH);
         layoutData = new GridData (GridData.HORIZONTAL_ALIGN_BEGINNING);
         layoutData.widthHint = 80;
         previousRecordButton.setLayoutData(layoutData);
 
-        final Button lastRecordButton = new Button(dataHolder, SWT.PUSH);
-        lastRecordButton.setText(LAST);
+        final Button lastRecordButton = toolkit.createButton(dataHolder, LAST, SWT.PUSH);
         layoutData = new GridData (GridData.HORIZONTAL_ALIGN_BEGINNING);
         layoutData.widthHint = 80;
         lastRecordButton.setLayoutData(layoutData);
         
-        final Composite composite = new Composite(dataHolder, SWT.NONE);
+        final Composite composite = toolkit.createComposite(dataHolder, SWT.NONE);
         GridLayout layout = new GridLayout();
         layout.horizontalSpacing = layout.verticalSpacing = 0;
         layout.marginHeight = layout.marginWidth = 0;
@@ -195,7 +189,7 @@
 
                 Button traverseButton =(Button)e.widget; 
                 CompositeData data = getCompositeData(dataHolder, traverseButton.getText());
-                populateCompositeDataHolder(composite, data);
+                populateCompositeDataHolder(toolkit, composite, data);
                 enableOrDisableTraversalButtons(dataHolder);   
             }
         };
@@ -248,7 +242,7 @@
     }
 
     @SuppressWarnings("unchecked")
-    public static void populateCompositeDataHolder(Composite parent, CompositeData data/*String dataIndex*/)
+    public static void populateCompositeDataHolder(FormToolkit toolkit, Composite parent, CompositeData data/*String dataIndex*/)
     {
         Control[] oldControls = parent.getChildren();       
         for (int i = 0; i < oldControls.length; i++)
@@ -256,7 +250,7 @@
             oldControls[i].dispose();
         }
         
-        Composite compositeHolder = new Composite(parent, SWT.NONE);
+        Composite compositeHolder = toolkit.createComposite(parent, SWT.NONE);
         GridLayout layout = new GridLayout(4, false);
         layout.horizontalSpacing = 10;
         compositeHolder.setLayout(layout);
@@ -271,12 +265,10 @@
             OpenType itemType = data.getCompositeType().getType(itemName);
             if (compositeHolder.getData(itemName) == null)
             {
-                Label keyLabel = new Label(compositeHolder, SWT.TRAIL);
-                keyLabel.setText(itemName);
+                Label keyLabel = toolkit.createLabel(compositeHolder, itemName, SWT.TRAIL);
                 GridData layoutData = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
                 layoutData.minimumWidth = 70;
                 keyLabel.setLayoutData(layoutData);
-                System.out.println(itemType);
 
                 if (itemType.isArray())
                 {
@@ -298,12 +290,12 @@
                             
                             if (mimeType.equals("text/plain"))
                             {
-                                displayByteArray(compositeHolder, data, itemName, encoding);
+                                displayByteArray(toolkit, compositeHolder, data, itemName, encoding);
                             }
                         }
                         else
                         {
-                            displayNotSupportedDataType(compositeHolder);
+                            displayNotSupportedDataType(toolkit, compositeHolder);
                         }                        
                     }
                     // If array of any other supported type, show as a list of String array
@@ -313,23 +305,22 @@
                     }
                     else
                     {
-                        displayNotSupportedDataType(compositeHolder);
+                        displayNotSupportedDataType(toolkit, compositeHolder);
                     }
                 }
                 else if (itemType instanceof TabularType)
                 {
-                    Composite composite = new Composite(compositeHolder, SWT.NONE);
+                    Composite composite = toolkit.createComposite(compositeHolder, SWT.NONE);
                     composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 3, 1));
                     layout = new GridLayout();
                     layout.marginHeight = 0;
                     layout.marginWidth = 0;
                     composite.setLayout(layout);
-                    createTabularDataHolder(composite, (TabularDataSupport)data.get(itemName));
+                    createTabularDataHolder(toolkit, composite, (TabularDataSupport)data.get(itemName));
                 }
                 else
                 {
-                    Text valueText = new Text(compositeHolder, SWT.READ_ONLY | SWT.BORDER);
-                    valueText.setText(String.valueOf(data.get(itemName)));
+                    Text valueText = toolkit.createText(compositeHolder, String.valueOf(data.get(itemName)), SWT.READ_ONLY | SWT.BORDER);
                     valueText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 3, 1));
                 }
             }
@@ -340,7 +331,7 @@
     } //end of method
   
     
-    private static void displayByteArray(Composite compositeHolder, CompositeData data, String itemName, String encoding)
+    private static void displayByteArray(FormToolkit toolkit, Composite compositeHolder, CompositeData data, String itemName, String encoding)
     {
         Byte[] arrayItems = (Byte[])data.get(itemName);
         byte[] byteArray = new byte[arrayItems.length];
@@ -354,9 +345,8 @@
             String textMessage = new String(byteArray, encoding);
             System.out.println("\nMessage : \n" + textMessage + "\n");
 
-            Text valueText = new Text(compositeHolder, SWT.READ_ONLY | SWT.BORDER |
+            Text valueText = toolkit.createText(compositeHolder, textMessage, SWT.READ_ONLY | SWT.BORDER |
                     SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
-            valueText.setText(textMessage);
             GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1);
             gridData.heightHint = 300;
             valueText.setLayoutData(gridData);
@@ -369,8 +359,7 @@
     
     public static int popupInfoMessage(String title, String message)
     {
-        MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), 
-                                    SWT.ICON_INFORMATION | SWT.OK);
+        MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_INFORMATION | SWT.OK);
         messageBox.setMessage(message);
         messageBox.setText(title);
         int response = messageBox.open();
@@ -380,8 +369,7 @@
     
     public static int popupErrorMessage(String title, String message)
     {
-        MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), 
-                                    SWT.ICON_ERROR | SWT.OK);
+        MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_ERROR | SWT.OK);
         messageBox.setMessage(message);
         messageBox.setText(title);
         int response = messageBox.open();
@@ -425,8 +413,10 @@
         label.setLayoutData(new GridData(SWT.TRAIL, SWT.TOP, false, false));
         
         shell.open();
-        while (!shell.isDisposed()) {
-            if (!display.readAndDispatch()) {
+        while (!shell.isDisposed())
+        {
+            if (!display.readAndDispatch())
+            {
                 display.sleep();
             }
         }
@@ -446,6 +436,12 @@
         return shell;
     }
     
+    /**
+     * Creates a List widget for displaying array of strings
+     * @param compositeHolder
+     * @param data - containing the array item value
+     * @param itemName - item name
+     */
     private static void displayArrayItem(Composite compositeHolder, CompositeData data, String itemName)
     {
         Object[] arrayItems = (Object[])data.get(itemName);
@@ -457,21 +453,20 @@
         org.eclipse.swt.widgets.List list = new org.eclipse.swt.widgets.List(compositeHolder,
                 SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY);
         list.setItems(items);
-        list.setBackground(compositeHolder.getBackground());
+        //list.setBackground(compositeHolder.getBackground());
         list.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
     }
     
-    private static void displayNotSupportedDataType(Composite compositeHolder)
+    private static void displayNotSupportedDataType(FormToolkit toolkit, Composite compositeHolder)
     {
-        Text valueText = new Text(compositeHolder, SWT.READ_ONLY);
-        valueText.setText("Format is not supported to be displayed");
+        Text valueText = toolkit.createText(compositeHolder, "Format is not supported to be displayed", SWT.READ_ONLY);
         valueText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 3, 1));
     }
     
     /**
      * Converts the input string to displayable format by converting some character case or inserting space
      * @param input
-     * @return
+     * @return formatted string
      */
     public static String getDisplayText(String input)
     {
@@ -498,6 +493,10 @@
         return result.toString();
     }
     
+    /**
+     * Disposes the children of given Composite if not null and not already disposed
+     * @param parent composite
+     */
     public static void disposeChildren(Composite parent)
     {
         if (parent == null || parent.isDisposed())
diff --git a/java/pom.xml b/java/pom.xml
index b45c14b..dd63bbb 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -186,11 +186,11 @@
                               time, during the 'package' phase to capture the version of any resources added to jar files.
                               This svnversion command is always run in the top directory to accurately reflect the svnversion range accross all modules 
                               at the time of the build.
-                              The properties are placed into a file 'version.properties' in the target/classes directory of any child module that runs 
+                              The properties are placed into a file 'qpidversion.properties' in the target/classes directory of any child module that runs 
                               this plugin.
-                              The 'version.properties' file is loaded by the org.apache.qpid.common.QpidProperties class.
+                              The 'qpidversion.properties' file is loaded by the org.apache.qpid.common.QpidProperties class.
                               Be carefull of the possibility that the 'common' module may run this antrun plugin and recieve its own set of 
-                              version.properties and then the client or broker being built against an older version of the common library ending up with
+                              qpidversion.properties and then the client or broker being built against an older version of the common library ending up with
                               the wrong version information. This is unlikely to happen because the client or broker should pick up its own properties
                               from the classpath first. If this happens it will be obvious because the productName property will be 
                               'Qpid Common Utilities'. If this is a problem then push this ant task down into the client and broker poms and remove it
diff --git a/java/systests/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java b/java/systests/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java
index 5909ac0..05c57c2 100644
--- a/java/systests/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java
+++ b/java/systests/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java
@@ -22,12 +22,7 @@
 
 import junit.framework.TestCase;
 import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.BasicContentHeaderProperties;
-import org.apache.qpid.framing.BasicPublishBody;
-import org.apache.qpid.framing.ContentBody;
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.framing.FieldTableFactory;
+import org.apache.qpid.framing.*;
 import org.apache.qpid.server.queue.AMQMessage;
 import org.apache.qpid.server.queue.AMQQueue;
 import org.apache.qpid.server.queue.MessageHandleFactory;
@@ -153,7 +148,9 @@
 
     static BasicPublishBody getPublishRequest(String id)
     {
-        BasicPublishBody request = new BasicPublishBody();
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Establish some way to determine the version for the test.
+        BasicPublishBody request = new BasicPublishBody((byte)8, (byte)0);
         request.routingKey = id;
         return request;
     }
diff --git a/java/systests/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.java b/java/systests/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.java
index c8a87a0..40cb4ab 100644
--- a/java/systests/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.java
+++ b/java/systests/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.java
@@ -18,15 +18,10 @@
 package org.apache.qpid.server.exchange;
 
 import junit.framework.TestCase;
-import org.apache.qpid.server.management.ManagedObject;
 import org.apache.qpid.server.queue.AMQQueue;
 import org.apache.qpid.server.queue.QueueRegistry;
 import org.apache.qpid.server.registry.ApplicationRegistry;
 
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.TabularData;
-import java.util.ArrayList;
-
 /**
  * Unit test class for testing different Exchange MBean operations
  */
@@ -39,6 +34,7 @@
      * Test for direct exchange mbean
      * @throws Exception
      */
+	 /*
     public void testDirectExchangeMBean() throws Exception
     {
         DestNameExchange exchange = new DestNameExchange();
@@ -51,7 +47,7 @@
 
         TabularData data = mbean.bindings();
         ArrayList<CompositeData> list = new ArrayList<CompositeData>(data.values());
-        assertTrue(list.size() == 2);
+        assertTrue(list.length() == 2);
 
         // test general exchange properties
         assertEquals(mbean.getName(), "amq.direct");
@@ -60,11 +56,12 @@
         assertTrue(!mbean.isDurable());
         assertTrue(mbean.isAutoDelete());
     }
-
+*/
     /**
      * Test for "topic" exchange mbean
      * @throws Exception
      */
+	 /*
     public void testTopicExchangeMBean() throws Exception
     {
         DestWildExchange exchange = new DestWildExchange();
@@ -77,7 +74,7 @@
 
         TabularData data = mbean.bindings();
         ArrayList<CompositeData> list = new ArrayList<CompositeData>(data.values());
-        assertTrue(list.size() == 2);
+        assertTrue(list.length() == 2);
 
         // test general exchange properties
         assertEquals(mbean.getName(), "amq.topic");
@@ -86,11 +83,12 @@
         assertTrue(!mbean.isDurable());
         assertTrue(mbean.isAutoDelete());
     }
-
+*/
     /**
      * Test for "Headers" exchange mbean
      * @throws Exception
      */
+	 /*
     public void testHeadersExchangeMBean() throws Exception
     {
         HeadersExchange exchange = new HeadersExchange();
@@ -103,7 +101,7 @@
 
         TabularData data = mbean.bindings();
         ArrayList<CompositeData> list = new ArrayList<CompositeData>(data.values());
-        assertTrue(list.size() == 2);
+        assertTrue(list.length() == 2);
 
         // test general exchange properties
         assertEquals(mbean.getName(), "amq.headers");
@@ -112,6 +110,10 @@
         assertTrue(!mbean.isDurable());
         assertTrue(mbean.isAutoDelete());
     }
+*/
+public void testTest() throws Exception
+{
+}
 
     @Override
     protected void setUp() throws Exception
diff --git a/java/systests/src/test/java/org/apache/qpid/server/exchange/ReturnUnroutableMandatoryMessageTest.java b/java/systests/src/test/java/org/apache/qpid/server/exchange/ReturnUnroutableMandatoryMessageTest.java
index b125bc1..546c61e 100644
--- a/java/systests/src/test/java/org/apache/qpid/server/exchange/ReturnUnroutableMandatoryMessageTest.java
+++ b/java/systests/src/test/java/org/apache/qpid/server/exchange/ReturnUnroutableMandatoryMessageTest.java
@@ -2,7 +2,6 @@
 

 import junit.framework.TestCase;

 import org.apache.log4j.Logger;

-import org.apache.qpid.test.VMBrokerSetup;

 import org.apache.qpid.server.registry.ApplicationRegistry;

 import org.apache.qpid.server.util.TestApplicationRegistry;

 import org.apache.qpid.client.*;

@@ -11,7 +10,6 @@
 import org.apache.qpid.url.BindingURL;

 import org.apache.qpid.exchange.ExchangeDefaults;

 import org.apache.qpid.framing.FieldTable;

-import org.apache.qpid.framing.PropertyFieldTable;

 

 import javax.jms.*;

 import java.util.List;

@@ -63,7 +61,7 @@
         AMQSession consumerSession = (AMQSession) con.createSession(false, Session.CLIENT_ACKNOWLEDGE);

 

         AMQHeadersExchange queue = new AMQHeadersExchange(new AMQBindingURL(ExchangeDefaults.HEADERS_EXCHANGE_CLASS + "://" + ExchangeDefaults.HEADERS_EXCHANGE_NAME + "/test/queue1?" + BindingURL.OPTION_ROUTING_KEY + "='F0000=1'"));

-        FieldTable ft = new PropertyFieldTable();

+        FieldTable ft = new FieldTable();

         ft.setString("F1000", "1");

         MessageConsumer consumer = consumerSession.createConsumer(queue, AMQSession.DEFAULT_PREFETCH_LOW_MARK, AMQSession.DEFAULT_PREFETCH_HIGH_MARK, false, false, (String) null, ft);

 

diff --git a/java/systests/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java b/java/systests/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java
index 562452d..1520e5c 100644
--- a/java/systests/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java
+++ b/java/systests/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java
@@ -156,7 +156,9 @@
 
     private AMQMessage message(boolean immediate) throws AMQException
     {
-        BasicPublishBody publish = new BasicPublishBody();
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Establish some way to determine the version for the test.
+        BasicPublishBody publish = new BasicPublishBody((byte)8, (byte)0);
         publish.immediate = immediate;
         ContentHeaderBody contentHeaderBody = new ContentHeaderBody();
         contentHeaderBody.bodySize = 1000;   // in bytes       
diff --git a/java/systests/src/test/java/org/apache/qpid/server/queue/AckTest.java b/java/systests/src/test/java/org/apache/qpid/server/queue/AckTest.java
index d4ea728..b9b5634 100644
--- a/java/systests/src/test/java/org/apache/qpid/server/queue/AckTest.java
+++ b/java/systests/src/test/java/org/apache/qpid/server/queue/AckTest.java
@@ -88,7 +88,9 @@
         MessageHandleFactory factory = new MessageHandleFactory();
         for (int i = 1; i <= count; i++)
         {
-            BasicPublishBody publishBody = new BasicPublishBody();
+            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+            // TODO: Establish some way to determine the version for the test.
+            BasicPublishBody publishBody = new BasicPublishBody((byte)8, (byte)0);
             publishBody.routingKey = "rk";
             publishBody.exchange = "someExchange";
             AMQMessage msg = new AMQMessage(_messageStore.getNewMessageId(), publishBody, txnContext);
diff --git a/java/systests/src/test/java/org/apache/qpid/server/queue/MessageTestHelper.java b/java/systests/src/test/java/org/apache/qpid/server/queue/MessageTestHelper.java
index 7843d8a..85c7ff9 100644
--- a/java/systests/src/test/java/org/apache/qpid/server/queue/MessageTestHelper.java
+++ b/java/systests/src/test/java/org/apache/qpid/server/queue/MessageTestHelper.java
@@ -56,7 +56,9 @@
 
     AMQMessage message(boolean immediate) throws AMQException
     {
-        BasicPublishBody publish = new BasicPublishBody();
+        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
+        // TODO: Establish some way to determine the version for the test.
+        BasicPublishBody publish = new BasicPublishBody((byte)8, (byte)0);
         publish.immediate = immediate;
         return new AMQMessage(_messageStore.getNewMessageId(), publish, _txnContext,
                               new ContentHeaderBody());