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 2014/05/01 21:37:15 UTC
svn commit: r1591753 - in /qpid/proton/trunk:
contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/api/
contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/impl/
contrib/proton-hawtdispatch/src/test/ja...
Author: rhs
Date: Thu May 1 19:37:14 2014
New Revision: 1591753
URL: http://svn.apache.org/r1591753
Log:
PROTON-495: simplified factory pattern for proton-j
Added:
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/Codec.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Engine.java
Removed:
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/ProtonFactory.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/ProtonFactoryImpl.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/ProtonFactoryLoader.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/DataFactory.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DataFactoryImpl.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/DriverFactory.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/DriverFactoryImpl.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/EngineFactory.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/EngineFactoryImpl.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportFactory.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportFactoryImpl.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/message/MessageFactory.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/message/impl/MessageFactoryImpl.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/MessengerFactory.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerFactoryImpl.java
qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/ProtonFactoryLoaderTest.java
qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/factoryloadertesting/
qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/ProtonFactoryTest.java
qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/engine/ProtonFactoryTestFixture.java
Modified:
qpid/proton/trunk/contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/api/AmqpSession.java
qpid/proton/trunk/contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/api/MessageDelivery.java
qpid/proton/trunk/contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/impl/AmqpTransport.java
qpid/proton/trunk/contrib/proton-hawtdispatch/src/test/java/org/apache/qpid/proton/hawtdispatch/test/MessengerServer.java
qpid/proton/trunk/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/AMQPNativeOutboundTransformer.java
qpid/proton/trunk/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/EncodedMessage.java
qpid/proton/trunk/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/JMSMappingOutboundTransformer.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/Proton.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/Data.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Driver.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/ConnectorImpl.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/DriverImpl.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Collector.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Connection.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/SslDomain.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/SslPeerDetails.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Transport.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/SslDomainImpl.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/SslPeerDetailsImpl.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/message/Message.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/Messenger.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerImpl.java
qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/ProtonEngineExampleTest.java
qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/SimpleTest.java
qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/engine/ConnectionTest.java
qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/engine/TransportTest.java
qpid/proton/trunk/tests/java/org/apache/qpid/proton/InteropTest.java
Modified: qpid/proton/trunk/contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/api/AmqpSession.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/api/AmqpSession.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/api/AmqpSession.java (original)
+++ qpid/proton/trunk/contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/api/AmqpSession.java Thu May 1 19:37:14 2014
@@ -25,7 +25,6 @@ import org.apache.qpid.proton.engine.Pro
import org.apache.qpid.proton.engine.Receiver;
import org.apache.qpid.proton.engine.Sender;
import org.apache.qpid.proton.message.Message;
-import org.apache.qpid.proton.message.impl.MessageFactoryImpl;
import org.apache.qpid.proton.amqp.Binary;
import org.apache.qpid.proton.amqp.messaging.*;
import org.apache.qpid.proton.amqp.transport.SenderSettleMode;
@@ -37,7 +36,6 @@ import java.util.UUID;
*/
public class AmqpSession extends AmqpEndpointBase {
- private final MessageFactoryImpl messageFactory = new MessageFactoryImpl();
final AmqpConnection parent;
final ProtonJSession session;
@@ -124,7 +122,7 @@ public class AmqpSession extends AmqpEnd
}
public Message createTextMessage(String value) {
- Message msg = messageFactory.createMessage();
+ Message msg = Message.Factory.create();
Section body = new AmqpValue(value);
msg.setBody(body);
return msg;
@@ -135,7 +133,7 @@ public class AmqpSession extends AmqpEnd
}
public Message createBinaryMessage(byte value[], int offset, int len) {
- Message msg = messageFactory.createMessage();
+ Message msg = Message.Factory.create();
Data body = new Data(new Binary(value, offset,len));
msg.setBody(body);
return msg;
Modified: qpid/proton/trunk/contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/api/MessageDelivery.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/api/MessageDelivery.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/api/MessageDelivery.java (original)
+++ qpid/proton/trunk/contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/api/MessageDelivery.java Thu May 1 19:37:14 2014
@@ -23,7 +23,6 @@ import org.apache.qpid.proton.hawtdispat
import org.apache.qpid.proton.hawtdispatch.impl.WatchBase;
import org.apache.qpid.proton.message.Message;
import org.apache.qpid.proton.message.ProtonJMessage;
-import org.apache.qpid.proton.message.impl.MessageFactoryImpl;
import org.fusesource.hawtbuf.Buffer;
import org.fusesource.hawtdispatch.Task;
@@ -32,7 +31,6 @@ import org.fusesource.hawtdispatch.Task;
*/
public abstract class MessageDelivery extends WatchBase {
- private static final MessageFactoryImpl MESSAGE_FACTORY = new MessageFactoryImpl();
final int initialSize;
private Message message;
private Buffer encoded;
@@ -50,7 +48,7 @@ public abstract class MessageDelivery ex
}
static Message decode(Buffer buffer) {
- Message msg = MESSAGE_FACTORY.createMessage();
+ Message msg = Message.Factory.create();
int offset = buffer.offset;
int len = buffer.length;
while( len > 0 ) {
Modified: qpid/proton/trunk/contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/impl/AmqpTransport.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/impl/AmqpTransport.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/impl/AmqpTransport.java (original)
+++ qpid/proton/trunk/contrib/proton-hawtdispatch/src/main/java/org/apache/qpid/proton/hawtdispatch/impl/AmqpTransport.java Thu May 1 19:37:14 2014
@@ -22,7 +22,6 @@ import org.apache.qpid.proton.hawtdispat
import org.apache.qpid.proton.hawtdispatch.api.TransportState;
import org.apache.qpid.proton.engine.*;
import org.apache.qpid.proton.engine.impl.ByteBufferUtils;
-import org.apache.qpid.proton.engine.impl.EngineFactoryImpl;
import org.apache.qpid.proton.engine.impl.ProtocolTracer;
import org.fusesource.hawtbuf.Buffer;
import org.fusesource.hawtbuf.DataByteArrayOutputStream;
@@ -53,7 +52,6 @@ public class AmqpTransport extends Watch
final DispatchQueue queue;
final ProtonJConnection connection;
- private final EngineFactoryImpl engineFactory = new EngineFactoryImpl();
Transport hawtdispatchTransport;
ProtonJTransport protonTransport;
Throwable failure;
@@ -63,7 +61,7 @@ public class AmqpTransport extends Watch
private AmqpTransport(DispatchQueue queue) {
this.queue = queue;
- this.connection = engineFactory.createConnection();
+ this.connection = (ProtonJConnection) Connection.Factory.create();
defers = Dispatch.createSource(EventAggregators.<Defer>linkedList(), this.queue);
defers.setEventHandler(new Task(){
@@ -324,7 +322,7 @@ public class AmqpTransport extends Watch
private void bind(final Transport transport) {
this.hawtdispatchTransport = transport;
- this.protonTransport = engineFactory.createTransport();
+ this.protonTransport = (ProtonJTransport) org.apache.qpid.proton.engine.Transport.Factory.create();
this.protonTransport.bind(connection);
if( transport.getProtocolCodec()==null ) {
try {
Modified: qpid/proton/trunk/contrib/proton-hawtdispatch/src/test/java/org/apache/qpid/proton/hawtdispatch/test/MessengerServer.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/contrib/proton-hawtdispatch/src/test/java/org/apache/qpid/proton/hawtdispatch/test/MessengerServer.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/contrib/proton-hawtdispatch/src/test/java/org/apache/qpid/proton/hawtdispatch/test/MessengerServer.java (original)
+++ qpid/proton/trunk/contrib/proton-hawtdispatch/src/test/java/org/apache/qpid/proton/hawtdispatch/test/MessengerServer.java Thu May 1 19:37:14 2014
@@ -7,11 +7,10 @@ import java.util.concurrent.atomic.Atomi
import java.util.concurrent.atomic.AtomicReference;
import org.apache.qpid.proton.InterruptException;
-import org.apache.qpid.proton.ProtonFactoryLoader;
+import org.apache.qpid.proton.Proton;
import org.apache.qpid.proton.amqp.messaging.Section;
import org.apache.qpid.proton.message.Message;
import org.apache.qpid.proton.messenger.Messenger;
-import org.apache.qpid.proton.messenger.MessengerFactory;
import org.apache.qpid.proton.messenger.Tracker;
public class MessengerServer {
@@ -33,7 +32,7 @@ public class MessengerServer {
if (!serverShouldRun.compareAndSet(false, true)) {
throw new IllegalStateException("started twice");
}
- msgr = new ProtonFactoryLoader<MessengerFactory>(MessengerFactory.class).loadFactory().createMessenger();
+ msgr = Proton.messenger();
serverStart = new CountDownLatch(1);
thread = new Thread(new Runnable() {
Modified: qpid/proton/trunk/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/AMQPNativeOutboundTransformer.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/AMQPNativeOutboundTransformer.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/AMQPNativeOutboundTransformer.java (original)
+++ qpid/proton/trunk/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/AMQPNativeOutboundTransformer.java Thu May 1 19:37:14 2014
@@ -28,14 +28,11 @@ import javax.jms.MessageFormatException;
import java.nio.ByteBuffer;
import org.apache.qpid.proton.message.ProtonJMessage;
-import org.apache.qpid.proton.message.impl.MessageFactoryImpl;
/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
public class AMQPNativeOutboundTransformer extends OutboundTransformer {
- private static final MessageFactoryImpl MESSAGE_FACTORY = new MessageFactoryImpl();
-
public AMQPNativeOutboundTransformer(JMSVendor vendor) {
super(vendor);
}
@@ -73,7 +70,7 @@ public class AMQPNativeOutboundTransform
if( count > 1 ) {
// decode...
- ProtonJMessage amqp = MESSAGE_FACTORY.createMessage();
+ ProtonJMessage amqp = (ProtonJMessage) org.apache.qpid.proton.message.Message.Factory.create();
int offset = 0;
int len = data.length;
while( len > 0 ) {
Modified: qpid/proton/trunk/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/EncodedMessage.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/EncodedMessage.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/EncodedMessage.java (original)
+++ qpid/proton/trunk/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/EncodedMessage.java Thu May 1 19:37:14 2014
@@ -18,14 +18,12 @@ package org.apache.qpid.proton.jms;
import org.apache.qpid.proton.message.Message;
import org.apache.qpid.proton.amqp.Binary;
-import org.apache.qpid.proton.message.impl.MessageFactoryImpl;
/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
public class EncodedMessage
{
- private final MessageFactoryImpl messageFactory = new MessageFactoryImpl();
private final Binary data;
final long messageFormat;
@@ -40,7 +38,7 @@ public class EncodedMessage
}
public Message decode() throws Exception {
- Message amqp = messageFactory.createMessage();
+ Message amqp = Message.Factory.create();
int offset = getArrayOffset();
int len = getLength();
Modified: qpid/proton/trunk/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/JMSMappingOutboundTransformer.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/JMSMappingOutboundTransformer.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/JMSMappingOutboundTransformer.java (original)
+++ qpid/proton/trunk/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/JMSMappingOutboundTransformer.java Thu May 1 19:37:14 2014
@@ -21,7 +21,6 @@ import org.apache.qpid.proton.codec.Comp
import org.apache.qpid.proton.codec.WritableBuffer;
import org.apache.qpid.proton.codec.DroppingWritableBuffer;
import org.apache.qpid.proton.message.ProtonJMessage;
-import org.apache.qpid.proton.message.impl.MessageFactoryImpl;
import org.apache.qpid.proton.amqp.Binary;
import org.apache.qpid.proton.amqp.Symbol;
import org.apache.qpid.proton.amqp.UnsignedByte;
@@ -41,8 +40,6 @@ import java.util.HashMap;
*/
public class JMSMappingOutboundTransformer extends OutboundTransformer {
- private static final MessageFactoryImpl MESSAGE_FACTORY = new MessageFactoryImpl();
-
String prefixDeliveryAnnotations = "DA_";
String prefixMessageAnnotations= "MA_";
String prefixFooter = "FT_";
@@ -212,7 +209,7 @@ public class JMSMappingOutboundTransform
Footer footer=null;
if( footerMap!=null ) footer = new Footer(footerMap);
- ProtonJMessage amqp = MESSAGE_FACTORY.createMessage(header, da, ma, props, ap, body, footer);
+ ProtonJMessage amqp = (ProtonJMessage) org.apache.qpid.proton.message.Message.Factory.create(header, da, ma, props, ap, body, footer);
ByteBuffer buffer = ByteBuffer.wrap(new byte[1024*4]);
final DroppingWritableBuffer overflow = new DroppingWritableBuffer();
Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/Proton.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/Proton.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/Proton.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/Proton.java Thu May 1 19:37:14 2014
@@ -30,87 +30,58 @@ import org.apache.qpid.proton.amqp.messa
import org.apache.qpid.proton.amqp.messaging.MessageAnnotations;
import org.apache.qpid.proton.amqp.messaging.Properties;
import org.apache.qpid.proton.amqp.messaging.Section;
+import org.apache.qpid.proton.codec.Codec;
import org.apache.qpid.proton.codec.Data;
-import org.apache.qpid.proton.codec.DataFactory;
import org.apache.qpid.proton.driver.Driver;
-import org.apache.qpid.proton.driver.DriverFactory;
+import org.apache.qpid.proton.engine.Engine;
import org.apache.qpid.proton.engine.Collector;
import org.apache.qpid.proton.engine.Connection;
-import org.apache.qpid.proton.engine.EngineFactory;
import org.apache.qpid.proton.engine.SslDomain;
import org.apache.qpid.proton.engine.SslPeerDetails;
import org.apache.qpid.proton.engine.Transport;
import org.apache.qpid.proton.message.Message;
-import org.apache.qpid.proton.message.MessageFactory;
import org.apache.qpid.proton.messenger.Messenger;
-import org.apache.qpid.proton.messenger.MessengerFactory;
-
-import org.apache.qpid.proton.engine.impl.CollectorImpl;
public final class Proton
{
- public static ProtonFactory.ImplementationType ANY = ProtonFactory.ImplementationType.ANY;
- public static ProtonFactory.ImplementationType PROTON_C = ProtonFactory.ImplementationType.PROTON_C;
- public static ProtonFactory.ImplementationType PROTON_J = ProtonFactory.ImplementationType.PROTON_J;
-
-
- private static final MessengerFactory MESSENGER_FACTORY =
- (new ProtonFactoryLoader<MessengerFactory>(MessengerFactory.class)).loadFactory();
- private static final DriverFactory DRIVER_FACTORY =
- (new ProtonFactoryLoader<DriverFactory>(DriverFactory.class)).loadFactory();
- private static final MessageFactory MESSAGE_FACTORY =
- (new ProtonFactoryLoader<MessageFactory>(MessageFactory.class)).loadFactory();
- private static final DataFactory DATA_FACTORY =
- (new ProtonFactoryLoader<DataFactory>(DataFactory.class)).loadFactory();
- private static final EngineFactory ENGINE_FACTORY =
- (new ProtonFactoryLoader<EngineFactory>(EngineFactory.class)).loadFactory();
-
- private static final ProtonFactory.ImplementationType DEFAULT_IMPLEMENTATION =
- ProtonFactoryLoader.getImpliedImplementationType();
-
private Proton()
{
}
- public static ProtonFactory.ImplementationType getDefaultImplementationType()
- {
- return DEFAULT_IMPLEMENTATION;
- }
-
public static Collector collector()
{
- return new CollectorImpl();
+ return Engine.collector();
}
public static Connection connection()
{
- return ENGINE_FACTORY.createConnection();
+ return Engine.connection();
}
public static Transport transport()
{
- return ENGINE_FACTORY.createTransport();
+ return Engine.transport();
}
public static SslDomain sslDomain()
{
- return ENGINE_FACTORY.createSslDomain();
+ return Engine.sslDomain();
}
public static SslPeerDetails sslPeerDetails(String hostname, int port)
{
- return ENGINE_FACTORY.createSslPeerDetails(hostname, port);
+ return Engine.sslPeerDetails(hostname, port);
}
public static Data data(long capacity)
{
- return DATA_FACTORY.createData(capacity);
+ return Codec.data(capacity);
}
public static Message message()
{
- return MESSAGE_FACTORY.createMessage();
+ return Message.Factory.create();
}
public static Message message(Header header,
@@ -118,134 +89,25 @@ public final class Proton
Properties properties, ApplicationProperties applicationProperties,
Section body, Footer footer)
{
- return MESSAGE_FACTORY.createMessage(header, deliveryAnnotations,
- messageAnnotations, properties,
- applicationProperties, body, footer);
+ return Message.Factory.create(header, deliveryAnnotations,
+ messageAnnotations, properties,
+ applicationProperties, body, footer);
}
public static Messenger messenger()
{
- return MESSENGER_FACTORY.createMessenger();
+ return Messenger.Factory.create();
}
public static Messenger messenger(String name)
{
- return MESSENGER_FACTORY.createMessenger(name);
+ return Messenger.Factory.create(name);
}
public static Driver driver() throws IOException
{
- return DRIVER_FACTORY.createDriver();
- }
-
-
-
- public static Connection connection(ProtonFactory.ImplementationType implementation)
- {
- return getEngineFactory(implementation).createConnection();
- }
-
- public static Transport transport(ProtonFactory.ImplementationType implementation)
- {
- return getEngineFactory(implementation).createTransport();
- }
-
- public static SslDomain sslDomain(ProtonFactory.ImplementationType implementation)
- {
- return getEngineFactory(implementation).createSslDomain();
- }
-
- public static SslPeerDetails sslPeerDetails(ProtonFactory.ImplementationType implementation, String hostname, int port)
- {
- return getEngineFactory(implementation).createSslPeerDetails(hostname, port);
- }
-
- public static Data data(ProtonFactory.ImplementationType implementation, long capacity)
- {
- return getDataFactory(implementation).createData(capacity);
- }
-
- public static Message message(ProtonFactory.ImplementationType implementation)
- {
- return getMessageFactory(implementation).createMessage();
- }
-
- public static Message message(ProtonFactory.ImplementationType implementation, Header header,
- DeliveryAnnotations deliveryAnnotations, MessageAnnotations messageAnnotations,
- Properties properties, ApplicationProperties applicationProperties,
- Section body, Footer footer)
- {
- return getMessageFactory(implementation).createMessage(header, deliveryAnnotations,
- messageAnnotations, properties,
- applicationProperties, body, footer);
+ return Driver.Factory.create();
}
-
- public static Messenger messenger(ProtonFactory.ImplementationType implementation)
- {
- return getMessengerFactory(implementation).createMessenger();
- }
-
- public static Messenger messenger(ProtonFactory.ImplementationType implementation, String name)
- {
- return getMessengerFactory(implementation).createMessenger(name);
- }
-
- public static Driver driver(ProtonFactory.ImplementationType implementation) throws IOException
- {
- return getDriverFactory(implementation).createDriver();
- }
-
-
- private static final ConcurrentMap<ProtonFactory.ImplementationType, EngineFactory> _engineFactories =
- new ConcurrentHashMap<ProtonFactory.ImplementationType, EngineFactory>();
- private static final ConcurrentMap<ProtonFactory.ImplementationType, MessageFactory> _messageFactories =
- new ConcurrentHashMap<ProtonFactory.ImplementationType, MessageFactory>();
- private static final ConcurrentMap<ProtonFactory.ImplementationType, MessengerFactory> _messengerFactories =
- new ConcurrentHashMap<ProtonFactory.ImplementationType, MessengerFactory>();
- private static final ConcurrentMap<ProtonFactory.ImplementationType, DataFactory> _dataFactories =
- new ConcurrentHashMap<ProtonFactory.ImplementationType, DataFactory>();
- private static final ConcurrentMap<ProtonFactory.ImplementationType, DriverFactory> _driverFactories =
- new ConcurrentHashMap<ProtonFactory.ImplementationType, DriverFactory>();
-
- private static EngineFactory getEngineFactory(ProtonFactory.ImplementationType implementation)
- {
- return getFactory(EngineFactory.class, implementation, _engineFactories);
- }
-
- private static MessageFactory getMessageFactory(ProtonFactory.ImplementationType implementation)
- {
- return getFactory(MessageFactory.class, implementation, _messageFactories);
- }
-
- private static MessengerFactory getMessengerFactory(ProtonFactory.ImplementationType implementation)
- {
- return getFactory(MessengerFactory.class, implementation, _messengerFactories);
- }
-
- private static DriverFactory getDriverFactory(ProtonFactory.ImplementationType implementation)
- {
- return getFactory(DriverFactory.class, implementation, _driverFactories);
- }
-
- private static DataFactory getDataFactory(ProtonFactory.ImplementationType implementation)
- {
- return getFactory(DataFactory.class, implementation, _dataFactories);
- }
-
- private static <T extends ProtonFactory> T getFactory(Class<T> factoryClass, ProtonFactory.ImplementationType implementation,
- ConcurrentMap<ProtonFactory.ImplementationType, T> factories)
- {
- T factory = factories.get(implementation);
- if(factory == null)
- {
- factories.putIfAbsent(implementation, (new ProtonFactoryLoader<T>(factoryClass,implementation)).loadFactory());
- factory = factories.get(implementation);
-
- }
- return factory;
- }
-
-
}
Added: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/Codec.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/Codec.java?rev=1591753&view=auto
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/Codec.java (added)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/Codec.java Thu May 1 19:37:14 2014
@@ -0,0 +1,40 @@
+/*
+ *
+ * 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.proton.codec;
+
+/**
+ * Codec
+ *
+ */
+
+public final class Codec
+{
+
+ private Codec()
+ {
+ }
+
+ public static Data data(long capacity)
+ {
+ return Data.Factory.create();
+ }
+
+}
Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/Data.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/Data.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/Data.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/Data.java Thu May 1 19:37:14 2014
@@ -37,9 +37,19 @@ import org.apache.qpid.proton.amqp.Unsig
import org.apache.qpid.proton.amqp.UnsignedLong;
import org.apache.qpid.proton.amqp.UnsignedShort;
+import org.apache.qpid.proton.codec.impl.DataImpl;
+
public interface Data
{
+ public static final class Factory {
+
+ public static Data create() {
+ return new DataImpl();
+ }
+
+ }
+
enum DataType
{
Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Driver.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Driver.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Driver.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Driver.java Thu May 1 19:37:14 2014
@@ -21,8 +21,10 @@
package org.apache.qpid.proton.driver;
+import java.io.IOException;
import java.nio.channels.SelectableChannel;
import java.nio.channels.ServerSocketChannel;
+import org.apache.qpid.proton.driver.impl.DriverImpl;
/**
* A driver for the proton engine.
@@ -40,6 +42,14 @@ import java.nio.channels.ServerSocketCha
*/
public interface Driver
{
+
+ public static final class Factory
+ {
+ public static Driver create() throws IOException {
+ return new DriverImpl();
+ }
+ }
+
/**
* Force {@link #doWait(long)} to return.
*
Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/ConnectorImpl.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/ConnectorImpl.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/ConnectorImpl.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/ConnectorImpl.java Thu May 1 19:37:14 2014
@@ -32,7 +32,6 @@ import org.apache.qpid.proton.engine.Con
import org.apache.qpid.proton.engine.Sasl;
import org.apache.qpid.proton.engine.Transport;
import org.apache.qpid.proton.engine.TransportException;
-import org.apache.qpid.proton.engine.impl.TransportFactory;
class ConnectorImpl<C> implements Connector<C>
{
Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/DriverImpl.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/DriverImpl.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/DriverImpl.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/impl/DriverImpl.java Thu May 1 19:37:14 2014
@@ -53,7 +53,7 @@ public class DriverImpl implements Drive
private Queue<ConnectorImpl> _selectedConnectors = new ArrayDeque<ConnectorImpl>();
private Queue<ListenerImpl> _selectedListeners = new ArrayDeque<ListenerImpl>();
- DriverImpl() throws IOException
+ public DriverImpl() throws IOException
{
_selector = Selector.open();
}
Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Collector.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Collector.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Collector.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Collector.java Thu May 1 19:37:14 2014
@@ -20,6 +20,7 @@
*/
package org.apache.qpid.proton.engine;
+import org.apache.qpid.proton.engine.impl.CollectorImpl;
/**
* Collector
@@ -29,6 +30,13 @@ package org.apache.qpid.proton.engine;
public interface Collector
{
+ public static final class Factory
+ {
+ public static Collector create() {
+ return new CollectorImpl();
+ }
+ }
+
Event peek();
void pop();
Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Connection.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Connection.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Connection.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Connection.java Thu May 1 19:37:14 2014
@@ -24,6 +24,8 @@ import java.util.EnumSet;
import java.util.Map;
import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.engine.impl.ConnectionImpl;
+
/**
* Maintains lists of sessions, links and deliveries in a state
@@ -36,6 +38,13 @@ import org.apache.qpid.proton.amqp.Symbo
public interface Connection extends Endpoint
{
+ public static final class Factory
+ {
+ public static Connection create() {
+ return new ConnectionImpl();
+ }
+ }
+
/**
* Returns a newly created session
*
Added: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Engine.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Engine.java?rev=1591753&view=auto
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Engine.java (added)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Engine.java Thu May 1 19:37:14 2014
@@ -0,0 +1,60 @@
+/*
+ *
+ * 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.proton.engine;
+
+/**
+ * Engine
+ *
+ */
+
+public final class Engine
+{
+
+ private Engine()
+ {
+ }
+
+ public static Collector collector()
+ {
+ return Collector.Factory.create();
+ }
+
+ public static Connection connection()
+ {
+ return Connection.Factory.create();
+ }
+
+ public static Transport transport()
+ {
+ return Transport.Factory.create();
+ }
+
+ public static SslDomain sslDomain()
+ {
+ return SslDomain.Factory.create();
+ }
+
+ public static SslPeerDetails sslPeerDetails(String hostname, int port)
+ {
+ return SslPeerDetails.Factory.create(hostname, port);
+ }
+
+}
Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/SslDomain.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/SslDomain.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/SslDomain.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/SslDomain.java Thu May 1 19:37:14 2014
@@ -18,11 +18,21 @@
*/
package org.apache.qpid.proton.engine;
+import org.apache.qpid.proton.engine.impl.ssl.SslDomainImpl;
+
/**
* I store the details used to create SSL sessions.
*/
public interface SslDomain
{
+
+ public static final class Factory
+ {
+ public static SslDomain create() {
+ return new SslDomainImpl();
+ }
+ }
+
/**
* Determines whether the endpoint acts as a client or server.
*/
Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/SslPeerDetails.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/SslPeerDetails.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/SslPeerDetails.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/SslPeerDetails.java Thu May 1 19:37:14 2014
@@ -18,6 +18,8 @@
*/
package org.apache.qpid.proton.engine;
+import org.apache.qpid.proton.engine.impl.ssl.SslPeerDetailsImpl;
+
/**
* The details of the remote peer involved in an SSL session.
*
@@ -28,6 +30,14 @@ package org.apache.qpid.proton.engine;
*/
public interface SslPeerDetails
{
+
+ public static final class Factory
+ {
+ public static SslPeerDetails create(String hostname, int port) {
+ return new SslPeerDetailsImpl(hostname, port);
+ }
+ }
+
String getHostname();
int getPort();
-}
\ No newline at end of file
+}
Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Transport.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Transport.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Transport.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Transport.java Thu May 1 19:37:14 2014
@@ -22,6 +22,8 @@ package org.apache.qpid.proton.engine;
import java.nio.ByteBuffer;
+import org.apache.qpid.proton.engine.impl.TransportImpl;
+
/**
* <p>
@@ -63,6 +65,14 @@ import java.nio.ByteBuffer;
*/
public interface Transport extends Endpoint
{
+
+ public static final class Factory
+ {
+ public static Transport create() {
+ return new TransportImpl();
+ }
+ }
+
public static final int DEFAULT_MAX_FRAME_SIZE = -1;
/** the lower bound for the agreed maximum frame size (in bytes). */
Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java Thu May 1 19:37:14 2014
@@ -47,7 +47,6 @@ import org.apache.qpid.proton.codec.Enco
import org.apache.qpid.proton.codec.WritableBuffer;
import org.apache.qpid.proton.engine.Connection;
import org.apache.qpid.proton.engine.EndpointState;
-import org.apache.qpid.proton.engine.EngineFactory;
import org.apache.qpid.proton.engine.Event;
import org.apache.qpid.proton.engine.ProtonJTransport;
import org.apache.qpid.proton.engine.Sasl;
Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/SslDomainImpl.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/SslDomainImpl.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/SslDomainImpl.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/SslDomainImpl.java Thu May 1 19:37:14 2014
@@ -19,7 +19,6 @@
package org.apache.qpid.proton.engine.impl.ssl;
import org.apache.qpid.proton.ProtonUnsupportedOperationException;
-import org.apache.qpid.proton.engine.EngineFactory;
import org.apache.qpid.proton.engine.ProtonJSslDomain;
import org.apache.qpid.proton.engine.SslDomain;
import org.apache.qpid.proton.engine.SslPeerDetails;
Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/SslPeerDetailsImpl.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/SslPeerDetailsImpl.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/SslPeerDetailsImpl.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/SslPeerDetailsImpl.java Thu May 1 19:37:14 2014
@@ -18,7 +18,6 @@
*/
package org.apache.qpid.proton.engine.impl.ssl;
-import org.apache.qpid.proton.engine.EngineFactory;
import org.apache.qpid.proton.engine.ProtonJSslPeerDetails;
Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/message/Message.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/message/Message.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/message/Message.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/message/Message.java Thu May 1 19:37:14 2014
@@ -28,6 +28,8 @@ import org.apache.qpid.proton.amqp.messa
import org.apache.qpid.proton.amqp.messaging.Properties;
import org.apache.qpid.proton.amqp.messaging.Section;
+import org.apache.qpid.proton.message.impl.MessageImpl;
+
/**
* Represents a Message within Proton.
*
@@ -36,6 +38,27 @@ import org.apache.qpid.proton.amqp.messa
*/
public interface Message
{
+
+ public static final class Factory
+ {
+ public static Message create() {
+ return new MessageImpl();
+ }
+
+ public static Message create(Header header,
+ DeliveryAnnotations deliveryAnnotations,
+ MessageAnnotations messageAnnotations,
+ Properties properties,
+ ApplicationProperties applicationProperties,
+ Section body,
+ Footer footer) {
+ return new MessageImpl(header, deliveryAnnotations,
+ messageAnnotations, properties,
+ applicationProperties, body, footer);
+ }
+ }
+
+
short DEFAULT_PRIORITY = 4;
boolean isDurable();
Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/Messenger.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/Messenger.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/Messenger.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/Messenger.java Thu May 1 19:37:14 2014
@@ -25,6 +25,8 @@ import java.io.IOException;
import org.apache.qpid.proton.TimeoutException;
import org.apache.qpid.proton.message.Message;
+import org.apache.qpid.proton.messenger.impl.MessengerImpl;
+
/**
*
* Messenger defines a high level interface for sending and receiving
@@ -69,6 +71,18 @@ import org.apache.qpid.proton.message.Me
*/
public interface Messenger
{
+
+ public static final class Factory
+ {
+ public static Messenger create() {
+ return new MessengerImpl();
+ }
+
+ public static Messenger create(String name) {
+ return new MessengerImpl(name);
+ }
+ }
+
/**
* Flag for use with reject(), accept() and settle() methods.
*/
Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerImpl.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerImpl.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerImpl.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerImpl.java Thu May 1 19:37:14 2014
@@ -29,17 +29,14 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.qpid.proton.Proton;
-import org.apache.qpid.proton.ProtonFactoryLoader;
import org.apache.qpid.proton.InterruptException;
import org.apache.qpid.proton.TimeoutException;
import org.apache.qpid.proton.driver.Connector;
import org.apache.qpid.proton.driver.Driver;
-import org.apache.qpid.proton.driver.DriverFactory;
import org.apache.qpid.proton.driver.Listener;
import org.apache.qpid.proton.engine.Connection;
import org.apache.qpid.proton.engine.Delivery;
import org.apache.qpid.proton.engine.EndpointState;
-import org.apache.qpid.proton.engine.EngineFactory;
import org.apache.qpid.proton.engine.Link;
import org.apache.qpid.proton.engine.Receiver;
import org.apache.qpid.proton.engine.Sasl;
@@ -49,10 +46,8 @@ import org.apache.qpid.proton.engine.Ssl
import org.apache.qpid.proton.engine.Ssl;
import org.apache.qpid.proton.engine.Transport;
import org.apache.qpid.proton.message.Message;
-import org.apache.qpid.proton.message.MessageFactory;
import org.apache.qpid.proton.messenger.Messenger;
import org.apache.qpid.proton.messenger.MessengerException;
-import org.apache.qpid.proton.messenger.MessengerFactory;
import org.apache.qpid.proton.messenger.Status;
import org.apache.qpid.proton.messenger.Tracker;
import org.apache.qpid.proton.amqp.messaging.Source;
Modified: qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/ProtonEngineExampleTest.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/ProtonEngineExampleTest.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/ProtonEngineExampleTest.java (original)
+++ qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/ProtonEngineExampleTest.java Thu May 1 19:37:14 2014
@@ -26,7 +26,6 @@ import static org.apache.qpid.proton.eng
import static org.apache.qpid.proton.engine.EndpointState.CLOSED;
import static org.apache.qpid.proton.engine.EndpointState.UNINITIALIZED;
import static org.apache.qpid.proton.systemtests.TestLoggingHelper.bold;
-import static org.apache.qpid.proton.systemtests.engine.ProtonFactoryTestFixture.isProtonJ;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
@@ -34,7 +33,7 @@ import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.logging.Logger;
-import org.apache.qpid.proton.ProtonFactoryLoader;
+import org.apache.qpid.proton.Proton;
import org.apache.qpid.proton.amqp.messaging.Accepted;
import org.apache.qpid.proton.amqp.messaging.AmqpValue;
import org.apache.qpid.proton.amqp.messaging.Section;
@@ -45,10 +44,8 @@ import org.apache.qpid.proton.amqp.trans
import org.apache.qpid.proton.engine.Delivery;
import org.apache.qpid.proton.engine.Endpoint;
import org.apache.qpid.proton.engine.EndpointState;
-import org.apache.qpid.proton.engine.EngineFactory;
import org.apache.qpid.proton.engine.Receiver;
import org.apache.qpid.proton.message.Message;
-import org.apache.qpid.proton.message.MessageFactory;
import org.junit.Test;
/**
@@ -80,26 +77,23 @@ public class ProtonEngineExampleTest
private final String _targetAddress = _server.containerId + "-link1-target";
- private final EngineFactory _engineFactory = new ProtonFactoryLoader<EngineFactory>(EngineFactory.class).loadFactory();
- private final MessageFactory _messageFactory = new ProtonFactoryLoader<MessageFactory>(MessageFactory.class).loadFactory();
-
@Test
public void test() throws Exception
{
LOGGER.fine(bold("======== About to create transports"));
- _client.transport = _engineFactory.createTransport();
+ _client.transport = Proton.transport();
ProtocolTracerEnabler.setProtocolTracer(_client.transport, TestLoggingHelper.CLIENT_PREFIX);
- _server.transport = _engineFactory.createTransport();
+ _server.transport = Proton.transport();
ProtocolTracerEnabler.setProtocolTracer(_server.transport, " " + TestLoggingHelper.SERVER_PREFIX);
doOutputInputCycle();
- _client.connection = _engineFactory.createConnection();
+ _client.connection = Proton.connection();
_client.transport.bind(_client.connection);
- _server.connection = _engineFactory.createConnection();
+ _server.connection = Proton.connection();
_server.transport.bind(_server.connection);
@@ -182,7 +176,7 @@ public class ProtonEngineExampleTest
LOGGER.fine(bold("======== About to create a message and send it to the server"));
- _client.message = _messageFactory.createMessage();
+ _client.message = Proton.message();
Section messageBody = new AmqpValue("Hello");
_client.message.setBody(messageBody);
_client.messageData = new byte[BUFFER_SIZE];
@@ -195,12 +189,7 @@ public class ProtonEngineExampleTest
assertEquals("For simplicity, assume the sender can accept all the data",
lengthOfEncodedMessage, numberOfBytesAcceptedBySender);
- if (isProtonJ(_engineFactory))
- {
- // TODO PROTON-261: Proton-c ProtonJNI.pn_delivery_local_state is returning 0, which doesn't map to an
- // value within the C enum.
- assertNull(_client.delivery.getLocalState());
- }
+ assertNull(_client.delivery.getLocalState());
boolean senderAdvanced = _client.sender.advance();
assertTrue("sender has not advanced", senderAdvanced);
@@ -213,11 +202,8 @@ public class ProtonEngineExampleTest
_server.delivery = _server.connection.getWorkHead();
assertEquals("The received delivery should be on our receiver",
_server.receiver, _server.delivery.getLink());
- if (isProtonJ(_engineFactory))
- {
- assertNull(_server.delivery.getLocalState());
- assertNull(_server.delivery.getRemoteState());
- }
+ assertNull(_server.delivery.getLocalState());
+ assertNull(_server.delivery.getRemoteState());
assertFalse(_server.delivery.isPartial());
assertTrue(_server.delivery.isReadable());
@@ -226,7 +212,7 @@ public class ProtonEngineExampleTest
int numberOfBytesProducedByReceiver = _server.receiver.recv(_server.messageData, 0, BUFFER_SIZE);
assertEquals(numberOfBytesAcceptedBySender, numberOfBytesProducedByReceiver);
- _server.message = _messageFactory.createMessage();
+ _server.message = Proton.message();
_server.message.decode(_server.messageData, 0, numberOfBytesProducedByReceiver);
boolean messageProcessed = applicationProcessMessage(_server.message);
Modified: qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/SimpleTest.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/SimpleTest.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/SimpleTest.java (original)
+++ qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/SimpleTest.java Thu May 1 19:37:14 2014
@@ -20,10 +20,9 @@ package org.apache.qpid.proton.systemtes
import static org.junit.Assert.assertEquals;
-import org.apache.qpid.proton.ProtonFactoryLoader;
+import org.apache.qpid.proton.Proton;
import org.apache.qpid.proton.engine.Connection;
import org.apache.qpid.proton.engine.EndpointState;
-import org.apache.qpid.proton.engine.EngineFactory;
import org.apache.qpid.proton.engine.Transport;
import org.junit.Test;
@@ -33,14 +32,12 @@ public class SimpleTest
@Test
public void test()
{
- EngineFactory engineFactory = new ProtonFactoryLoader<EngineFactory>(EngineFactory.class).loadFactory();
-
- Connection connection1 = engineFactory.createConnection();
- Connection connection2 = engineFactory.createConnection();;
- Transport transport1 = engineFactory.createTransport();
+ Connection connection1 = Proton.connection();
+ Connection connection2 = Proton.connection();;
+ Transport transport1 = Proton.transport();
transport1.bind(connection1);
- Transport transport2 = engineFactory.createTransport();
+ Transport transport2 = Proton.transport();
transport2.bind(connection2);
assertEquals(EndpointState.UNINITIALIZED, connection1.getLocalState());
Modified: qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/engine/ConnectionTest.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/engine/ConnectionTest.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/engine/ConnectionTest.java (original)
+++ qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/engine/ConnectionTest.java Thu May 1 19:37:14 2014
@@ -23,8 +23,6 @@ import static java.util.EnumSet.of;
import static org.apache.qpid.proton.engine.EndpointState.ACTIVE;
import static org.apache.qpid.proton.engine.EndpointState.CLOSED;
import static org.apache.qpid.proton.engine.EndpointState.UNINITIALIZED;
-import static org.apache.qpid.proton.systemtests.engine.ProtonFactoryTestFixture.isProtonC;
-import static org.apache.qpid.proton.systemtests.engine.ProtonFactoryTestFixture.isProtonJ;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -34,6 +32,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
+import org.apache.qpid.proton.Proton;
import org.apache.qpid.proton.amqp.Symbol;
import org.apache.qpid.proton.amqp.transport.Close;
import org.apache.qpid.proton.amqp.transport.ErrorCondition;
@@ -41,7 +40,6 @@ import org.apache.qpid.proton.amqp.trans
import org.apache.qpid.proton.engine.Connection;
import org.apache.qpid.proton.engine.Endpoint;
import org.apache.qpid.proton.engine.EndpointState;
-import org.apache.qpid.proton.engine.EngineFactory;
import org.apache.qpid.proton.engine.Session;
import org.apache.qpid.proton.engine.Transport;
import org.apache.qpid.proton.engine.TransportException;
@@ -59,18 +57,13 @@ public class ConnectionTest
private static final String SERVER_CONTAINER = "serverContainer";
private static final String CLIENT_CONTAINER = "clientContainer";
- private final ProtonFactoryTestFixture _protonFactoryTestFixture = new ProtonFactoryTestFixture();
-
- private EngineFactory _clientFactory = _protonFactoryTestFixture.getFactory1();
- private EngineFactory _serverFactory = _protonFactoryTestFixture.getFactory2();
-
- private final Transport _clientTransport = _clientFactory.createTransport();
- private final Transport _serverTransport = _serverFactory.createTransport();
+ private final Transport _clientTransport = Proton.transport();
+ private final Transport _serverTransport = Proton.transport();
private final TransportPumper _pumper = new TransportPumper(_clientTransport, _serverTransport);
- private final Connection _clientConnection = _clientFactory.createConnection();
- private final Connection _serverConnection = _serverFactory.createConnection();
+ private final Connection _clientConnection = Proton.connection();
+ private final Connection _serverConnection = Proton.connection();
private final AmqpFramer _framer = new AmqpFramer();
@@ -97,7 +90,6 @@ public class ConnectionTest
int serverConsumed = _serverTransport.input(openFrameBuffer, 0, openFrameBuffer.length);
assertEquals(openFrameBuffer.length, serverConsumed);
- assumeTrue(isProtonJ(_serverFactory));
}
/**
@@ -268,10 +260,7 @@ public class ConnectionTest
_pumper.pumpOnceFromClientToServer();
assertEnpointState(_clientConnection, CLOSED, UNINITIALIZED);
- if (!isProtonC(_serverFactory))
- {
- assertEnpointState(_serverConnection, UNINITIALIZED, CLOSED);
- }
+ assertEnpointState(_serverConnection, UNINITIALIZED, CLOSED);
}
/**
@@ -341,9 +330,6 @@ public class ConnectionTest
@SuppressWarnings({ "rawtypes", "unchecked" })
public void testCloseConnectionWithErrorCode_causesCloseFrameContainingErrorCodeToBeSent()
{
- // TODO Proton-c fails if no remote condition is set
- assumeTrue(isProtonJ(_clientFactory) && isProtonJ(_serverFactory));
-
bindAndOpenConnections();
/*
@@ -411,8 +397,6 @@ public class ConnectionTest
Close surprisingClose = new Close();
byte[] buf = _framer.generateFrame(0, surprisingClose);
- assumeTrue(isProtonJ(_serverFactory));
- // TODO Proton-C: function pn_do_close causes a SEGV fault if you try and close an unopened connection
_serverTransport.input(buf, 0, buf.length);
// TODO server should indicate error
Modified: qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/engine/TransportTest.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/engine/TransportTest.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/engine/TransportTest.java (original)
+++ qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/systemtests/engine/TransportTest.java Thu May 1 19:37:14 2014
@@ -22,7 +22,7 @@ package org.apache.qpid.proton.systemtes
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import org.apache.qpid.proton.engine.EngineFactory;
+import org.apache.qpid.proton.Proton;
import org.apache.qpid.proton.engine.Transport;
import org.apache.qpid.proton.engine.TransportException;
import org.junit.Ignore;
@@ -34,9 +34,7 @@ import org.junit.Test;
*/
public class TransportTest
{
- private final ProtonFactoryTestFixture _protonFactoryTestFixture = new ProtonFactoryTestFixture();
- private final EngineFactory _factory = _protonFactoryTestFixture.getFactory1();
- private final Transport _transport = _factory.createTransport();
+ private final Transport _transport = Proton.transport();
/**
* Note that Proton does not yet give the application explicit control over protocol version negotiation
Modified: qpid/proton/trunk/tests/java/org/apache/qpid/proton/InteropTest.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/java/org/apache/qpid/proton/InteropTest.java?rev=1591753&r1=1591752&r2=1591753&view=diff
==============================================================================
--- qpid/proton/trunk/tests/java/org/apache/qpid/proton/InteropTest.java (original)
+++ qpid/proton/trunk/tests/java/org/apache/qpid/proton/InteropTest.java Thu May 1 19:37:14 2014
@@ -19,13 +19,11 @@
package org.apache.qpid.proton;
import org.apache.qpid.proton.TestDecoder;
-import org.apache.qpid.proton.ProtonFactoryLoader;
import org.apache.qpid.proton.amqp.Binary;
import org.apache.qpid.proton.amqp.DescribedType;
import org.apache.qpid.proton.amqp.Symbol;
import org.apache.qpid.proton.amqp.messaging.AmqpValue;
import org.apache.qpid.proton.message.Message;
-import org.apache.qpid.proton.message.MessageFactory;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertArrayEquals;
@@ -69,8 +67,7 @@ public class InteropTest
Message decodeMessage(String name) throws IOException
{
byte[] data = getBytes(name);
- MessageFactory mf = new ProtonFactoryLoader<MessageFactory>(MessageFactory.class).loadFactory();
- Message m = mf.createMessage();
+ Message m = Proton.message();
m.decode(data, 0, data.length);
return m;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org