diff options
author | Robert Greig <rgreig@apache.org> | 2007-01-24 20:50:47 +0000 |
---|---|---|
committer | Robert Greig <rgreig@apache.org> | 2007-01-24 20:50:47 +0000 |
commit | 9fe1026450626ed29511466b8f3ddebe844ea894 (patch) | |
tree | 1a4ff54d1882db55b1066d639f56436775e3e649 /java/common | |
parent | 485c128337350ea77dbc469122fe01141c03d055 (diff) | |
download | qpid-python-9fe1026450626ed29511466b8f3ddebe844ea894.tar.gz |
QPID-317 : Patch supplied by Rob Godfrey - Remove dependency on JMS from common / broker.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@499563 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common')
-rw-r--r-- | java/common/pom.xml | 5 | ||||
-rw-r--r-- | java/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java | 473 |
2 files changed, 0 insertions, 478 deletions
diff --git a/java/common/pom.xml b/java/common/pom.xml index 3a7d971173..7472b5ef7d 100644 --- a/java/common/pom.xml +++ b/java/common/pom.xml @@ -97,11 +97,6 @@ </dependency> <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jms_1.1_spec</artifactId> - </dependency> - - <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> 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 ed6ab63ded..1045b02868 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 @@ -22,11 +22,7 @@ package org.apache.qpid.framing; import org.apache.log4j.Logger; import org.apache.mina.common.ByteBuffer; -import org.apache.qpid.AMQPInvalidClassException; -import javax.jms.JMSException; -import javax.jms.MessageFormatException; -import java.util.Enumeration; public class BasicContentHeaderProperties implements ContentHeaderProperties { @@ -659,474 +655,5 @@ public class BasicContentHeaderProperties implements ContentHeaderProperties ",JMSType = " + _type; } - // MapMessage Interface - public boolean getBoolean(String string) throws JMSException - { - Boolean b = getHeaders().getBoolean(string); - - if (b == null) - { - if (getHeaders().containsKey(string)) - { - Object str = getHeaders().getObject(string); - - if (str == null || !(str instanceof String)) - { - throw new MessageFormatException("getBoolean can't use " + string + " item."); - } - else - { - return Boolean.valueOf((String) str); - } - } - else - { - b = Boolean.valueOf(null); - } - } - - return b; - } - - public boolean getBoolean(AMQShortString string) throws JMSException - { - Boolean b = getHeaders().getBoolean(string); - - if (b == null) - { - if (getHeaders().containsKey(string)) - { - Object str = getHeaders().getObject(string); - - if (str == null || !(str instanceof String)) - { - throw new MessageFormatException("getBoolean can't use " + string + " item."); - } - else - { - return Boolean.valueOf((String) str); - } - } - else - { - b = Boolean.valueOf(null); - } - } - - return b; - } - - public char getCharacter(String string) throws JMSException - { - Character c = getHeaders().getCharacter(string); - - if (c == null) - { - if (getHeaders().isNullStringValue(string)) - { - throw new NullPointerException("Cannot convert null char"); - } - else - { - throw new MessageFormatException("getChar can't use " + string + " item."); - } - } - else - { - return (char) c; - } - } - - public byte[] getBytes(String string) throws JMSException - { - return getBytes(new AMQShortString(string)); - } - - public byte[] getBytes(AMQShortString string) throws JMSException - { - byte[] bs = getHeaders().getBytes(string); - - if (bs == null) - { - throw new MessageFormatException("getBytes can't use " + string + " item."); - } - else - { - return bs; - } - } - - public byte getByte(String string) throws JMSException - { - Byte b = getHeaders().getByte(string); - if (b == null) - { - if (getHeaders().containsKey(string)) - { - Object str = getHeaders().getObject(string); - - if (str == null || !(str instanceof String)) - { - throw new MessageFormatException("getByte can't use " + string + " item."); - } - else - { - return Byte.valueOf((String) str); - } - } - else - { - b = Byte.valueOf(null); - } - } - - return b; - } - - public short getShort(String string) throws JMSException - { - Short s = getHeaders().getShort(string); - - if (s == null) - { - s = Short.valueOf(getByte(string)); - } - - return s; - } - - public int getInteger(String string) throws JMSException - { - Integer i = getHeaders().getInteger(string); - - if (i == null) - { - i = Integer.valueOf(getShort(string)); - } - - return i; - } - - public long getLong(String string) throws JMSException - { - Long l = getHeaders().getLong(string); - - if (l == null) - { - l = Long.valueOf(getInteger(string)); - } - - return l; - } - - public float getFloat(String string) throws JMSException - { - Float f = getHeaders().getFloat(string); - - if (f == null) - { - if (getHeaders().containsKey(string)) - { - Object str = getHeaders().getObject(string); - - if (str == null || !(str instanceof String)) - { - throw new MessageFormatException("getFloat can't use " + string + " item."); - } - else - { - return Float.valueOf((String) str); - } - } - else - { - f = Float.valueOf(null); - } - - } - - return f; - } - - public double getDouble(String string) throws JMSException - { - Double d = getHeaders().getDouble(string); - - if (d == null) - { - d = Double.valueOf(getFloat(string)); - } - - return d; - } - - public String getString(String string) throws JMSException - { - String s = getHeaders().getString(string); - - if (s == null) - { - if (getHeaders().containsKey(string)) - { - Object o = getHeaders().getObject(string); - if (o instanceof byte[]) - { - throw new MessageFormatException("getObject couldn't find " + string + " item."); - } - else - { - if (o == null) - { - return null; - } - else - { - s = String.valueOf(o); - } - } - } - } - - return s; - } - - public Object getObject(String string) throws JMSException - { - return getHeaders().getObject(string); - } - - public void setBoolean(AMQShortString string, boolean b) throws JMSException - { - checkPropertyName(string); - getHeaders().setBoolean(string, b); - } - - public void setBoolean(String string, boolean b) throws JMSException - { - checkPropertyName(string); - getHeaders().setBoolean(string, b); - } - - public void setChar(String string, char c) throws JMSException - { - checkPropertyName(string); - getHeaders().setChar(string, c); - } - - public Object setBytes(AMQShortString string, byte[] bytes) - { - return getHeaders().setBytes(string, bytes); - } - - public Object setBytes(String string, byte[] bytes) - { - return getHeaders().setBytes(string, bytes); - } - - public Object setBytes(String string, byte[] bytes, int start, int length) - { - return getHeaders().setBytes(string, bytes, start, length); - } - - public void setByte(String string, byte b) throws JMSException - { - checkPropertyName(string); - getHeaders().setByte(string, b); - } - - public void setShort(String string, short i) throws JMSException - { - checkPropertyName(string); - getHeaders().setShort(string, i); - } - - public void setInteger(String string, int i) throws JMSException - { - checkPropertyName(string); - getHeaders().setInteger(string, i); - } - - public void setLong(String string, long l) throws JMSException - { - checkPropertyName(string); - getHeaders().setLong(string, l); - } - - public void setFloat(String string, float v) throws JMSException - { - checkPropertyName(string); - getHeaders().setFloat(string, v); - } - - public void setDouble(String string, double v) throws JMSException - { - checkPropertyName(string); - getHeaders().setDouble(string, v); - } - - public void setString(String string, String string1) throws JMSException - { - checkPropertyName(string); - getHeaders().setString(string, string1); - } - - public void setString(AMQShortString string, String string1) throws JMSException - { - checkPropertyName(string); - getHeaders().setString(string, string1); - } - - public void setObject(String string, Object object) throws JMSException - { - checkPropertyName(string); - try - { - getHeaders().setObject(string, object); - } - catch (AMQPInvalidClassException aice) - { - throw new MessageFormatException("Only primatives are allowed object is:" + object.getClass()); - } - } - public boolean itemExists(String string) throws JMSException - { - return getHeaders().containsKey(string); - } - - public Enumeration getPropertyNames() - { - return getHeaders().getPropertyNames(); - } - - public void clear() - { - getHeaders().clear(); - } - - public boolean propertyExists(AMQShortString propertyName) - { - return getHeaders().propertyExists(propertyName); - } - - public boolean propertyExists(String propertyName) - { - return getHeaders().propertyExists(propertyName); - } - - public Object put(Object key, Object value) - { - return getHeaders().setObject(key.toString(), value); - } - - public Object remove(AMQShortString propertyName) - { - return getHeaders().remove(propertyName); - } - - public Object remove(String propertyName) - { - return getHeaders().remove(propertyName); - } - - public boolean isEmpty() - { - return getHeaders().isEmpty(); - } - - public void writeToBuffer(ByteBuffer data) - { - getHeaders().writeToBuffer(data); - } - - public Enumeration getMapNames() - { - return getPropertyNames(); - } - - protected static void checkPropertyName(CharSequence propertyName) - { - if (propertyName == null) - { - throw new IllegalArgumentException("Property name must not be null"); - } - else if (propertyName.length() == 0) - { - throw new IllegalArgumentException("Property name must not be the empty string"); - } - - checkIdentiferFormat(propertyName); - } - - protected static void checkIdentiferFormat(CharSequence propertyName) - { -// JMS requirements 3.5.1 Property Names -// Identifiers: -// - An identifier is an unlimited-length character sequence that must begin -// with a Java identifier start character; all following characters must be Java -// identifier part characters. An identifier start character is any character for -// which the method Character.isJavaIdentifierStart returns true. This includes -// '_' and '$'. An identifier part character is any character for which the -// method Character.isJavaIdentifierPart returns true. -// - Identifiers cannot be the names NULL, TRUE, or FALSE. -// – Identifiers cannot be NOT, AND, OR, BETWEEN, LIKE, IN, IS, or -// ESCAPE. -// – Identifiers are either header field references or property references. The -// type of a property value in a message selector corresponds to the type -// used to set the property. If a property that does not exist in a message is -// referenced, its value is NULL. The semantics of evaluating NULL values -// in a selector are described in Section 3.8.1.2, “Null Values.” -// – The conversions that apply to the get methods for properties do not -// apply when a property is used in a message selector expression. For -// example, suppose you set a property as a string value, as in the -// following: -// myMessage.setStringProperty("NumberOfOrders", "2"); -// The following expression in a message selector would evaluate to false, -// because a string cannot be used in an arithmetic expression: -// "NumberOfOrders > 1" -// – Identifiers are case sensitive. -// – Message header field references are restricted to JMSDeliveryMode, -// JMSPriority, JMSMessageID, JMSTimestamp, JMSCorrelationID, and -// JMSType. JMSMessageID, JMSCorrelationID, and JMSType values may be -// null and if so are treated as a NULL value. - - if (Boolean.getBoolean("strict-jms")) - { - // JMS start character - if (!(Character.isJavaIdentifierStart(propertyName.charAt(0)))) - { - throw new IllegalArgumentException("Identifier '" + propertyName + "' does not start with a valid JMS identifier start character"); - } - - // JMS part character - int length = propertyName.length(); - for (int c = 1; c < length; c++) - { - if (!(Character.isJavaIdentifierPart(propertyName.charAt(c)))) - { - throw new IllegalArgumentException("Identifier '" + propertyName + "' contains an invalid JMS identifier character"); - } - } - - - - - // JMS invalid names - if ((propertyName.equals("NULL") - || propertyName.equals("TRUE") - || propertyName.equals("FALSE") - || propertyName.equals("NOT") - || propertyName.equals("AND") - || propertyName.equals("OR") - || propertyName.equals("BETWEEN") - || propertyName.equals("LIKE") - || propertyName.equals("IN") - || propertyName.equals("IS") - || propertyName.equals("ESCAPE"))) - { - throw new IllegalArgumentException("Identifier '" + propertyName + "' is not allowed in JMS"); - } - } - - } } |