You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2013/09/25 16:33:07 UTC
svn commit: r1526190 [7/7] - in /qpid/trunk/qpid/java/amqp-1-0-client-jms:
example/src/main/java/org/apache/qpid/amqp_1_0/jms/example/
src/main/java/org/apache/qpid/amqp_1_0/jms/
src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ src/main/java/org/apache...
Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/StreamMessageImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/StreamMessageImpl.java?rev=1526190&r1=1526189&r2=1526190&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/StreamMessageImpl.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/StreamMessageImpl.java Wed Sep 25 14:33:06 2013
@@ -1,466 +1,466 @@
-/*
- * 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.amqp_1_0.jms.impl;
-
-import org.apache.qpid.amqp_1_0.jms.StreamMessage;
-import org.apache.qpid.amqp_1_0.type.Binary;
-import org.apache.qpid.amqp_1_0.type.Section;
-import org.apache.qpid.amqp_1_0.type.messaging.*;
-import org.apache.qpid.amqp_1_0.type.messaging.Properties;
-
-import javax.jms.JMSException;
-import javax.jms.MessageEOFException;
-import javax.jms.MessageFormatException;
-import java.io.EOFException;
-import java.util.*;
-
-public class StreamMessageImpl extends MessageImpl implements StreamMessage
-{
- private List _list;
- private boolean _readOnly;
- private int _position = -1;
- private int _offset = -1;
-
-
-
- protected StreamMessageImpl(Header header, MessageAnnotations messageAnnotations, Properties properties, ApplicationProperties appProperties, List list,
- Footer footer, SessionImpl session)
- {
- super(header, messageAnnotations, properties, appProperties, footer, session);
- _list = list;
- }
-
- StreamMessageImpl(final SessionImpl session)
- {
- super(new Header(), new MessageAnnotations(new HashMap()), new Properties(),
- new ApplicationProperties(new HashMap()), new Footer(Collections.EMPTY_MAP),
- session);
- _list = new ArrayList();
- }
-
- public StreamMessageImpl(final Header header,
- final MessageAnnotations messageAnnotations,
- final Properties properties,
- final ApplicationProperties appProperties,
- final List amqpListSection, final Footer footer)
- {
- super(header, messageAnnotations, properties, appProperties, footer, null);
- _list = amqpListSection;
- }
-
- public boolean readBoolean() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Boolean)
- {
- return (Boolean) obj;
- }
- if(obj instanceof String || obj == null)
- {
- return Boolean.valueOf((String)obj);
- }
- else
- {
- throw new MessageFormatException("Cannot read " + obj.getClass().getName() + " as boolean");
- }
- }
-
- @Override
- public void clearBody() throws JMSException
- {
- super.clearBody();
- _list.clear();
- _position = -1;
- _offset = -1;
- }
-
- public byte readByte() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Byte)
- {
- return (Byte) obj;
- }
- else if(obj instanceof String || obj == null)
- {
- try
- {
- return Byte.valueOf((String)obj);
- }
- catch(RuntimeException e)
- {
- backup();
- throw e;
- }
- }
- else
- {
- backup();
- throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
- }
- }
-
- private void backup()
- {
- _position--;
- }
-
- public short readShort() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Short)
- {
- return (Short) obj;
- }
- else if(obj instanceof Byte)
- {
- return (Byte) obj;
- }
- else if(obj instanceof String || obj == null)
- {
- try
- {
- return Short.valueOf((String)obj);
- }
- catch(RuntimeException e)
- {
- backup();
- throw e;
- }
- }
- else
- {
- backup();
- throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
- }
-
- }
-
- public char readChar() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Character)
- {
- return (Character) obj;
- }
- if(obj == null)
- {
- backup();
- throw new NullPointerException();
- }
- else
- {
- backup();
- throw new MessageFormatException("Cannot read " + obj.getClass().getName() + " as boolean");
- }
-
- }
-
- public int readInt() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Integer)
- {
- return (Integer) obj;
- }
- else if(obj instanceof Short)
- {
- return (Short) obj;
- }
- else if(obj instanceof Byte)
- {
- return (Byte) obj;
- }
- else if(obj instanceof String || obj == null)
- {
- try
- {
- return Integer.valueOf((String)obj);
- }
- catch (RuntimeException e)
- {
- backup();
- throw e;
- }
- }
- else
- {
- backup();
- throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
- }
- }
-
- public long readLong() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Long)
- {
- return (Long) obj;
- }
- else if(obj instanceof Integer)
- {
- return (Integer) obj;
- }
- else if(obj instanceof Short)
- {
- return (Short) obj;
- }
- else if(obj instanceof Byte)
- {
- return (Byte) obj;
- }
- else if(obj instanceof String || obj == null)
- {
- try
- {
- return Long.valueOf((String)obj);
- }
- catch (RuntimeException e)
- {
- backup();
- throw e;
- }
- }
- else
- {
- backup();
- throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
- }
- }
-
- public float readFloat() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Float)
- {
- return (Float) obj;
- }
- else if(obj instanceof String || obj == null)
- {
- try
- {
- return Float.valueOf((String)obj);
- }
- catch (RuntimeException e)
- {
- backup();
- throw e;
- }
- }
- else
- {
- backup();
- throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
- }
- }
-
- public double readDouble() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Double)
- {
- return (Double) obj;
- }
- else if(obj instanceof Float)
- {
- return (Float) obj;
- }
- else if(obj instanceof String || obj == null)
- {
- try
- {
- return Double.valueOf((String)obj);
- }
- catch (RuntimeException e)
- {
- backup();
- throw e;
- }
- }
- else
- {
- backup();
- throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
- }
- }
-
- public String readString() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Binary)
- {
- backup();
- throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
- }
- return String.valueOf(obj);
- }
-
- public int readBytes(final byte[] bytes) throws JMSException
- {
- Object obj = readObject();
- if(!(obj instanceof Binary))
- {
- backup();
- if(_position > -1 && _list.get(_position) instanceof Binary)
- {
- return -1;
- }
- throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
- }
- Binary binary = (Binary) obj;
- if(bytes.length >= binary.getLength())
- {
- System.arraycopy(binary.getArray(),binary.getArrayOffset(),bytes,0,binary.getLength());
- return binary.getLength();
- }
- return -1;
- }
-
- public Object readObject() throws JMSException
- {
- checkReadable();
- if(_offset == -1)
- {
- try
- {
- return _list.get(++_position);
- }
- catch (IndexOutOfBoundsException e)
- {
- throw new MessageEOFException("No more data in message stream");
- }
- }
- else
- {
- return null; //TODO
- }
- }
-
- public void writeBoolean(final boolean b) throws JMSException
- {
- checkWritable();
- _list.add(b);
- }
-
- public void writeByte(final byte b) throws JMSException
- {
- checkWritable();
- _list.add(b);
- }
-
- public void writeShort(final short i) throws JMSException
- {
- checkWritable();
- _list.add(i);
- }
-
- public void writeChar(final char c) throws JMSException
- {
- checkWritable();
- _list.add(c);
- }
-
- public void writeInt(final int i) throws JMSException
- {
- checkWritable();
- _list.add(i);
- }
-
- public void writeLong(final long l) throws JMSException
- {
- checkWritable();
- _list.add(l);
- }
-
- public void writeFloat(final float v) throws JMSException
- {
- checkWritable();
- _list.add(v);
- }
-
- public void writeDouble(final double v) throws JMSException
- {
- checkWritable();
- _list.add(v);
- }
-
- public void writeString(final String s) throws JMSException
- {
- checkWritable();
- _list.add(s);
- }
-
- public void writeBytes(final byte[] bytes) throws JMSException
- {
- checkWritable();
- writeBytes(bytes, 0, bytes.length);
- }
-
- public void writeBytes(final byte[] bytes, final int offset, final int size) throws JMSException
- {
- checkWritable();
-
- if(!_list.isEmpty() && _list.get(_list.size()-1) instanceof byte[])
- {
- Binary oldVal = (Binary) _list.get(_list.size()-1);
- byte[] allBytes = new byte[oldVal.getLength() + size];
- System.arraycopy(oldVal.getArray(),oldVal.getArrayOffset(),allBytes,0,oldVal.getLength());
- System.arraycopy(bytes, offset, allBytes, oldVal.getLength(), size);
- _list.set(_list.size()-1, allBytes);
- }
- else
- {
- byte[] dup = new byte[size];
- System.arraycopy(bytes,offset,dup,0,size);
- _list.add(new Binary(dup));
- }
- }
-
- public void writeObject(final Object o) throws JMSException
- {
- checkWritable();
- if(o == null || _supportedClasses.contains(o.getClass()))
- {
- _list.add(o);
- }
- }
-
- public void reset() throws JMSException
- {
- super.reset();
- _position = -1;
- _offset = -1;
- }
-
- @Override Collection<Section> getSections()
- {
- List<Section> sections = new ArrayList<Section>();
- sections.add(getHeader());
- if(getMessageAnnotations() != null && getMessageAnnotations().getValue() != null && !getMessageAnnotations().getValue().isEmpty())
- {
- sections.add(getMessageAnnotations());
- }
- sections.add(getProperties());
- sections.add(getApplicationProperties());
- sections.add(new AmqpValue(_list));
- sections.add(getFooter());
- return sections;
- }
-}
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import org.apache.qpid.amqp_1_0.jms.StreamMessage;
+import org.apache.qpid.amqp_1_0.type.Binary;
+import org.apache.qpid.amqp_1_0.type.Section;
+import org.apache.qpid.amqp_1_0.type.messaging.*;
+import org.apache.qpid.amqp_1_0.type.messaging.Properties;
+
+import javax.jms.JMSException;
+import javax.jms.MessageEOFException;
+import javax.jms.MessageFormatException;
+import java.io.EOFException;
+import java.util.*;
+
+public class StreamMessageImpl extends MessageImpl implements StreamMessage
+{
+ private List _list;
+ private boolean _readOnly;
+ private int _position = -1;
+ private int _offset = -1;
+
+
+
+ protected StreamMessageImpl(Header header, MessageAnnotations messageAnnotations, Properties properties, ApplicationProperties appProperties, List list,
+ Footer footer, SessionImpl session)
+ {
+ super(header, messageAnnotations, properties, appProperties, footer, session);
+ _list = list;
+ }
+
+ StreamMessageImpl(final SessionImpl session)
+ {
+ super(new Header(), new MessageAnnotations(new HashMap()), new Properties(),
+ new ApplicationProperties(new HashMap()), new Footer(Collections.EMPTY_MAP),
+ session);
+ _list = new ArrayList();
+ }
+
+ public StreamMessageImpl(final Header header,
+ final MessageAnnotations messageAnnotations,
+ final Properties properties,
+ final ApplicationProperties appProperties,
+ final List amqpListSection, final Footer footer)
+ {
+ super(header, messageAnnotations, properties, appProperties, footer, null);
+ _list = amqpListSection;
+ }
+
+ public boolean readBoolean() throws JMSException
+ {
+ Object obj = readObject();
+ if(obj instanceof Boolean)
+ {
+ return (Boolean) obj;
+ }
+ if(obj instanceof String || obj == null)
+ {
+ return Boolean.valueOf((String)obj);
+ }
+ else
+ {
+ throw new MessageFormatException("Cannot read " + obj.getClass().getName() + " as boolean");
+ }
+ }
+
+ @Override
+ public void clearBody() throws JMSException
+ {
+ super.clearBody();
+ _list.clear();
+ _position = -1;
+ _offset = -1;
+ }
+
+ public byte readByte() throws JMSException
+ {
+ Object obj = readObject();
+ if(obj instanceof Byte)
+ {
+ return (Byte) obj;
+ }
+ else if(obj instanceof String || obj == null)
+ {
+ try
+ {
+ return Byte.valueOf((String)obj);
+ }
+ catch(RuntimeException e)
+ {
+ backup();
+ throw e;
+ }
+ }
+ else
+ {
+ backup();
+ throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
+ }
+ }
+
+ private void backup()
+ {
+ _position--;
+ }
+
+ public short readShort() throws JMSException
+ {
+ Object obj = readObject();
+ if(obj instanceof Short)
+ {
+ return (Short) obj;
+ }
+ else if(obj instanceof Byte)
+ {
+ return (Byte) obj;
+ }
+ else if(obj instanceof String || obj == null)
+ {
+ try
+ {
+ return Short.valueOf((String)obj);
+ }
+ catch(RuntimeException e)
+ {
+ backup();
+ throw e;
+ }
+ }
+ else
+ {
+ backup();
+ throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
+ }
+
+ }
+
+ public char readChar() throws JMSException
+ {
+ Object obj = readObject();
+ if(obj instanceof Character)
+ {
+ return (Character) obj;
+ }
+ if(obj == null)
+ {
+ backup();
+ throw new NullPointerException();
+ }
+ else
+ {
+ backup();
+ throw new MessageFormatException("Cannot read " + obj.getClass().getName() + " as boolean");
+ }
+
+ }
+
+ public int readInt() throws JMSException
+ {
+ Object obj = readObject();
+ if(obj instanceof Integer)
+ {
+ return (Integer) obj;
+ }
+ else if(obj instanceof Short)
+ {
+ return (Short) obj;
+ }
+ else if(obj instanceof Byte)
+ {
+ return (Byte) obj;
+ }
+ else if(obj instanceof String || obj == null)
+ {
+ try
+ {
+ return Integer.valueOf((String)obj);
+ }
+ catch (RuntimeException e)
+ {
+ backup();
+ throw e;
+ }
+ }
+ else
+ {
+ backup();
+ throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
+ }
+ }
+
+ public long readLong() throws JMSException
+ {
+ Object obj = readObject();
+ if(obj instanceof Long)
+ {
+ return (Long) obj;
+ }
+ else if(obj instanceof Integer)
+ {
+ return (Integer) obj;
+ }
+ else if(obj instanceof Short)
+ {
+ return (Short) obj;
+ }
+ else if(obj instanceof Byte)
+ {
+ return (Byte) obj;
+ }
+ else if(obj instanceof String || obj == null)
+ {
+ try
+ {
+ return Long.valueOf((String)obj);
+ }
+ catch (RuntimeException e)
+ {
+ backup();
+ throw e;
+ }
+ }
+ else
+ {
+ backup();
+ throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
+ }
+ }
+
+ public float readFloat() throws JMSException
+ {
+ Object obj = readObject();
+ if(obj instanceof Float)
+ {
+ return (Float) obj;
+ }
+ else if(obj instanceof String || obj == null)
+ {
+ try
+ {
+ return Float.valueOf((String)obj);
+ }
+ catch (RuntimeException e)
+ {
+ backup();
+ throw e;
+ }
+ }
+ else
+ {
+ backup();
+ throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
+ }
+ }
+
+ public double readDouble() throws JMSException
+ {
+ Object obj = readObject();
+ if(obj instanceof Double)
+ {
+ return (Double) obj;
+ }
+ else if(obj instanceof Float)
+ {
+ return (Float) obj;
+ }
+ else if(obj instanceof String || obj == null)
+ {
+ try
+ {
+ return Double.valueOf((String)obj);
+ }
+ catch (RuntimeException e)
+ {
+ backup();
+ throw e;
+ }
+ }
+ else
+ {
+ backup();
+ throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
+ }
+ }
+
+ public String readString() throws JMSException
+ {
+ Object obj = readObject();
+ if(obj instanceof Binary)
+ {
+ backup();
+ throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
+ }
+ return String.valueOf(obj);
+ }
+
+ public int readBytes(final byte[] bytes) throws JMSException
+ {
+ Object obj = readObject();
+ if(!(obj instanceof Binary))
+ {
+ backup();
+ if(_position > -1 && _list.get(_position) instanceof Binary)
+ {
+ return -1;
+ }
+ throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
+ }
+ Binary binary = (Binary) obj;
+ if(bytes.length >= binary.getLength())
+ {
+ System.arraycopy(binary.getArray(),binary.getArrayOffset(),bytes,0,binary.getLength());
+ return binary.getLength();
+ }
+ return -1;
+ }
+
+ public Object readObject() throws JMSException
+ {
+ checkReadable();
+ if(_offset == -1)
+ {
+ try
+ {
+ return _list.get(++_position);
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ throw new MessageEOFException("No more data in message stream");
+ }
+ }
+ else
+ {
+ return null; //TODO
+ }
+ }
+
+ public void writeBoolean(final boolean b) throws JMSException
+ {
+ checkWritable();
+ _list.add(b);
+ }
+
+ public void writeByte(final byte b) throws JMSException
+ {
+ checkWritable();
+ _list.add(b);
+ }
+
+ public void writeShort(final short i) throws JMSException
+ {
+ checkWritable();
+ _list.add(i);
+ }
+
+ public void writeChar(final char c) throws JMSException
+ {
+ checkWritable();
+ _list.add(c);
+ }
+
+ public void writeInt(final int i) throws JMSException
+ {
+ checkWritable();
+ _list.add(i);
+ }
+
+ public void writeLong(final long l) throws JMSException
+ {
+ checkWritable();
+ _list.add(l);
+ }
+
+ public void writeFloat(final float v) throws JMSException
+ {
+ checkWritable();
+ _list.add(v);
+ }
+
+ public void writeDouble(final double v) throws JMSException
+ {
+ checkWritable();
+ _list.add(v);
+ }
+
+ public void writeString(final String s) throws JMSException
+ {
+ checkWritable();
+ _list.add(s);
+ }
+
+ public void writeBytes(final byte[] bytes) throws JMSException
+ {
+ checkWritable();
+ writeBytes(bytes, 0, bytes.length);
+ }
+
+ public void writeBytes(final byte[] bytes, final int offset, final int size) throws JMSException
+ {
+ checkWritable();
+
+ if(!_list.isEmpty() && _list.get(_list.size()-1) instanceof byte[])
+ {
+ Binary oldVal = (Binary) _list.get(_list.size()-1);
+ byte[] allBytes = new byte[oldVal.getLength() + size];
+ System.arraycopy(oldVal.getArray(),oldVal.getArrayOffset(),allBytes,0,oldVal.getLength());
+ System.arraycopy(bytes, offset, allBytes, oldVal.getLength(), size);
+ _list.set(_list.size()-1, allBytes);
+ }
+ else
+ {
+ byte[] dup = new byte[size];
+ System.arraycopy(bytes,offset,dup,0,size);
+ _list.add(new Binary(dup));
+ }
+ }
+
+ public void writeObject(final Object o) throws JMSException
+ {
+ checkWritable();
+ if(o == null || _supportedClasses.contains(o.getClass()))
+ {
+ _list.add(o);
+ }
+ }
+
+ public void reset() throws JMSException
+ {
+ super.reset();
+ _position = -1;
+ _offset = -1;
+ }
+
+ @Override Collection<Section> getSections()
+ {
+ List<Section> sections = new ArrayList<Section>();
+ sections.add(getHeader());
+ if(getMessageAnnotations() != null && getMessageAnnotations().getValue() != null && !getMessageAnnotations().getValue().isEmpty())
+ {
+ sections.add(getMessageAnnotations());
+ }
+ sections.add(getProperties());
+ sections.add(getApplicationProperties());
+ sections.add(new AmqpValue(_list));
+ sections.add(getFooter());
+ return sections;
+ }
+}
Propchange: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/StreamMessageImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryQueueImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryQueueImpl.java?rev=1526190&r1=1526189&r2=1526190&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryQueueImpl.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryQueueImpl.java Wed Sep 25 14:33:06 2013
@@ -1,107 +1,107 @@
-/*
- * 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.amqp_1_0.jms.impl;
-
-import org.apache.qpid.amqp_1_0.client.Sender;
-import org.apache.qpid.amqp_1_0.jms.MessageConsumer;
-import org.apache.qpid.amqp_1_0.jms.TemporaryQueue;
-
-import javax.jms.IllegalStateException;
-import javax.jms.JMSException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-public class TemporaryQueueImpl extends QueueImpl implements TemporaryQueue
-{
- private Sender _sender;
- private SessionImpl _session;
- private final Set<MessageConsumer> _consumers =
- Collections.synchronizedSet(new HashSet<MessageConsumer>());
- private boolean _deleted;
-
- protected TemporaryQueueImpl(String address, Sender sender, SessionImpl session)
- {
- super(address);
- _sender = sender;
- _session = session;
- _session.getConnection().addOnCloseTask(new ConnectionImpl.CloseTask()
- {
- public void onClose() throws JMSException
- {
- synchronized (TemporaryQueueImpl.this)
- {
- close();
- }
- }
- });
- }
-
- public synchronized void delete() throws JMSException
- {
- if(_consumers.isEmpty())
- {
- close();
- _deleted = true;
- }
- else
- {
- throw new IllegalStateException("Cannot delete destination as it has consumers");
- }
- }
-
- private void close() throws JMSException
- {
- if(_sender != null)
- {
- try
- {
- _sender.close();
- _sender = null;
- }
- catch (Sender.SenderClosingException e)
- {
- final JMSException jmsException = new JMSException(e.getMessage());
- jmsException.setLinkedException(e);
- throw jmsException;
- }
- }
-
- }
-
- public SessionImpl getSession()
- {
- return _session;
- }
-
- public void addConsumer(MessageConsumer consumer)
- {
- _consumers.add(consumer);
- }
-
- public void removeConsumer(MessageConsumer consumer)
- {
- _consumers.remove(consumer);
- }
-
- public boolean isDeleted()
- {
- return _deleted;
- }
-}
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import org.apache.qpid.amqp_1_0.client.Sender;
+import org.apache.qpid.amqp_1_0.jms.MessageConsumer;
+import org.apache.qpid.amqp_1_0.jms.TemporaryQueue;
+
+import javax.jms.IllegalStateException;
+import javax.jms.JMSException;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+public class TemporaryQueueImpl extends QueueImpl implements TemporaryQueue
+{
+ private Sender _sender;
+ private SessionImpl _session;
+ private final Set<MessageConsumer> _consumers =
+ Collections.synchronizedSet(new HashSet<MessageConsumer>());
+ private boolean _deleted;
+
+ protected TemporaryQueueImpl(String address, Sender sender, SessionImpl session)
+ {
+ super(address);
+ _sender = sender;
+ _session = session;
+ _session.getConnection().addOnCloseTask(new ConnectionImpl.CloseTask()
+ {
+ public void onClose() throws JMSException
+ {
+ synchronized (TemporaryQueueImpl.this)
+ {
+ close();
+ }
+ }
+ });
+ }
+
+ public synchronized void delete() throws JMSException
+ {
+ if(_consumers.isEmpty())
+ {
+ close();
+ _deleted = true;
+ }
+ else
+ {
+ throw new IllegalStateException("Cannot delete destination as it has consumers");
+ }
+ }
+
+ private void close() throws JMSException
+ {
+ if(_sender != null)
+ {
+ try
+ {
+ _sender.close();
+ _sender = null;
+ }
+ catch (Sender.SenderClosingException e)
+ {
+ final JMSException jmsException = new JMSException(e.getMessage());
+ jmsException.setLinkedException(e);
+ throw jmsException;
+ }
+ }
+
+ }
+
+ public SessionImpl getSession()
+ {
+ return _session;
+ }
+
+ public void addConsumer(MessageConsumer consumer)
+ {
+ _consumers.add(consumer);
+ }
+
+ public void removeConsumer(MessageConsumer consumer)
+ {
+ _consumers.remove(consumer);
+ }
+
+ public boolean isDeleted()
+ {
+ return _deleted;
+ }
+}
Propchange: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryQueueImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryTopicImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryTopicImpl.java?rev=1526190&r1=1526189&r2=1526190&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryTopicImpl.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryTopicImpl.java Wed Sep 25 14:33:06 2013
@@ -1,112 +1,112 @@
-/*
- * 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.amqp_1_0.jms.impl;
-
-import org.apache.qpid.amqp_1_0.client.Sender;
-import org.apache.qpid.amqp_1_0.jms.MessageConsumer;
-import org.apache.qpid.amqp_1_0.jms.TemporaryTopic;
-
-import javax.jms.IllegalStateException;
-import javax.jms.JMSException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-public class TemporaryTopicImpl extends TopicImpl implements TemporaryTopic
-{
- private Sender _sender;
- private SessionImpl _session;
- private final Set<MessageConsumer> _consumers =
- Collections.synchronizedSet(new HashSet<MessageConsumer>());
- private boolean _deleted;
-
- protected TemporaryTopicImpl(String address, Sender sender, SessionImpl session)
- {
- super(address);
- _sender = sender;
- _session = session;
-
- _session.getConnection().addOnCloseTask(new ConnectionImpl.CloseTask()
- {
- public void onClose() throws JMSException
- {
- synchronized (TemporaryTopicImpl.this)
- {
- close();
- }
- }
- });
- }
-
- public void delete() throws JMSException
- {
- if(_consumers.isEmpty())
- {
- _deleted = true;
- close();
- }
- else
- {
- throw new IllegalStateException("Cannot delete destination as it has consumers");
- }
-
- }
-
-
- private void close() throws JMSException
- {
- if(_sender != null)
- {
- try
- {
-
- _sender.close();
- _sender = null;
- }
- catch (Sender.SenderClosingException e)
- {
- final JMSException jmsException = new JMSException(e.getMessage());
- jmsException.setLinkedException(e);
- throw jmsException;
- }
- }
-
- }
-
- public SessionImpl getSession()
- {
- return _session;
- }
-
-
- public void addConsumer(MessageConsumer consumer)
- {
- _consumers.add(consumer);
- }
-
- public void removeConsumer(MessageConsumer consumer)
- {
- _consumers.remove(consumer);
- }
-
- public boolean isDeleted()
- {
- return _deleted;
- }
-}
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import org.apache.qpid.amqp_1_0.client.Sender;
+import org.apache.qpid.amqp_1_0.jms.MessageConsumer;
+import org.apache.qpid.amqp_1_0.jms.TemporaryTopic;
+
+import javax.jms.IllegalStateException;
+import javax.jms.JMSException;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+public class TemporaryTopicImpl extends TopicImpl implements TemporaryTopic
+{
+ private Sender _sender;
+ private SessionImpl _session;
+ private final Set<MessageConsumer> _consumers =
+ Collections.synchronizedSet(new HashSet<MessageConsumer>());
+ private boolean _deleted;
+
+ protected TemporaryTopicImpl(String address, Sender sender, SessionImpl session)
+ {
+ super(address);
+ _sender = sender;
+ _session = session;
+
+ _session.getConnection().addOnCloseTask(new ConnectionImpl.CloseTask()
+ {
+ public void onClose() throws JMSException
+ {
+ synchronized (TemporaryTopicImpl.this)
+ {
+ close();
+ }
+ }
+ });
+ }
+
+ public void delete() throws JMSException
+ {
+ if(_consumers.isEmpty())
+ {
+ _deleted = true;
+ close();
+ }
+ else
+ {
+ throw new IllegalStateException("Cannot delete destination as it has consumers");
+ }
+
+ }
+
+
+ private void close() throws JMSException
+ {
+ if(_sender != null)
+ {
+ try
+ {
+
+ _sender.close();
+ _sender = null;
+ }
+ catch (Sender.SenderClosingException e)
+ {
+ final JMSException jmsException = new JMSException(e.getMessage());
+ jmsException.setLinkedException(e);
+ throw jmsException;
+ }
+ }
+
+ }
+
+ public SessionImpl getSession()
+ {
+ return _session;
+ }
+
+
+ public void addConsumer(MessageConsumer consumer)
+ {
+ _consumers.add(consumer);
+ }
+
+ public void removeConsumer(MessageConsumer consumer)
+ {
+ _consumers.remove(consumer);
+ }
+
+ public boolean isDeleted()
+ {
+ return _deleted;
+ }
+}
Propchange: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryTopicImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TextMessageImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TextMessageImpl.java?rev=1526190&r1=1526189&r2=1526190&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TextMessageImpl.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TextMessageImpl.java Wed Sep 25 14:33:06 2013
@@ -1,93 +1,93 @@
-/*
- * 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.amqp_1_0.jms.impl;
-
-import org.apache.qpid.amqp_1_0.jms.TextMessage;
-import org.apache.qpid.amqp_1_0.type.Section;
-import org.apache.qpid.amqp_1_0.type.messaging.*;
-import org.apache.qpid.amqp_1_0.type.messaging.Properties;
-
-import javax.jms.JMSException;
-import javax.jms.MessageNotWriteableException;
-import java.util.*;
-
-public class TextMessageImpl extends MessageImpl implements TextMessage
-{
- private String _text;
-
- protected TextMessageImpl(Header header,
- MessageAnnotations messageAnnotations,
- Properties properties,
- ApplicationProperties appProperties,
- String text,
- Footer footer,
- SessionImpl session)
- {
- super(header, messageAnnotations, properties, appProperties, footer, session);
- _text = text;
- }
-
- protected TextMessageImpl(final SessionImpl session)
- {
- super(new Header(), new MessageAnnotations(new HashMap()),
- new Properties(), new ApplicationProperties(new HashMap()), new Footer(Collections.EMPTY_MAP),
- session);
- }
-
- public void setText(final String text) throws MessageNotWriteableException
- {
- if(isReadOnly())
- {
- throw new MessageNotWriteableException("Cannot set object, message is in read only mode");
- }
-
- _text = text;
- }
-
- public String getText() throws JMSException
- {
- return _text;
- }
-
- @Override
- public void clearBody() throws JMSException
- {
- super.clearBody();
- _text = null;
- }
-
- @Override Collection<Section> getSections()
- {
- List<Section> sections = new ArrayList<Section>();
- sections.add(getHeader());
- if(getMessageAnnotations() != null && getMessageAnnotations().getValue() != null && !getMessageAnnotations().getValue().isEmpty())
- {
- sections.add(getMessageAnnotations());
- }
- sections.add(getProperties());
- sections.add(getApplicationProperties());
- AmqpValue section = new AmqpValue(_text);
- sections.add(section);
- sections.add(getFooter());
- return sections;
- }
-
-
-}
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import org.apache.qpid.amqp_1_0.jms.TextMessage;
+import org.apache.qpid.amqp_1_0.type.Section;
+import org.apache.qpid.amqp_1_0.type.messaging.*;
+import org.apache.qpid.amqp_1_0.type.messaging.Properties;
+
+import javax.jms.JMSException;
+import javax.jms.MessageNotWriteableException;
+import java.util.*;
+
+public class TextMessageImpl extends MessageImpl implements TextMessage
+{
+ private String _text;
+
+ protected TextMessageImpl(Header header,
+ MessageAnnotations messageAnnotations,
+ Properties properties,
+ ApplicationProperties appProperties,
+ String text,
+ Footer footer,
+ SessionImpl session)
+ {
+ super(header, messageAnnotations, properties, appProperties, footer, session);
+ _text = text;
+ }
+
+ protected TextMessageImpl(final SessionImpl session)
+ {
+ super(new Header(), new MessageAnnotations(new HashMap()),
+ new Properties(), new ApplicationProperties(new HashMap()), new Footer(Collections.EMPTY_MAP),
+ session);
+ }
+
+ public void setText(final String text) throws MessageNotWriteableException
+ {
+ if(isReadOnly())
+ {
+ throw new MessageNotWriteableException("Cannot set object, message is in read only mode");
+ }
+
+ _text = text;
+ }
+
+ public String getText() throws JMSException
+ {
+ return _text;
+ }
+
+ @Override
+ public void clearBody() throws JMSException
+ {
+ super.clearBody();
+ _text = null;
+ }
+
+ @Override Collection<Section> getSections()
+ {
+ List<Section> sections = new ArrayList<Section>();
+ sections.add(getHeader());
+ if(getMessageAnnotations() != null && getMessageAnnotations().getValue() != null && !getMessageAnnotations().getValue().isEmpty())
+ {
+ sections.add(getMessageAnnotations());
+ }
+ sections.add(getProperties());
+ sections.add(getApplicationProperties());
+ AmqpValue section = new AmqpValue(_text);
+ sections.add(section);
+ sections.add(getFooter());
+ return sections;
+ }
+
+
+}
Propchange: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TextMessageImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicConnectionImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicConnectionImpl.java?rev=1526190&r1=1526189&r2=1526190&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicConnectionImpl.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicConnectionImpl.java Wed Sep 25 14:33:06 2013
@@ -1,48 +1,48 @@
-/*
- * 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.amqp_1_0.jms.impl;
-
-import org.apache.qpid.amqp_1_0.jms.TopicConnection;
-
-import javax.jms.ConnectionConsumer;
-import javax.jms.JMSException;
-import javax.jms.ServerSessionPool;
-import javax.jms.Topic;
-
-public class TopicConnectionImpl extends ConnectionImpl implements TopicConnection
-{
- TopicConnectionImpl(String host, int port, String username, String password, String clientId)
- throws JMSException
- {
- super(host, port, username, password, clientId);
- }
-
- public TopicSessionImpl createTopicSession(final boolean b, final int i) throws JMSException
- {
- return null; //TODO
- }
-
- public ConnectionConsumer createConnectionConsumer(final Topic topic,
- final String s,
- final ServerSessionPool serverSessionPool,
- final int i) throws JMSException
- {
- return null; //TODO
- }
-}
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import org.apache.qpid.amqp_1_0.jms.TopicConnection;
+
+import javax.jms.ConnectionConsumer;
+import javax.jms.JMSException;
+import javax.jms.ServerSessionPool;
+import javax.jms.Topic;
+
+public class TopicConnectionImpl extends ConnectionImpl implements TopicConnection
+{
+ TopicConnectionImpl(String host, int port, String username, String password, String clientId)
+ throws JMSException
+ {
+ super(host, port, username, password, clientId);
+ }
+
+ public TopicSessionImpl createTopicSession(final boolean b, final int i) throws JMSException
+ {
+ return null; //TODO
+ }
+
+ public ConnectionConsumer createConnectionConsumer(final Topic topic,
+ final String s,
+ final ServerSessionPool serverSessionPool,
+ final int i) throws JMSException
+ {
+ return null; //TODO
+ }
+}
Propchange: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicConnectionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicImpl.java?rev=1526190&r1=1526189&r2=1526190&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicImpl.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicImpl.java Wed Sep 25 14:33:06 2013
@@ -1,56 +1,56 @@
-/*
- * 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.amqp_1_0.jms.impl;
-
-import org.apache.qpid.amqp_1_0.jms.Topic;
-
-import java.util.WeakHashMap;
-
-public class TopicImpl extends DestinationImpl implements Topic
-{
- private static final WeakHashMap<String, TopicImpl> TOPIC_CACHE =
- new WeakHashMap<String, TopicImpl>();
-
-
- public TopicImpl(String address)
- {
- super(address);
- }
-
- public String getTopicName()
- {
- return getAddress();
- }
-
- public static synchronized TopicImpl createTopic(final String address)
- {
- TopicImpl topic = TOPIC_CACHE.get(address);
- if(topic == null)
- {
- topic = new TopicImpl(address);
- TOPIC_CACHE.put(address, topic);
- }
- return topic;
- }
-
- public static TopicImpl valueOf(String address)
- {
- return address == null ? null : createTopic(address);
- }
-}
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import org.apache.qpid.amqp_1_0.jms.Topic;
+
+import java.util.WeakHashMap;
+
+public class TopicImpl extends DestinationImpl implements Topic
+{
+ private static final WeakHashMap<String, TopicImpl> TOPIC_CACHE =
+ new WeakHashMap<String, TopicImpl>();
+
+
+ public TopicImpl(String address)
+ {
+ super(address);
+ }
+
+ public String getTopicName()
+ {
+ return getAddress();
+ }
+
+ public static synchronized TopicImpl createTopic(final String address)
+ {
+ TopicImpl topic = TOPIC_CACHE.get(address);
+ if(topic == null)
+ {
+ topic = new TopicImpl(address);
+ TOPIC_CACHE.put(address, topic);
+ }
+ return topic;
+ }
+
+ public static TopicImpl valueOf(String address)
+ {
+ return address == null ? null : createTopic(address);
+ }
+}
Propchange: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicPublisherImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicPublisherImpl.java?rev=1526190&r1=1526189&r2=1526190&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicPublisherImpl.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicPublisherImpl.java Wed Sep 25 14:33:06 2013
@@ -1,36 +1,36 @@
-/*
- * 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.amqp_1_0.jms.impl;
-
-import org.apache.qpid.amqp_1_0.jms.TopicPublisher;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Topic;
-
-public class TopicPublisherImpl extends MessageProducerImpl implements TopicPublisher
-{
- protected TopicPublisherImpl(final Destination destination, final SessionImpl session)
- throws JMSException
- {
- super(destination, session);
- }
-
-}
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import org.apache.qpid.amqp_1_0.jms.TopicPublisher;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Topic;
+
+public class TopicPublisherImpl extends MessageProducerImpl implements TopicPublisher
+{
+ protected TopicPublisherImpl(final Destination destination, final SessionImpl session)
+ throws JMSException
+ {
+ super(destination, session);
+ }
+
+}
Propchange: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicPublisherImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSessionImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSessionImpl.java?rev=1526190&r1=1526189&r2=1526190&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSessionImpl.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSessionImpl.java Wed Sep 25 14:33:06 2013
@@ -1,56 +1,56 @@
-/*
- * 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.amqp_1_0.jms.impl;
-
-import org.apache.qpid.amqp_1_0.jms.TopicSession;
-
-import javax.jms.JMSException;
-import javax.jms.Topic;
-
-public class TopicSessionImpl extends SessionImpl implements TopicSession
-{
- protected TopicSessionImpl(final ConnectionImpl connection, final AcknowledgeMode acknowledgeMode)
- throws JMSException
- {
- super(connection, acknowledgeMode);
- setTopicSession(true);
- }
-
- public TopicSubscriberImpl createSubscriber(final Topic topic) throws JMSException
- {
- return createSubscriber(topic,null, false);
- }
-
- public TopicSubscriberImpl createSubscriber(final Topic topic, final String selector, final boolean noLocal) throws JMSException
- {
-
- final TopicSubscriberImpl messageConsumer;
- synchronized(getClientSession().getEndpoint().getLock())
- {
- messageConsumer = new TopicSubscriberImpl((TopicImpl) topic, this, selector, noLocal);
- addConsumer(messageConsumer);
- }
- return messageConsumer;
- }
-
- public TopicPublisherImpl createPublisher(final Topic topic) throws JMSException
- {
- return null; //TODO
- }
-}
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import org.apache.qpid.amqp_1_0.jms.TopicSession;
+
+import javax.jms.JMSException;
+import javax.jms.Topic;
+
+public class TopicSessionImpl extends SessionImpl implements TopicSession
+{
+ protected TopicSessionImpl(final ConnectionImpl connection, final AcknowledgeMode acknowledgeMode)
+ throws JMSException
+ {
+ super(connection, acknowledgeMode);
+ setTopicSession(true);
+ }
+
+ public TopicSubscriberImpl createSubscriber(final Topic topic) throws JMSException
+ {
+ return createSubscriber(topic,null, false);
+ }
+
+ public TopicSubscriberImpl createSubscriber(final Topic topic, final String selector, final boolean noLocal) throws JMSException
+ {
+
+ final TopicSubscriberImpl messageConsumer;
+ synchronized(getClientSession().getEndpoint().getLock())
+ {
+ messageConsumer = new TopicSubscriberImpl((TopicImpl) topic, this, selector, noLocal);
+ addConsumer(messageConsumer);
+ }
+ return messageConsumer;
+ }
+
+ public TopicPublisherImpl createPublisher(final Topic topic) throws JMSException
+ {
+ return null; //TODO
+ }
+}
Propchange: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSessionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSubscriberImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSubscriberImpl.java?rev=1526190&r1=1526189&r2=1526190&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSubscriberImpl.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSubscriberImpl.java Wed Sep 25 14:33:06 2013
@@ -1,133 +1,133 @@
-/*
- * 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.amqp_1_0.jms.impl;
-
-import java.util.Map;
-import javax.jms.InvalidSelectorException;
-import javax.jms.JMSException;
-import org.apache.qpid.amqp_1_0.client.AcknowledgeMode;
-import org.apache.qpid.amqp_1_0.client.ConnectionErrorException;
-import org.apache.qpid.amqp_1_0.client.Receiver;
-import org.apache.qpid.amqp_1_0.jms.Topic;
-import org.apache.qpid.amqp_1_0.jms.TopicSubscriber;
-import org.apache.qpid.amqp_1_0.type.Symbol;
-import org.apache.qpid.amqp_1_0.type.messaging.Filter;
-import org.apache.qpid.amqp_1_0.type.messaging.StdDistMode;
-import org.apache.qpid.amqp_1_0.type.transport.AmqpError;
-
-public class TopicSubscriberImpl extends MessageConsumerImpl implements TopicSubscriber
-{
-
- TopicSubscriberImpl(String name,
- boolean durable,
- final Topic destination,
- final SessionImpl session,
- final String selector,
- final boolean noLocal)
- throws JMSException
- {
- super(destination, session, selector, noLocal, name, durable);
- setTopicSubscriber(true);
- }
-
- TopicSubscriberImpl(final Topic destination,
- final SessionImpl session,
- final String selector,
- final boolean noLocal)
- throws JMSException
- {
- super(destination, session, selector, noLocal);
- setTopicSubscriber(true);
- }
-
- public TopicImpl getTopic() throws JMSException
- {
- return (TopicImpl) getDestination();
- }
-
-
- protected Receiver createClientReceiver() throws JMSException
- {
- try
- {
- String address = getSession().toAddress(getDestination());
- Receiver receiver = getSession().getClientSession().createReceiver(address,
- StdDistMode.COPY, AcknowledgeMode.ALO,
- getLinkName(), isDurable(), getFilters(),
- null);
- String actualAddress = receiver.getAddress();
-
- @SuppressWarnings("unchecked")
- Map<Symbol, Filter> actualFilters = (Map<Symbol, Filter>) receiver.getFilter();
-
- if(!address.equals(actualAddress) || !filtersEqual(getFilters(), actualFilters))
- {
- receiver.close();
- if(isDurable())
- {
- receiver = getSession().getClientSession().createReceiver(address,
- StdDistMode.COPY, AcknowledgeMode.ALO,
- getLinkName(), false, getFilters(),
- null);
- receiver.close();
- }
- receiver = getSession().getClientSession().createReceiver(address,
- StdDistMode.COPY, AcknowledgeMode.ALO,
- getLinkName(), isDurable(), getFilters(),
- null);
- }
-
-
- return receiver;
- }
- catch (ConnectionErrorException e)
- {
- org.apache.qpid.amqp_1_0.type.transport.Error error = e.getRemoteError();
- if(AmqpError.INVALID_FIELD.equals(error.getCondition()))
- {
- throw new InvalidSelectorException(e.getMessage());
- }
- else
- {
- throw new JMSException(e.getMessage(), error.getCondition().getValue().toString());
-
- }
-
- }
- }
-
- private boolean filtersEqual(Map<Symbol, Filter> filters, Map<Symbol, Filter> actualFilters)
- {
- if(filters == null || filters.isEmpty())
- {
- return actualFilters == null || actualFilters.isEmpty();
- }
- else
- {
- return actualFilters != null && filters.equals(actualFilters);
- }
-
- }
-
-
- protected void closeUnderlyingReceiver(Receiver receiver)
- {
- receiver.close();
- }
-}
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import java.util.Map;
+import javax.jms.InvalidSelectorException;
+import javax.jms.JMSException;
+import org.apache.qpid.amqp_1_0.client.AcknowledgeMode;
+import org.apache.qpid.amqp_1_0.client.ConnectionErrorException;
+import org.apache.qpid.amqp_1_0.client.Receiver;
+import org.apache.qpid.amqp_1_0.jms.Topic;
+import org.apache.qpid.amqp_1_0.jms.TopicSubscriber;
+import org.apache.qpid.amqp_1_0.type.Symbol;
+import org.apache.qpid.amqp_1_0.type.messaging.Filter;
+import org.apache.qpid.amqp_1_0.type.messaging.StdDistMode;
+import org.apache.qpid.amqp_1_0.type.transport.AmqpError;
+
+public class TopicSubscriberImpl extends MessageConsumerImpl implements TopicSubscriber
+{
+
+ TopicSubscriberImpl(String name,
+ boolean durable,
+ final Topic destination,
+ final SessionImpl session,
+ final String selector,
+ final boolean noLocal)
+ throws JMSException
+ {
+ super(destination, session, selector, noLocal, name, durable);
+ setTopicSubscriber(true);
+ }
+
+ TopicSubscriberImpl(final Topic destination,
+ final SessionImpl session,
+ final String selector,
+ final boolean noLocal)
+ throws JMSException
+ {
+ super(destination, session, selector, noLocal);
+ setTopicSubscriber(true);
+ }
+
+ public TopicImpl getTopic() throws JMSException
+ {
+ return (TopicImpl) getDestination();
+ }
+
+
+ protected Receiver createClientReceiver() throws JMSException
+ {
+ try
+ {
+ String address = getSession().toAddress(getDestination());
+ Receiver receiver = getSession().getClientSession().createReceiver(address,
+ StdDistMode.COPY, AcknowledgeMode.ALO,
+ getLinkName(), isDurable(), getFilters(),
+ null);
+ String actualAddress = receiver.getAddress();
+
+ @SuppressWarnings("unchecked")
+ Map<Symbol, Filter> actualFilters = (Map<Symbol, Filter>) receiver.getFilter();
+
+ if(!address.equals(actualAddress) || !filtersEqual(getFilters(), actualFilters))
+ {
+ receiver.close();
+ if(isDurable())
+ {
+ receiver = getSession().getClientSession().createReceiver(address,
+ StdDistMode.COPY, AcknowledgeMode.ALO,
+ getLinkName(), false, getFilters(),
+ null);
+ receiver.close();
+ }
+ receiver = getSession().getClientSession().createReceiver(address,
+ StdDistMode.COPY, AcknowledgeMode.ALO,
+ getLinkName(), isDurable(), getFilters(),
+ null);
+ }
+
+
+ return receiver;
+ }
+ catch (ConnectionErrorException e)
+ {
+ org.apache.qpid.amqp_1_0.type.transport.Error error = e.getRemoteError();
+ if(AmqpError.INVALID_FIELD.equals(error.getCondition()))
+ {
+ throw new InvalidSelectorException(e.getMessage());
+ }
+ else
+ {
+ throw new JMSException(e.getMessage(), error.getCondition().getValue().toString());
+
+ }
+
+ }
+ }
+
+ private boolean filtersEqual(Map<Symbol, Filter> filters, Map<Symbol, Filter> actualFilters)
+ {
+ if(filters == null || filters.isEmpty())
+ {
+ return actualFilters == null || actualFilters.isEmpty();
+ }
+ else
+ {
+ return actualFilters != null && filters.equals(actualFilters);
+ }
+
+ }
+
+
+ protected void closeUnderlyingReceiver(Receiver receiver)
+ {
+ receiver.close();
+ }
+}
Propchange: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSubscriberImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/jndi/NameParserImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/jndi/PropertiesFileInitialContextFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/jndi/ReadOnlyContext.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org