summaryrefslogtreecommitdiff
path: root/qpid/java/amqp-1-0-client/src/main
diff options
context:
space:
mode:
authorRobert Godfrey <rgodfrey@apache.org>2013-09-30 07:29:51 +0000
committerRobert Godfrey <rgodfrey@apache.org>2013-09-30 07:29:51 +0000
commitc8d0fb167d8fc89fcb27823414454675b60a9dc1 (patch)
tree587e486d46940256b1107cee59d3c61ecf9f3f29 /qpid/java/amqp-1-0-client/src/main
parentcce85c2b500a08719e551b756d41b34246535416 (diff)
downloadqpid-python-c8d0fb167d8fc89fcb27823414454675b60a9dc1.tar.gz
QPID-5177 : Set the default and supported outcomes on sending links in the amqp 1.0 JMS client
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1527467 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/amqp-1-0-client/src/main')
-rw-r--r--qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Sender.java23
-rw-r--r--qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Session.java36
2 files changed, 37 insertions, 22 deletions
diff --git a/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Sender.java b/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Sender.java
index 6727459b56..e35248f58c 100644
--- a/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Sender.java
+++ b/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Sender.java
@@ -107,6 +107,16 @@ public class Sender implements DeliveryStateHandler
this(session, linkName, createTarget(targetAddr, isDurable), createSource(sourceAddr), window, mode, unsettled);
}
+ protected void configureSource(org.apache.qpid.amqp_1_0.type.messaging.Source source)
+ {
+
+ }
+
+ protected void configureTarget(org.apache.qpid.amqp_1_0.type.messaging.Target target)
+ {
+
+ }
+
private static org.apache.qpid.amqp_1_0.type.messaging.Source createSource(final String sourceAddr)
{
org.apache.qpid.amqp_1_0.type.messaging.Source source = new org.apache.qpid.amqp_1_0.type.messaging.Source();
@@ -133,6 +143,8 @@ public class Sender implements DeliveryStateHandler
_session = session;
session.getConnection().checkNotClosed();
+ configureSource(source);
+ configureTarget(target);
_endpoint = session.getEndpoint().createSendingLinkEndpoint(linkName,
source, target, unsettled);
@@ -189,16 +201,15 @@ public class Sender implements DeliveryStateHandler
super.remoteDetached(endpoint, detach);
}
});
- final org.apache.qpid.amqp_1_0.type.messaging.Source remoteSource =
- (org.apache.qpid.amqp_1_0.type.messaging.Source) getSource();
- _defaultOutcome = remoteSource.getDefaultOutcome();
+
+ _defaultOutcome = source.getDefaultOutcome();
if(_defaultOutcome == null)
{
- if(remoteSource.getOutcomes() == null || remoteSource.getOutcomes().length == 0)
+ if(source.getOutcomes() == null || source.getOutcomes().length == 0)
{
_defaultOutcome = new Accepted();
}
- else if(remoteSource.getOutcomes().length == 1)
+ else if(source.getOutcomes().length == 1)
{
final AMQPDescribedTypeRegistry describedTypeRegistry = _endpoint.getSession()
@@ -206,7 +217,7 @@ public class Sender implements DeliveryStateHandler
.getDescribedTypeRegistry();
DescribedTypeConstructor constructor = describedTypeRegistry
- .getConstructor(remoteSource.getOutcomes()[0]);
+ .getConstructor(source.getOutcomes()[0]);
if(constructor != null)
{
Object impliedOutcome = constructor.construct(Collections.EMPTY_LIST);
diff --git a/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Session.java b/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Session.java
index 79ed3b4457..626ea0f34d 100644
--- a/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Session.java
+++ b/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Session.java
@@ -63,15 +63,26 @@ public class Session
public synchronized Sender createSender(final String targetName)
throws Sender.SenderCreationException, ConnectionClosedException
{
- return createSender(targetName, false);
+
+ final String sourceName = UUID.randomUUID().toString();
+ return new Sender(this, targetName +"<-"+sourceName, targetName, sourceName, false);
+
}
- public synchronized Sender createSender(final String targetName, boolean synchronous)
+
+ public synchronized Sender createSender(final String targetName, final SourceConfigurator configurator)
throws Sender.SenderCreationException, ConnectionClosedException
{
final String sourceName = UUID.randomUUID().toString();
- return new Sender(this, targetName+"<-"+sourceName, targetName, sourceName, synchronous);
+ return new Sender(this, targetName +"<-"+sourceName, targetName, sourceName, false)
+ {
+ @Override
+ protected void configureSource(final Source source)
+ {
+ configurator.configureSource(source);
+ }
+ };
}
@@ -83,22 +94,10 @@ public class Session
}
- public Sender createSender(String targetName, int window, AcknowledgeMode mode)
- throws Sender.SenderCreationException, ConnectionClosedException
- {
-
- return createSender(targetName, window, mode, null);
- }
-
public Sender createSender(String targetName, int window, AcknowledgeMode mode, String linkName)
throws Sender.SenderCreationException, ConnectionClosedException
{
- return createSender(targetName, window, mode, linkName, null);
- }
- public Sender createSender(String targetName, int window, AcknowledgeMode mode, String linkName, Map<Binary, Outcome> unsettled)
- throws Sender.SenderCreationException, ConnectionClosedException
- {
- return createSender(targetName, window, mode, linkName, false, unsettled);
+ return createSender(targetName, window, mode, linkName, false, null);
}
public Sender createSender(String targetName, int window, AcknowledgeMode mode, String linkName,
@@ -381,4 +380,9 @@ public class Session
}
}
}
+
+ public static interface SourceConfigurator
+ {
+ public void configureSource(final Source source);
+ }
}