diff options
| author | Ted Ross <tross@apache.org> | 2009-12-11 13:52:48 +0000 |
|---|---|---|
| committer | Ted Ross <tross@apache.org> | 2009-12-11 13:52:48 +0000 |
| commit | 3bc7e889caef716d8fdd8006f2d53b821ecef6c1 (patch) | |
| tree | 9ec4173ccd99f4fc3c29fd229fdef322f66ec9ed /qpid/java/management/agent/src | |
| parent | ea80bee0d468ffab3dfec89ffcd171ad54fdd3c4 (diff) | |
| download | qpid-python-3bc7e889caef716d8fdd8006f2d53b821ecef6c1.tar.gz | |
QPID-2245 QMF protocol changes will make 0.6 incompatible with 0.5
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@889619 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/management/agent/src')
3 files changed, 17 insertions, 58 deletions
diff --git a/qpid/java/management/agent/src/main/java/org/apache/qpid/agent/Agent.java b/qpid/java/management/agent/src/main/java/org/apache/qpid/agent/Agent.java index 40797d51f9..f6ae6adbc3 100644 --- a/qpid/java/management/agent/src/main/java/org/apache/qpid/agent/Agent.java +++ b/qpid/java/management/agent/src/main/java/org/apache/qpid/agent/Agent.java @@ -239,7 +239,7 @@ public class Agent implements MessageListener throw new AgentException(e); } byte[] magic = dec.readBytes(3); - if (magic[0] != 'A' || magic[1] != 'M' || magic[2] != '3') + if (magic[0] != 'A' || magic[1] != 'M' || magic[2] != '2') { throw new AgentException("bad magic: " + new String(magic)); } @@ -475,7 +475,7 @@ public class Agent implements MessageListener enc.init(); enc.writeUint8((short) 'A'); enc.writeUint8((short) 'M'); - enc.writeUint8((short) '3'); + enc.writeUint8((short) '2'); enc.writeUint8((short) opcode); enc.writeUint32(sequence); return enc; diff --git a/qpid/java/management/agent/src/main/java/org/apache/qpid/agent/binding/ClassBinding.java b/qpid/java/management/agent/src/main/java/org/apache/qpid/agent/binding/ClassBinding.java index 7c324fadb9..0a74958023 100644 --- a/qpid/java/management/agent/src/main/java/org/apache/qpid/agent/binding/ClassBinding.java +++ b/qpid/java/management/agent/src/main/java/org/apache/qpid/agent/binding/ClassBinding.java @@ -356,13 +356,13 @@ public class ClassBinding implements TypeBinding enc.writeStr8(name); enc.writeBin128(this.getSchemaHash()); // schema hash // Send true (1) if we have a super-type - if (superType == null) - { - enc.writeUint8((short) 0); - } else - { - enc.writeUint8((short) 1); - } + //if (superType == null) + //{ + // enc.writeUint8((short) 0); + //} else + //{ + // enc.writeUint8((short) 1); + //} enc.writeUint16(properties.size()); // Events do not have the method size sent if (kind == 1) @@ -371,12 +371,12 @@ public class ClassBinding implements TypeBinding enc.writeUint16(methods.size()); } // Add the super type information if we have it - if (superType != null) - { - enc.writeStr8(superType.pkg); - enc.writeStr8(superType.name); - enc.writeBin128(superType.getSchemaHash()); // schema hash - } + //if (superType != null) + //{ + // enc.writeStr8(superType.pkg); + // enc.writeStr8(superType.name); + // enc.writeBin128(superType.getSchemaHash()); // schema hash + //} for (PropertyBinding p : properties) { log.trace("encoding property " + p.getName()); diff --git a/qpid/java/management/agent/src/main/java/org/apache/qpid/agent/binding/MapBinding.java b/qpid/java/management/agent/src/main/java/org/apache/qpid/agent/binding/MapBinding.java index 80889f3b4e..02d562a59a 100644 --- a/qpid/java/management/agent/src/main/java/org/apache/qpid/agent/binding/MapBinding.java +++ b/qpid/java/management/agent/src/main/java/org/apache/qpid/agent/binding/MapBinding.java @@ -49,53 +49,12 @@ public class MapBinding implements TypeBinding public void encode(Encoder enc, Object value) { Map map = (Map) value; - BBEncoder newEncoder = new BBEncoder(10); - newEncoder.writeUint32(map.size()); - for (Object key : map.keySet()) - { - String keyString = key.toString(); - Object mapValue = map.get(key); - TypeBinding binding = bctx.getTypeBinding(mapValue.getClass()); - newEncoder.writeStr8(keyString); - newEncoder.writeUint8(binding.getCode()); - binding.encode(newEncoder, mapValue); - } - enc.writeVbin32(newEncoder.buffer().array()); + enc.writeMap(map); } public Object decode(Decoder dec) { - Map map = null; - try - { - if (javaClass.isInterface()) - { - map = new HashMap(); - } else - { - map = (Map) javaClass.newInstance(); - } - } catch (Exception e) - { - throw new BindingException( - "Could not create a Map implementation for " - + javaClass.getName(), e); - } - BBDecoder newDecoder = new BBDecoder(); - newDecoder.init(ByteBuffer.wrap(dec.readVbin32())); - long count = newDecoder.readUint32(); - while (count > 0) - { - String key = newDecoder.readStr8(); - short typeCode = newDecoder.readUint8(); - TypeBinding type = QMFTypeBinding.getType(typeCode); - if (type == null) - { - type = bctx.getTypeBinding(Object.class); - } - map.put(key, type.decode(newDecoder)); - count -= 1; - } + Map map = dec.readMap(); return map; } |
