diff options
Diffstat (limited to 'qpid/java')
7 files changed, 57 insertions, 43 deletions
diff --git a/qpid/java/client/src/main/java/client.log4j b/qpid/java/client/src/main/java/client.log4j index 525433e9a9..c7b6630987 100644 --- a/qpid/java/client/src/main/java/client.log4j +++ b/qpid/java/client/src/main/java/client.log4j @@ -6,9 +6,9 @@ # 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
@@ -19,8 +19,15 @@ log4j.rootLogger=${root.logging.level}
-log4j.logger.org.apache.qpid=${amqj.logging.level}, console
+#log4j.logger.org.apache.qpid=${amqj.logging.level}, console
+#log4j.additivity.org.apache.qpid=false
+#log4j.logger.org.apache.qpidity.transport=TRACE, console
+
+log4j.logger.org.apache.qpid=MAJOR, console
log4j.additivity.org.apache.qpid=false
+log4j.logger.org.apache.qpidity.transport=MAJOR, console
+log4j.logger.org.apache.qpid.testutil.QpidTestCase=MAJOR, console
+
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.Threshold=all
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java index cf8ecd74ac..10fd7c410b 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java @@ -96,7 +96,7 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer BasicContentHeaderProperties contentHeaderProperties = message.getContentHeaderProperties(); // set the application properties qpidityMessage.getMessageProperties().setContentType(contentHeaderProperties.getContentType().toString()); - qpidityMessage.getMessageProperties().setMessageId(message.getJMSMessageID()) ; + qpidityMessage.getMessageProperties().setMessageId(message.getJMSMessageID()) ; AMQShortString correlationID = contentHeaderProperties.getCorrelationId(); if( correlationID != null ) { @@ -125,7 +125,7 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer for(String key:qpidityMessage.getMessageProperties().getApplicationHeaders().keySet()) { - System.out.println(key + "=" + qpidityMessage.getMessageProperties().getApplicationHeaders().get(key)); + _logger.debug(key + "=" + qpidityMessage.getMessageProperties().getApplicationHeaders().get(key)); } } // send the message diff --git a/qpid/java/client/src/main/java/org/apache/qpidity/nclient/interop/BasicInteropTest.java b/qpid/java/client/src/main/java/org/apache/qpidity/nclient/interop/BasicInteropTest.java index 4ea8df3273..54765ea72e 100644 --- a/qpid/java/client/src/main/java/org/apache/qpidity/nclient/interop/BasicInteropTest.java +++ b/qpid/java/client/src/main/java/org/apache/qpidity/nclient/interop/BasicInteropTest.java @@ -81,6 +81,8 @@ public class BasicInteropTest implements ClosedListener props.put("spf", 8.5); session.header(new DeliveryProperties().setRoutingKey("testKey"),new MessageProperties().setApplicationHeaders(props)); + //session.header(new DeliveryProperties().setRoutingKey("testKey")); + session.data("TestMessage"); session.endData(); session.sync(); diff --git a/qpid/java/client/src/main/java/org/apache/qpidity/nclient/util/ByteBufferMessage.java b/qpid/java/client/src/main/java/org/apache/qpidity/nclient/util/ByteBufferMessage.java index 8441c9f629..5e87d63966 100644 --- a/qpid/java/client/src/main/java/org/apache/qpidity/nclient/util/ByteBufferMessage.java +++ b/qpid/java/client/src/main/java/org/apache/qpidity/nclient/util/ByteBufferMessage.java @@ -14,8 +14,8 @@ import org.apache.qpidity.api.Message; * for small messages. When the readData methods are called * we assume the message is complete. i.e there want be any * appendData operations after that.</p> - * - * <p>If you need large message support please see + * + * <p>If you need large message support please see * <code>FileMessage</code> and <code>StreamingMessage</code> * </p> */ @@ -23,7 +23,7 @@ public class ByteBufferMessage implements Message { private Queue<ByteBuffer> _data = new LinkedList<ByteBuffer>(); private ByteBuffer _readBuffer; - private int _dataSize; + private int _dataSize; private DeliveryProperties _currentDeliveryProps; private MessageProperties _currentMessageProps; private long _transferId; @@ -37,19 +37,19 @@ public class ByteBufferMessage implements Message public ByteBufferMessage(long transferId) { _transferId = transferId; - } - + } + public long getMessageTransferId() { return _transferId; } - + public void clearData() { _data = new LinkedList<ByteBuffer>(); _readBuffer = null; } - + public void appendData(byte[] src) throws IOException { appendData(ByteBuffer.wrap(src)); @@ -61,9 +61,9 @@ public class ByteBufferMessage implements Message public void appendData(ByteBuffer src) throws IOException { _data.offer(src); - _dataSize += src.remaining(); + _dataSize += src.remaining(); } - + public DeliveryProperties getDeliveryProperties() { return _currentDeliveryProps; @@ -71,10 +71,9 @@ public class ByteBufferMessage implements Message public MessageProperties getMessageProperties() { - System.out.println("MessageProperties is null ? " + _currentMessageProps == null? "true":"false"); return _currentMessageProps; } - + public void setDeliveryProperties(DeliveryProperties props) { _currentDeliveryProps = props; @@ -84,17 +83,17 @@ public class ByteBufferMessage implements Message { _currentMessageProps = props; } - + public void readData(byte[] target) throws IOException { getReadBuffer().get(target); } - + public ByteBuffer readData() throws IOException - { + { return getReadBuffer(); } - + private void buildReadBuffer() { //optimize for the simple cases @@ -112,13 +111,13 @@ public class ByteBufferMessage implements Message _readBuffer.flip(); } } - + private ByteBuffer getReadBuffer() throws IOException { if (_readBuffer != null ) { return _readBuffer.slice(); - } + } else { if (_data.size() >0) @@ -132,7 +131,7 @@ public class ByteBufferMessage implements Message } } } - + //hack for testing @Override public String toString() { diff --git a/qpid/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java b/qpid/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java index bd27550387..fcdd42639d 100644 --- a/qpid/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java +++ b/qpid/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java @@ -5,9 +5,9 @@ * 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 @@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory; */ public class QpidTestCase extends TestCase { - + /* this clas logger */ private static final Logger _logger = LoggerFactory.getLogger(QpidTestCase.class); @@ -91,7 +91,7 @@ public class QpidTestCase extends TestCase // create an in_VM broker TransportConnection.createVMBroker(1); } - _logger.info("========================================="); + _logger.info("========================================="); _logger.info("= " + _shel + " " + _brokerPath + " " + _brokerParams); } @@ -116,7 +116,7 @@ public class QpidTestCase extends TestCase super.tearDown(); } - //--------- Util method + //--------- Util method /** * This method starts a remote server by spawning an external process. @@ -134,7 +134,7 @@ public class QpidTestCase extends TestCase //bad, we had an error starting the broker throw new Exception("Problem when starting the broker: " + reader.readLine()); } - // We need to wait for th ebroker to start ideally we would need to ping it + // We need to wait for th ebroker to start ideally we would need to ping it synchronized(this) { this.wait(1000); diff --git a/qpid/java/common/src/main/java/org/apache/qpidity/security/CallbackHandlerRegistry.java b/qpid/java/common/src/main/java/org/apache/qpidity/security/CallbackHandlerRegistry.java index 624b015c69..b23fea7e4a 100644 --- a/qpid/java/common/src/main/java/org/apache/qpidity/security/CallbackHandlerRegistry.java +++ b/qpid/java/common/src/main/java/org/apache/qpidity/security/CallbackHandlerRegistry.java @@ -7,9 +7,9 @@ * 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 @@ -24,10 +24,12 @@ import java.util.HashMap; import java.util.Map; import org.apache.qpidity.QpidConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class CallbackHandlerRegistry { - + private static final Logger _logger = LoggerFactory.getLogger(CallbackHandlerRegistry.class); private static CallbackHandlerRegistry _instance = new CallbackHandlerRegistry(); private Map<String,Class> _mechanismToHandlerClassMap = new HashMap<String,Class>(); @@ -36,7 +38,7 @@ public class CallbackHandlerRegistry public static CallbackHandlerRegistry getInstance() { - return _instance; + return _instance; } public Class getCallbackHandlerClass(String mechanism) @@ -57,7 +59,7 @@ public class CallbackHandlerRegistry } private void registerMechanisms() - { + { for (QpidConfig.SecurityMechanism securityMechanism: QpidConfig.get().getSecurityMechanisms() ) { Class clazz = null; @@ -66,14 +68,14 @@ public class CallbackHandlerRegistry clazz = Class.forName(securityMechanism.getHandler()); if (!AMQPCallbackHandler.class.isAssignableFrom(clazz)) { - System.out.println("SASL provider " + clazz + " does not implement " + AMQPCallbackHandler.class + + _logger.debug("SASL provider " + clazz + " does not implement " + AMQPCallbackHandler.class + ". Skipping"); continue; } _mechanismToHandlerClassMap.put(securityMechanism.getType(), clazz); if (_mechanisms == null) { - + _mechanisms = new StringBuilder(); _mechanisms.append(securityMechanism.getType()); } @@ -84,7 +86,7 @@ public class CallbackHandlerRegistry } catch (ClassNotFoundException ex) { - System.out.println("Unable to load class " + securityMechanism.getHandler() + ". Skipping that SASL provider"); + _logger.debug("Unable to load class " + securityMechanism.getHandler() + ". Skipping that SASL provider"); continue; } } diff --git a/qpid/java/common/src/main/java/org/apache/qpidity/security/DynamicSaslRegistrar.java b/qpid/java/common/src/main/java/org/apache/qpidity/security/DynamicSaslRegistrar.java index 52dacc6985..f95c47e0be 100644 --- a/qpid/java/common/src/main/java/org/apache/qpidity/security/DynamicSaslRegistrar.java +++ b/qpid/java/common/src/main/java/org/apache/qpidity/security/DynamicSaslRegistrar.java @@ -7,9 +7,9 @@ * 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 @@ -27,12 +27,16 @@ import java.util.TreeMap; import javax.security.sasl.SaslClientFactory; import org.apache.qpidity.QpidConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class DynamicSaslRegistrar { + private static final Logger _logger = LoggerFactory.getLogger(DynamicSaslRegistrar.class); + public static void registerSaslProviders() { - Map<String, Class> factories = registerSaslClientFactories(); + Map<String, Class> factories = registerSaslClientFactories(); if (factories.size() > 0) { Security.addProvider(new JCAProvider(factories)); @@ -44,7 +48,7 @@ public class DynamicSaslRegistrar { TreeMap<String, Class> factoriesToRegister = new TreeMap<String, Class>(); - + for (QpidConfig.SaslClientFactory factory: QpidConfig.get().getSaslClientFactories()) { String className = factory.getFactoryClass(); @@ -53,14 +57,14 @@ public class DynamicSaslRegistrar Class clazz = Class.forName(className); if (!(SaslClientFactory.class.isAssignableFrom(clazz))) { - System.out.println("Class " + clazz + " does not implement " + SaslClientFactory.class + " - skipping"); + _logger.debug("Class " + clazz + " does not implement " + SaslClientFactory.class + " - skipping"); continue; } factoriesToRegister.put(factory.getType(), clazz); } catch (Exception ex) { - System.out.println("Error instantiating SaslClientFactory calss " + className + " - skipping"); + _logger.debug("Error instantiating SaslClientFactory calss " + className + " - skipping"); } } return factoriesToRegister; |
