summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Greig <rgreig@apache.org>2006-12-21 22:22:09 +0000
committerRobert Greig <rgreig@apache.org>2006-12-21 22:22:09 +0000
commit0d5658dfb5a210a6987ef75e2d1813944ab79c4c (patch)
tree48500667ac3862107af7146bbf764201886e6b49
parent7cedc91fe5ec9859d932e63dc1f7c809860126d0 (diff)
downloadqpid-python-0d5658dfb5a210a6987ef75e2d1813944ab79c4c.tar.gz
Merge from trunk up to revision 488596
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/new_persistence@489477 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java2
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/Main.java4
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/exchange/DestNameExchange.java2
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java1
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java1
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java1
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java1
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java5
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessageHandle.java2
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java20
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/queue/InMemoryMessageHandle.java6
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/queue/WeakReferenceMessageHandle.java5
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/security/auth/plain/PlainSaslServer.java2
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/transport/ConnectorConfiguration.java1
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/AMQAuthenticationException.java1
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/AMQConnection.java10
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java1
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/AMQSession.java66
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java98
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java3
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/CustomJMXProperty.java47
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/QpidConnectionMetaData.java131
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/TemporaryDestination.java1
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/TopicSubscriberAdaptor.java2
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/handler/ConnectionOpenOkMethodHandler.java8
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java20
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/message/JMSBytesMessage.java1
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java3
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessageFactory.java1
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java1
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/transport/ITransportConnection.java1
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/transport/SocketTransportConnection.java1
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/transport/VmPipeTransportConnection.java1
-rw-r--r--java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java1
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/ack/RecoverTest.java97
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/basic/BytesMessageTest.java2
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/basic/FieldTablePropertyTest.java3
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java5
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java2
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/client/AMQConnectionTest.java15
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java6
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java83
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java2
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/CombinedTest.java2
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/client/message/MapMessageTest.java2
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/client/message/TextMessageTest.java1
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/client/temporaryqueue/TemporaryQueueTest.java3
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/message/JMSDestinationTest.java70
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/message/StreamMessageTest.java4
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java17
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/topic/TopicSessionTest.java2
-rw-r--r--java/common/src/main/java/org/apache/qpid/url/BindingURL.java2
-rw-r--r--java/common/src/main/xsl/java.xsl2
-rw-r--r--java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java4
-rw-r--r--java/management/eclipse-plugin/plugins/com.ibm.icu_3.4.4.1.jarbin3255246 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/license.eclipse.txt88
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.core.commands_3.2.0.jarbin89522 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.core.contenttype_3.2.0.jarbin76141 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.core.expressions_3.2.0.jarbin66037 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.core.jobs_3.2.0.jarbin74797 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.core.runtime.compatibility.auth_3.2.0.jarbin18733 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0/META-INF/MANIFEST.MF12
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0/runtime_registry_compatibility.jarbin7584 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.core.runtime_3.2.0.jarbin76627 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.equinox.common_3.2.0.jarbin79780 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.equinox.preferences_3.2.0.jarbin91661 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.equinox.registry_3.2.0.jarbin143841 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.help_3.2.0.jarbin115438 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.jface_3.2.0.jarbin813596 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.osgi_3.2.0.jarbin846716 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.swt.win32.win32.x86_3.2.0.jarbin1553408 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.swt_3.2.0.jarbin11003 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.ui.forms_3.2.0.jarbin235371 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.ui.workbench.compatibility_3.2.0/META-INF/MANIFEST.MF12
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.ui.workbench.compatibility_3.2.0/compatibility.jarbin4080 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.ui.workbench_3.2.0.jarbin3070253 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/plugins/org.eclipse.ui_3.2.0.jarbin124307 -> 0 bytes
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java5
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java251
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java72
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java69
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java129
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/TabControl.java15
-rw-r--r--java/management/eclipse-plugin/src/main/resources/win32/configuration/org.eclipse.osgi/bundles/16/1/.cp/swt-win32-3232.dllbin323584 -> 0 bytes
-rw-r--r--java/systests/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java5
-rw-r--r--java/systests/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java9
-rw-r--r--java/systests/src/test/java/org/apache/qpid/server/exchange/ReturnUnroutableMandatoryMessageTest.java5
-rw-r--r--java/systests/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java185
-rw-r--r--java/systests/src/test/java/org/apache/qpid/server/queue/SynchronizedDeliveryManagerTest.java1
89 files changed, 1044 insertions, 589 deletions
diff --git a/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java b/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java
index cd5923751a..63cc57b05e 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java
@@ -417,7 +417,7 @@ public class AMQChannel
long deliveryTag = message.deliveryTag;
String consumerTag = message.consumerTag;
AMQMessage msg = message.message;
-
+ msg.setRedelivered(true);
msg.writeDeliver(session, _channelId, deliveryTag, consumerTag);
// false means continue processing
return false;
diff --git a/java/broker/src/main/java/org/apache/qpid/server/Main.java b/java/broker/src/main/java/org/apache/qpid/server/Main.java
index 3470a5bb08..553aecc217 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/Main.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/Main.java
@@ -522,10 +522,10 @@ public class Main implements ProtocolVersionList
*/
public void unregisterExchange(String exchangeName) throws JMException
{
- boolean inUse = false;
// TODO
// Check if the exchange is in use.
- // Check if there are queue-bindings with the exchnage and unregister
+ // boolean inUse = false;
+ // Check if there are queue-bindings with the exchange and unregister
// when there are no bindings.
try
{
diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/DestNameExchange.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/DestNameExchange.java
index b5c7a2ba23..7b28161263 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/exchange/DestNameExchange.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/DestNameExchange.java
@@ -170,7 +170,7 @@ public class DestNameExchange extends AbstractExchange
{
final BasicPublishBody publishBody = payload.getPublishBody();
final String routingKey = publishBody.routingKey;
- final List<AMQQueue> queues = _index.get(routingKey);
+ final List<AMQQueue> queues = (routingKey == null) ? null : _index.get(routingKey);
if (queues == null || queues.isEmpty())
{
String msg = "Routing key " + routingKey + " is not known to " + this;
diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java
index dcc50a796a..4a0a6a0ee1 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java
@@ -21,7 +21,6 @@
package org.apache.qpid.server.exchange;
import org.apache.qpid.AMQException;
-import org.apache.qpid.server.queue.AMQMessage;
public interface ExchangeRegistry extends MessageRouter
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java
index 8417ada15f..87ccc60907 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java
@@ -31,7 +31,6 @@ import org.apache.qpid.server.AMQChannel;
import org.apache.qpid.framing.AMQFrame;
import org.apache.qpid.framing.ChannelFlowBody;
import org.apache.qpid.framing.ChannelFlowOkBody;
-import org.apache.qpid.framing.ChannelCloseBody;
import org.apache.qpid.AMQException;
public class ChannelFlowHandler implements StateAwareMethodListener<ChannelFlowBody>
diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java
index c858d25e2d..c32f5e4283 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java
@@ -21,7 +21,6 @@
package org.apache.qpid.server.handler;
import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQChannelException;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.framing.*;
import org.apache.qpid.server.exchange.ExchangeRegistry;
diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java
index b8235a0808..535122efb5 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java
@@ -61,7 +61,6 @@ class MBeanIntrospector {
*/
for (Method method : interfaceClass.getMethods())
{
- int argCount = method.getParameterTypes().length;
String name = method.getName();
Class<?> resultType = method.getReturnType();
MBeanAttributeInfo attributeInfo = null;
diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java
index 12ae8330a6..8f6377d80d 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java
@@ -436,6 +436,11 @@ public class AMQMessage
return _messageHandle.isRedelivered();
}
+ public void setRedelivered(boolean redelivered)
+ {
+ _messageHandle.setRedelivered(redelivered);
+ }
+
/**
* Called when this message is delivered to a consumer. (used to
* implement the 'immediate' flag functionality).
diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessageHandle.java b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessageHandle.java
index 0fc9ec5dcd..949b245c35 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessageHandle.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessageHandle.java
@@ -48,6 +48,8 @@ public interface AMQMessageHandle
boolean isRedelivered();
+ void setRedelivered(boolean redelivered);
+
boolean isPersistent(long messageId) throws AMQException;
void setPublishAndContentHeaderBody(long messageId, BasicPublishBody publishBody,
diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java
index e09b177fb9..169055bad0 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java
@@ -288,10 +288,13 @@ public class AMQQueueMBean extends AMQManagedObject implements ManagedQueue
ContentBody body = cBodies.next();
if (body.getSize() != 0)
{
- ByteBuffer slice = body.payload.slice();
- for (int j = 0; j < slice.limit(); j++)
+ if (body.getSize() != 0)
{
- msgContent.add(slice.get());
+ ByteBuffer slice = body.payload.slice();
+ for (int j = 0; j < slice.limit(); j++)
+ {
+ msgContent.add(slice.get());
+ }
}
}
}
@@ -300,15 +303,18 @@ public class AMQQueueMBean extends AMQManagedObject implements ManagedQueue
{
// Create header attributes list
BasicContentHeaderProperties headerProperties = (BasicContentHeaderProperties) msg.getContentHeaderBody().properties;
- String mimeType = headerProperties.getContentType();
- String encoding = headerProperties.getEncoding() == null ? "" : headerProperties.getEncoding();
+ String mimeType = null, encoding = null;
+ if (headerProperties != null)
+ {
+ mimeType = headerProperties.getContentType();
+ encoding = headerProperties.getEncoding() == null ? "" : headerProperties.getEncoding();
+ }
Object[] itemValues = {msgId, mimeType, encoding, msgContent.toArray(new Byte[0])};
-
return new CompositeDataSupport(_msgContentType, _msgContentAttributes, itemValues);
}
catch (AMQException e)
{
- throw new JMException("Error create header attributes list: " + e);
+ throw new JMException("Error creating header attributes list: " + e);
}
}
diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/InMemoryMessageHandle.java b/java/broker/src/main/java/org/apache/qpid/server/queue/InMemoryMessageHandle.java
index e2e334c5f4..4a8616746c 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/queue/InMemoryMessageHandle.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/queue/InMemoryMessageHandle.java
@@ -74,6 +74,12 @@ public class InMemoryMessageHandle implements AMQMessageHandle
return _redelivered;
}
+
+ public void setRedelivered(boolean redelivered)
+ {
+ _redelivered = redelivered;
+ }
+
public boolean isPersistent(long messageId) throws AMQException
{
//todo remove literal values to a constant file such as AMQConstants in common
diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/WeakReferenceMessageHandle.java b/java/broker/src/main/java/org/apache/qpid/server/queue/WeakReferenceMessageHandle.java
index ba25ee32d7..c6f5c19940 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/queue/WeakReferenceMessageHandle.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/queue/WeakReferenceMessageHandle.java
@@ -103,6 +103,11 @@ public class WeakReferenceMessageHandle implements AMQMessageHandle
return _redelivered;
}
+ public void setRedelivered(boolean redelivered)
+ {
+ _redelivered = redelivered;
+ }
+
public boolean isPersistent(long messageId) throws AMQException
{
//todo remove literal values to a constant file such as AMQConstants in common
diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/auth/plain/PlainSaslServer.java b/java/broker/src/main/java/org/apache/qpid/server/security/auth/plain/PlainSaslServer.java
index fdf655c2d9..7f51260e45 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/security/auth/plain/PlainSaslServer.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/security/auth/plain/PlainSaslServer.java
@@ -62,7 +62,7 @@ public class PlainSaslServer implements SaslServer
}
// we do not currently support authcid in any meaningful way
- String authcid = new String(response, 0, authzidNullPosition, "utf8");
+ // String authcid = new String(response, 0, authzidNullPosition, "utf8");
String authzid = new String(response, authzidNullPosition + 1, authcidNullPosition - 1, "utf8");
// we do not care about the prompt but it throws if null
diff --git a/java/broker/src/main/java/org/apache/qpid/server/transport/ConnectorConfiguration.java b/java/broker/src/main/java/org/apache/qpid/server/transport/ConnectorConfiguration.java
index ca008a0bd5..ac164f0cab 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/transport/ConnectorConfiguration.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/transport/ConnectorConfiguration.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.transport;
import org.apache.qpid.configuration.Configured;
import org.apache.mina.common.IoAcceptor;
-import org.apache.mina.filter.executor.ExecutorExecutor;
import org.apache.mina.util.NewThreadExecutor;
public class ConnectorConfiguration
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQAuthenticationException.java b/java/client/src/main/java/org/apache/qpid/client/AMQAuthenticationException.java
index 74462a8d19..52dcfcfbfb 100644
--- a/java/client/src/main/java/org/apache/qpid/client/AMQAuthenticationException.java
+++ b/java/client/src/main/java/org/apache/qpid/client/AMQAuthenticationException.java
@@ -21,7 +21,6 @@
package org.apache.qpid.client;
import org.apache.qpid.AMQException;
-import org.apache.qpid.protocol.AMQConstant;
public class AMQAuthenticationException extends AMQException
{
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java b/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
index 8b2387b9a0..820b8c3f83 100644
--- a/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
+++ b/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
@@ -54,7 +54,6 @@ import java.net.ConnectException;
import java.nio.channels.UnresolvedAddressException;
import java.text.MessageFormat;
import java.util.ArrayList;
-import java.util.Enumeration;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
@@ -140,6 +139,12 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect
*/
private AMQException _lastAMQException = null;
+
+ /*
+ * The connection meta data
+ */
+ private QpidConnectionMetaData _connectionMetaData;
+
public AMQConnection(String broker, String username, String password,
String clientName, String virtualHost) throws AMQException, URLSyntaxException
{
@@ -282,6 +287,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect
throw e;
}
+ _connectionMetaData = new QpidConnectionMetaData(this);
}
protected boolean checkException(Throwable thrown)
@@ -551,7 +557,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect
public ConnectionMetaData getMetaData() throws JMSException
{
checkNotClosed();
- return QpidConnectionMetaData.instance();
+ return _connectionMetaData;
}
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java b/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java
index 9e99734840..b2d2d2bec3 100644
--- a/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java
+++ b/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.client;
-import org.apache.qpid.AMQException;
import org.apache.qpid.url.AMQBindingURL;
import org.apache.qpid.url.URLSyntaxException;
import org.apache.qpid.jms.ConnectionURL;
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
index 21fc5c89c5..fae5e7ac08 100644
--- a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
+++ b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
@@ -23,23 +23,22 @@ package org.apache.qpid.client;
import org.apache.log4j.Logger;
import org.apache.qpid.AMQException;
import org.apache.qpid.AMQUndeliveredException;
-import org.apache.qpid.server.handler.ExchangeBoundHandler;
-import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.client.failover.FailoverSupport;
import org.apache.qpid.client.message.AbstractJMSMessage;
import org.apache.qpid.client.message.JMSStreamMessage;
import org.apache.qpid.client.message.MessageFactoryRegistry;
import org.apache.qpid.client.message.UnprocessedMessage;
-import org.apache.qpid.client.protocol.AMQProtocolHandler;
import org.apache.qpid.client.protocol.AMQMethodEvent;
+import org.apache.qpid.client.protocol.AMQProtocolHandler;
import org.apache.qpid.client.util.FlowControllingBlockingQueue;
+import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.framing.*;
import org.apache.qpid.jms.Session;
import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.server.handler.ExchangeBoundHandler;
import org.apache.qpid.url.AMQBindingURL;
import org.apache.qpid.url.URLSyntaxException;
-
import javax.jms.*;
import javax.jms.IllegalStateException;
import java.io.Serializable;
@@ -50,7 +49,6 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
public class AMQSession extends Closeable implements Session, QueueSession, TopicSession
{
@@ -104,7 +102,7 @@ public class AMQSession extends Closeable implements Session, QueueSession, Topi
/**
* Maps from consumer tag (String) to JMSMessageConsumer instance
*/
- private Map _consumers = new ConcurrentHashMap();
+ private Map<String, BasicMessageConsumer> _consumers = new ConcurrentHashMap<String, BasicMessageConsumer>();
/**
* Maps from destination to count of JMSMessageConsumers
@@ -138,7 +136,11 @@ public class AMQSession extends Closeable implements Session, QueueSession, Topi
*/
private volatile AtomicBoolean _stopped = new AtomicBoolean(true);
- private final AtomicLong _lastDeliveryTag = new AtomicLong();
+ /**
+ * Set when recover is called. This is to handle the case where recover() is called by application code
+ * during onMessage() processing. We need to make sure we do not send an auto ack if recover was called.
+ */
+ private boolean _inRecovery;
/**
@@ -174,7 +176,7 @@ public class AMQSession extends Closeable implements Session, QueueSession, Topi
{
if (message.deliverBody != null)
{
- final BasicMessageConsumer consumer = (BasicMessageConsumer) _consumers.get(message.deliverBody.consumerTag);
+ final BasicMessageConsumer consumer = _consumers.get(message.deliverBody.consumerTag);
if (consumer == null)
{
@@ -467,10 +469,10 @@ public class AMQSession extends Closeable implements Session, QueueSession, Topi
{
// Acknowledge up to message last delivered (if any) for each consumer.
//need to send ack for messages delivered to consumers so far
- for (Iterator i = _consumers.values().iterator(); i.hasNext();)
+ for (Iterator<BasicMessageConsumer> i = _consumers.values().iterator(); i.hasNext();)
{
//Sends acknowledgement to server
- ((BasicMessageConsumer) i.next()).acknowledgeLastDelivered();
+ i.next().acknowledgeLastDelivered();
}
// Commits outstanding messages sent and outstanding acknowledgements.
@@ -652,12 +654,12 @@ public class AMQSession extends Closeable implements Session, QueueSession, Topi
}
// we need to clone the list of consumers since the close() method updates the _consumers collection
// which would result in a concurrent modification exception
- final ArrayList clonedConsumers = new ArrayList(_consumers.values());
+ final ArrayList<BasicMessageConsumer> clonedConsumers = new ArrayList(_consumers.values());
- final Iterator it = clonedConsumers.iterator();
+ final Iterator<BasicMessageConsumer> it = clonedConsumers.iterator();
while (it.hasNext())
{
- final BasicMessageConsumer con = (BasicMessageConsumer) it.next();
+ final BasicMessageConsumer con = it.next();
if (error != null)
{
con.notifyError(error);
@@ -678,12 +680,12 @@ public class AMQSession extends Closeable implements Session, QueueSession, Topi
}
// we need to clone the list of consumers since the close() method updates the _consumers collection
// which would result in a concurrent modification exception
- final ArrayList clonedConsumers = new ArrayList(_consumers.values());
+ final ArrayList<BasicMessageConsumer> clonedConsumers = new ArrayList<BasicMessageConsumer>(_consumers.values());
- final Iterator it = clonedConsumers.iterator();
+ final Iterator<BasicMessageConsumer> it = clonedConsumers.iterator();
while (it.hasNext())
{
- final BasicMessageConsumer con = (BasicMessageConsumer) it.next();
+ final BasicMessageConsumer con = it.next();
con.markClosed();
}
// at this point the _consumers map will be empty
@@ -698,31 +700,41 @@ public class AMQSession extends Closeable implements Session, QueueSession, Topi
{
checkNotClosed();
checkNotTransacted(); // throws IllegalStateException if a transacted session
-
+ // this is set only here, and the before the consumer's onMessage is called it is set to false
+ _inRecovery = true;
+ for (BasicMessageConsumer consumer : _consumers.values())
+ {
+ consumer.clearUnackedMessages();
+ }
_connection.getProtocolHandler().writeFrame(BasicRecoverBody.createAMQFrame(_channelId, false));
}
+ boolean isInRecovery()
+ {
+ return _inRecovery;
+ }
+
+ void setInRecovery(boolean inRecovery)
+ {
+ _inRecovery = inRecovery;
+ }
public void acknowledge() throws JMSException
{
- if (getAMQConnection().isClosed())
+ if(isClosed())
{
- throw new javax.jms.IllegalStateException("Connection is already closed");
+ throw new IllegalStateException("Session is already closed");
}
- if (isClosed())
+ for(BasicMessageConsumer consumer : _consumers.values())
{
- throw new javax.jms.IllegalStateException("Session is already closed");
+ consumer.acknowledge();
}
- acknowledgeMessage(_lastDeliveryTag.get(), true);
- }
- void setLastDeliveredMessage(AbstractJMSMessage message)
- {
- _lastDeliveryTag.set(message.getDeliveryTag());
}
+
public MessageListener getMessageListener() throws JMSException
{
checkNotClosed();
@@ -1479,7 +1491,7 @@ public class AMQSession extends Closeable implements Session, QueueSession, Topi
String subscriptionName = _reverseSubscriptionMap.remove(consumer);
if(subscriptionName != null)
{
- _subscriptions.remove(subscriptionName);
+ _subscriptions.remove(subscriptionName);
}
Destination dest = consumer.getDestination();
diff --git a/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java b/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
index 9f9038fddd..f0d3cf5abc 100644
--- a/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
+++ b/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
@@ -22,6 +22,8 @@ package org.apache.qpid.client;
import org.apache.log4j.Logger;
import org.apache.qpid.AMQException;
+import org.apache.qpid.url.AMQBindingURL;
+import org.apache.qpid.url.URLSyntaxException;
import org.apache.qpid.client.message.AbstractJMSMessage;
import org.apache.qpid.client.message.MessageFactoryRegistry;
import org.apache.qpid.client.message.UnprocessedMessage;
@@ -36,7 +38,10 @@ import org.apache.qpid.jms.Session;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
-import java.util.concurrent.SynchronousQueue;
+import java.util.Iterator;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import javax.jms.Destination;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
@@ -80,7 +85,7 @@ public class BasicMessageConsumer extends Closeable implements MessageConsumer
* Used in the blocking receive methods to receive a message from
* the Session thread. Argument true indicates we want strict FIFO semantics
*/
- private final SynchronousQueue _synchronousQueue = new SynchronousQueue(true);
+ private final ArrayBlockingQueue _synchronousQueue;
private MessageFactoryRegistry _messageFactory;
@@ -132,6 +137,14 @@ public class BasicMessageConsumer extends Closeable implements MessageConsumer
*/
private boolean _dups_ok_acknowledge_send;
+ private ConcurrentLinkedQueue<Long> _unacknowledgedDeliveryTags = new ConcurrentLinkedQueue<Long>();
+
+ /**
+ * The thread that was used to call receive(). This is important for being able to interrupt that thread if
+ * a receive() is in progress.
+ */
+ private Thread _receivingThread;
+
protected BasicMessageConsumer(int channelId, AMQConnection connection, AMQDestination destination, String messageSelector,
boolean noLocal, MessageFactoryRegistry messageFactory, AMQSession session,
AMQProtocolHandler protocolHandler, FieldTable rawSelectorFieldTable,
@@ -150,6 +163,7 @@ public class BasicMessageConsumer extends Closeable implements MessageConsumer
_prefetchLow = prefetchLow;
_exclusive = exclusive;
_acknowledgeMode = acknowledgeMode;
+ _synchronousQueue = new ArrayBlockingQueue(prefetchHigh, true);
}
public AMQDestination getDestination()
@@ -217,7 +231,7 @@ public class BasicMessageConsumer extends Closeable implements MessageConsumer
AbstractJMSMessage jmsMsg = (AbstractJMSMessage)_synchronousQueue.poll();
if (jmsMsg != null)
{
- _session.setLastDeliveredMessage(jmsMsg);
+ preApplicationProcessing(jmsMsg);
messageListener.onMessage(jmsMsg);
postDeliver(jmsMsg);
}
@@ -225,6 +239,26 @@ public class BasicMessageConsumer extends Closeable implements MessageConsumer
}
}
+ private void preApplicationProcessing(AbstractJMSMessage jmsMsg) throws JMSException
+ {
+ if(_session.getAcknowledgeMode() == Session.CLIENT_ACKNOWLEDGE)
+ {
+ _unacknowledgedDeliveryTags.add(jmsMsg.getDeliveryTag());
+ String url = jmsMsg.getStringProperty(CustomJMXProperty.JMSX_QPID_JMSDESTINATIONURL.toString());
+ try
+ {
+ Destination dest = AMQDestination.createDestination(new AMQBindingURL(url));
+ jmsMsg.setJMSDestination(dest);
+ }
+ catch (URLSyntaxException e)
+ {
+ _logger.warn("Unable to parse the supplied destination header: " + url);
+ }
+
+ }
+ _session.setInRecovery(false);
+ }
+
private void acquireReceiving() throws JMSException
{
if (!_receiving.compareAndSet(false, true))
@@ -235,11 +269,13 @@ public class BasicMessageConsumer extends Closeable implements MessageConsumer
{
throw new javax.jms.IllegalStateException("A listener has already been set.");
}
+ _receivingThread = Thread.currentThread();
}
private void releaseReceiving()
{
_receiving.set(false);
+ _receivingThread = null;
}
public FieldTable getRawSelectorFieldTable()
@@ -280,7 +316,7 @@ public class BasicMessageConsumer extends Closeable implements MessageConsumer
public Message receive(long l) throws JMSException
{
checkPreConditions();
-
+
acquireReceiving();
try
@@ -297,15 +333,15 @@ public class BasicMessageConsumer extends Closeable implements MessageConsumer
final AbstractJMSMessage m = returnMessageOrThrow(o);
if (m != null)
{
- _session.setLastDeliveredMessage(m);
+ preApplicationProcessing(m);
postDeliver(m);
}
-
+
return m;
}
catch (InterruptedException e)
{
- _logger.warn("Interrupted: " + e, e);
+ _logger.warn("Interrupted: " + e);
return null;
}
finally
@@ -326,7 +362,7 @@ public class BasicMessageConsumer extends Closeable implements MessageConsumer
final AbstractJMSMessage m = returnMessageOrThrow(o);
if (m != null)
{
- _session.setLastDeliveredMessage(m);
+ preApplicationProcessing(m);
postDeliver(m);
}
@@ -385,6 +421,12 @@ public class BasicMessageConsumer extends Closeable implements MessageConsumer
}
deregisterConsumer();
+ _unacknowledgedDeliveryTags.clear();
+ if (_messageListener != null && _receiving.get())
+ {
+ _logger.info("Interrupting thread: " + _receivingThread);
+ _receivingThread.interrupt();
+ }
}
}
}
@@ -421,6 +463,7 @@ public class BasicMessageConsumer extends Closeable implements MessageConsumer
messageFrame.bodies);
_logger.debug("Message is of type: " + jmsMessage.getClass().getName());
+ jmsMessage.setConsumer(this);
preDeliver(jmsMessage);
@@ -428,7 +471,7 @@ public class BasicMessageConsumer extends Closeable implements MessageConsumer
{
//we do not need a lock around the test above, and the dispatch below as it is invalid
//for an application to alter an installed listener while the session is started
- _session.setLastDeliveredMessage(jmsMessage);
+ preApplicationProcessing(jmsMessage);
getMessageListener().onMessage(jmsMessage);
postDeliver(jmsMessage);
}
@@ -482,11 +525,18 @@ public class BasicMessageConsumer extends Closeable implements MessageConsumer
if (_dups_ok_acknowledge_send)
{
- _session.acknowledgeMessage(msg.getDeliveryTag(), true);
+ if (!_session.isInRecovery())
+ {
+ _session.acknowledgeMessage(msg.getDeliveryTag(), true);
+ }
}
break;
case Session.AUTO_ACKNOWLEDGE:
- _session.acknowledgeMessage(msg.getDeliveryTag(), false);
+ // we do not auto ack a message if the application code called recover()
+ if (!_session.isInRecovery())
+ {
+ _session.acknowledgeMessage(msg.getDeliveryTag(), false);
+ }
break;
case Session.SESSION_TRANSACTED:
_lastDeliveryTag = msg.getDeliveryTag();
@@ -554,4 +604,30 @@ public class BasicMessageConsumer extends Closeable implements MessageConsumer
throw new javax.jms.IllegalStateException("Invalid Session");
}
}
+
+ public void acknowledge() throws JMSException
+ {
+ if(!isClosed())
+ {
+
+ Iterator<Long> tags = _unacknowledgedDeliveryTags.iterator();
+ while(tags.hasNext())
+ {
+ _session.acknowledgeMessage(tags.next(), false);
+ tags.remove();
+ }
+ }
+ else
+ {
+ throw new IllegalStateException("Consumer is closed");
+ }
+ }
+
+ /**
+ * Called on recovery to reset the list of delivery tags
+ */
+ public void clearUnackedMessages()
+ {
+ _unacknowledgedDeliveryTags.clear();
+ }
}
diff --git a/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java b/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
index e11d70cf41..7a5fcbccf9 100644
--- a/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
+++ b/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
@@ -507,8 +507,11 @@ public class BasicMessageProducer extends Closeable implements org.apache.qpid.j
long timeToLive, boolean mandatory, boolean immediate, boolean wait) throws JMSException
{
checkTemporaryDestination(destination);
+ origMessage.setJMSDestination(destination);
+
AbstractJMSMessage message = convertToNativeMessage(origMessage);
+ message.getJmsContentHeaderProperties().getJMSHeaders().setString(CustomJMXProperty.JMSX_QPID_JMSDESTINATIONURL.toString(), destination.toURL());
AMQFrame publishFrame = BasicPublishBody.createAMQFrame(_channelId, 0, destination.getExchangeName(),
destination.getRoutingKey(), mandatory, immediate);
diff --git a/java/client/src/main/java/org/apache/qpid/client/CustomJMXProperty.java b/java/client/src/main/java/org/apache/qpid/client/CustomJMXProperty.java
new file mode 100644
index 0000000000..3a7b7a7b3d
--- /dev/null
+++ b/java/client/src/main/java/org/apache/qpid/client/CustomJMXProperty.java
@@ -0,0 +1,47 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.client;
+
+import java.util.*;
+
+public enum CustomJMXProperty
+{
+ JMSX_QPID_JMSDESTINATIONURL,
+ JMSXGroupID,
+ JMSXGroupSeq;
+
+ private static Enumeration _names;
+
+ public static synchronized Enumeration asEnumeration()
+ {
+ if(_names == null)
+ {
+ CustomJMXProperty[] properties = values();
+ ArrayList<String> nameList = new ArrayList<String>(properties.length);
+ for(CustomJMXProperty property : properties)
+ {
+ nameList.add(property.toString());
+ }
+ _names = Collections.enumeration(nameList);
+ }
+ return _names;
+ }
+}
diff --git a/java/client/src/main/java/org/apache/qpid/client/QpidConnectionMetaData.java b/java/client/src/main/java/org/apache/qpid/client/QpidConnectionMetaData.java
index 10a65c2ad8..6ab7808110 100644
--- a/java/client/src/main/java/org/apache/qpid/client/QpidConnectionMetaData.java
+++ b/java/client/src/main/java/org/apache/qpid/client/QpidConnectionMetaData.java
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
package org.apache.qpid.client;
import java.util.Enumeration;
@@ -5,46 +25,73 @@ import java.util.Enumeration;
import javax.jms.ConnectionMetaData;
import javax.jms.JMSException;
-public class QpidConnectionMetaData implements ConnectionMetaData {
-
- private static QpidConnectionMetaData _instance = new QpidConnectionMetaData();
-
- private QpidConnectionMetaData(){
- }
-
- public static QpidConnectionMetaData instance(){
- return _instance;
- }
-
- public int getJMSMajorVersion() throws JMSException {
- return 1;
- }
-
- public int getJMSMinorVersion() throws JMSException {
- return 1;
- }
-
- public String getJMSProviderName() throws JMSException {
- return "Apache Qpid";
- }
-
- public String getJMSVersion() throws JMSException {
- return "1.1";
- }
-
- public Enumeration getJMSXPropertyNames() throws JMSException {
- return null;
- }
-
- public int getProviderMajorVersion() throws JMSException {
- return 0;
- }
-
- public int getProviderMinorVersion() throws JMSException {
- return 9;
- }
-
- public String getProviderVersion() throws JMSException {
- return "Incubating-M1";
- }
+public class QpidConnectionMetaData implements ConnectionMetaData
+{
+
+
+
+ QpidConnectionMetaData(AMQConnection conn)
+ {
+ }
+
+ public int getJMSMajorVersion() throws JMSException
+ {
+ return 1;
+ }
+
+ public int getJMSMinorVersion() throws JMSException
+ {
+ return 1;
+ }
+
+ public String getJMSProviderName() throws JMSException
+ {
+ return "Apache Qpid";
+ }
+
+ public String getJMSVersion() throws JMSException
+ {
+ return "1.1";
+ }
+
+ public Enumeration getJMSXPropertyNames() throws JMSException
+ {
+ return CustomJMXProperty.asEnumeration();
+ }
+
+ public int getProviderMajorVersion() throws JMSException
+ {
+ return 0;
+ }
+
+ public int getProviderMinorVersion() throws JMSException
+ {
+ return 8;
+ }
+
+ public String getProviderVersion() throws JMSException
+ {
+ return "QPID (Client: [" + getClientVersion() + "] ; Broker [" + getBrokerVersion() + "] ; Protocol: [ "
+ + getProtocolVersion() + "] )";
+ }
+
+ private String getProtocolVersion()
+ {
+ // TODO - Implement based on connection negotiated protocol
+ return "0.8";
+ }
+
+ public String getBrokerVersion()
+ {
+ // TODO - get broker version
+ return "<unkown>";
+ }
+
+ public String getClientVersion()
+ {
+ // TODO - get client build version from properties file or similar
+ return "<unknown>";
+ }
+
+
}
diff --git a/java/client/src/main/java/org/apache/qpid/client/TemporaryDestination.java b/java/client/src/main/java/org/apache/qpid/client/TemporaryDestination.java
index 8c11672a65..b4772b1f9b 100644
--- a/java/client/src/main/java/org/apache/qpid/client/TemporaryDestination.java
+++ b/java/client/src/main/java/org/apache/qpid/client/TemporaryDestination.java
@@ -1,7 +1,6 @@
package org.apache.qpid.client;
import javax.jms.*;
-import java.util.concurrent.atomic.AtomicBoolean;
/**
* Provides support for covenience interface implemented by both AMQTemporaryTopic and AMQTemporaryQueue
diff --git a/java/client/src/main/java/org/apache/qpid/client/TopicSubscriberAdaptor.java b/java/client/src/main/java/org/apache/qpid/client/TopicSubscriberAdaptor.java
index dbc7b72813..d4bec5d906 100644
--- a/java/client/src/main/java/org/apache/qpid/client/TopicSubscriberAdaptor.java
+++ b/java/client/src/main/java/org/apache/qpid/client/TopicSubscriberAdaptor.java
@@ -20,10 +20,8 @@
*/
package org.apache.qpid.client;
-import javax.jms.IllegalStateException;
import javax.jms.JMSException;
import javax.jms.Message;
-import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.Topic;
import javax.jms.TopicSubscriber;
diff --git a/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionOpenOkMethodHandler.java b/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionOpenOkMethodHandler.java
index 8785e7d44e..b5001a6e64 100644
--- a/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionOpenOkMethodHandler.java
+++ b/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionOpenOkMethodHandler.java
@@ -20,20 +20,14 @@
*/
package org.apache.qpid.client.handler;
-import org.apache.log4j.Logger;
import org.apache.qpid.AMQException;
import org.apache.qpid.client.protocol.AMQMethodEvent;
-import org.apache.qpid.client.protocol.AMQProtocolSession;
import org.apache.qpid.client.state.AMQState;
import org.apache.qpid.client.state.AMQStateManager;
import org.apache.qpid.client.state.StateAwareMethodListener;
-import org.apache.qpid.framing.ConnectionOpenOkBody;
public class ConnectionOpenOkMethodHandler implements StateAwareMethodListener
{
-
- private static final Logger _logger = Logger.getLogger(ConnectionOpenOkMethodHandler.class);
-
private static final ConnectionOpenOkMethodHandler _instance = new ConnectionOpenOkMethodHandler();
public static ConnectionOpenOkMethodHandler getInstance()
@@ -47,8 +41,6 @@ public class ConnectionOpenOkMethodHandler implements StateAwareMethodListener
public void methodReceived(AMQStateManager stateManager, AMQMethodEvent evt) throws AMQException
{
- AMQProtocolSession session = evt.getProtocolSession();
- ConnectionOpenOkBody method = (ConnectionOpenOkBody) evt.getMethod();
stateManager.changeState(AMQState.CONNECTION_OPEN);
}
diff --git a/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java b/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java
index 75e84fee96..fea7a29594 100644
--- a/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java
+++ b/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java
@@ -26,19 +26,14 @@ import org.apache.qpid.AMQException;
import org.apache.qpid.url.BindingURL;
import org.apache.qpid.url.AMQBindingURL;
import org.apache.qpid.url.URLSyntaxException;
-import org.apache.qpid.client.AMQDestination;
-import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.client.AMQTopic;
-import org.apache.qpid.client.JmsNotImplementedException;
+import org.apache.qpid.client.*;
import org.apache.qpid.framing.BasicContentHeaderProperties;
import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.framing.JMSPropertyFieldTable;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageNotReadableException;
import javax.jms.MessageNotWriteableException;
-import javax.jms.MessageFormatException;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Map;
@@ -53,7 +48,8 @@ public abstract class AbstractJMSMessage extends AMQMessage implements org.apach
private boolean _readableProperties = false;
private boolean _readableMessage = false;
private Destination _destination;
-
+ private BasicMessageConsumer _consumer;
+
protected AbstractJMSMessage(ByteBuffer data)
{
super(new BasicContentHeaderProperties());
@@ -176,13 +172,12 @@ public abstract class AbstractJMSMessage extends AMQMessage implements org.apach
public Destination getJMSDestination() throws JMSException
{
- // TODO: implement this once we have sorted out how to figure out the exchange class
- return _destination;
+ return _destination;
}
public void setJMSDestination(Destination destination) throws JMSException
{
- _destination = destination;
+ _destination = destination;
}
public int getJMSDeliveryMode() throws JMSException
@@ -538,4 +533,9 @@ public abstract class AbstractJMSMessage extends AMQMessage implements org.apach
_readableMessage = true;
}
}
+
+ public void setConsumer(BasicMessageConsumer basicMessageConsumer)
+ {
+ _consumer = basicMessageConsumer;
+ }
}
diff --git a/java/client/src/main/java/org/apache/qpid/client/message/JMSBytesMessage.java b/java/client/src/main/java/org/apache/qpid/client/message/JMSBytesMessage.java
index debabfd559..f5c9f7111a 100644
--- a/java/client/src/main/java/org/apache/qpid/client/message/JMSBytesMessage.java
+++ b/java/client/src/main/java/org/apache/qpid/client/message/JMSBytesMessage.java
@@ -27,7 +27,6 @@ import org.apache.qpid.framing.ContentHeaderBody;
import javax.jms.BytesMessage;
import javax.jms.JMSException;
import javax.jms.MessageFormatException;
-import javax.jms.MessageEOFException;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
diff --git a/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java b/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java
index f69bed0fc0..a93c4d5d6d 100644
--- a/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java
+++ b/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java
@@ -21,8 +21,6 @@
package org.apache.qpid.client.message;
import org.apache.mina.common.ByteBuffer;
-import org.apache.qpid.framing.PropertyFieldTable;
-import org.apache.qpid.framing.FieldTableFactory;
import org.apache.qpid.framing.ContentHeaderBody;
import org.apache.qpid.framing.EncodingUtils;
import org.apache.qpid.framing.JMSPropertyFieldTable;
@@ -31,7 +29,6 @@ import org.apache.qpid.AMQException;
import org.apache.log4j.Logger;
import javax.jms.JMSException;
-import javax.jms.MessageFormatException;
import java.util.Enumeration;
public class JMSMapMessage extends JMSBytesMessage implements javax.jms.MapMessage
diff --git a/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessageFactory.java b/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessageFactory.java
index 38b8b67ff9..b110f04460 100644
--- a/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessageFactory.java
+++ b/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessageFactory.java
@@ -22,7 +22,6 @@ package org.apache.qpid.client.message;
import org.apache.mina.common.ByteBuffer;
import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.BasicContentHeaderProperties;
import org.apache.qpid.AMQException;
import javax.jms.JMSException;
diff --git a/java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java b/java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java
index 93c17520b0..104c5bfc44 100644
--- a/java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java
+++ b/java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java
@@ -21,7 +21,6 @@
package org.apache.qpid.client.transport;
import org.apache.qpid.jms.BrokerDetails;
-import org.apache.qpid.AMQException;
public class AMQNoTransportForProtocolException extends AMQTransportConnectionException
{
diff --git a/java/client/src/main/java/org/apache/qpid/client/transport/ITransportConnection.java b/java/client/src/main/java/org/apache/qpid/client/transport/ITransportConnection.java
index 7630f59115..cb956b1cef 100644
--- a/java/client/src/main/java/org/apache/qpid/client/transport/ITransportConnection.java
+++ b/java/client/src/main/java/org/apache/qpid/client/transport/ITransportConnection.java
@@ -21,7 +21,6 @@
package org.apache.qpid.client.transport;
import org.apache.qpid.client.protocol.AMQProtocolHandler;
-import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.jms.BrokerDetails;
import java.io.IOException;
diff --git a/java/client/src/main/java/org/apache/qpid/client/transport/SocketTransportConnection.java b/java/client/src/main/java/org/apache/qpid/client/transport/SocketTransportConnection.java
index 2e47ed2666..0de2850080 100644
--- a/java/client/src/main/java/org/apache/qpid/client/transport/SocketTransportConnection.java
+++ b/java/client/src/main/java/org/apache/qpid/client/transport/SocketTransportConnection.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.client.transport;
-import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.protocol.AMQProtocolHandler;
import org.apache.qpid.pool.ReadWriteThreadModel;
import org.apache.qpid.jms.BrokerDetails;
diff --git a/java/client/src/main/java/org/apache/qpid/client/transport/VmPipeTransportConnection.java b/java/client/src/main/java/org/apache/qpid/client/transport/VmPipeTransportConnection.java
index 6287d70a56..1fc43f3496 100644
--- a/java/client/src/main/java/org/apache/qpid/client/transport/VmPipeTransportConnection.java
+++ b/java/client/src/main/java/org/apache/qpid/client/transport/VmPipeTransportConnection.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.client.transport;
-import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.protocol.AMQProtocolHandler;
import org.apache.qpid.client.transport.ITransportConnection;
import org.apache.qpid.pool.PoolingFilter;
diff --git a/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java b/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java
index 0759113667..53e7fd066e 100644
--- a/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java
+++ b/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java
@@ -26,7 +26,6 @@ import org.apache.qpid.client.AMQHeadersExchange;
import org.apache.qpid.client.AMQQueue;
import org.apache.qpid.client.AMQTopic;
import org.apache.qpid.client.AMQDestination;
-import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.url.AMQBindingURL;
import org.apache.qpid.url.BindingURL;
import org.apache.qpid.url.URLSyntaxException;
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/ack/RecoverTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/ack/RecoverTest.java
index dc0ade76c4..d12ab01bdc 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/ack/RecoverTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/ack/RecoverTest.java
@@ -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,19 +19,15 @@
*/
package org.apache.qpid.test.unit.ack;
+import junit.framework.TestCase;
+import org.apache.log4j.Logger;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQQueue;
import org.apache.qpid.client.AMQSession;
import org.apache.qpid.client.transport.TransportConnection;
-import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
-import org.apache.qpid.testutil.VMBrokerSetup;
-import org.apache.log4j.Logger;
-import org.apache.log4j.xml.DOMConfigurator;
import javax.jms.*;
-import junit.framework.TestCase;
-
public class RecoverTest extends TestCase
{
private static final Logger _logger = Logger.getLogger(RecoverTest.class);
@@ -46,11 +42,9 @@ public class RecoverTest extends TestCase
{
super.tearDown();
TransportConnection.killAllVMBrokers();
- //Thread.sleep(2000);
}
-
public void testRecoverResendsMsgs() throws Exception
{
Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
@@ -133,7 +127,7 @@ public class RecoverTest extends TestCase
_logger.info("Starting connection");
con.start();
TextMessage tm = (TextMessage) consumer.receive();
- TextMessage tm2 = (TextMessage) consumer.receive();
+ consumer.receive();
tm.acknowledge();
_logger.info("Received 2 messages, acknowledge() first message, should acknowledge both");
@@ -150,7 +144,7 @@ public class RecoverTest extends TestCase
_logger.info("Received redelivery of two messages. calling acknolwedgeThis() first of those message");
- ((org.apache.qpid.jms.Message)tm3).acknowledgeThis();
+ ((org.apache.qpid.jms.Message) tm3).acknowledgeThis();
_logger.info("Calling recover");
// all acked so no messages to be delivered
@@ -158,7 +152,7 @@ public class RecoverTest extends TestCase
tm4 = (TextMessage) consumer.receive(3000);
assertEquals("msg4", tm4.getText());
- ((org.apache.qpid.jms.Message)tm4).acknowledgeThis();
+ ((org.apache.qpid.jms.Message) tm4).acknowledgeThis();
_logger.info("Calling recover");
// all acked so no messages to be delivered
@@ -172,6 +166,83 @@ public class RecoverTest extends TestCase
con.close();
}
+ public void testAcknowledgePerConsumer() throws Exception
+ {
+ Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
+
+ Session consumerSession = con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+ Queue queue = new AMQQueue("Q1", "Q1", false, true);
+ Queue queue2 = new AMQQueue("Q2", "Q2", false, true);
+ MessageConsumer consumer = consumerSession.createConsumer(queue);
+ MessageConsumer consumer2 = consumerSession.createConsumer(queue2);
+
+ Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "producer1", "/test");
+ Session producerSession = con2.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+ MessageProducer producer = producerSession.createProducer(queue);
+ MessageProducer producer2 = producerSession.createProducer(queue2);
+
+ producer.send(producerSession.createTextMessage("msg1"));
+ producer2.send(producerSession.createTextMessage("msg2"));
+
+ con2.close();
+
+ _logger.info("Starting connection");
+ con.start();
+
+ TextMessage tm2 = (TextMessage) consumer2.receive();
+ assertNotNull(tm2);
+ assertEquals("msg2", tm2.getText());
+
+ tm2.acknowledge();
+
+ consumerSession.recover();
+
+ TextMessage tm1 = (TextMessage) consumer.receive(2000);
+ assertNotNull(tm1);
+ assertEquals("msg1", tm1.getText());
+
+ con.close();
+
+ }
+
+ public void testRecoverInAutoAckListener() throws Exception
+ {
+ Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
+
+ final Session consumerSession = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Queue queue = new AMQQueue("Q1", "Q1", false, true);
+ MessageProducer producer = consumerSession.createProducer(queue);
+ producer.send(consumerSession.createTextMessage("hello"));
+ MessageConsumer consumer = consumerSession.createConsumer(queue);
+ consumer.setMessageListener(new MessageListener()
+ {
+ private int count = 0;
+
+ public void onMessage(Message message)
+ {
+ try
+ {
+ if (count++ == 0)
+ {
+ assertFalse(message.getJMSRedelivered());
+ consumerSession.recover();
+ }
+ else if (count++ == 1)
+ {
+ assertTrue(message.getJMSRedelivered());
+ }
+ else
+ {
+ fail("Message delivered too many times!");
+ }
+ }
+ catch (JMSException e)
+ {
+ _logger.error("Error recovering session: " + e, e);
+ }
+ }
+ });
+ }
public static junit.framework.Test suite()
{
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/basic/BytesMessageTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/basic/BytesMessageTest.java
index e6f7032aa7..59be38f0dd 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/basic/BytesMessageTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/basic/BytesMessageTest.java
@@ -23,8 +23,6 @@ import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQDestination;
import org.apache.qpid.client.AMQQueue;
import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
-import org.apache.qpid.client.transport.TransportConnection;
import org.apache.qpid.client.message.JMSBytesMessage;
import org.apache.qpid.testutil.VMBrokerSetup;
import org.apache.mina.common.ByteBuffer;
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/basic/FieldTablePropertyTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/basic/FieldTablePropertyTest.java
index 92b4831d93..3cd99d3262 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/basic/FieldTablePropertyTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/basic/FieldTablePropertyTest.java
@@ -20,13 +20,10 @@
*/
package org.apache.qpid.test.unit.basic;
-import org.apache.qpid.framing.PropertyFieldTable;
-import org.apache.qpid.framing.FieldTable;
import org.apache.qpid.client.message.JMSTextMessage;
import org.apache.qpid.client.message.TestMessageHelper;
import java.util.Enumeration;
-import java.util.NoSuchElementException;
import javax.jms.JMSException;
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java
index c88024f39f..1e9de221d4 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java
@@ -31,7 +31,7 @@ import javax.jms.*;
public class MultipleConnectionTest extends TestCase
{
public static final String _defaultBroker = "vm://:1";
- public static String _connectionString = _defaultBroker;
+ public String _connectionString = _defaultBroker;
private static class Receiver
{
@@ -176,9 +176,6 @@ public class MultipleConnectionTest extends TestCase
{
String broker = argv.length > 0 ? argv[0] : _defaultBroker;
- int connections = 7;
- int sessions = 2;
-
MultipleConnectionTest test = new MultipleConnectionTest();
test._connectionString = broker;
test.test();
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java
index 9ddb290e73..726c7e39d7 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java
@@ -24,8 +24,6 @@ import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQDestination;
import org.apache.qpid.client.AMQQueue;
import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.client.transport.TransportConnection;
-import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
import org.apache.qpid.testutil.VMBrokerSetup;
import javax.jms.JMSException;
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQConnectionTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQConnectionTest.java
index 54f4ad4665..c4b60be1d1 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQConnectionTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQConnectionTest.java
@@ -20,17 +20,12 @@
*/
package org.apache.qpid.test.unit.client;
-import org.apache.qpid.client.transport.TransportConnection;
-import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
import org.apache.qpid.client.AMQTopic;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQQueue;
import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.testutil.VMBrokerSetup;
-import org.apache.qpid.url.URLSyntaxException;
+import org.apache.qpid.client.transport.TransportConnection;
-import java.lang.reflect.Method;
import javax.jms.*;
import junit.framework.TestCase;
@@ -46,6 +41,7 @@ public class AMQConnectionTest extends TestCase
protected void setUp() throws Exception
{
super.setUp();
+ TransportConnection.createVMBroker(1);
_connection = new AMQConnection("vm://:1", "guest", "guest", "fred", "/test");
_topic = new AMQTopic("mytopic");
_queue = new AMQQueue("myqueue");
@@ -53,6 +49,7 @@ public class AMQConnectionTest extends TestCase
protected void tearDown() throws Exception
{
+ super.tearDown();
try
{
_connection.close();
@@ -60,8 +57,8 @@ public class AMQConnectionTest extends TestCase
catch (JMSException e)
{
//ignore
- }
- super.tearDown();
+ }
+ TransportConnection.killAllVMBrokers();
}
/**
@@ -200,6 +197,6 @@ public class AMQConnectionTest extends TestCase
public static junit.framework.Test suite()
{
- return new VMBrokerSetup(new junit.framework.TestSuite(AMQConnectionTest.class));
+ return new junit.framework.TestSuite(AMQConnectionTest.class);
}
}
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java
index cfea11ba4d..67c4f1dd6b 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java
@@ -20,15 +20,11 @@
*/
package org.apache.qpid.test.unit.client;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.testutil.VMBrokerSetup;
-import org.apache.qpid.client.transport.TransportConnection;
-import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
import org.apache.qpid.client.AMQTopic;
import org.apache.qpid.client.AMQSession;
import org.apache.qpid.client.AMQQueue;
import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.url.URLSyntaxException;
+import org.apache.qpid.testutil.VMBrokerSetup;
import javax.jms.JMSException;
import javax.jms.TopicSubscriber;
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java
new file mode 100644
index 0000000000..0b3ed931f8
--- /dev/null
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java
@@ -0,0 +1,83 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid.test.unit.client.channelclose;
+
+import junit.framework.TestCase;
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQTopic;
+import org.apache.qpid.client.transport.TransportConnection;
+
+import javax.jms.Connection;
+import javax.jms.Session;
+import javax.jms.MessageConsumer;
+
+/**
+ * @author Apache Software Foundation
+ */
+public class CloseWithBlockingReceiveTest extends TestCase
+{
+
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ TransportConnection.createVMBroker(1);
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ TransportConnection.killAllVMBrokers();
+ }
+
+
+ public void testReceiveReturnsNull() throws Exception
+ {
+ final Connection connection = new AMQConnection("vm://:1", "guest", "guest",
+ "fred", "/test");
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session.createConsumer(new AMQTopic("banana"));
+ connection.start();
+
+ Runnable r = new Runnable()
+ {
+
+ public void run()
+ {
+ try
+ {
+ Thread.sleep(1000);
+ connection.close();
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ };
+ long startTime = System.currentTimeMillis();
+ new Thread(r).start();
+ consumer.receive(10000);
+ assertTrue(System.currentTimeMillis() - startTime < 10000);
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new junit.framework.TestSuite(CloseWithBlockingReceiveTest.class);
+ }
+
+}
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
index 64adcb13e4..147d2ae43e 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
@@ -22,8 +22,6 @@ package org.apache.qpid.test.unit.client.connectionurl;
import org.apache.qpid.client.AMQConnectionURL;
import org.apache.qpid.client.AMQBrokerDetails;
-import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
-import org.apache.qpid.client.transport.TransportConnection;
import org.apache.qpid.jms.ConnectionURL;
import org.apache.qpid.jms.BrokerDetails;
import org.apache.qpid.url.URLSyntaxException;
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/CombinedTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/CombinedTest.java
index dde3d53299..234f6fb358 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/CombinedTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/CombinedTest.java
@@ -20,8 +20,6 @@
*/
package org.apache.qpid.test.unit.client.forwardall;
-import org.apache.qpid.client.transport.TransportConnection;
-import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
import org.apache.qpid.testutil.VMBrokerSetup;
import junit.framework.TestCase;
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/client/message/MapMessageTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/client/message/MapMessageTest.java
index bd4b3b3987..cddd73898d 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/client/message/MapMessageTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/client/message/MapMessageTest.java
@@ -108,7 +108,7 @@ public class MapMessageTest extends TestCase
JMSMapMessage mm = TestMessageHelper.newJMSMapMessage();
mm.setString("value", null);
- char c = mm.getChar("value");
+ mm.getChar("value");
fail("Expected NullPointerException");
}
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/client/message/TextMessageTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/client/message/TextMessageTest.java
index 64d10fb13f..6112c2412c 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/client/message/TextMessageTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/client/message/TextMessageTest.java
@@ -28,7 +28,6 @@ import junit.framework.TestCase;
import junit.framework.Assert;
import javax.jms.JMSException;
-import javax.jms.MessageFormatException;
public class TextMessageTest extends TestCase
{
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/client/temporaryqueue/TemporaryQueueTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/client/temporaryqueue/TemporaryQueueTest.java
index 1e13962f01..6c064e3853 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/client/temporaryqueue/TemporaryQueueTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/client/temporaryqueue/TemporaryQueueTest.java
@@ -3,10 +3,7 @@ package org.apache.qpid.test.unit.client.temporaryqueue;
import junit.framework.TestCase;
import org.apache.qpid.client.transport.TransportConnection;
import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQAuthenticationException;
import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQConnectionException;
-import org.apache.qpid.AMQUnresolvedAddressException;
import org.apache.qpid.url.URLSyntaxException;
import javax.jms.*;
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/message/JMSDestinationTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/message/JMSDestinationTest.java
new file mode 100644
index 0000000000..27736ac473
--- /dev/null
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/message/JMSDestinationTest.java
@@ -0,0 +1,70 @@
+package org.apache.qpid.test.unit.message;
+
+import junit.framework.TestCase;
+import org.apache.log4j.Logger;
+import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQSession;
+import org.apache.qpid.client.AMQHeadersExchange;
+import org.apache.qpid.client.AMQQueue;
+import org.apache.qpid.url.AMQBindingURL;
+import org.apache.qpid.url.BindingURL;
+import org.apache.qpid.exchange.ExchangeDefaults;
+import org.apache.qpid.framing.FieldTable;
+import org.apache.qpid.framing.PropertyFieldTable;
+
+import javax.jms.*;
+
+/**
+ * @author Apache Software Foundation
+ */
+public class JMSDestinationTest extends TestCase
+{
+
+ private static final Logger _logger = Logger.getLogger(JMSDestinationTest.class);
+
+ public String _connectionString = "vm://:1";
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ TransportConnection.createVMBroker(1);
+ }
+
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ TransportConnection.killAllVMBrokers();
+ }
+
+ public void testJMSDestination() throws Exception
+ {
+ Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
+ AMQSession consumerSession = (AMQSession) con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+ Queue queue = new AMQQueue("someQ", "someQ", false, true);
+ MessageConsumer consumer = consumerSession.createConsumer(queue);
+
+ Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "producer1", "/test");
+ Session producerSession = con2.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+ MessageProducer producer = producerSession.createProducer(queue);
+
+ TextMessage sentMsg = producerSession.createTextMessage("hello");
+ assertNull(sentMsg.getJMSDestination());
+
+ producer.send(sentMsg);
+
+ assertEquals(sentMsg.getJMSDestination(), queue);
+
+ con2.close();
+
+ con.start();
+
+ TextMessage rm = (TextMessage) consumer.receive();
+ assertNotNull(rm);
+
+ assertEquals(rm.getJMSDestination(),queue);
+ con.close();
+ }
+
+}
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/message/StreamMessageTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/message/StreamMessageTest.java
index 315ba6ae4c..83969822c4 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/message/StreamMessageTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/message/StreamMessageTest.java
@@ -89,10 +89,10 @@ public class StreamMessageTest extends TestCase
StreamMessage msg2 = (StreamMessage) consumer.receive();
- byte b1 = msg2.readByte();
+ msg2.readByte();
try
{
- byte b2 = msg2.readByte();
+ msg2.readByte();
}
catch (Exception e)
{
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java
index 09ec66494a..8263e7f126 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java
@@ -21,8 +21,6 @@
package org.apache.qpid.test.unit.topic;
import org.apache.qpid.AMQException;
-import org.apache.qpid.testutil.VMBrokerSetup;
-import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
import org.apache.qpid.url.URLSyntaxException;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQSession;
@@ -41,6 +39,19 @@ import junit.framework.TestCase;
public class DurableSubscriptionTest extends TestCase
{
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ TransportConnection.createVMBroker(1);
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ TransportConnection.killAllVMBrokers();
+ }
+
public void testUnsubscribe() throws AMQException, JMSException, URLSyntaxException
{
AMQTopic topic = new AMQTopic("MyTopic");
@@ -130,6 +141,6 @@ public class DurableSubscriptionTest extends TestCase
public static junit.framework.Test suite()
{
- return new VMBrokerSetup(new junit.framework.TestSuite(DurableSubscriptionTest.class));
+ return new junit.framework.TestSuite(DurableSubscriptionTest.class);
}
}
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/topic/TopicSessionTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/topic/TopicSessionTest.java
index 14ceaa75f1..794316d2f5 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/topic/TopicSessionTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/topic/TopicSessionTest.java
@@ -260,7 +260,7 @@ public class TopicSessionTest extends TestCase
TopicSession session2 = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
try
{
- MessageConsumer consumer2 = session2.createConsumer(topic);
+ session2.createConsumer(topic);
fail("Expected a JMSException when subscribing to a temporary topic created on adifferent session");
}
catch (JMSException je)
diff --git a/java/common/src/main/java/org/apache/qpid/url/BindingURL.java b/java/common/src/main/java/org/apache/qpid/url/BindingURL.java
index 0a95e13e73..76690b3230 100644
--- a/java/common/src/main/java/org/apache/qpid/url/BindingURL.java
+++ b/java/common/src/main/java/org/apache/qpid/url/BindingURL.java
@@ -20,8 +20,6 @@
*/
package org.apache.qpid.url;
-import java.util.List;
-
/*
Binding URL format:
<exch_class>://<exch_name>/[<destination>]/[<queue>]?<option>='<value>'[,<option>='<value>']*
diff --git a/java/common/src/main/xsl/java.xsl b/java/common/src/main/xsl/java.xsl
index 685a9a27ed..948415fc18 100644
--- a/java/common/src/main/xsl/java.xsl
+++ b/java/common/src/main/xsl/java.xsl
@@ -66,8 +66,6 @@ import org.apache.qpid.framing.AMQFrame;
import org.apache.qpid.framing.AMQFrameDecodingException;
import org.apache.qpid.framing.AMQMethodBody;
import org.apache.qpid.framing.EncodableAMQDataBlock;
-import org.apache.qpid.framing.EncodingUtils;
-import org.apache.qpid.framing.FieldTable;
/**
* This class is autogenerated, do not modify. [From <xsl:value-of select="$f/parent::frames/@protocol"/>]
diff --git a/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java b/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java
index 865735499b..9cad31766b 100644
--- a/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java
+++ b/java/common/src/test/java/org/apache/qpid/framing/JMSPropertyFieldTableTest.java
@@ -24,11 +24,7 @@ import junit.framework.Assert;
import junit.framework.TestCase;
import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.HashMap;
-import org.apache.mina.common.ByteBuffer;
import org.apache.log4j.Logger;
import javax.jms.JMSException;
diff --git a/java/management/eclipse-plugin/plugins/com.ibm.icu_3.4.4.1.jar b/java/management/eclipse-plugin/plugins/com.ibm.icu_3.4.4.1.jar
deleted file mode 100644
index c33f004a95..0000000000
--- a/java/management/eclipse-plugin/plugins/com.ibm.icu_3.4.4.1.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/license.eclipse.txt b/java/management/eclipse-plugin/plugins/license.eclipse.txt
deleted file mode 100644
index da433e89f9..0000000000
--- a/java/management/eclipse-plugin/plugins/license.eclipse.txt
+++ /dev/null
@@ -1,88 +0,0 @@
-Eclipse Public License - v 1.0
-
-THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
-
-1. DEFINITIONS
-
-"Contribution" means:
-
-a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
-b) in the case of each subsequent Contributor:
-
-i) changes to the Program, and
-
-ii) additions to the Program;
-
-where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
-
-"Contributor" means any person or entity that distributes the Program.
-
-"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
-
-"Program" means the Contributions distributed in accordance with this Agreement.
-
-"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
-
-2. GRANT OF RIGHTS
-
-a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
-
-b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
-
-c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
-
-d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
-
-3. REQUIREMENTS
-
-A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
-
-a) it complies with the terms and conditions of this Agreement; and
-
-b) its license agreement:
-
-i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
-
-ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
-
-iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
-
-iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
-
-When the Program is made available in source code form:
-
-a) it must be made available under this Agreement; and
-
-b) a copy of this Agreement must be included with each copy of the Program.
-
-Contributors may not remove or alter any copyright notices contained within the Program.
-
-Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
-
-4. COMMERCIAL DISTRIBUTION
-
-Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
-
-For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
-
-5. NO WARRANTY
-
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
-
-6. DISCLAIMER OF LIABILITY
-
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-7. GENERAL
-
-If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
-
-If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
-
-All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
-
-Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
-
-This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
-
-
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.core.commands_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.core.commands_3.2.0.jar
deleted file mode 100644
index 215f09bf12..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.core.commands_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.core.contenttype_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.core.contenttype_3.2.0.jar
deleted file mode 100644
index f7f8e93d22..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.core.contenttype_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.core.expressions_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.core.expressions_3.2.0.jar
deleted file mode 100644
index 9672474250..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.core.expressions_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.core.jobs_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.core.jobs_3.2.0.jar
deleted file mode 100644
index 63ae34b87b..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.core.jobs_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.core.runtime.compatibility.auth_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.core.runtime.compatibility.auth_3.2.0.jar
deleted file mode 100644
index 9e1a33cfa9..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.core.runtime.compatibility.auth_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0/META-INF/MANIFEST.MF b/java/management/eclipse-plugin/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0/META-INF/MANIFEST.MF
deleted file mode 100644
index 0e8c61f1b7..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,12 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: %fragmentName
-Bundle-ClassPath: runtime_registry_compatibility.jar
-Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,J2SE-1.3
-Eclipse-PatchFragment: true
-Bundle-Vendor: %providerName
-Bundle-ManifestVersion: 2
-Fragment-Host: org.eclipse.equinox.registry
-Bundle-Localization: fragment
-Bundle-SymbolicName: org.eclipse.core.runtime.compatibility.registry
-Bundle-Version: 3.2.0.v20060603
-
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0/runtime_registry_compatibility.jar b/java/management/eclipse-plugin/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0/runtime_registry_compatibility.jar
deleted file mode 100644
index aae3e74ad7..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0/runtime_registry_compatibility.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.core.runtime_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.core.runtime_3.2.0.jar
deleted file mode 100644
index 3834c9802c..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.core.runtime_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.equinox.common_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.equinox.common_3.2.0.jar
deleted file mode 100644
index ee0e7865c2..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.equinox.common_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.equinox.preferences_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.equinox.preferences_3.2.0.jar
deleted file mode 100644
index 32f8e048dc..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.equinox.preferences_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.equinox.registry_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.equinox.registry_3.2.0.jar
deleted file mode 100644
index 1fe65676d5..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.equinox.registry_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.help_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.help_3.2.0.jar
deleted file mode 100644
index 809be21af0..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.help_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.jface_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.jface_3.2.0.jar
deleted file mode 100644
index 5c7509b07e..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.jface_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.osgi_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.osgi_3.2.0.jar
deleted file mode 100644
index 5f86e420d6..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.osgi_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.swt.win32.win32.x86_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.swt.win32.win32.x86_3.2.0.jar
deleted file mode 100644
index 392713689c..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.swt.win32.win32.x86_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.swt_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.swt_3.2.0.jar
deleted file mode 100644
index 7e1dbb85da..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.swt_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.ui.forms_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.ui.forms_3.2.0.jar
deleted file mode 100644
index 9c1bee69f4..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.ui.forms_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.ui.workbench.compatibility_3.2.0/META-INF/MANIFEST.MF b/java/management/eclipse-plugin/plugins/org.eclipse.ui.workbench.compatibility_3.2.0/META-INF/MANIFEST.MF
deleted file mode 100644
index 04a1db7c85..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.ui.workbench.compatibility_3.2.0/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,12 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: %fragmentName
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
-Bundle-Vendor: %providerName
-Bundle-ManifestVersion: 2
-Fragment-Host: org.eclipse.ui.workbench;bundle-version="[3.0.0,4.0.0)"
-Bundle-Localization: fragment-compatibility
-Bundle-SymbolicName: org.eclipse.ui.workbench.compatibility
-Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.
- 0)"
-Bundle-Version: 3.2.0.I20060605-1400
-
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.ui.workbench.compatibility_3.2.0/compatibility.jar b/java/management/eclipse-plugin/plugins/org.eclipse.ui.workbench.compatibility_3.2.0/compatibility.jar
deleted file mode 100644
index 13682c5d36..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.ui.workbench.compatibility_3.2.0/compatibility.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.ui.workbench_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.ui.workbench_3.2.0.jar
deleted file mode 100644
index 40e7d55f58..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.ui.workbench_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/plugins/org.eclipse.ui_3.2.0.jar b/java/management/eclipse-plugin/plugins/org.eclipse.ui_3.2.0.jar
deleted file mode 100644
index 5821d85bac..0000000000
--- a/java/management/eclipse-plugin/plugins/org.eclipse.ui_3.2.0.jar
+++ /dev/null
Binary files differ
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
index e7cd7f4671..adb20b1cd9 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
@@ -36,11 +36,12 @@ public class Constants
public final static String MBEAN = "mbean";
public final static String ATTRIBUTES = "Attributes";
public final static String NOTIFICATION = "Notifications";
+ public final static String RESULT = "Result";
public final static String ALL = "All";
public final static String NAVIGATION_ROOT = "Qpid Connections";
- public final static String DESCRIPTION = " Description : ";
+ public final static String DESCRIPTION = " Description";
public final static String BROKER_MANAGER = "Broker_Manager";
public final static String QUEUE = "Queue";
@@ -76,6 +77,8 @@ public class Constants
public final static String BUTTON_CLEAR = "Clear";
public final static String BUTTON_CONNECT = "Connect";
public final static String BUTTON_CANCEL = "Cancel";
+ public final static String BUTTON_UPDATE = "Update";
+
public final static int OPERATION_IMPACT_INFO = 0;
public final static int OPERATION_IMPACT_ACTION = 1;
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
index 04890e4e63..7a5217d58a 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
@@ -39,6 +39,7 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
@@ -80,6 +81,10 @@ import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormToolkit;
+/**
+ * Creates controller composite for the attribute's tab.
+ * @author Bhupendra Bhardwaj
+ */
public class AttributesTabControl extends TabControl
{
private FormToolkit _toolkit;
@@ -87,10 +92,11 @@ public class AttributesTabControl extends TabControl
private Table _table = null;
private TableViewer _tableViewer = null;
private static final int[] tableWidths = new int[] {300, 300};
- private static final String DESCRIPTION = "Description";
- private static final String UPDATE_BUTTON = "Update";
private final String[] _tableTitles = {"Attribute Name", "Value"};
+ private Composite _tableComposite = null;
+ private Composite _buttonsComposite = null;
+
private DisposeListener tableDisposeListener = new DisposeListenerImpl();
final Image image;
private Button _detailsButton = null;
@@ -107,8 +113,6 @@ public class AttributesTabControl extends TabControl
private int startX = 80;
private int startY = 60;
- static int number = 0;
-
public AttributesTabControl(TabFolder tabFolder)
{
super(tabFolder);
@@ -118,16 +122,28 @@ public class AttributesTabControl extends TabControl
gridLayout.marginWidth = 0;
gridLayout.marginHeight = 0;
_form.getBody().setLayout(gridLayout);
+ _tableComposite = _toolkit.createComposite(_form.getBody());
+ _tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ _tableComposite.setLayout(new GridLayout());
+ _buttonsComposite = _toolkit.createComposite(_form.getBody());
+ _tableComposite.setLayoutData(new GridData());
+ _buttonsComposite.setLayout(new GridLayout());
image = Display.getCurrent().getSystemImage(SWT.ICON_INFORMATION);
createWidgets();
}
+ /**
+ * @see TabControl#getControl()
+ */
public Control getControl()
{
return _form;
}
+ /**
+ * Creates required widgets for Attribute's tab
+ */
protected void createWidgets()
{
createTable();
@@ -136,10 +152,13 @@ public class AttributesTabControl extends TabControl
addTableListeners();
}
+ /**
+ * Creates table for listing the MBean attributes
+ */
private void createTable()
- {
- _table = _toolkit.createTable(_form.getBody(), SWT.FULL_SELECTION);
- GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 6);
+ {
+ _table = _toolkit.createTable(_tableComposite, SWT.FULL_SELECTION);
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
_table.setLayoutData(gridData);
for (int i = 0; i < _tableTitles.length; ++i)
@@ -154,35 +173,18 @@ public class AttributesTabControl extends TabControl
_table.setHeaderVisible (true);
}
+ /**
+ * Creates tableviewer for the attribute's table
+ *
+ */
private void createTableViewer()
{
_tableViewer = new TableViewer(_table);
_tableViewer.setUseHashlookup(true);
- //_tableViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 6));
-
- // Set the column properties that will be used in callbacks to recognize
- // the column on which we will want to operate
_tableViewer.setColumnProperties(_tableTitles);
- /*
- // Create the cell editors
- CellEditor[] cellEditors = new CellEditor[_tableTitles.length];
-
-
- TextCellEditor textEditor = new TextCellEditor(_table);
- cellEditors[0] = textEditor;
- textEditor = new TextCellEditor(_table);
- cellEditors[1] = textEditor;
-
- // Assign the cell editors to the viewer
- _tableViewer.setCellEditors(cellEditors);
- _tableViewer.setCellModifier(new TableCellModifier());
- */
-
-
-
_tableViewer.setContentProvider(new ContentProviderImpl());
_tableViewer.setLabelProvider(new LabelProviderImpl());
-
+ _tableViewer.setSorter(new ViewerSorterImpl());
}
private void createButtons()
@@ -192,17 +194,13 @@ public class AttributesTabControl extends TabControl
addGraphButton();
addRefreshButton();
}
-
-
+
private void addDetailsButton()
{
// Create and configure the button for attribute details
- _detailsButton = _toolkit.createButton(_form.getBody(),
- Constants.BUTTON_DETAILS,
- SWT.PUSH | SWT.CENTER);
-
+ _detailsButton = _toolkit.createButton(_buttonsComposite, Constants.BUTTON_DETAILS, SWT.PUSH | SWT.CENTER);
_detailsButton.setFont(ApplicationRegistry.getFont(Constants.FONT_BUTTON));
- GridData gridData = new GridData(SWT.BEGINNING, SWT.TOP, true, false);
+ GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
gridData.widthHint = 80;
_detailsButton.setLayoutData(gridData);
_detailsButton.addSelectionListener(new SelectionAdapter()
@@ -219,14 +217,15 @@ public class AttributesTabControl extends TabControl
});
}
+ /**
+ * Creates the button for editing attributes.
+ */
private void addEditButton()
{
// Create and configure the button for editing attribute
- _editButton = _toolkit.createButton(_form.getBody(),
- Constants.BUTTON_EDIT_ATTRIBUTE,
- SWT.PUSH | SWT.CENTER);
+ _editButton = _toolkit.createButton(_buttonsComposite, Constants.BUTTON_EDIT_ATTRIBUTE, SWT.PUSH | SWT.CENTER);
_editButton.setFont(ApplicationRegistry.getFont(Constants.FONT_BUTTON));
- GridData gridData = new GridData(SWT.BEGINNING, SWT.TOP, true, false);
+ GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
gridData.widthHint = 80;
_editButton.setLayoutData(gridData);
_editButton.addSelectionListener(new SelectionAdapter()
@@ -241,13 +240,14 @@ public class AttributesTabControl extends TabControl
});
}
+ /**
+ * Creates the button for viewing Graphs
+ */
private void addGraphButton()
{
- _graphButton = _toolkit.createButton(_form.getBody(),
- Constants.BUTTON_GRAPH,
- SWT.PUSH | SWT.CENTER);
+ _graphButton = _toolkit.createButton(_buttonsComposite, Constants.BUTTON_GRAPH, SWT.PUSH | SWT.CENTER);
_graphButton.setFont(ApplicationRegistry.getFont(Constants.FONT_BUTTON));
- GridData gridData = new GridData(SWT.BEGINNING, SWT.TOP, true, false);
+ GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
gridData.widthHint = 80;
_graphButton.setLayoutData(gridData);
_graphButton.addSelectionListener(new SelectionAdapter()
@@ -262,15 +262,15 @@ public class AttributesTabControl extends TabControl
});
}
+ /**
+ * Creates the "Refresh" button
+ */
private void addRefreshButton()
{
- // Create and configure the "Refresh" button
- _refreshButton = _toolkit.createButton(_form.getBody(),
- Constants.BUTTON_REFRESH,
- SWT.PUSH | SWT.CENTER);
+ _refreshButton = _toolkit.createButton(_buttonsComposite, Constants.BUTTON_REFRESH, SWT.PUSH | SWT.CENTER);
_refreshButton.setFont(ApplicationRegistry.getFont(Constants.FONT_BUTTON));
- GridData gridData = new GridData(SWT.BEGINNING, SWT.TOP, true, false);
+ GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
gridData.widthHint = 80;
_refreshButton.setLayoutData(gridData);
_refreshButton.addSelectionListener(new SelectionAdapter()
@@ -314,25 +314,14 @@ public class AttributesTabControl extends TabControl
{
event.height = event.gc.getFontMetrics().getHeight() * 3/2;
}
- });
-
- // Below to be worked on to set an image in front of each row.
- /*
- _table.addListener(SWT.PaintItem, new Listener() {
- public void handleEvent(Event event)
- {
- int x = event.x + event.width;
- Rectangle rect = image.getBounds();
- int offset = Math.max(0, (event.height - rect.height) / 2);
- event.gc.drawImage(image, event.x, event.y + offset);
- }
- });
- */
+ });
}
- private class MouseListenerImpl implements MouseTrackListener, MouseMoveListener,
- KeyListener, MouseListener
-
+ /**
+ * Listeners implementation class for showing table tooltip
+ * @author Bhupendra Bhardwaj
+ */
+ private class MouseListenerImpl implements MouseTrackListener, MouseMoveListener, KeyListener, MouseListener
{
Shell tooltipShell = null;
Label tooltipLabel = null;
@@ -425,6 +414,10 @@ public class AttributesTabControl extends TabControl
}
} // end of MouseListenerImpl
+ /**
+ * Creates pop-up window for showing attribute details
+ * @param data - Selectes attribute
+ */
public void createDetailsPopup(AttributeData data)
{
int width = 500;
@@ -448,6 +441,9 @@ public class AttributesTabControl extends TabControl
shell.dispose();
}
+ /**
+ * Listener class for table tooltip label
+ */
final Listener tooltipLabelListener = new Listener ()
{
public void handleEvent (Event event)
@@ -471,6 +467,11 @@ public class AttributesTabControl extends TabControl
};
+ /**
+ * Create the contents for the attribute details window pop-up
+ * @param shell - The shell that will be filled with details.
+ * @param attribute - Selected attribute
+ */
private void createDetailsPopupContents(Composite shell, AttributeData attribute)
{
GridLayout layout = new GridLayout(2, false);
@@ -495,7 +496,7 @@ public class AttributesTabControl extends TabControl
// Description
label = new Label(parent, SWT.NONE);
- label.setText(DESCRIPTION);
+ label.setText(Constants.DESCRIPTION);
label.setLayoutData(new GridData(SWT.TRAIL, SWT.TOP, false, false));
value = new Text(parent, SWT.BEGINNING | SWT.BORDER | SWT.READ_ONLY);
value.setText(attribute.getDescription());
@@ -576,13 +577,16 @@ public class AttributesTabControl extends TabControl
}
}
+ /**
+ * Create the button for updating attributes. This should be enabled for writable attribute
+ */
private Button addUpdateButton(Composite parent)
{
final Button updateButton = new Button(parent, SWT.PUSH | SWT.CENTER);
// set the data to access in the listener
- parent.setData(UPDATE_BUTTON, updateButton);
+ parent.setData(Constants.BUTTON_UPDATE, updateButton);
- updateButton.setText(UPDATE_BUTTON);
+ updateButton.setText(Constants.BUTTON_UPDATE);
GridData gridData = new GridData (SWT.CENTER, SWT.BOTTOM, true, true, 2, 1);
gridData.widthHint = 100;
updateButton.setLayoutData(gridData);
@@ -617,7 +621,9 @@ public class AttributesTabControl extends TabControl
_tableViewer.setInput(attributesList);
}
- // Refreshes the attribute tab by querying the mbean server for latest values
+ /**
+ * Refreshes the attribute tab by querying the mbean server for latest values
+ */
@Override
public void refresh(ManagedBean mbean)
{
@@ -637,18 +643,23 @@ public class AttributesTabControl extends TabControl
MBeanUtility.handleException(_mbean, ex);
}
_tableViewer.setInput(attributesList);
- _table.setItemCount(attributesList.getCount());
-
- // No attribtue selected when refreshing the tab
- checkForEnablingButtons(null);
+ checkForEnablingButtons(getSelectionAttribute());
_form.layout();
}
+ /**
+ * @see TabControl#setFocus()
+ */
public void setFocus()
{
_table.setFocus();
}
+ /**
+ * Checks which buttons are to be enabled or disabled. The graph button will be enabled only
+ * for readable number attributes. Editing is enabled for writeable attribtues.
+ * @param attribute
+ */
private void checkForEnablingButtons(AttributeData attribute)
{
if (attribute == null)
@@ -681,6 +692,10 @@ public class AttributesTabControl extends TabControl
}
}
+ /**
+ * Creates graph in a pop-up window for given attribute.
+ * @param data
+ */
private void createGraph(final AttributeData data)
{
Display display = Display.getCurrent();
@@ -769,8 +784,10 @@ public class AttributesTabControl extends TabControl
// Launch the timer
display.timerExec(Constants.TIMER_INTERVAL, runnable);
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) {
+ while (!shell.isDisposed())
+ {
+ if (!display.readAndDispatch())
+ {
display.sleep();
}
}
@@ -780,6 +797,9 @@ public class AttributesTabControl extends TabControl
shell.dispose();
}
+ /**
+ * @return selected attribute in the table
+ */
public AttributeData getSelectionAttribute()
{
int index = _table.getSelectionIndex();
@@ -789,6 +809,12 @@ public class AttributesTabControl extends TabControl
return (AttributeData)_table.getItem(index).getData();
}
+ /**
+ * checks for newer values of selected attribute to update the graph
+ * @param canvas
+ * @param data
+ * @throws Exception
+ */
private void animate(Canvas canvas, AttributeData data) throws Exception
{
String attribute = data.getName();
@@ -813,6 +839,10 @@ public class AttributesTabControl extends TabControl
canvas.redraw();
}
+ /**
+ * @param maxAttributeValue
+ * @return dynamically calculated value for y-axis on the graph
+ */
private long getGraphMaxValue(long maxAttributeValue)
{
long maxGraphValue = 100;
@@ -826,6 +856,10 @@ public class AttributesTabControl extends TabControl
return maxGraphValue;
}
+ /**
+ * Content Provider class for the table viewer
+ * @author Bhupendra Bhardwaj
+ */
private class ContentProviderImpl implements IStructuredContentProvider
{
@@ -845,11 +879,14 @@ public class AttributesTabControl extends TabControl
}
}
+ /**
+ * Label Provider class for the table viewer
+ * @author Bhupendra Bhardwaj
+ */
private class LabelProviderImpl extends LabelProvider implements ITableLabelProvider,
IFontProvider,
IColorProvider
{
-
AttributeData attribute = null;
public String getColumnText(Object element, int columnIndex)
{
@@ -903,58 +940,20 @@ public class AttributesTabControl extends TabControl
}
}
-
- /*
- class TableCellModifier implements ICellModifier
- {
-
- public boolean canModify(Object element, String property)
- {
- int columnIndex = Arrays.asList(_tableTitles).indexOf(property);
- if (columnIndex == 0)
- return false;
-
- return true;
- }
-
- public Object getValue(Object element, String property) {
- // Find the index of the column
- int columnIndex = Arrays.asList(_tableTitles).indexOf(property);
- Attribute attribute = (Attribute)element;
-
-
- Object result = null;
-
- switch (columnIndex)
- {
- case 0 : // attribute name column
- result = attribute.getName();
- break;
- case 1 : // attribute value column
- result = attribute.getValue();
- break;
- default :
- result = "";
- }
-
- return result;
- }
-
-
- public void modify(Object element, String property, Object value)
+ /**
+ * Sorter class for the table viewer. It sorts the table for according to attribute name.
+ * @author Bhupendra Bhardwaj
+ *
+ */
+ private class ViewerSorterImpl extends ViewerSorter
+ {
+ public int compare(Viewer viewer, Object o1, Object o2)
{
- // Find the index of the column
- int columnIndex = Arrays.asList(_tableTitles).indexOf(property);
+ AttributeData attribtue1 = (AttributeData)o1;
+ AttributeData attribtue2 = (AttributeData)o2;
- if (columnIndex == 1)
- {
- //TODO
- // update the attribute value and call the MBean setAttribute method
- // then refresh the attribute tab with new values
- }
+ return collator.compare(attribtue1.getName(), attribtue2.getName());
}
}
- */
-
} \ No newline at end of file
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java
index 063f80fd3f..4b044c2e13 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java
@@ -78,74 +78,6 @@ public class MBeanView extends ViewPart
IStructuredSelection ss = (IStructuredSelection) sel;
TreeObject node = (TreeObject)ss.getFirstElement();
showSelectedMBean(node);
- /*
- _mbean = null;
- setInvisible();
-
- if (node == null)
- {
- _form.setText("Qpid Management Console");
- return;
- }
-
- if (Constants.NOTIFICATION.equals(node.getType()))
- {
- _mbean = (ManagedBean)node.getParent().getManagedObject();
- }
- else if (Constants.MBEAN.equals(node.getType()))
- {
- _mbean = (ManagedBean)node.getManagedObject();
- }
- else
- {
- _form.setText("Qpid Management Console");
- return;
- }
-
- setFocus();
- try
- {
- MBeanUtility.getMBeanInfo(_mbean);
- }
- catch(Exception ex)
- {
- MBeanUtility.handleException(_mbean, ex);
- return;
- }
-
- TabFolder tabFolder = tabFolderMap.get(_mbean.getType());
- if (tabFolder == null)
- {
- tabFolder = createTabFolder();
- }
-
- String text = _mbean.getType();
- if (_mbean.getName() != null && _mbean.getName().length() != 0)
- {
- text = text + ": " + _mbean.getName();
- }
- _form.setText(text);
- int tabIndex = 0;
- if (Constants.NOTIFICATION.equals(node.getType()))
- {
- tabIndex = tabFolder.getItemCount() -1;
- }
-
- TabItem tab = tabFolder.getItem(tabIndex);
- // refreshTab(tab);
- // If folder is being set as visible after tab refresh, then the tab
- // doesn't have the focus.
-
- tabFolder.setSelection(tabIndex);
- refreshTab(tab);
- setVisible(tabFolder);
- _form.layout();
-
- // Set the focus on the first attribute in attributes table
- if (tab.getText().equals(Constants.ATTRIBUTES))
- {
- ((TabControl)tabFolder.getData(ATTRIBUTES_CONTROL)).setFocus();
- }*/
}
}
@@ -156,7 +88,7 @@ public class MBeanView extends ViewPart
if (node == null)
{
- _form.setText("Qpid Management Console");
+ _form.setText(Constants.APPLICATION_NAME);
return;
}
@@ -170,7 +102,7 @@ public class MBeanView extends ViewPart
}
else
{
- _form.setText("Qpid Management Console");
+ _form.setText(Constants.APPLICATION_NAME);
return;
}
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java
index c3f42f46aa..c1784d0bf1 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java
@@ -63,9 +63,8 @@ import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormToolkit;
/**
- *
+ * Creates control composite for Notifications tab
* @author Bhupendra Bhardwaj
- *
*/
public class NotificationsTabControl extends TabControl
{
@@ -124,11 +123,18 @@ public class NotificationsTabControl extends TabControl
createTableViewer();
}
+ /**
+ * @see TabControl#getControl()
+ */
public Control getControl()
{
return _form;
}
+ /**
+ * Creates composite and populates for displaying Notification Information (name, type, description)
+ * and creates buttons for subscribing or unsubscribing for notifications
+ */
private void createNotificationInfoComposite()
{
Composite composite = _toolkit.createComposite(_form.getBody(), SWT.NONE);
@@ -183,7 +189,7 @@ public class NotificationsTabControl extends TabControl
formData.top = new FormAttachment(notificationNameCombo, 5);
formData.left = new FormAttachment(0, 10);
fixedLabel.setLayoutData(formData);
- fixedLabel.setText(Constants.DESCRIPTION);
+ fixedLabel.setText(Constants.DESCRIPTION + " : ");
fixedLabel.setFont(ApplicationRegistry.getFont(Constants.FONT_BOLD));
descriptionLabel = _toolkit.createLabel(composite, "");
@@ -196,6 +202,9 @@ public class NotificationsTabControl extends TabControl
descriptionLabel.setFont(ApplicationRegistry.getFont(Constants.FONT_ITALIC));
}
+ /**
+ * Creates clear buttin and refresh button
+ */
private void addButtons()
{
Composite composite = _toolkit.createComposite(_form.getBody(), SWT.NONE);
@@ -239,6 +248,9 @@ public class NotificationsTabControl extends TabControl
});
}
+ /**
+ * Creates table to display notifications
+ */
private void createTable()
{
table = _toolkit.createTable(_form.getBody(), SWT.FULL_SELECTION);
@@ -264,6 +276,9 @@ public class NotificationsTabControl extends TabControl
table.setLinesVisible(true);
}
+ /**
+ * Creates JFace viewer for the notifications table
+ */
protected void createTableViewer()
{
createTable();
@@ -300,6 +315,9 @@ public class NotificationsTabControl extends TabControl
//viewerComposite.layout();
}
+ /**
+ * Adds listeners to the viewer for displaying notification details
+ */
private void addTableListeners()
{
_tableViewer.addDoubleClickListener(new IDoubleClickListener()
@@ -409,15 +427,6 @@ public class NotificationsTabControl extends TabControl
}
populateNotificationInfo();
- /*
- ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(_mbean);
- _notifications = serverRegistry.getNotifications(_mbean);
- if (_notifications != null)
- {
- _tableViewer.setInput(_notifications);
-
- }*/
- //_tableViewer.setInput(null);
workerRunning = true;
_form.layout();
}
@@ -428,6 +437,9 @@ public class NotificationsTabControl extends TabControl
_tableViewer.getTable().clearAll();
}
+ /**
+ * Fills the notification information widgets for selected mbean
+ */
private void populateNotificationInfo()
{
notificationNameCombo.removeAll();
@@ -448,6 +460,9 @@ public class NotificationsTabControl extends TabControl
checkForEnablingButtons();
}
+ /**
+ * Checks and the enabing/disabling of buttons
+ */
private void checkForEnablingButtons()
{
int nameIndex = notificationNameCombo.getSelectionIndex();
@@ -492,6 +507,9 @@ public class NotificationsTabControl extends TabControl
return true;
}
+ /**
+ * Selection listener for subscribing or unsubscribing the notifications
+ */
private class SelectionListenerImpl extends SelectionAdapter
{
public void widgetSelected(SelectionEvent e)
@@ -528,7 +546,10 @@ public class NotificationsTabControl extends TabControl
}
}
-
+ /**
+ * Selection listener class for the Notification Name. The notification type and description will be
+ * displayed accordingly
+ */
private class ComboSelectionListener extends SelectionAdapter
{
public void widgetSelected(SelectionEvent e)
@@ -559,6 +580,9 @@ public class NotificationsTabControl extends TabControl
}
}
+ /**
+ * Content provider class for the table viewer
+ */
private class ContentProviderImpl implements IStructuredContentProvider, INotificationViewer
{
public void inputChanged(Viewer v, Object oldInput, Object newInput)
@@ -584,6 +608,9 @@ public class NotificationsTabControl extends TabControl
}
}
+ /**
+ * Label provider for the table viewer
+ */
private class LabelProviderImpl implements ITableLabelProvider
{
List<ILabelProviderListener> listeners = new ArrayList<ILabelProviderListener>();
@@ -643,6 +670,9 @@ public class NotificationsTabControl extends TabControl
workerRunning = running;
}
+ /**
+ * Worker class which keeps looking if there are new notifications coming from server for the selected mbean
+ */
private class Worker implements Runnable
{
public void run()
@@ -684,6 +714,9 @@ public class NotificationsTabControl extends TabControl
}
}
+ /**
+ * Updates the table with new notifications received from mbean server for the selected mbean
+ */
private void updateTableViewer()
{
ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(_mbean);
@@ -691,16 +724,6 @@ public class NotificationsTabControl extends TabControl
if (newList == null)
return;
- /*
- int notificationCount = 0;
- if (_notifications != null)
- notificationCount = _notifications.size();
-
- for (int i = notificationCount; i < newList.size(); i++)
- {
- ((INotificationViewer)contentProvider).addNotification(newList.get(i));
- }*/
-
_notifications = newList;
_tableViewer.setInput(_notifications);
_tableViewer.refresh();
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
index c62f90353d..d951642736 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
@@ -66,7 +66,6 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
* Control class for the MBean operations tab. It creates the required widgets
* for the selected MBean.
* @author Bhupendra Bhardwaj
- *
*/
public class OperationTabControl extends TabControl
{
@@ -100,19 +99,28 @@ public class OperationTabControl extends TabControl
_toolkit = new FormToolkit(_tabFolder.getDisplay());
_form = _toolkit.createForm(_tabFolder);
_form.getBody().setLayout(new GridLayout());
-
- // Form area is devided in four parts:
- // Header composite - displays operaiton information
- // Patameters composite - displays parameters if there
- // Button - operation execution button
- // Results composite - displays results for operations, which have
- // no parameters but have some return value
+ }
+
+ /**
+ * Form area is devided in four parts:
+ * Header composite - displays operaiton information
+ * Patameters composite - displays parameters if there
+ * Button - operation execution button
+ * Results composite - displays results for operations, which have
+ * no parameters but have some return value
+ */
+ private void createComposites()
+ {
+ //
_headerComposite = _toolkit.createComposite(_form.getBody(), SWT.NONE);
_headerComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- _paramsComposite = _toolkit.createComposite(_form.getBody(), SWT.NONE);
- _paramsComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
+ List<ParameterData> params = _opData.getParameters();
+ if (params != null && !params.isEmpty())
+ {
+ _paramsComposite = _toolkit.createComposite(_form.getBody(), SWT.NONE);
+ _paramsComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ }
_executionButton = _toolkit.createButton(_form.getBody(), Constants.BUTTON_EXECUTE, SWT.PUSH | SWT.CENTER);
_executionButton.setFont(ApplicationRegistry.getFont(Constants.FONT_BUTTON));
GridData layoutData = new GridData(SWT.CENTER, SWT.TOP, true, false);
@@ -126,11 +134,15 @@ public class OperationTabControl extends TabControl
_resultsComposite.setLayout(new GridLayout());
}
+ /**
+ * @see TabControl#getControl()
+ */
public Control getControl()
{
return _form;
}
+ @Override
public void refresh(ManagedBean mbean)
{
_mbean = mbean;
@@ -138,6 +150,7 @@ public class OperationTabControl extends TabControl
_opData = serverRegistry.getOperationModel(mbean).getOperations().get(0);
refresh(_mbean, _opData);
}
+
public void refresh(ManagedBean mbean, OperationData opData)
{
_mbean = mbean;
@@ -148,13 +161,14 @@ public class OperationTabControl extends TabControl
// instead of having half the widgets displayed.
_form.setVisible(false);
- ViewUtility.disposeChildren(_headerComposite);
- ViewUtility.disposeChildren(_paramsComposite);
- ViewUtility.disposeChildren(_resultsComposite);
-
+ ViewUtility.disposeChildren(_form.getBody());
+ createComposites();
setHeader();
createParameterWidgets();
+ // Set button text and add appropriate listener to button.
+ // If there are no parameters and it is info operation, then operation gets executed
+ // and result is displayed
List<ParameterData> params = opData.getParameters();
if (params != null && !params.isEmpty())
{
@@ -174,12 +188,15 @@ public class OperationTabControl extends TabControl
_form.layout();
}
+ /**
+ * populates the header composite, containing the operation name and description.
+ */
private void setHeader()
{
_form.setText(ViewUtility.getDisplayText(_opData.getName()));
_headerComposite.setLayout(new GridLayout(2, false));
//operation description
- Label label = _toolkit.createLabel(_headerComposite, Constants.DESCRIPTION);
+ Label label = _toolkit.createLabel(_headerComposite, Constants.DESCRIPTION + " : ");
label.setFont(ApplicationRegistry.getFont(Constants.FONT_BOLD));
label.setLayoutData(new GridData(SWT.LEAD, SWT.TOP, false, false));
@@ -190,6 +207,9 @@ public class OperationTabControl extends TabControl
_headerComposite.layout();
}
+ /**
+ * Creates the widgets for operation parameters if there are any
+ */
private void createParameterWidgets()
{
List<ParameterData> params = _opData.getParameters();
@@ -299,11 +319,12 @@ public class OperationTabControl extends TabControl
formData.left = new FormAttachment(valueNumerator, 5);
label.setLayoutData(formData);
}
-
- //_parametersHolder.setMinSize(_parametersComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- //_parametersComposite.layout();
}
+ /**
+ * Creates customized dispaly for a method "CreateNewBinding" for Headers exchange
+ *
+ */
private void customCreateNewBinding()
{
headerBindingHashMap = new HashMap<Text, Text>();
@@ -381,6 +402,12 @@ public class OperationTabControl extends TabControl
composite.layout();
}
+ /**
+ * Adds a row for adding a binding for Headers Exchange. Used by the method, which creates the customized
+ * layout and widgest for Header's exchange method createNewBinding.
+ * @param parent composite
+ * @param rowCount - row number
+ */
private void createARowForCreatingHeadersBinding(Composite parent, int rowCount)
{
Label key = _toolkit.createLabel(parent, "Name");
@@ -415,6 +442,10 @@ public class OperationTabControl extends TabControl
headerBindingHashMap.put(keyText, valueText);
}
+ /**
+ * Sets text and listener for the operation execution button
+ * @param text
+ */
private void setButton(String text)
{
_executionButton.setText(text);
@@ -431,12 +462,16 @@ public class OperationTabControl extends TabControl
}
}
+ /**
+ * displays the operation result in a pop-up window
+ * @param result
+ */
private void populateResults(Object result)
{
Display display = Display.getCurrent();
int width = 600;
int height = 400;
- Shell shell = ViewUtility.createPopupShell("Result", width, height);
+ Shell shell = ViewUtility.createPopupShell(Constants.RESULT, width, height);
populateResults(result, shell);
shell.open();
@@ -448,6 +483,11 @@ public class OperationTabControl extends TabControl
shell.dispose();
}
+ /**
+ * Displays the operation result
+ * @param result
+ * @param parent
+ */
private void populateResults(Object result, Composite parent)
{
if (result instanceof TabularDataSupport)
@@ -458,34 +498,11 @@ public class OperationTabControl extends TabControl
{
ViewUtility.populateCompositeDataHolder(parent, (CompositeDataSupport)result);
}
- }
+ }
/**
- * clears the parameter values entered.
- * @param opName
-
- private void clearParameterValues()
- {
- List<ParameterData> params = _opData.getParameters();
- if (params != null && !params.isEmpty())
- {
- for (ParameterData param : params)
- {
- param.setValue(null);
- }
-
- Control[] controls = _paramsComposite.getChildren();
-
- for (int i = 0; i < controls.length; i++)
- {
- if (controls[i] instanceof Combo)
- ((Combo)controls[i]).select(0);
- else if (controls[i] instanceof Text)
- ((Text)controls[i]).setText("");
- }
- }
- }*/
-
+ * Clears the parameter values of the operation
+ */
private void clearParameters()
{
List<ParameterData> params = _opData.getParameters();
@@ -498,6 +515,10 @@ public class OperationTabControl extends TabControl
}
}
+ /**
+ * Clears the values entered by the user from parameter value widgets
+ * @param control
+ */
private void clearParameterValues(Composite control)
{
Control[] controls = control.getChildren();
@@ -556,6 +577,7 @@ public class OperationTabControl extends TabControl
}
}
+ // Listener for the "Refresh" execution button
private class RefreshListener extends SelectionAdapter
{
public void widgetSelected(SelectionEvent e)
@@ -564,7 +586,9 @@ public class OperationTabControl extends TabControl
}
}
-
+ /**
+ * Executres the operation, gets the result from server and displays to the user
+ */
private void executeAndShowResults()
{
Object result = null;
@@ -578,6 +602,7 @@ public class OperationTabControl extends TabControl
return;
}
+ // Some mbeans have only "type" and no "name".
String title = _mbean.getType();
if (_mbean.getName() != null && _mbean.getName().length() != 0)
{
@@ -623,6 +648,9 @@ public class OperationTabControl extends TabControl
}
}
+ /**
+ * Listener class for boolean parameter widgets
+ */
private class BooleanSelectionListener extends SelectionAdapter
{
public void widgetSelected(SelectionEvent e)
@@ -652,6 +680,10 @@ public class OperationTabControl extends TabControl
}
}
+ /**
+ * Listener class for HeaderExchange's new binding widgets. Used when the new bindings are
+ * being created for Header's Exchange
+ */
private class HeaderBindingKeyListener extends KeyAdapter
{
public void keyReleased(KeyEvent e)
@@ -679,6 +711,9 @@ public class OperationTabControl extends TabControl
}
}
+ /**
+ * Listener class for verifying the user input with parameter type
+ */
private class VerifyListenerImpl implements VerifyListener
{
public void verifyText(VerifyEvent event)
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/TabControl.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/TabControl.java
index 4b89b7ca30..c8916044cb 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/TabControl.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/TabControl.java
@@ -25,6 +25,10 @@ import org.apache.qpid.management.ui.model.OperationData;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.TabFolder;
+/**
+ * Abstract class for all the control classes of tabs.
+ * @author Bhupendra Bhardwaj
+ */
public abstract class TabControl
{
protected ManagedBean _mbean = null;
@@ -35,21 +39,24 @@ public abstract class TabControl
_tabFolder = tabFolder;
}
+ /**
+ * @return controller composite for the tab
+ */
public Control getControl()
{
return null;
}
- public void refresh(ManagedBean mbean)
- {
-
- }
+ public abstract void refresh(ManagedBean mbean);
public void refresh(ManagedBean mbean, OperationData opData)
{
}
+ /**
+ * Sets focus on a widget
+ */
public void setFocus()
{
diff --git a/java/management/eclipse-plugin/src/main/resources/win32/configuration/org.eclipse.osgi/bundles/16/1/.cp/swt-win32-3232.dll b/java/management/eclipse-plugin/src/main/resources/win32/configuration/org.eclipse.osgi/bundles/16/1/.cp/swt-win32-3232.dll
deleted file mode 100644
index f028cec28d..0000000000
--- a/java/management/eclipse-plugin/src/main/resources/win32/configuration/org.eclipse.osgi/bundles/16/1/.cp/swt-win32-3232.dll
+++ /dev/null
Binary files differ
diff --git a/java/systests/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java b/java/systests/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java
index 6213a9d318..991a098678 100644
--- a/java/systests/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java
+++ b/java/systests/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java
@@ -58,6 +58,11 @@ public class AbstractHeadersExchangeTestBase extends TestCase
private int count;
+ public void testDoNothing()
+ {
+ // this is here only to make junit under Eclipse happy
+ }
+
protected TestQueue bindDefault(String... bindings) throws AMQException
{
return bind("Queue" + (++count), bindings);
diff --git a/java/systests/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java b/java/systests/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java
index c220442a78..c01241d11d 100644
--- a/java/systests/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java
+++ b/java/systests/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java
@@ -43,8 +43,6 @@ public class HeadersExchangeTest extends AbstractHeadersExchangeTestBase
TestQueue q6 = bindDefault("F0000=Aardvark", "F0001=Bear");
TestQueue q7 = bindDefault("F0000", "F0001=Bear");
TestQueue q8 = bindDefault("F0000=Aardvark", "F0001");
- TestQueue q9 = bindDefault("F0000=Apple", "F0001=Banana");
- TestQueue q10 = bindDefault("F0000=Apple", "F0001");
routeAndTest(new Message("Message1", "F0000"), q1);
routeAndTest(new Message("Message2", "F0000=Aardvark"), q1, q2);
@@ -74,7 +72,6 @@ public class HeadersExchangeTest extends AbstractHeadersExchangeTestBase
TestQueue q2 = bindDefault("F0000=Aardvark", "F0001=Bear", "X-match=any");
TestQueue q3 = bindDefault("F0000", "F0001=Bear", "X-match=any");
TestQueue q4 = bindDefault("F0000=Aardvark", "F0001", "X-match=any");
- TestQueue q5 = bindDefault("F0000=Apple", "F0001=Banana", "X-match=any");
TestQueue q6 = bindDefault("F0000=Apple", "F0001", "X-match=any");
routeAndTest(new Message("Message1", "F0000"), q1, q3);
@@ -87,16 +84,14 @@ public class HeadersExchangeTest extends AbstractHeadersExchangeTestBase
public void testMandatory() throws AMQException
{
- TestQueue q1 = bindDefault("F0000");
+ bindDefault("F0000");
Message m1 = new Message("Message1", "XXXXX");
Message m2 = new Message("Message2", "F0000");
BasicPublishBody pb1 = m1.getPublishBody();
pb1.mandatory = true;
- BasicPublishBody pb2 = m1.getPublishBody();
+ BasicPublishBody pb2 = m2.getPublishBody();
pb2.mandatory = true;
routeAndTest(m1,true);
-
-
}
public static junit.framework.Test suite()
diff --git a/java/systests/src/test/java/org/apache/qpid/server/exchange/ReturnUnroutableMandatoryMessageTest.java b/java/systests/src/test/java/org/apache/qpid/server/exchange/ReturnUnroutableMandatoryMessageTest.java
index 4dffe3e75f..ec6a82cc29 100644
--- a/java/systests/src/test/java/org/apache/qpid/server/exchange/ReturnUnroutableMandatoryMessageTest.java
+++ b/java/systests/src/test/java/org/apache/qpid/server/exchange/ReturnUnroutableMandatoryMessageTest.java
@@ -5,7 +5,6 @@ import org.apache.log4j.Logger;
import org.apache.qpid.test.VMBrokerSetup;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.util.TestApplicationRegistry;
-import org.apache.qpid.server.store.TestableMemoryMessageStore;
import org.apache.qpid.client.*;
import org.apache.qpid.url.AMQBindingURL;
import org.apache.qpid.url.BindingURL;
@@ -57,16 +56,12 @@ public class ReturnUnroutableMandatoryMessageTest extends TestCase implements Ex
_bouncedMessageList.clear();
Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
- TestableMemoryMessageStore store = (TestableMemoryMessageStore) ApplicationRegistry.getInstance().getMessageStore();
-
AMQSession consumerSession = (AMQSession) con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-
AMQHeadersExchange queue = new AMQHeadersExchange(new AMQBindingURL(ExchangeDefaults.HEADERS_EXCHANGE_CLASS+"://"+ExchangeDefaults.HEADERS_EXCHANGE_NAME+"/test/queue1?"+ BindingURL.OPTION_ROUTING_KEY+"='F0000=1'"));
FieldTable ft = new PropertyFieldTable();
ft.setString("F1000","1");
MessageConsumer consumer = consumerSession.createConsumer(queue, AMQSession.DEFAULT_PREFETCH_LOW_MARK, AMQSession.DEFAULT_PREFETCH_HIGH_MARK, false, false, (String)null, ft);
-
//force synch to ensure the consumer has resulted in a bound queue
((AMQSession) consumerSession).declareExchangeSynch(ExchangeDefaults.HEADERS_EXCHANGE_NAME, ExchangeDefaults.HEADERS_EXCHANGE_CLASS);
diff --git a/java/systests/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java b/java/systests/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java
new file mode 100644
index 0000000000..4fcc691a2f
--- /dev/null
+++ b/java/systests/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java
@@ -0,0 +1,185 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid.server.queue;
+
+import junit.framework.TestCase;
+import org.apache.qpid.AMQException;
+import org.apache.qpid.framing.BasicPublishBody;
+import org.apache.qpid.framing.ContentHeaderBody;
+import org.apache.qpid.server.AMQChannel;
+import org.apache.qpid.server.RequiredDeliveryException;
+import org.apache.qpid.server.txn.TransactionalContext;
+import org.apache.qpid.server.txn.NonTransactionalContext;
+import org.apache.qpid.server.store.MessageStore;
+import org.apache.qpid.server.store.SkeletonMessageStore;
+
+import javax.management.JMException;
+import java.util.LinkedList;
+
+/**
+ * Test class to test AMQQueueMBean attribtues and operations
+ */
+public class AMQQueueMBeanTest extends TestCase
+{
+ private AMQQueue _queue;
+ private AMQQueueMBean _queueMBean;
+ private QueueRegistry _queueRegistry;
+ private MessageStore _messageStore = new SkeletonMessageStore();
+ private TransactionalContext _transactionalContext = new NonTransactionalContext(_messageStore, null,
+ new LinkedList<RequiredDeliveryException>());
+ private MockProtocolSession _protocolSession;
+ private AMQChannel _channel;
+
+ public void testMessageCount() throws Exception
+ {
+ int messageCount = 10;
+ sendMessages(messageCount);
+ assertTrue(_queueMBean.getMessageCount() == messageCount);
+ assertTrue(_queueMBean.getReceivedMessageCount() == messageCount);
+ assertTrue(_queueMBean.getQueueDepth() == 10);
+
+ _queueMBean.deleteMessageFromTop();
+ assertTrue(_queueMBean.getMessageCount() == messageCount - 1);
+ assertTrue(_queueMBean.getReceivedMessageCount() == messageCount);
+
+ _queueMBean.clearQueue();
+ assertTrue(_queueMBean.getMessageCount() == 0);
+ assertTrue(_queueMBean.getReceivedMessageCount() == messageCount);
+ }
+
+ public void testConsumerCount() throws Exception
+ {
+ SubscriptionManager mgr = _queue.getSubscribers();
+ assertFalse(mgr.hasActiveSubscribers());
+ assertTrue(_queueMBean.getActiveConsumerCount() == 0);
+
+ _channel = new AMQChannel(1, _messageStore, null);
+ _protocolSession = new MockProtocolSession(_messageStore);
+ _protocolSession.addChannel(_channel);
+
+ _queue.registerProtocolSession(_protocolSession, 1, "test", false);
+ assertTrue(_queueMBean.getActiveConsumerCount() == 1);
+
+ SubscriptionSet _subscribers = (SubscriptionSet)mgr;
+ SubscriptionTestHelper s1 = new SubscriptionTestHelper("S1");
+ SubscriptionTestHelper s2 = new SubscriptionTestHelper("S2");
+ _subscribers.addSubscriber(s1);
+ _subscribers.addSubscriber(s2);
+ assertTrue(_queueMBean.getActiveConsumerCount() == 3);
+ assertTrue(_queueMBean.getConsumerCount() == 3);
+
+ s1.setSuspended(true);
+ assertTrue(_queueMBean.getActiveConsumerCount() == 2);
+ assertTrue(_queueMBean.getConsumerCount() == 3);
+ }
+
+ public void testGeneralProperties()
+ {
+ _queueMBean.setMaximumMessageCount(50000);
+ _queueMBean.setMaximumMessageSize(2000l);
+ _queueMBean.setMaximumQueueDepth(1000l);
+
+ assertTrue(_queueMBean.getMaximumMessageCount() == 50000);
+ assertTrue(_queueMBean.getMaximumMessageSize() == 2000);
+ assertTrue(_queueMBean.getMaximumQueueDepth() == 1000);
+
+ assertTrue(_queueMBean.getName().equals("testQueue"));
+ assertTrue(_queueMBean.getOwner().equals("AMQueueMBeanTest"));
+ assertFalse(_queueMBean.isAutoDelete());
+ assertFalse(_queueMBean.isDurable());
+ }
+
+ public void testExceptions() throws Exception
+ {
+ try
+ {
+ _queueMBean.viewMessages(0, 3);
+ fail();
+ }
+ catch (JMException ex)
+ {
+
+ }
+
+ try
+ {
+ _queueMBean.viewMessages(2, 1);
+ fail();
+ }
+ catch (JMException ex)
+ {
+
+ }
+
+ try
+ {
+ _queueMBean.viewMessages(-1, 1);
+ fail();
+ }
+ catch (JMException ex)
+ {
+
+ }
+
+ AMQMessage msg = message(false);
+ long id = msg.getMessageId();
+ _queue.clearQueue();
+ _queue.process(msg);
+ _queueMBean.viewMessageContent(id);
+ try
+ {
+ _queueMBean.viewMessageContent(id + 1);
+ fail();
+ }
+ catch (JMException ex)
+ {
+
+ }
+ }
+
+ private AMQMessage message(boolean immediate) throws AMQException
+ {
+ BasicPublishBody publish = new BasicPublishBody();
+ publish.immediate = immediate;
+ ContentHeaderBody contentHeaderBody = new ContentHeaderBody();
+ contentHeaderBody.bodySize = 1000; // in bytes
+ return new AMQMessage(_messageStore.getNewMessageId(), publish, _transactionalContext, contentHeaderBody);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ _queueRegistry = new DefaultQueueRegistry();
+ _queue = new AMQQueue("testQueue", false, "AMQueueMBeanTest", false, _queueRegistry);
+ _queueMBean = new AMQQueueMBean(_queue);
+ }
+
+ private void sendMessages(int messageCount) throws AMQException
+ {
+ AMQMessage[] messages = new AMQMessage[messageCount];
+ for (int i = 0; i < messages.length; i++)
+ {
+ messages[i] = message(false);;
+ }
+ for (int i = 0; i < messageCount; i++)
+ {
+ _queue.process(messages[i]);
+ }
+ }
+}
diff --git a/java/systests/src/test/java/org/apache/qpid/server/queue/SynchronizedDeliveryManagerTest.java b/java/systests/src/test/java/org/apache/qpid/server/queue/SynchronizedDeliveryManagerTest.java
index b49166d1ce..ebe8e192a0 100644
--- a/java/systests/src/test/java/org/apache/qpid/server/queue/SynchronizedDeliveryManagerTest.java
+++ b/java/systests/src/test/java/org/apache/qpid/server/queue/SynchronizedDeliveryManagerTest.java
@@ -23,7 +23,6 @@ package org.apache.qpid.server.queue;
import org.apache.qpid.server.queue.SynchronizedDeliveryManager;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.queue.DefaultQueueRegistry;
-import org.apache.qpid.server.queue.ConcurrentDeliveryManager;
import org.apache.qpid.server.queue.DeliveryManagerTest;
import org.apache.qpid.AMQException;