diff options
Diffstat (limited to 'qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java')
-rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java | 132 |
1 files changed, 91 insertions, 41 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java index 61fe722423..530186b1f9 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java @@ -20,15 +20,8 @@ */ package org.apache.qpid.client; -import java.net.URISyntaxException; -import java.util.Map; -import java.util.concurrent.atomic.AtomicLong; - -import javax.jms.Destination; -import javax.naming.NamingException; -import javax.naming.Reference; -import javax.naming.Referenceable; -import javax.naming.StringRefAddr; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.qpid.client.messaging.address.AddressHelper; import org.apache.qpid.client.messaging.address.Link; @@ -40,23 +33,30 @@ import org.apache.qpid.messaging.Address; import org.apache.qpid.url.AMQBindingURL; import org.apache.qpid.url.BindingURL; import org.apache.qpid.url.URLHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; + +import javax.jms.Destination; +import javax.naming.NamingException; +import javax.naming.Reference; +import javax.naming.Referenceable; +import javax.naming.StringRefAddr; +import java.net.URISyntaxException; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; public abstract class AMQDestination implements Destination, Referenceable { private static final Logger _logger = LoggerFactory.getLogger(AMQDestination.class); - protected AMQShortString _exchangeName; + private AMQShortString _exchangeName; - protected AMQShortString _exchangeClass; + private AMQShortString _exchangeClass; - protected boolean _isDurable; + private boolean _isDurable; - protected boolean _isExclusive; + private boolean _isExclusive; - protected boolean _isAutoDelete; + private boolean _isAutoDelete; private boolean _browseOnly; @@ -81,6 +81,41 @@ public abstract class AMQDestination implements Destination, Referenceable public static final int TOPIC_TYPE = 2; public static final int UNKNOWN_TYPE = 3; + protected void setExclusive(boolean exclusive) + { + _isExclusive = exclusive; + } + + protected AddressHelper getAddrHelper() + { + return _addrHelper; + } + + protected void setAddrHelper(AddressHelper addrHelper) + { + _addrHelper = addrHelper; + } + + protected String getName() + { + return _name; + } + + protected void setName(String name) + { + _name = name; + } + + protected Link getTargetLink() + { + return _targetLink; + } + + protected void setTargetLink(Link targetLink) + { + _targetLink = targetLink; + } + // ----- Fields required to support new address syntax ------- public enum DestSyntax { @@ -109,31 +144,46 @@ public abstract class AMQDestination implements Destination, Referenceable public static AddressOption getOption(String str) { - if ("always".equals(str)) return ALWAYS; - else if ("never".equals(str)) return NEVER; - else if ("sender".equals(str)) return SENDER; - else if ("receiver".equals(str)) return RECEIVER; - else throw new IllegalArgumentException(str + " is not an allowed value"); + if ("always".equals(str)) + { + return ALWAYS; + } + else if ("never".equals(str)) + { + return NEVER; + } + else if ("sender".equals(str)) + { + return SENDER; + } + else if ("receiver".equals(str)) + { + return RECEIVER; + } + else + { + throw new IllegalArgumentException(str + " is not an allowed value"); + } } } - protected final static DestSyntax defaultDestSyntax; + private final static DestSyntax defaultDestSyntax; - protected DestSyntax _destSyntax = DestSyntax.ADDR; + private DestSyntax _destSyntax = DestSyntax.ADDR; - protected AddressHelper _addrHelper; - protected Address _address; - protected int _addressType = AMQDestination.UNKNOWN_TYPE; - protected String _name; - protected String _subject; - protected AddressOption _create = AddressOption.NEVER; - protected AddressOption _assert = AddressOption.NEVER; - protected AddressOption _delete = AddressOption.NEVER; + private AddressHelper _addrHelper; + private Address _address; + private int _addressType = AMQDestination.UNKNOWN_TYPE; + private String _name; + private String _subject; + private AddressOption _create = AddressOption.NEVER; + private AddressOption _assert = AddressOption.NEVER; + private AddressOption _delete = AddressOption.NEVER; - protected Node _targetNode; - protected Node _sourceNode; - protected Link _targetLink; - protected Link _link; + private Node _targetNode; + private Node _sourceNode; + private Link _targetLink; + private Link _link; // ----- / Fields required to support new address syntax ------- @@ -543,7 +593,7 @@ public abstract class AMQDestination implements Destination, Referenceable { return true; } - if (o == null || getClass() != o.getClass()) + if (!(o instanceof AMQDestination)) { return false; } @@ -572,7 +622,6 @@ public abstract class AMQDestination implements Destination, Referenceable int result; result = _exchangeName == null ? "".hashCode() : _exchangeName.hashCode(); result = 29 * result + (_exchangeClass == null ? "".hashCode() :_exchangeClass.hashCode()); - //result = 29 * result + _destinationName.hashCode(); if (_queueName != null) { result = 29 * result + _queueName.hashCode(); @@ -631,10 +680,10 @@ public abstract class AMQDestination implements Destination, Referenceable public static class Binding { - String exchange; - String bindingKey; - String queue; - Map<String,Object> args; + private String exchange; + private String bindingKey; + private String queue; + private Map<String,Object> args; public Binding(String exchange, String queue, @@ -887,4 +936,5 @@ public abstract class AMQDestination implements Destination, Referenceable return _rejectBehaviour; } + } |