summaryrefslogtreecommitdiff
path: root/java/broker-plugins
diff options
context:
space:
mode:
authorRobert Godfrey <rgodfrey@apache.org>2010-01-31 00:31:49 +0000
committerRobert Godfrey <rgodfrey@apache.org>2010-01-31 00:31:49 +0000
commit2b8bb96fca71909d1dc185e1f62ee5fdaad02abd (patch)
tree919f0119bd3d23d97b497c5fa486121d4b5e286d /java/broker-plugins
parentf038a9ea62f563979678c2f1251d1eda82f1f20f (diff)
downloadqpid-python-2b8bb96fca71909d1dc185e1f62ee5fdaad02abd.tar.gz
QPID-2379 : Initial work on adding QMF and federation to the Java Broker
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@904934 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker-plugins')
-rw-r--r--java/broker-plugins/src/main/java/org/apache/qpid/extras/exchanges/diagnostic/DiagnosticExchange.java102
-rw-r--r--java/broker-plugins/src/main/java/org/apache/qpid/extras/exchanges/example/TestExchange.java129
2 files changed, 172 insertions, 59 deletions
diff --git a/java/broker-plugins/src/main/java/org/apache/qpid/extras/exchanges/diagnostic/DiagnosticExchange.java b/java/broker-plugins/src/main/java/org/apache/qpid/extras/exchanges/diagnostic/DiagnosticExchange.java
index 637997a947..b497f192d6 100644
--- a/java/broker-plugins/src/main/java/org/apache/qpid/extras/exchanges/diagnostic/DiagnosticExchange.java
+++ b/java/broker-plugins/src/main/java/org/apache/qpid/extras/exchanges/diagnostic/DiagnosticExchange.java
@@ -28,12 +28,17 @@ import javax.management.openmbean.OpenDataException;
import javax.management.openmbean.TabularData;
import org.apache.qpid.AMQException;
+import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.BasicContentHeaderProperties;
import org.apache.qpid.framing.FieldTable;
import org.apache.qpid.server.exchange.AbstractExchange;
+import org.apache.qpid.server.exchange.AbstractExchangeMBean;
+import org.apache.qpid.server.exchange.ExchangeType;
+import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.message.InboundMessage;
+import org.apache.qpid.server.binding.Binding;
+import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.junit.extensions.util.SizeOf;
import org.apache.qpid.management.common.mbeans.annotations.MBeanConstructor;
@@ -69,7 +74,7 @@ public class DiagnosticExchange extends AbstractExchange
* MBean class implementing the management interfaces.
*/
@MBeanDescription("Management Bean for Diagnostic Exchange")
- private final class DiagnosticExchangeMBean extends ExchangeMBean
+ private final class DiagnosticExchangeMBean extends AbstractExchangeMBean<DiagnosticExchange>
{
/**
@@ -80,8 +85,8 @@ public class DiagnosticExchange extends AbstractExchange
@MBeanConstructor("Creates an MBean for AMQ Diagnostic exchange")
public DiagnosticExchangeMBean() throws JMException
{
- super();
- _exchangeType = "diagnostic";
+ super(DiagnosticExchange.this);
+
init();
}
@@ -116,6 +121,42 @@ public class DiagnosticExchange extends AbstractExchange
} // End of MBean class
+
+ public static final ExchangeType<DiagnosticExchange> TYPE = new ExchangeType<DiagnosticExchange>()
+ {
+
+ public AMQShortString getName()
+ {
+ return DIAGNOSTIC_EXCHANGE_CLASS;
+ }
+
+ public Class<DiagnosticExchange> getExchangeClass()
+ {
+ return DiagnosticExchange.class;
+ }
+
+ public DiagnosticExchange newInstance(VirtualHost host,
+ AMQShortString name,
+ boolean durable,
+ int ticket,
+ boolean autoDelete) throws AMQException
+ {
+ DiagnosticExchange exch = new DiagnosticExchange();
+ exch.initialise(host,name,durable,ticket,autoDelete);
+ return exch;
+ }
+
+ public AMQShortString getDefaultExchangeName()
+ {
+ return DIAGNOSTIC_EXCHANGE_NAME ;
+ }
+ };
+
+ public DiagnosticExchange()
+ {
+ super(TYPE);
+ }
+
/**
* Creates a new MBean instance
*
@@ -123,7 +164,7 @@ public class DiagnosticExchange extends AbstractExchange
* @throws AMQException
* if something goes wrong
*/
- protected ExchangeMBean createMBean() throws JMException
+ protected AbstractExchangeMBean createMBean() throws JMException
{
return new DiagnosticExchange.DiagnosticExchangeMBean();
@@ -134,51 +175,12 @@ public class DiagnosticExchange extends AbstractExchange
return _logger;
}
- public AMQShortString getType()
- {
- return DIAGNOSTIC_EXCHANGE_CLASS;
- }
-
- /**
- * Does nothing.
- *
- * @param routingKey
- * pointless
- * @param queue
- * pointless
- * @param args
- * pointless
- * @throws AMQException
- * never
- */
- public void registerQueue(AMQShortString routingKey, AMQQueue queue, FieldTable args) throws AMQException
- {
- // No op
- }
-
public void registerQueue(String routingKey, AMQQueue queue, Map<String, Object> args) throws AMQException
{
// No op
}
- /**
- * Does nothing.
- *
- * @param routingKey
- * pointless
- * @param queue
- * pointless
- * @param args
- * pointless
- * @throws AMQException
- * never
- */
- public void deregisterQueue(AMQShortString routingKey, AMQQueue queue, FieldTable args) throws AMQException
- {
- // No op
- }
-
public boolean isBound(AMQShortString routingKey, AMQQueue queue)
{
return false;
@@ -199,7 +201,7 @@ public class DiagnosticExchange extends AbstractExchange
return false;
}
- public ArrayList<AMQQueue> route(InboundMessage payload)
+ public ArrayList<AMQQueue> doRoute(InboundMessage payload)
{
Long value = new Long(SizeOf.getUsedMemory());
@@ -224,4 +226,14 @@ public class DiagnosticExchange extends AbstractExchange
return false;
}
+
+ protected void onBind(final Binding binding)
+ {
+
+ }
+
+ protected void onUnbind(final Binding binding)
+ {
+
+ }
}
diff --git a/java/broker-plugins/src/main/java/org/apache/qpid/extras/exchanges/example/TestExchange.java b/java/broker-plugins/src/main/java/org/apache/qpid/extras/exchanges/example/TestExchange.java
index cb46b9c815..ace30b9b89 100644
--- a/java/broker-plugins/src/main/java/org/apache/qpid/extras/exchanges/example/TestExchange.java
+++ b/java/broker-plugins/src/main/java/org/apache/qpid/extras/exchanges/example/TestExchange.java
@@ -21,18 +21,25 @@ package org.apache.qpid.extras.exchanges.example;
*/
-import java.util.List;
-import java.util.Map;
-import java.util.ArrayList;
-
import org.apache.qpid.AMQException;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.framing.FieldTable;
+import org.apache.qpid.server.binding.Binding;
+import org.apache.qpid.server.configuration.ConfiguredObject;
+import org.apache.qpid.server.configuration.ExchangeConfigType;
+import org.apache.qpid.server.configuration.VirtualHostConfig;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.exchange.ExchangeReferrer;
+import org.apache.qpid.server.exchange.ExchangeType;
+import org.apache.qpid.server.message.InboundMessage;
import org.apache.qpid.server.queue.AMQQueue;
+import org.apache.qpid.server.queue.BaseQueue;
import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.message.InboundMessage;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+import java.util.UUID;
public class TestExchange implements Exchange
{
@@ -41,21 +48,24 @@ public class TestExchange implements Exchange
{
}
- public void deregisterQueue(AMQShortString routingKey, AMQQueue queue, FieldTable args) throws AMQException
+
+
+ public void addBindingListener(final BindingListener listener)
{
+ //To change body of implemented methods use File | Settings | File Templates.
}
- public Map<AMQShortString, List<AMQQueue>> getBindings()
+ public void removeBindingListener(final BindingListener listener)
{
- return null;
+ //To change body of implemented methods use File | Settings | File Templates.
}
- public AMQShortString getName()
+ public AMQShortString getNameShortString()
{
return null;
}
- public AMQShortString getType()
+ public AMQShortString getTypeShortString()
{
return null;
}
@@ -75,11 +85,61 @@ public class TestExchange implements Exchange
return false;
}
+ public void addCloseTask(final Task task)
+ {
+
+ }
+
+ public void removeCloseTask(final Task task)
+ {
+
+ }
+
public Exchange getAlternateExchange()
{
return null;
}
+ public Map<String, Object> getArguments()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public long getBindingCount()
+ {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public long getBindingCountHigh()
+ {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public long getMsgReceives()
+ {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public long getMsgRoutes()
+ {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public long getByteReceives()
+ {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public long getByteRoutes()
+ {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public long getCreateTime()
+ {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
public void setAlternateExchange(Exchange exchange)
{
@@ -100,11 +160,41 @@ public class TestExchange implements Exchange
return false;
}
+ public void addBinding(final Binding binding)
+ {
+
+ }
+
+ public void removeBinding(final Binding binding)
+ {
+
+ }
+
+ public Collection<Binding> getBindings()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
public void initialise(VirtualHost host, AMQShortString name, boolean durable, boolean autoDelete)
throws AMQException
{
}
+ public VirtualHostConfig getVirtualHost()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getName()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public ExchangeType getType()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
public boolean isAutoDelete()
{
return false;
@@ -130,16 +220,27 @@ public class TestExchange implements Exchange
return false;
}
- public boolean isDurable()
+ public UUID getId()
{
- return false;
+ return null; //To change body of implemented methods use File | Settings | File Templates.
}
- public void registerQueue(AMQShortString routingKey, AMQQueue queue, FieldTable args) throws AMQException
+ public ExchangeConfigType getConfigType()
{
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public ConfiguredObject getParent()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean isDurable()
+ {
+ return false;
}
- public ArrayList<AMQQueue> route(InboundMessage message)
+ public ArrayList<? extends BaseQueue> route(InboundMessage message)
{
return new ArrayList<AMQQueue>();
}