You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2007/01/04 23:11:39 UTC
svn commit: r492777 - in /incubator/qpid/branches/qpid.0-9: java/broker/etc/
java/common/src/main/java/org/apache/qpid/framing/ python/qpid/
Author: rhs
Date: Thu Jan 4 14:11:38 2007
New Revision: 492777
URL: http://svn.apache.org/viewvc?view=rev&rev=492777
Log:
svn merge -r492717:492730 from the trunk
Modified:
incubator/qpid/branches/qpid.0-9/java/broker/etc/config.xml
incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/AMQType.java
incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/AMQTypeMap.java
incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java
incubator/qpid/branches/qpid.0-9/python/qpid/connection.py
incubator/qpid/branches/qpid.0-9/python/qpid/spec.py
Modified: incubator/qpid/branches/qpid.0-9/java/broker/etc/config.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/broker/etc/config.xml?view=diff&rev=492777&r1=492776&r2=492777
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/broker/etc/config.xml (original)
+++ incubator/qpid/branches/qpid.0-9/java/broker/etc/config.xml Thu Jan 4 14:11:38 2007
@@ -69,7 +69,7 @@
<class>org.apache.qpid.server.security.auth.amqplain.AmqPlainInitialiser</class>
<principal-database>passwordfile</principal-database>
</initialiser>
- </mechanism>-->
+ </mechanism>
<mechanism>
<initialiser>
<class>org.apache.qpid.server.security.auth.plain.PlainInitialiser</class>
Modified: incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/AMQType.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/AMQType.java?view=diff&rev=492777&r1=492776&r2=492777
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/AMQType.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/AMQType.java Thu Jan 4 14:11:38 2007
@@ -28,35 +28,39 @@
//AMQP FieldTable Wire Types
- DECIMAL('D')
+ LONG_STRING('S')
{
-
public int getEncodingSize(Object value)
{
- // TODO : fixme
- throw new UnsupportedOperationException();
+ return EncodingUtils.encodedLongStringLength((String) value);
}
- public Object toNativeValue(Object value)
+
+ public String toNativeValue(Object value)
{
- // TODO : fixme
- throw new UnsupportedOperationException();
+ if (value != null)
+ {
+ return value.toString();
+ }
+ else
+ {
+ throw new NullPointerException("Cannot convert: null to String.");
+ }
}
public void writeValueImpl(Object value, ByteBuffer buffer)
{
- // TODO : fixme
- throw new UnsupportedOperationException();
+ EncodingUtils.writeLongStringBytes(buffer, (String) value);
}
public Object readValueFromBuffer(ByteBuffer buffer)
{
- // TODO : fixme
- throw new UnsupportedOperationException();
+ return EncodingUtils.readLongString(buffer);
}
+
},
- UNSIGNED_SHORT('S')
+ INTEGER('I')
{
public int getEncodingSize(Object value)
@@ -65,6 +69,7 @@
throw new UnsupportedOperationException();
}
+
public Object toNativeValue(Object value)
{
// TODO : fixme
@@ -82,10 +87,9 @@
// TODO : fixme
throw new UnsupportedOperationException();
}
-
},
- UNSIGNED_INT('I')
+ DECIMAL('D')
{
public int getEncodingSize(Object value)
@@ -94,7 +98,6 @@
throw new UnsupportedOperationException();
}
-
public Object toNativeValue(Object value)
{
// TODO : fixme
@@ -114,7 +117,7 @@
}
},
- UNSIGNED_LONG('L')
+ TIMESTAMP('T')
{
public int getEncodingSize(Object value)
@@ -124,7 +127,7 @@
}
- public Long toNativeValue(Object value)
+ public Object toNativeValue(Object value)
{
// TODO : fixme
throw new UnsupportedOperationException();
@@ -143,9 +146,8 @@
}
},
- EXTTENDED('D')
+ FIELD_TABLE('F')
{
-
public int getEncodingSize(Object value)
{
// TODO : fixme
@@ -172,35 +174,39 @@
}
},
- TIMESTAMP('T')
+ VOID('V')
{
-
public int getEncodingSize(Object value)
{
- // TODO : fixme
- throw new UnsupportedOperationException();
+ return 0;
}
public Object toNativeValue(Object value)
{
- // TODO : fixme
- throw new UnsupportedOperationException();
+ 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)
{
- // TODO : fixme
- throw new UnsupportedOperationException();
}
public Object readValueFromBuffer(ByteBuffer buffer)
{
- // TODO : fixme
- throw new UnsupportedOperationException();
+ return null;
}
},
+ // Extended types
+
BINARY('x')
{
public int getEncodingSize(Object value)
@@ -299,38 +305,6 @@
}
},
- 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)
@@ -368,77 +342,77 @@
}
},
- BYTE('b')
+ ASCII_CHARACTER('k')
{
public int getEncodingSize(Object value)
{
- return EncodingUtils.encodedByteLength();
+ return EncodingUtils.encodedCharLength();
}
- public Byte toNativeValue(Object value)
+ public Character toNativeValue(Object value)
{
- if (value instanceof Byte)
+ if (value instanceof Character)
{
- return (Byte) value;
+ return (Character) value;
}
- else if ((value instanceof String) || (value == null))
+ else if (value == null)
{
- return Byte.valueOf((String)value);
+ throw new NullPointerException("Cannot convert null into char");
}
else
{
throw new NumberFormatException("Cannot convert: " + value + "(" +
- value.getClass().getName() + ") to byte.");
+ value.getClass().getName() + ") to char.");
}
}
public void writeValueImpl(Object value, ByteBuffer buffer)
{
- EncodingUtils.writeByte(buffer, (Byte) value);
+ EncodingUtils.writeChar(buffer, (Character) value);
}
public Object readValueFromBuffer(ByteBuffer buffer)
{
- return EncodingUtils.readByte(buffer);
+ return EncodingUtils.readChar(buffer);
}
+
},
- ASCII_CHARACTER('k')
+ BYTE('b')
{
public int getEncodingSize(Object value)
{
- return EncodingUtils.encodedCharLength();
+ return EncodingUtils.encodedByteLength();
}
- public Character toNativeValue(Object value)
+ public Byte toNativeValue(Object value)
{
- if (value instanceof Character)
+ if (value instanceof Byte)
{
- return (Character) value;
+ return (Byte) value;
}
- else if (value == null)
+ else if ((value instanceof String) || (value == null))
{
- throw new NullPointerException("Cannot convert null into char");
+ return Byte.valueOf((String)value);
}
else
{
throw new NumberFormatException("Cannot convert: " + value + "(" +
- value.getClass().getName() + ") to char.");
+ value.getClass().getName() + ") to byte.");
}
}
public void writeValueImpl(Object value, ByteBuffer buffer)
{
- EncodingUtils.writeChar(buffer, (Character) value);
+ EncodingUtils.writeByte(buffer, (Byte) value);
}
public Object readValueFromBuffer(ByteBuffer buffer)
{
- return EncodingUtils.readChar(buffer);
+ return EncodingUtils.readByte(buffer);
}
-
},
SHORT('s')
Modified: incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/AMQTypeMap.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/AMQTypeMap.java?view=diff&rev=492777&r1=492776&r2=492777
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/AMQTypeMap.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/AMQTypeMap.java Thu Jan 4 14:11:38 2007
@@ -37,7 +37,12 @@
public static AMQType getType(Byte identifier)
{
- return _reverseTypeMap.get(identifier);
+ AMQType result = _reverseTypeMap.get(identifier);
+ if (result == null) {
+ throw new IllegalArgumentException
+ ("no such type code: " + Integer.toHexString(identifier.intValue()));
+ }
+ return result;
}
}
Modified: incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java?view=diff&rev=492777&r1=492776&r2=492777
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java Thu Jan 4 14:11:38 2007
@@ -257,7 +257,7 @@
checkPropertyName(string);
if (value == null)
{
- return _properties.put(string, AMQType.NULL_STRING.asTypedValue(null));
+ return _properties.put(string, AMQType.VOID.asTypedValue(null));
}
else
{
@@ -344,7 +344,7 @@
public boolean isNullStringValue(String name)
{
AMQTypedValue value = _properties.get(name);
- return (value != null) && (value.getType() == AMQType.NULL_STRING);
+ return (value != null) && (value.getType() == AMQType.VOID);
}
// ***** Methods
Modified: incubator/qpid/branches/qpid.0-9/python/qpid/connection.py
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/python/qpid/connection.py?view=diff&rev=492777&r1=492776&r2=492777
==============================================================================
--- incubator/qpid/branches/qpid.0-9/python/qpid/connection.py (original)
+++ incubator/qpid/branches/qpid.0-9/python/qpid/connection.py Thu Jan 4 14:11:38 2007
@@ -59,7 +59,7 @@
self.host = host
self.port = port
self.spec = spec
- self.FRAME_END = self.spec.constants.byname["frame end"].id
+ self.FRAME_END = self.spec.constants.bypyname["frame_end"].id
def connect(self):
sock = socket.socket()
@@ -78,14 +78,14 @@
def write(self, frame):
c = self.codec
- c.encode_octet(self.spec.constants.byname[frame.payload.type].id)
+ c.encode_octet(self.spec.constants.bypyname[frame.payload.type].id)
c.encode_short(frame.channel)
frame.payload.encode(c)
c.encode_octet(self.FRAME_END)
def read(self):
c = self.codec
- type = self.spec.constants.byid[c.decode_octet()].name
+ type = pythonize(self.spec.constants.byid[c.decode_octet()].name)
channel = c.decode_short()
payload = Frame.DECODERS[type].decode(self.spec, c)
end = c.decode_octet()
@@ -96,14 +96,14 @@
class Frame:
- METHOD = "frame method"
- HEADER = "frame header"
- BODY = "frame body"
- OOB_METHOD = "frame oob method"
- OOB_HEADER = "frame oob header"
- OOB_BODY = "frame oob body"
- TRACE = "frame trace"
- HEARTBEAT = "frame heartbeat"
+ METHOD = "frame_method"
+ HEADER = "frame_header"
+ BODY = "frame_body"
+ OOB_METHOD = "frame_oob_method"
+ OOB_HEADER = "frame_oob_header"
+ OOB_BODY = "frame_oob_body"
+ TRACE = "frame_trace"
+ HEARTBEAT = "frame_heartbeat"
DECODERS = {}
Modified: incubator/qpid/branches/qpid.0-9/python/qpid/spec.py
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/python/qpid/spec.py?view=diff&rev=492777&r1=492776&r2=492777
==============================================================================
--- incubator/qpid/branches/qpid.0-9/python/qpid/spec.py (original)
+++ incubator/qpid/branches/qpid.0-9/python/qpid/spec.py Thu Jan 4 14:11:38 2007
@@ -189,7 +189,8 @@
"short": 0,
"long": 0,
"longlong": 0,
- "timestamp": 0}
+ "timestamp": 0,
+ "content": None}
def define_method(self, name):
g = {Method.METHOD: self}
@@ -233,9 +234,11 @@
def load_fields(nd, l, domains):
for f_nd in nd["field"]:
try:
- type = f_nd["@type"]
+ type = f_nd["@domain"]
except KeyError:
- type = domains[f_nd["@domain"]]
+ type = f_nd["@type"]
+ while domains.has_key(type) and domains[type] != type:
+ type = domains[type]
l.add(Field(f_nd["@name"], f_nd.index(), type, get_docs(f_nd)))
def load(specfile):