You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2012/08/03 14:14:12 UTC
svn commit: r1368910 [21/27] - in /qpid/branches/asyncstore: ./ bin/
cpp/bindings/qmf/ruby/ cpp/bindings/qmf2/ruby/ cpp/bindings/qpid/python/
cpp/bindings/qpid/ruby/ cpp/bindings/qpid/ruby/features/
cpp/bindings/qpid/ruby/features/step_definitions/ cpp...
Modified: qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java (original)
+++ qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java Fri Aug 3 12:13:32 2012
@@ -321,7 +321,40 @@ public abstract class AbstractJMSMessage
protected abstract String getMimeType();
+ public String toHeaderString() throws JMSException
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append("\nJMS Correlation ID: ").append(getJMSCorrelationID());
+ buf.append("\nJMS timestamp: ").append(getJMSTimestamp());
+ buf.append("\nJMS expiration: ").append(getJMSExpiration());
+ buf.append("\nJMS priority: ").append(getJMSPriority());
+ buf.append("\nJMS delivery mode: ").append(getJMSDeliveryMode());
+ buf.append("\nJMS reply to: ").append(getReplyToString());
+ buf.append("\nJMS Redelivered: ").append(_redelivered);
+ buf.append("\nJMS Destination: ").append(getJMSDestination());
+ buf.append("\nJMS Type: ").append(getJMSType());
+ buf.append("\nJMS MessageID: ").append(getJMSMessageID());
+ buf.append("\nJMS Content-Type: ").append(getContentType());
+ buf.append("\nAMQ message number: ").append(getDeliveryTag());
+
+ buf.append("\nProperties:");
+ final Enumeration propertyNames = getPropertyNames();
+ if (!propertyNames.hasMoreElements())
+ {
+ buf.append("<NONE>");
+ }
+ else
+ {
+ buf.append('\n');
+ while(propertyNames.hasMoreElements())
+ {
+ String propertyName = (String) propertyNames.nextElement();
+ buf.append("\t").append(propertyName).append(" = ").append(getObjectProperty(propertyName)).append("\n");
+ }
+ }
+ return buf.toString();
+ }
public String toString()
{
@@ -330,35 +363,7 @@ public abstract class AbstractJMSMessage
StringBuffer buf = new StringBuffer("Body:\n");
buf.append(toBodyString());
- buf.append("\nJMS Correlation ID: ").append(getJMSCorrelationID());
- buf.append("\nJMS timestamp: ").append(getJMSTimestamp());
- buf.append("\nJMS expiration: ").append(getJMSExpiration());
- buf.append("\nJMS priority: ").append(getJMSPriority());
- buf.append("\nJMS delivery mode: ").append(getJMSDeliveryMode());
- buf.append("\nJMS reply to: ").append(getReplyToString());
- buf.append("\nJMS Redelivered: ").append(_redelivered);
- buf.append("\nJMS Destination: ").append(getJMSDestination());
- buf.append("\nJMS Type: ").append(getJMSType());
- buf.append("\nJMS MessageID: ").append(getJMSMessageID());
- buf.append("\nJMS Content-Type: ").append(getContentType());
- buf.append("\nAMQ message number: ").append(getDeliveryTag());
-
- buf.append("\nProperties:");
- final Enumeration propertyNames = getPropertyNames();
- if (!propertyNames.hasMoreElements())
- {
- buf.append("<NONE>");
- }
- else
- {
- buf.append('\n');
- while(propertyNames.hasMoreElements())
- {
- String propertyName = (String) propertyNames.nextElement();
- buf.append("\t").append(propertyName).append(" = ").append(getObjectProperty(propertyName)).append("\n");
- }
-
- }
+ buf.append(toHeaderString());
return buf.toString();
}
Modified: qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/message/FieldTableSupport.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/message/FieldTableSupport.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/message/FieldTableSupport.java (original)
+++ qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/message/FieldTableSupport.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.client.message;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.client.message;
* under the License.
*
*/
+package org.apache.qpid.client.message;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.framing.FieldTable;
Modified: qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/message/ReturnMessage.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/message/ReturnMessage.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/message/ReturnMessage.java (original)
+++ qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/message/ReturnMessage.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.client.message;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.client.message;
* under the License.
*
*/
+package org.apache.qpid.client.message;
import org.apache.qpid.framing.AMQShortString;
Modified: qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/security/crammd5hashed/CRAMMD5HashedSaslClientFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/security/crammd5hashed/CRAMMD5HashedSaslClientFactory.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/security/crammd5hashed/CRAMMD5HashedSaslClientFactory.java (original)
+++ qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/security/crammd5hashed/CRAMMD5HashedSaslClientFactory.java Fri Aug 3 12:13:32 2012
@@ -44,14 +44,13 @@ public class CRAMMD5HashedSaslClientFact
throw new SaslException("CallbackHandler must not be null");
}
- String[] mechs = {"CRAM-MD5"};
- return Sasl.createSaslClient(mechs, authorizationId, protocol, serverName, props, cbh);
+ return new CRAMMD5HashedSaslClient(authorizationId, protocol, serverName, props, cbh);
}
}
return null;
}
- public String[] getMechanismNames(Map props)
+ public String[] getMechanismNames(Map<String,?> props)
{
if (props != null)
{
Modified: qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java (original)
+++ qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java Fri Aug 3 12:13:32 2012
@@ -125,9 +125,9 @@ public class AMQStateManager implements
*/
public void setProtocolSession(AMQProtocolSession session)
{
- if (_logger.isInfoEnabled())
+ if (_logger.isDebugEnabled())
{
- _logger.info("Setting ProtocolSession:" + session);
+ _logger.debug("Setting ProtocolSession:" + session);
}
_protocolSession = session;
}
Modified: qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java (original)
+++ qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java Fri Aug 3 12:13:32 2012
@@ -61,7 +61,10 @@ public class StateWaiter extends Blockin
*/
public StateWaiter(AMQStateManager stateManager, AMQState currentState, Set<AMQState> awaitStates)
{
- _logger.info("New StateWaiter :" + currentState + ":" + awaitStates);
+ if(_logger.isDebugEnabled())
+ {
+ _logger.debug("New StateWaiter :" + currentState + ":" + awaitStates);
+ }
_stateManager = stateManager;
_awaitStates = awaitStates;
_startState = currentState;
Modified: qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/url/URLParser.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/url/URLParser.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/url/URLParser.java (original)
+++ qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/client/url/URLParser.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.client.url;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.client.url;
* under the License.
*
*/
+package org.apache.qpid.client.url;
import org.apache.qpid.client.AMQBrokerDetails;
Modified: qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/jms/FailoverPolicy.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/jms/FailoverPolicy.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/jms/FailoverPolicy.java (original)
+++ qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/jms/FailoverPolicy.java Fri Aug 3 12:13:32 2012
@@ -33,9 +33,7 @@ public class FailoverPolicy
{
private static final Logger _logger = LoggerFactory.getLogger(FailoverPolicy.class);
- private static final long MINUTE = 60000L;
-
- private static final long DEFAULT_METHOD_TIMEOUT = 1 * MINUTE;
+ private final long DEFAULT_METHOD_TIMEOUT = Long.getLong("qpid.failover_method_timeout", 120000);
private FailoverMethod[] _methods = new FailoverMethod[1];
Modified: qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/jms/TopicSubscriber.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/jms/TopicSubscriber.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/jms/TopicSubscriber.java (original)
+++ qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/jms/TopicSubscriber.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.jms;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.jms;
* under the License.
*
*/
+package org.apache.qpid.jms;
import org.apache.qpid.AMQException;
Modified: qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java (original)
+++ qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java Fri Aug 3 12:13:32 2012
@@ -69,46 +69,21 @@ public class PropertiesFileInitialContex
public Context getInitialContext(Hashtable environment) throws NamingException
{
Map data = new ConcurrentHashMap();
-
+ BufferedInputStream inputStream = null;
try
{
- String file = null;
-
- if (environment.containsKey(Context.PROVIDER_URL))
- {
- file = (String) environment.get(Context.PROVIDER_URL);
- }
- else
- {
- file = System.getProperty(Context.PROVIDER_URL);
- }
+ String fileName = (environment.containsKey(Context.PROVIDER_URL))
+ ? (String)environment.get(Context.PROVIDER_URL) : System.getProperty(Context.PROVIDER_URL);
- // Load the properties specified
- if (file != null)
+ if (fileName != null)
{
- _logger.info("Loading Properties from:" + file);
- BufferedInputStream inputStream = null;
+ _logger.info("Attempting to load " + fileName);
- if(file.contains("file:"))
- {
- inputStream = new BufferedInputStream(new FileInputStream(new File(new URI(file))));
- }
- else
- {
- inputStream = new BufferedInputStream(new FileInputStream(file));
- }
-
+ inputStream = new BufferedInputStream(new FileInputStream((fileName.contains("file:"))
+ ? new File(new URI(fileName)) : new File(fileName)));
Properties p = new Properties();
-
- try
- {
- p.load(inputStream);
- }
- finally
- {
- inputStream.close();
- }
+ p.load(inputStream);
Strings.Resolver resolver = new Strings.ChainedResolver
(Strings.SYSTEM_RESOLVER, new Strings.PropertiesResolver(p));
@@ -134,12 +109,23 @@ public class PropertiesFileInitialContex
catch (IOException ioe)
{
_logger.warn("Unable to load property file specified in Provider_URL:" + environment.get(Context.PROVIDER_URL) +"\n" +
- "Due to:"+ioe.getMessage());
+ "Due to:" + ioe.getMessage());
}
catch(URISyntaxException uoe)
{
_logger.warn("Unable to load property file specified in Provider_URL:" + environment.get(Context.PROVIDER_URL) +"\n" +
- "Due to:"+uoe.getMessage());
+ "Due to:" + uoe.getMessage());
+ }
+ finally
+ {
+ try
+ {
+ if(inputStream != null)
+ {
+ inputStream.close();
+ }
+ }
+ catch(Exception ignore){}
}
createConnectionFactories(data, environment);
Modified: qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/nclient/util/ByteBufferMessage.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/nclient/util/ByteBufferMessage.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/nclient/util/ByteBufferMessage.java (original)
+++ qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/nclient/util/ByteBufferMessage.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.nclient.util;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.nclient.util;
* under the License.
*
*/
+package org.apache.qpid.nclient.util;
import org.apache.qpid.api.Message;
Modified: qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/nclient/util/MessagePartListenerAdapter.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/nclient/util/MessagePartListenerAdapter.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/nclient/util/MessagePartListenerAdapter.java (original)
+++ qpid/branches/asyncstore/java/client/src/main/java/org/apache/qpid/nclient/util/MessagePartListenerAdapter.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.nclient.util;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.nclient.util;
* under the License.
*
*/
+package org.apache.qpid.nclient.util;
import org.apache.qpid.nclient.MessagePartListener;
Modified: qpid/branches/asyncstore/java/client/src/test/java/org/apache/qpid/client/message/AbstractJMSMessageTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/client/src/test/java/org/apache/qpid/client/message/AbstractJMSMessageTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/client/src/test/java/org/apache/qpid/client/message/AbstractJMSMessageTest.java (original)
+++ qpid/branches/asyncstore/java/client/src/test/java/org/apache/qpid/client/message/AbstractJMSMessageTest.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.client.message;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.client.message;
* under the License.
*
*/
+package org.apache.qpid.client.message;
import junit.framework.TestCase;
Modified: qpid/branches/asyncstore/java/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java (original)
+++ qpid/branches/asyncstore/java/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java Fri Aug 3 12:13:32 2012
@@ -21,51 +21,47 @@
package org.apache.qpid.jndi;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
import java.util.Properties;
+import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.Queue;
import javax.jms.Topic;
import javax.naming.ConfigurationException;
import javax.naming.Context;
import javax.naming.InitialContext;
+import javax.naming.NamingException;
-import junit.framework.TestCase;
-
+import org.apache.qpid.client.AMQConnectionFactory;
import org.apache.qpid.client.AMQDestination;
+import org.apache.qpid.configuration.ClientProperties;
import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.test.utils.QpidTestCase;
-public class PropertiesFileInitialContextFactoryTest extends TestCase
+public class PropertiesFileInitialContextFactoryTest extends QpidTestCase
{
- private static final String FILE_URL_PATH = System.getProperty("user.dir") + "/client/src/test/java/org/apache/qpid/jndi/";
- private static final String FILE_NAME = "hello.properties";
-
- private Context ctx;
-
- protected void setUp() throws Exception
- {
- Properties properties = new Properties();
- properties.load(this.getClass().getResourceAsStream("JNDITest.properties"));
-
- //Create the initial context
- ctx = new InitialContext(properties);
- }
-
+ private static final String CONNECTION_URL = "amqp://username:password@clientid/test?brokerlist='tcp://testContextFromProviderURL:5672'";
public void testQueueNamesWithTrailingSpaces() throws Exception
{
+ Context ctx = prepareContext();
Queue queue = (Queue)ctx.lookup("QueueNameWithSpace");
assertEquals("QueueNameWithSpace",queue.getQueueName());
}
public void testTopicNamesWithTrailingSpaces() throws Exception
{
+ Context ctx = prepareContext();
Topic topic = (Topic)ctx.lookup("TopicNameWithSpace");
assertEquals("TopicNameWithSpace",topic.getTopicName());
}
public void testMultipleTopicNamesWithTrailingSpaces() throws Exception
{
+ Context ctx = prepareContext();
Topic topic = (Topic)ctx.lookup("MultipleTopicNamesWithSpace");
int i = 0;
for (AMQShortString bindingKey: ((AMQDestination)topic).getBindingKeys())
@@ -83,13 +79,59 @@ public class PropertiesFileInitialContex
try
{
- ctx = new InitialContext(properties);
+ new InitialContext(properties);
fail("A configuration exception should be thrown with details about the address syntax error");
}
catch(ConfigurationException e)
{
assertTrue("Incorrect exception", e.getMessage().contains("Failed to parse entry: amq.topic/test;create:always}"));
}
+ }
+ private InitialContext prepareContext() throws IOException, NamingException
+ {
+ Properties properties = new Properties();
+ properties.load(this.getClass().getResourceAsStream("JNDITest.properties"));
+
+ return new InitialContext(properties);
+ }
+
+ /**
+ * Test loading of a JNDI properties file through use of a file:// URL
+ * supplied via the InitialContext.PROVIDER_URL system property.
+ */
+ public void testContextFromProviderURL() throws Exception
+ {
+ Properties properties = new Properties();
+ properties.put("connectionfactory.qpidConnectionfactory", CONNECTION_URL);
+ properties.put("destination.topicExchange", "destName");
+
+ File f = File.createTempFile(getTestName(), ".properties");
+ try
+ {
+ FileOutputStream fos = new FileOutputStream(f);
+ properties.store(fos, null);
+ fos.close();
+
+ setTestSystemProperty(ClientProperties.DEST_SYNTAX, "ADDR");
+ setTestSystemProperty(InitialContext.INITIAL_CONTEXT_FACTORY, "org.apache.qpid.jndi.PropertiesFileInitialContextFactory");
+ setTestSystemProperty(InitialContext.PROVIDER_URL, "file://" + f.getCanonicalPath());
+
+ InitialContext context = new InitialContext();
+ Destination dest = (Destination) context.lookup("topicExchange");
+ assertNotNull("Lookup from URI based context should not be null", dest);
+ assertTrue("Unexpected value from lookup", dest.toString().contains("destName"));
+
+ ConnectionFactory factory = (ConnectionFactory) context.lookup("qpidConnectionfactory");
+ assertTrue("ConnectionFactory was not an instance of AMQConnectionFactory", factory instanceof AMQConnectionFactory);
+ assertEquals("Unexpected ConnectionURL value", CONNECTION_URL.replaceAll("password", "********"),
+ ((AMQConnectionFactory)factory).getConnectionURLString());
+
+ context.close();
+ }
+ finally
+ {
+ f.delete();
+ }
}
}
Modified: qpid/branches/asyncstore/java/common.xml
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common.xml?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common.xml (original)
+++ qpid/branches/asyncstore/java/common.xml Fri Aug 3 12:13:32 2012
@@ -18,12 +18,12 @@
- under the License.
-
-->
-<project name="common">
+<project xmlns:ivy="antlib:org.apache.ivy.ant" name="common">
<dirname property="project.root" file="${ant.file.common}"/>
<property name="project.name" value="qpid"/>
- <property name="project.version" value="0.17"/>
+ <property name="project.version" value="0.19"/>
<property name="project.url" value="http://qpid.apache.org"/>
<property name="project.groupid" value="org.apache.qpid"/>
<property name="project.namever" value="${project.name}-${project.version}"/>
@@ -43,7 +43,8 @@
<property name="build.release" location="${build}/release"/>
<property name="build.release.prepare" location="${build.release}/prepare"/>
<property name="build.plugins" location="${build}/lib/plugins"/>
- <property name="build.coveragereport" location="${build}/coverage"/>
+ <property name="build.coverage.report" location="${build}/coverage/report"/>
+ <property name="build.coverage.src" location="${build}/coverage/src"/>
<property name="build.findbugs" location="${build}/findbugs"/>
<property name="java.target" value="1.5"/>
@@ -62,10 +63,12 @@
<property name="cobertura.dir" value="${project.root}/lib/cobertura" />
<property name="cobertura.version" value="1.9.4.1" />
- <property name="cobertura.download.url"
- value="http://downloads.sourceforge.net/project/cobertura/cobertura/${cobertura.version}/cobertura-${cobertura.version}-bin.zip" />
- <property name="cobertura.zip.filename" value="cobertura-${cobertura.version}-bin.zip" />
- <property name="cobertura.temp.dir" value="${cobertura.dir}"/>
+
+ <path id="cobertura.classpath">
+ <fileset dir="${cobertura.dir}">
+ <include name="**/*.jar" />
+ </fileset>
+ </path>
<property name="mllib.dir" value="${project.root}/../python" />
<property name="findbugs.dir" value="${project.root}/lib/findbugs" />
@@ -75,13 +78,7 @@
<property name="eclipse.compilercompliance" value="5.0"/>
<property name="eclipse.container" value="JVM 1.5"/>
- <path id="cobertura.classpath">
- <fileset dir="${cobertura.dir}">
- <include name="cobertura-${cobertura.version}/*.jar" />
- <include name="cobertura-${cobertura.version}/**/lib/*.jar" />
- </fileset>
- </path>
-
+ <!-- properties for generating the maven artifacts -->
<property name="maven.local.repo" value="${build.scratch}/maven-local-repo"/>
<property name="maven.settings.xml" value="${project.root}/maven-settings.xml"/>
<property name="maven.unique.version" value="false"/>
@@ -90,6 +87,52 @@
<isfalse value="${maven.snapshot}"/>
</condition>
+ <!-- properties for uploading our Maven artifacts to Nexus using Ivy -->
+ <property name="ivy.organisation" value="org/apache"/>
+ <property name="nexus.organisation" value="org.apache"/>
+ <property name="nexus.host" value="repository.apache.org"/>
+ <property name="nexus.upload.url" value="https://${nexus.host}/service/local/staging/deploy/maven2"/>
+
+ <!-- properties for downloading ivy, and then our dependencies -->
+ <property name="ivy.jar.dir" value="${project.root}/lib/ivy" />
+ <property name="ivy.install.version" value="2.2.0" />
+ <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy-${ivy.install.version}.jar" />
+ <property name="ivy.repo.url" value="http://repo1.maven.org/maven2/org/apache/ivy/ivy"/>
+ <property name="ivy.jar.url" value="${ivy.repo.url}/${ivy.install.version}/ivy-${ivy.install.version}.jar"/>
+
+ <available property="ivy.jar.file.exists" file="${ivy.jar.file}"/>
+ <property name="retrieve.dependencies" value="true" />
+ <property name="optional.dependencies" value="false" />
+
+ <condition property="dont.download.ivy">
+ <!-- Set prop to stop Ivy download if asked not to retrieve
+ the dependencies, or the ivy jar is already present -->
+ <or>
+ <isfalse value="${retrieve.dependencies}"/>
+ <and>
+ <isset property="ivy.jar.file.exists"/>
+ <istrue value="${ivy.jar.file.exists}"/>
+ </and>
+ </or>
+ </condition>
+
+ <condition property="ivy.dont.retrieve">
+ <isfalse value="${retrieve.dependencies}"/>
+ </condition>
+ <condition property="ivy.configured">
+ <isfalse value="${retrieve.dependencies}"/>
+ </condition>
+ <condition property="ivy.retrieve.optional">
+ <and>
+ <istrue value="${retrieve.dependencies}"/>
+ <or>
+ <istrue value="${optional.dependencies}"/>
+ <istrue value="${optional}"/>
+ </or>
+ </and>
+ </condition>
+
+
<macrodef name="indirect">
<attribute name="name"/>
<attribute name="variable"/>
@@ -141,7 +184,7 @@
<attribute name="path"/>
<element name="args"/>
<sequential>
- <java jar="${project.root}/lib/jython-2.5.0.jar" fork="true" failonerror="true">
+ <java jar="${project.root}/${jython}" fork="true" failonerror="true">
<arg value="-Dpython.path=@{path}"/>
<args/>
</java>
@@ -175,6 +218,21 @@
</sequential>
</macrodef>
+ <macrodef name="copytofile">
+ <attribute name="tofile"/>
+ <attribute name="dir"/>
+ <attribute name="include"/>
+ <attribute name="failOnError" default="false"/>
+ <sequential>
+ <copy tofile="@{tofile}" failOnError="@{failOnError}">
+ <fileset dir="@{dir}">
+ <include name="@{include}"/>
+ </fileset>
+ </copy>
+ </sequential>
+ </macrodef>
+
+
<target name="clean-tasks">
<delete dir="${tasks.classes}"/>
</target>
@@ -198,29 +256,69 @@
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
</target>
- <!--download Cobertura jar and expand-->
- <target name="download-cobertura" description="download Cobertura if not already present" depends="cobertura-check" unless="cobertura.already.exists">
- <mkdir dir="${cobertura.dir}"/>
- <echo>Downloading Cobertura ${cobertura.version}</echo>
- <get src="${cobertura.download.url}" dest="${cobertura.temp.dir}/${cobertura.zip.filename}" usetimestamp="false" />
- <echo>Extracting Cobertura JAR and dependencies</echo>
- <unzip src="${cobertura.temp.dir}/${cobertura.zip.filename}" dest="${cobertura.dir}"/>
- <echo>Cleanup Cobertura Download</echo>
- <delete file="${cobertura.temp.dir}/${cobertura.zip.filename}"/>
- <echo>Done</echo>
- </target>
+ <target name="findbugs-init">
- <target name="cobertura-check">
- <available property="cobertura.already.exists" file="${cobertura.dir}/cobertura-${cobertura.version}" type="dir"/>
- </target>
+ <mkdir dir="${findbugs.dir}"/>
+ <!-- Hack to make the FindBugs jars retrieved using Ivy work with the Ant Task,
+ because it expects certain jar names without versions like in the .zip release -->
+ <copytofile tofile="${findbugs.dir}/findbugs.jar" dir="${findbugs.dir}" include="findbugs-?.*.*.jar"/>
+ <copytofile tofile="${findbugs.dir}/findbugs-ant.jar" dir="${findbugs.dir}" include="findbugs-ant-?.*.*.jar"/>
+ <copytofile tofile="${findbugs.dir}/bcel.jar" dir="${findbugs.dir}" include="bcel-*.jar"/>
+ <copytofile tofile="${findbugs.dir}/annotations.jar" dir="${findbugs.dir}" include="annotations-?.*.*.jar"/>
+ <copytofile tofile="${findbugs.dir}/jsr305.jar" dir="${findbugs.dir}" include="jsr305-*.jar"/>
+ <copytofile tofile="${findbugs.dir}/jFormatString.jar" dir="${findbugs.dir}" include="jFormatString-*.jar"/>
- <target name="findbugs-init">
<available file="${findbugs.dir}/findbugs-ant.jar" property="findbugs-ant.jar.present"/>
- <fail unless="findbugs-ant.jar.present" message="Please follow the instructions at ${findbugs.dir}/README.txt to configure FindBugs"/>
+ <fail unless="findbugs-ant.jar.present" message="FindBugs was not found. Please add -Doptional.dependencies=true to your build command to retrieve FindBugs"/>
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${findbugs.dir}/findbugs-ant.jar"/>
</target>
+
+ <!-- targets for downloading ivy and retrieving dependencies -->
+ <target name="retrieve-dependencies" depends="load-ivy, configure-ivy, retrieve-optional-dependencies" unless="${ivy.dont.retrieve}">
+ <echo message="Resolving and retrieving dependencies..."/>
+ <ivy:resolve type="jar,bundle,war" file="${project.root}/ivy.retrieve.xml" conf="required"/>
+ <ivy:retrieve type="jar,bundle,war" conf="required" sync="true"
+ pattern="${project.root}/lib/required/[artifact]-[revision].[ext]" />
+ </target>
+
+ <target name="retrieve-optional-dependencies" if="${ivy.retrieve.optional}">
+ <echo message="Resolving and retrieving optional dependencies..."/>
+ <ivy:resolve type="jar" file="${project.root}/ivy.retrieve.xml" conf="findbugs"/>
+ <ivy:retrieve type="jar" conf="findbugs" sync="true"
+ pattern="${findbugs.dir}/[artifact]-[revision].[ext]" />
+
+ <ivy:resolve type="jar" file="${project.root}/ivy.retrieve.xml" conf="cobertura"/>
+ <ivy:retrieve type="jar" conf="cobertura" sync="true"
+ pattern="${cobertura.dir}/[artifact]-[revision].[ext]" />
+ </target>
+
+
+ <target name="configure-ivy" unless="${ivy.configured}">
+ <ivy:configure file="${project.root}/ivysettings.retrieve.xml" override="true"/>
+ <property name="ivy.configured" value="true" />
+ </target>
+
+ <target name="load-ivy" depends="download-ivy" unless="${ivy.dont.retrieve}">
+ <!-- Try to load Ivy from local ivy dir, in case the user has not already dropped it into
+ Ant's lib dir (note that the latter copy will always take precedence). Won't
+ fail so long as Ivy is in at least one of the locations. -->
+ <mkdir dir="${ivy.jar.dir}"/>
+ <path id="ivy.lib.path">
+ <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
+ </path>
+ <taskdef resource="org/apache/ivy/ant/antlib.xml"
+ uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
+ </target>
+
+ <target name="download-ivy" unless="${dont.download.ivy}">
+ <mkdir dir="${ivy.jar.dir}"/>
+ <echo message="Downloading ivy..."/>
+ <get src="${ivy.jar.url}" dest="${ivy.jar.file}" usetimestamp="true"/>
+ </target>
+
+
<target name="help" description="display detailed build documentation">
<echo>
ant build
Modified: qpid/branches/asyncstore/java/common/build.xml
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/build.xml?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/build.xml (original)
+++ qpid/branches/asyncstore/java/common/build.xml Fri Aug 3 12:13:32 2012
@@ -98,13 +98,19 @@ public class QpidBuildVersion
</target>
<target name="jms-selector">
+ <copy tofile="${module.build}/javacc.jar" failonerror="true">
+ <fileset dir="${project.root}/lib/required">
+ <include name="javacc-*.jar"/>
+ </fileset>
+ </copy>
<mkdir dir="${selector.output.dir}"/>
<javacc target="src/main/grammar/SelectorParser.jj"
outputdirectory="${selector.output.dir}"
- javacchome="${project.root}/lib"/>
+ javacchome="${module.build}"/>
</target>
<target name="precompile" depends="gentools,jython,create-version,build-version,jms-selector"/>
<target name="bundle" depends="bundle-tasks"/>
+
</project>
Modified: qpid/branches/asyncstore/java/common/src/main/java/common.bnd
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/common.bnd?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/common.bnd (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/common.bnd Fri Aug 3 12:13:32 2012
@@ -17,7 +17,7 @@
# under the License.
#
-ver: 0.17.0
+ver: 0.19.0
Bundle-SymbolicName: qpid-common
Bundle-Version: ${ver}
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/AMQException.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/AMQException.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/AMQException.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/AMQException.java Fri Aug 3 12:13:32 2012
@@ -40,6 +40,8 @@ public class AMQException extends Except
/** Holds the AMQ error code constant associated with this exception. */
private AMQConstant _errorCode;
+ private boolean _isHardError;
+
/**
* Creates an exception with an optional error code, optional message and optional underlying cause.
*
@@ -49,8 +51,24 @@ public class AMQException extends Except
*/
public AMQException(AMQConstant errorCode, String msg, Throwable cause)
{
+ // isHardError is defaulted to true to avoid unnessacery modification to
+ // existing code.
+ this(errorCode,true,msg,cause);
+ }
+
+ /**
+ * Creates an exception with an optional error code, optional message and optional underlying cause.
+ *
+ * @param errorCode The error code. May be null if not to be set.
+ * @param isHardError Denotes if the underlying error is considered a hard error.
+ * @param msg The exception message. May be null if not to be set.
+ * @param cause The underlying cause of the exception. May be null if not to be set.
+ */
+ public AMQException(AMQConstant errorCode, boolean isHardError, String msg, Throwable cause)
+ {
super(((msg == null) ? "" : msg), cause);
_errorCode = errorCode;
+ _isHardError = isHardError;
}
/*
@@ -92,7 +110,7 @@ public class AMQException extends Except
public boolean isHardError()
{
- return true;
+ return _isHardError;
}
/**
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/AMQProtocolException.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/AMQProtocolException.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/AMQProtocolException.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/AMQProtocolException.java Fri Aug 3 12:13:32 2012
@@ -1,8 +1,5 @@
-package org.apache.qpid;
-
-import org.apache.qpid.protocol.AMQConstant;
-
-/* Licensed to the Apache Software Foundation (ASF) under one
+/*
+* 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
@@ -19,6 +16,10 @@ import org.apache.qpid.protocol.AMQConst
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.qpid;
+
+import org.apache.qpid.protocol.AMQConstant;
+
public class AMQProtocolException extends AMQException
{
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/api/Message.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/api/Message.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/api/Message.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/api/Message.java Fri Aug 3 12:13:32 2012
@@ -1,12 +1,3 @@
-package org.apache.qpid.api;
-
-import org.apache.qpid.transport.DeliveryProperties;
-import org.apache.qpid.transport.Header;
-import org.apache.qpid.transport.MessageProperties;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -25,6 +16,14 @@ import java.nio.ByteBuffer;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.qpid.api;
+
+import org.apache.qpid.transport.DeliveryProperties;
+import org.apache.qpid.transport.Header;
+import org.apache.qpid.transport.MessageProperties;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
public interface Message
{
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java Fri Aug 3 12:13:32 2012
@@ -168,4 +168,28 @@ public class ClientProperties
public static final String SEND_BUFFER_SIZE_PROP_NAME = "qpid.send_buffer_size";
@Deprecated
public static final String LEGACY_SEND_BUFFER_SIZE_PROP_NAME = "amqj.sendBufferSize";
+
+ /**
+ * System property to set the time (in millis) to wait before failing when sending and
+ * the client has been flow controlled by the broker.
+ */
+ public static final String QPID_FLOW_CONTROL_WAIT_FAILURE = "qpid.flow_control_wait_failure";
+
+ /**
+ * Default time (in millis) to wait before failing when sending and the client has been
+ * flow controlled by the broker.
+ */
+ public static final long DEFAULT_FLOW_CONTROL_WAIT_FAILURE = 60000L;
+
+ /**
+ * System property to set the time (in millis) between log notifications that a
+ * send is waiting because the client was flow controlled by the broker.
+ */
+ public static final String QPID_FLOW_CONTROL_WAIT_NOTIFY_PERIOD = "qpid.flow_control_wait_notify_period";
+
+ /**
+ * Default time (in millis) between log notifications that a send is
+ * waiting because the client was flow controlled by the broker.
+ */
+ public static final long DEFAULT_FLOW_CONTROL_WAIT_NOTIFY_PERIOD = 5000L;
}
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/configuration/Validator.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/configuration/Validator.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/configuration/Validator.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/configuration/Validator.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.configuration;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.configuration;
* under the License.
*
*/
+package org.apache.qpid.configuration;
public interface Validator
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/filter/FilterableMessage.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/filter/FilterableMessage.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/filter/FilterableMessage.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/filter/FilterableMessage.java Fri Aug 3 12:13:32 2012
@@ -1,21 +1,21 @@
-package org.apache.qpid.filter;
-
-/**
+/*
* 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
- * <p/>
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
+ *
* 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.filter;
+
public interface FilterableMessage
{
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/filter/SelectorParsingException.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/filter/SelectorParsingException.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/filter/SelectorParsingException.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/filter/SelectorParsingException.java Fri Aug 3 12:13:32 2012
@@ -1,5 +1,3 @@
-package org.apache.qpid.filter;
-
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -7,15 +5,17 @@ package org.apache.qpid.filter;
* 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
- * <p/>
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
+ *
* 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.filter;
+
public class SelectorParsingException extends RuntimeException
{
public SelectorParsingException(String s)
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyImpl.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyImpl.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyImpl.java Fri Aug 3 12:13:32 2012
@@ -1,5 +1,3 @@
-package org.apache.qpid.framing;
-
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -20,6 +18,8 @@ package org.apache.qpid.framing;
* under the License.
*
*/
+package org.apache.qpid.framing;
+
import org.apache.qpid.AMQChannelException;
import org.apache.qpid.AMQConnectionException;
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/framing/AMQShortStringTokenizer.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/framing/AMQShortStringTokenizer.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/framing/AMQShortStringTokenizer.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/framing/AMQShortStringTokenizer.java Fri Aug 3 12:13:32 2012
@@ -1,5 +1,3 @@
-package org.apache.qpid.framing;
-
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -20,6 +18,9 @@ package org.apache.qpid.framing;
* under the License.
*
*/
+package org.apache.qpid.framing;
+
+
public interface AMQShortStringTokenizer
{
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/ssl/SSLContextFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/ssl/SSLContextFactory.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/ssl/SSLContextFactory.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/ssl/SSLContextFactory.java Fri Aug 3 12:13:32 2012
@@ -39,7 +39,6 @@ import java.security.KeyStore;
*/
public class SSLContextFactory
{
- public static final String JAVA_KEY_STORE_CODE = "JKS";
public static final String TRANSPORT_LAYER_SECURITY_CODE = "TLS";
private SSLContextFactory()
@@ -48,28 +47,32 @@ public class SSLContextFactory
}
public static SSLContext buildServerContext(final String keyStorePath,
- final String keyStorePassword, final String keyManagerFactoryAlgorithm)
+ final String keyStorePassword, final String keyStoreType,
+ final String keyManagerFactoryAlgorithm)
throws GeneralSecurityException, IOException
{
- return buildContext(null, null, null, keyStorePath, keyStorePassword,
+ return buildContext(null, null, null, null, keyStorePath, keyStorePassword, keyStoreType,
keyManagerFactoryAlgorithm, null);
}
public static SSLContext buildClientContext(final String trustStorePath,
- final String trustStorePassword, final String trustManagerFactoryAlgorithm,
- final String keyStorePath, final String keyStorePassword,
+ final String trustStorePassword, final String trustStoreType,
+ final String trustManagerFactoryAlgorithm, final String keyStorePath,
+ final String keyStorePassword, final String keyStoreType,
final String keyManagerFactoryAlgorithm, final String certAlias)
throws GeneralSecurityException, IOException
{
- return buildContext(trustStorePath, trustStorePassword,
- trustManagerFactoryAlgorithm, keyStorePath, keyStorePassword,
+ return buildContext(trustStorePath, trustStorePassword, trustStoreType,
+ trustManagerFactoryAlgorithm, keyStorePath, keyStorePassword, keyStoreType,
keyManagerFactoryAlgorithm, certAlias);
}
private static SSLContext buildContext(final String trustStorePath,
- final String trustStorePassword, final String trustManagerFactoryAlgorithm,
- final String keyStorePath, final String keyStorePassword,
- final String keyManagerFactoryAlgorithm, final String certAlias)
+ final String trustStorePassword, final String trustStoreType,
+ final String trustManagerFactoryAlgorithm,
+ final String keyStorePath, final String keyStorePassword,
+ final String keyStoreType, final String keyManagerFactoryAlgorithm,
+ final String certAlias)
throws GeneralSecurityException, IOException
{
// Initialize the SSLContext to work with our key managers.
@@ -82,7 +85,7 @@ public class SSLContextFactory
if (trustStorePath != null)
{
final KeyStore ts = SSLUtil.getInitializedKeyStore(trustStorePath,
- trustStorePassword);
+ trustStorePassword, trustStoreType);
final TrustManagerFactory tmf = TrustManagerFactory
.getInstance(trustManagerFactoryAlgorithm);
tmf.init(ts);
@@ -99,13 +102,13 @@ public class SSLContextFactory
if (certAlias != null)
{
keyManagers = new KeyManager[] { new QpidClientX509KeyManager(
- certAlias, keyStorePath, keyStorePassword,
+ certAlias, keyStorePath, keyStoreType, keyStorePassword,
keyManagerFactoryAlgorithm) };
}
else
{
final KeyStore ks = SSLUtil.getInitializedKeyStore(
- keyStorePath, keyStorePassword);
+ keyStorePath, keyStorePassword, keyStoreType);
char[] keyStoreCharPassword = keyStorePassword == null ? null : keyStorePassword.toCharArray();
// Set up key manager factory to use our key store
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/thread/RealtimeThreadFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/thread/RealtimeThreadFactory.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/thread/RealtimeThreadFactory.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/thread/RealtimeThreadFactory.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.thread;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.thread;
* under the License.
*
*/
+package org.apache.qpid.thread;
import java.lang.reflect.Constructor;
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/thread/ThreadFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/thread/ThreadFactory.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/thread/ThreadFactory.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/thread/ThreadFactory.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.thread;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.thread;
* under the License.
*
*/
+package org.apache.qpid.thread;
public interface ThreadFactory
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/thread/Threading.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/thread/Threading.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/thread/Threading.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/thread/Threading.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.thread;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.thread;
* under the License.
*
*/
+package org.apache.qpid.thread;
public final class Threading
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/Connection.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/Connection.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/Connection.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/Connection.java Fri Aug 3 12:13:32 2012
@@ -41,6 +41,8 @@ import static org.apache.qpid.transport.
import javax.security.sasl.SaslClient;
import javax.security.sasl.SaslServer;
+
+import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
@@ -127,6 +129,9 @@ public class Connection extends Connecti
private final AtomicBoolean connectionLost = new AtomicBoolean(false);
+ private SocketAddress _remoteAddress;
+ private SocketAddress _localAddress;
+
public Connection() {}
public void setConnectionDelegate(ConnectionDelegate delegate)
@@ -228,6 +233,9 @@ public class Connection extends Connecti
}
NetworkConnection network = transport.connect(settings, secureReceiver, null);
+ _remoteAddress = network.getRemoteAddress();
+ _localAddress = network.getLocalAddress();
+
final Sender<ByteBuffer> secureSender = securityLayer.sender(network.getSender());
if(secureSender instanceof ConnectionListener)
{
@@ -701,4 +709,14 @@ public class Connection extends Connecti
ssn.notifyFailoverRequired();
}
}
+
+ public SocketAddress getRemoteAddress()
+ {
+ return _remoteAddress;
+ }
+
+ public SocketAddress getLocalAddress()
+ {
+ return _localAddress;
+ }
}
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/ConnectionSettings.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/ConnectionSettings.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/ConnectionSettings.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/ConnectionSettings.java Fri Aug 3 12:13:32 2012
@@ -31,6 +31,7 @@ import static org.apache.qpid.configurat
import static org.apache.qpid.configuration.ClientProperties.LEGACY_RECEIVE_BUFFER_SIZE_PROP_NAME;
import static org.apache.qpid.configuration.ClientProperties.LEGACY_SEND_BUFFER_SIZE_PROP_NAME;
+import java.security.KeyStore;
import java.util.Map;
import javax.net.ssl.KeyManagerFactory;
@@ -67,10 +68,12 @@ public class ConnectionSettings
private boolean useSSL;
private String keyStorePath = System.getProperty("javax.net.ssl.keyStore");
private String keyStorePassword = System.getProperty("javax.net.ssl.keyStorePassword");
+ private String keyStoreType = System.getProperty("javax.net.ssl.keyStoreType",KeyStore.getDefaultType());
private String keyManagerFactoryAlgorithm = QpidProperty.stringProperty(KeyManagerFactory.getDefaultAlgorithm(), QPID_SSL_KEY_MANAGER_FACTORY_ALGORITHM_PROP_NAME, QPID_SSL_KEY_STORE_CERT_TYPE_PROP_NAME).get();
private String trustManagerFactoryAlgorithm = QpidProperty.stringProperty(TrustManagerFactory.getDefaultAlgorithm(), QPID_SSL_TRUST_MANAGER_FACTORY_ALGORITHM_PROP_NAME, QPID_SSL_TRUST_STORE_CERT_TYPE_PROP_NAME).get();
- private String trustStorePath = System.getProperty("javax.net.ssl.trustStore");;
- private String trustStorePassword = System.getProperty("javax.net.ssl.trustStorePassword");;
+ private String trustStorePath = System.getProperty("javax.net.ssl.trustStore");
+ private String trustStorePassword = System.getProperty("javax.net.ssl.trustStorePassword");
+ private String trustStoreType = System.getProperty("javax.net.ssl.trustStoreType",KeyStore.getDefaultType());
private String certAlias;
private boolean verifyHostname;
@@ -262,6 +265,16 @@ public class ConnectionSettings
this.keyStorePassword = keyStorePassword;
}
+ public void setKeyStoreType(String keyStoreType)
+ {
+ this.keyStoreType = keyStoreType;
+ }
+
+ public String getKeyStoreType()
+ {
+ return keyStoreType;
+ }
+
public String getTrustStorePath()
{
return trustStorePath;
@@ -322,6 +335,16 @@ public class ConnectionSettings
this.trustManagerFactoryAlgorithm = trustManagerFactoryAlgorithm;
}
+ public String getTrustStoreType()
+ {
+ return trustStoreType;
+ }
+
+ public void setTrustStoreType(String trustStoreType)
+ {
+ this.trustStoreType = trustStoreType;
+ }
+
public int getReadBufferSize()
{
return readBufferSize;
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/NetworkTransportConfiguration.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/NetworkTransportConfiguration.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/NetworkTransportConfiguration.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/NetworkTransportConfiguration.java Fri Aug 3 12:13:32 2012
@@ -25,17 +25,17 @@ import java.net.InetSocketAddress;
/**
* This interface provides a means for NetworkDrivers to configure TCP options such as incoming and outgoing
* buffer sizes and set particular options on the socket. NetworkDrivers should honour the values returned
- * from here if the underlying implementation supports them.
- */
-public interface NetworkTransportConfiguration
-{
- // Taken from Socket
- Boolean getTcpNoDelay();
+ * from here if the underlying implementation supports them.
+ */
+public interface NetworkTransportConfiguration
+{
+ // Taken from Socket
+ Boolean getTcpNoDelay();
- // The amount of memory in bytes to allocate to the incoming buffer
- Integer getReceiveBufferSize();
+ // The amount of memory in bytes to allocate to the incoming buffer
+ Integer getReceiveBufferSize();
- // The amount of memory in bytes to allocate to the outgoing buffer
+ // The amount of memory in bytes to allocate to the outgoing buffer
Integer getSendBufferSize();
Integer getPort();
@@ -47,4 +47,8 @@ public interface NetworkTransportConfigu
Integer getConnectorProcessors();
InetSocketAddress getAddress();
+
+ boolean needClientAuth();
+
+ boolean wantClientAuth();
}
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java Fri Aug 3 12:13:32 2012
@@ -78,7 +78,7 @@ public class ServerDelegate extends Conn
try
{
- SaslServer ss = createSaslServer(mechanism);
+ SaslServer ss = createSaslServer(conn, mechanism);
if (ss == null)
{
conn.connectionClose(ConnectionCloseCode.CONNECTION_FORCED,
@@ -94,7 +94,7 @@ public class ServerDelegate extends Conn
}
}
- protected SaslServer createSaslServer(String mechanism)
+ protected SaslServer createSaslServer(Connection conn, String mechanism)
throws SaslException
{
SaslServer ss = Sasl.createSaslServer(mechanism, "AMQP", "localhost", null, null);
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/Session.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/Session.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/Session.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/Session.java Fri Aug 3 12:13:32 2012
@@ -94,8 +94,10 @@ public class Session extends SessionInvo
private final long timeout = Long.getLong(ClientProperties.QPID_SYNC_OP_TIMEOUT,
Long.getLong(ClientProperties.AMQJ_DEFAULT_SYNCWRITE_TIMEOUT,
ClientProperties.DEFAULT_SYNC_OPERATION_TIMEOUT));
- private final long blockedSendTimeout = Long.getLong("qpid.flow_control_wait_failure", timeout);
- private long blockedSendReportingPeriod = Long.getLong("qpid.flow_control_wait_notify_period",5000L);
+ private final long blockedSendTimeout = Long.getLong(ClientProperties.QPID_FLOW_CONTROL_WAIT_FAILURE,
+ ClientProperties.DEFAULT_FLOW_CONTROL_WAIT_FAILURE);
+ private long blockedSendReportingPeriod = Long.getLong(ClientProperties.QPID_FLOW_CONTROL_WAIT_NOTIFY_PERIOD,
+ ClientProperties.DEFAULT_FLOW_CONTROL_WAIT_NOTIFY_PERIOD);
private boolean autoSync = false;
@@ -210,6 +212,11 @@ public class Session extends SessionInvo
}
}
+ protected State getState()
+ {
+ return this.state;
+ }
+
void setFlowControl(boolean value)
{
flowControl = value;
@@ -307,7 +314,7 @@ public class Session extends SessionInvo
xfr.setHeader(new Header(deliveryProps, header.getMessageProperties(),
header.getNonStandardProperties()));
}
-
+
}
else
{
@@ -616,7 +623,7 @@ public class Session extends SessionInvo
{
acquireCredit();
}
-
+
synchronized (commandsLock)
{
if (state == DETACHED && m.isUnreliable())
@@ -732,11 +739,11 @@ public class Session extends SessionInvo
{
sessionCommandPoint(0, 0);
}
-
+
boolean replayTransfer = !closing && !transacted &&
m instanceof MessageTransfer &&
! m.isUnreliable();
-
+
if ((replayTransfer) || m.hasCompletionListener())
{
setCommand(next, m);
@@ -833,7 +840,7 @@ public class Session extends SessionInvo
Waiter w = new Waiter(commandsLock, timeout);
while (w.hasTime() && state != CLOSED && lt(maxComplete, point))
{
- checkFailoverRequired("Session sync was interrupted by failover.");
+ checkFailoverRequired("Session sync was interrupted by failover.");
if(log.isDebugEnabled())
{
log.debug("%s waiting for[%d]: %d, %s", this, point, maxComplete, commands);
@@ -871,7 +878,7 @@ public class Session extends SessionInvo
{
future = results.remove(command);
}
-
+
if (future != null)
{
future.set(result);
@@ -1039,7 +1046,7 @@ public class Session extends SessionInvo
}
}
- protected void awaitClose()
+ protected void awaitClose()
{
Waiter w = new Waiter(commandsLock, timeout);
while (w.hasTime() && state != CLOSED)
@@ -1096,7 +1103,7 @@ public class Session extends SessionInvo
if(state == CLOSED)
{
- connection.removeSession(this);
+ connection.removeSession(this);
listener.closed(this);
}
}
@@ -1184,4 +1191,12 @@ public class Session extends SessionInvo
}
}
}
+
+ /**
+ * An auxiliary method for test purposes only
+ */
+ public boolean isFlowBlocked()
+ {
+ return flowControl && credit.availablePermits() == 0;
+ }
}
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/NetworkConnection.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/NetworkConnection.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/NetworkConnection.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/NetworkConnection.java Fri Aug 3 12:13:32 2012
@@ -20,10 +20,10 @@
*/
package org.apache.qpid.transport.network;
-import org.apache.qpid.transport.Sender;
-
import java.net.SocketAddress;
import java.nio.ByteBuffer;
+import java.security.Principal;
+import org.apache.qpid.transport.Sender;
public interface NetworkConnection
{
@@ -46,4 +46,8 @@ public interface NetworkConnection
void setMaxWriteIdle(int sec);
void setMaxReadIdle(int sec);
-}
\ No newline at end of file
+
+ void setPeerPrincipal(Principal principal);
+
+ Principal getPeerPrincipal();
+}
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkConnection.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkConnection.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkConnection.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkConnection.java Fri Aug 3 12:13:32 2012
@@ -20,16 +20,15 @@
*/
package org.apache.qpid.transport.network.io;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.transport.Receiver;
-import org.apache.qpid.transport.Sender;
-import org.apache.qpid.transport.network.NetworkConnection;
-
import java.net.Socket;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
+import java.security.Principal;
+import org.apache.qpid.transport.Receiver;
+import org.apache.qpid.transport.Sender;
+import org.apache.qpid.transport.network.NetworkConnection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class IoNetworkConnection implements NetworkConnection
{
@@ -38,6 +37,7 @@ public class IoNetworkConnection impleme
private final long _timeout;
private final IoSender _ioSender;
private final IoReceiver _ioReceiver;
+ private Principal _principal;
public IoNetworkConnection(Socket socket, Receiver<ByteBuffer> delegate,
int sendBufferSize, int receiveBufferSize, long timeout)
@@ -97,4 +97,16 @@ public class IoNetworkConnection impleme
// TODO implement support for setting heartbeating config in this way
// Currently a socket timeout is used in IoSender
}
+
+ @Override
+ public void setPeerPrincipal(Principal principal)
+ {
+ _principal = principal;
+ }
+
+ @Override
+ public Principal getPeerPrincipal()
+ {
+ return _principal;
+ }
}
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkTransport.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkTransport.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkTransport.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkTransport.java Fri Aug 3 12:13:32 2012
@@ -27,10 +27,12 @@ import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.nio.ByteBuffer;
-
+import java.security.Principal;
import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLPeerUnverifiedException;
+import javax.net.ssl.SSLServerSocket;
import javax.net.ssl.SSLServerSocketFactory;
-
+import javax.net.ssl.SSLSocket;
import org.apache.qpid.protocol.ProtocolEngine;
import org.apache.qpid.protocol.ProtocolEngineFactory;
import org.apache.qpid.transport.ConnectionSettings;
@@ -45,10 +47,10 @@ import org.slf4j.LoggerFactory;
public class IoNetworkTransport implements OutgoingNetworkTransport, IncomingNetworkTransport
{
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(IoNetworkTransport.class);
+ private static final int TIMEOUT = 60000;
private Socket _socket;
private IoNetworkConnection _connection;
- private long _timeout = 60000;
private AcceptingThread _acceptor;
public NetworkConnection connect(ConnectionSettings settings, Receiver<ByteBuffer> delegate, SSLContext sslContext)
@@ -73,7 +75,7 @@ public class IoNetworkTransport implemen
InetAddress address = InetAddress.getByName(settings.getHost());
- _socket.connect(new InetSocketAddress(address, settings.getPort()));
+ _socket.connect(new InetSocketAddress(address, settings.getPort()), TIMEOUT);
}
catch (SocketException e)
{
@@ -86,7 +88,7 @@ public class IoNetworkTransport implemen
try
{
- _connection = new IoNetworkConnection(_socket, delegate, sendBufferSize, receiveBufferSize, _timeout);
+ _connection = new IoNetworkConnection(_socket, delegate, sendBufferSize, receiveBufferSize, TIMEOUT);
_connection.start();
}
catch(Exception e)
@@ -167,6 +169,9 @@ public class IoNetworkTransport implemen
{
SSLServerSocketFactory socketFactory = _sslContext.getServerSocketFactory();
_serverSocket = socketFactory.createServerSocket();
+ ((SSLServerSocket)_serverSocket).setNeedClientAuth(config.needClientAuth());
+ ((SSLServerSocket)_serverSocket).setWantClientAuth(config.wantClientAuth());
+
}
_serverSocket.setReuseAddress(true);
@@ -216,9 +221,23 @@ public class IoNetworkTransport implemen
socket.setSendBufferSize(sendBufferSize);
socket.setReceiveBufferSize(receiveBufferSize);
+
ProtocolEngine engine = _factory.newProtocolEngine();
- NetworkConnection connection = new IoNetworkConnection(socket, engine, sendBufferSize, receiveBufferSize, _timeout);
+ NetworkConnection connection = new IoNetworkConnection(socket, engine, sendBufferSize, receiveBufferSize, TIMEOUT);
+
+ if(_sslContext != null)
+ {
+ try
+ {
+ Principal peerPrincipal = ((SSLSocket) socket).getSession().getPeerPrincipal();
+ connection.setPeerPrincipal(peerPrincipal);
+ }
+ catch(SSLPeerUnverifiedException e)
+ {
+ // ignore
+ }
+ }
engine.setNetworkConnection(connection, connection.getSender());
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/SecurityLayerFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/SecurityLayerFactory.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/SecurityLayerFactory.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/SecurityLayerFactory.java Fri Aug 3 12:13:32 2012
@@ -78,9 +78,11 @@ public class SecurityLayerFactory
sslCtx = SSLContextFactory
.buildClientContext(settings.getTrustStorePath(),
settings.getTrustStorePassword(),
+ settings.getTrustStoreType(),
settings.getTrustManagerFactoryAlgorithm(),
settings.getKeyStorePath(),
settings.getKeyStorePassword(),
+ settings.getKeyStoreType(),
settings.getKeyManagerFactoryAlgorithm(),
settings.getCertAlias());
}
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLEncryptor.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLEncryptor.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLEncryptor.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLEncryptor.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.transport.network.security.sasl;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.transport.networ
* under the License.
*
*/
+package org.apache.qpid.transport.network.security.sasl;
import org.apache.qpid.transport.Connection;
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLReceiver.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLReceiver.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLReceiver.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLReceiver.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.transport.network.security.sasl;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.transport.networ
* under the License.
*
*/
+package org.apache.qpid.transport.network.security.sasl;
import org.apache.qpid.transport.Receiver;
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLSender.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLSender.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLSender.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLSender.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.transport.network.security.sasl;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.transport.networ
* under the License.
*
*/
+package org.apache.qpid.transport.network.security.sasl;
import org.apache.qpid.transport.Sender;
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidClientX509KeyManager.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidClientX509KeyManager.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidClientX509KeyManager.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidClientX509KeyManager.java Fri Aug 3 12:13:32 2012
@@ -40,11 +40,11 @@ public class QpidClientX509KeyManager ex
private X509ExtendedKeyManager delegate;
private String alias;
- public QpidClientX509KeyManager(String alias, String keyStorePath,
+ public QpidClientX509KeyManager(String alias, String keyStorePath, String keyStoreType,
String keyStorePassword, String keyManagerFactoryAlgorithmName) throws GeneralSecurityException, IOException
{
this.alias = alias;
- KeyStore ks = SSLUtil.getInitializedKeyStore(keyStorePath,keyStorePassword);
+ KeyStore ks = SSLUtil.getInitializedKeyStore(keyStorePath,keyStorePassword,keyStoreType);
KeyManagerFactory kmf = KeyManagerFactory.getInstance(keyManagerFactoryAlgorithmName);
kmf.init(ks, keyStorePassword.toCharArray());
this.delegate = (X509ExtendedKeyManager)kmf.getKeyManagers()[0];
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLUtil.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLUtil.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLUtil.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLUtil.java Fri Aug 3 12:13:32 2012
@@ -125,9 +125,9 @@ public class SSLUtil
return id.toString();
}
- public static KeyStore getInitializedKeyStore(String storePath, String storePassword) throws GeneralSecurityException, IOException
+ public static KeyStore getInitializedKeyStore(String storePath, String storePassword, String keyStoreType) throws GeneralSecurityException, IOException
{
- KeyStore ks = KeyStore.getInstance("JKS");
+ KeyStore ks = KeyStore.getInstance(keyStoreType);
InputStream in = null;
try
{
@@ -140,7 +140,7 @@ public class SSLUtil
{
in = Thread.currentThread().getContextClassLoader().getResourceAsStream(storePath);
}
- if (in == null)
+ if (in == null && !"PKCS11".equalsIgnoreCase(keyStoreType)) // PKCS11 will not require an explicit path
{
throw new IOException("Unable to load keystore resource: " + storePath);
}
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/url/BindingURLParser.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/url/BindingURLParser.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/url/BindingURLParser.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/url/BindingURLParser.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.url;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.url;
* under the License.
*
*/
+package org.apache.qpid.url;
import org.slf4j.Logger;
Modified: qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/util/Serial.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/util/Serial.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/util/Serial.java (original)
+++ qpid/branches/asyncstore/java/common/src/main/java/org/apache/qpid/util/Serial.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.util;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.util;
* under the License.
*
*/
+package org.apache.qpid.util;
import java.util.Comparator;
Modified: qpid/branches/asyncstore/java/common/src/test/java/org/apache/qpid/codec/AMQDecoderTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/test/java/org/apache/qpid/codec/AMQDecoderTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/test/java/org/apache/qpid/codec/AMQDecoderTest.java (original)
+++ qpid/branches/asyncstore/java/common/src/test/java/org/apache/qpid/codec/AMQDecoderTest.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.codec;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.codec;
* under the License.
*
*/
+package org.apache.qpid.codec;
import junit.framework.TestCase;
Modified: qpid/branches/asyncstore/java/common/src/test/java/org/apache/qpid/codec/MockAMQVersionAwareProtocolSession.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/common/src/test/java/org/apache/qpid/codec/MockAMQVersionAwareProtocolSession.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/common/src/test/java/org/apache/qpid/codec/MockAMQVersionAwareProtocolSession.java (original)
+++ qpid/branches/asyncstore/java/common/src/test/java/org/apache/qpid/codec/MockAMQVersionAwareProtocolSession.java Fri Aug 3 12:13:32 2012
@@ -1,4 +1,3 @@
-package org.apache.qpid.codec;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +18,7 @@ package org.apache.qpid.codec;
* under the License.
*
*/
+package org.apache.qpid.codec;
import org.apache.qpid.AMQException;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org