diff options
| author | Robert Godfrey <rgodfrey@apache.org> | 2012-08-29 10:32:08 +0000 |
|---|---|---|
| committer | Robert Godfrey <rgodfrey@apache.org> | 2012-08-29 10:32:08 +0000 |
| commit | eda280d1d2d647d9679ae4c357fed24fe0519005 (patch) | |
| tree | 87529dcbd8289c0e942b9a9c4af10d5e6bfba6c9 /qpid/java | |
| parent | a97ff60d98dacd87f54fca5e1c08ef71cae0eee8 (diff) | |
| download | qpid-python-eda280d1d2d647d9679ae4c357fed24fe0519005.tar.gz | |
QPID-4242 : [Java Broker] Remove QMFv1 implementation
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1378496 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
120 files changed, 306 insertions, 11302 deletions
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java index 9323111fdd..851038c6de 100644 --- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java +++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java @@ -54,13 +54,10 @@ import org.apache.qpid.AMQStoreException; import org.apache.qpid.framing.FieldTable; import org.apache.qpid.server.binding.Binding; import org.apache.qpid.server.exchange.Exchange; -import org.apache.qpid.server.federation.Bridge; -import org.apache.qpid.server.federation.BrokerLink; import org.apache.qpid.server.message.EnqueableMessage; import org.apache.qpid.server.queue.AMQQueue; import org.apache.qpid.server.store.*; import org.apache.qpid.server.store.ConfigurationRecoveryHandler.BindingRecoveryHandler; -import org.apache.qpid.server.store.ConfigurationRecoveryHandler.BrokerLinkRecoveryHandler; import org.apache.qpid.server.store.ConfigurationRecoveryHandler.ExchangeRecoveryHandler; import org.apache.qpid.server.store.ConfigurationRecoveryHandler.QueueRecoveryHandler; import org.apache.qpid.server.store.MessageStoreRecoveryHandler.StoredMessageRecoveryHandler; @@ -73,7 +70,6 @@ import org.apache.qpid.server.store.berkeleydb.tuple.ContentBinding; import org.apache.qpid.server.store.berkeleydb.tuple.MessageMetaDataBinding; import org.apache.qpid.server.store.berkeleydb.tuple.PreparedTransactionBinding; import org.apache.qpid.server.store.berkeleydb.tuple.QueueEntryBinding; -import org.apache.qpid.server.store.berkeleydb.tuple.StringMapBinding; import org.apache.qpid.server.store.berkeleydb.tuple.UUIDTupleBinding; import org.apache.qpid.server.store.berkeleydb.tuple.XidBinding; import org.apache.qpid.server.store.berkeleydb.upgrade.Upgrader; @@ -423,8 +419,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore BindingRecoveryHandler brh = qrh.completeQueueRecovery(); _configuredObjectHelper.recoverBindings(brh, configuredObjects); - BrokerLinkRecoveryHandler lrh = brh.completeBindingRecovery(); - recoverBrokerLinks(lrh); + brh.completeBindingRecovery(); } catch (DatabaseException e) { @@ -466,66 +461,6 @@ public abstract class AbstractBDBMessageStore implements MessageStore } } - private void recoverBrokerLinks(final ConfigurationRecoveryHandler.BrokerLinkRecoveryHandler lrh) - { - Cursor cursor = null; - - try - { - cursor = _linkDb.openCursor(null, null); - DatabaseEntry key = new DatabaseEntry(); - DatabaseEntry value = new DatabaseEntry(); - - while (cursor.getNext(key, value, LockMode.RMW) == OperationStatus.SUCCESS) - { - UUID id = UUIDTupleBinding.getInstance().entryToObject(key); - long createTime = LongBinding.entryToLong(value); - Map<String,String> arguments = StringMapBinding.getInstance().entryToObject(value); - - ConfigurationRecoveryHandler.BridgeRecoveryHandler brh = lrh.brokerLink(id, createTime, arguments); - - recoverBridges(brh, id); - } - } - finally - { - closeCursorSafely(cursor); - } - - } - - private void recoverBridges(final ConfigurationRecoveryHandler.BridgeRecoveryHandler brh, final UUID linkId) - { - Cursor cursor = null; - - try - { - cursor = _bridgeDb.openCursor(null, null); - DatabaseEntry key = new DatabaseEntry(); - DatabaseEntry value = new DatabaseEntry(); - - while (cursor.getNext(key, value, LockMode.RMW) == OperationStatus.SUCCESS) - { - UUID id = UUIDTupleBinding.getInstance().entryToObject(key); - - UUID parentId = UUIDTupleBinding.getInstance().entryToObject(value); - if(parentId.equals(linkId)) - { - - long createTime = LongBinding.entryToLong(value); - Map<String,String> arguments = StringMapBinding.getInstance().entryToObject(value); - brh.bridge(id,createTime,arguments); - } - } - brh.completeBridgeRecoveryForLink(); - } - finally - { - closeCursorSafely(cursor); - } - - } - private void recoverMessages(MessageStoreRecoveryHandler msrh) throws DatabaseException { @@ -940,89 +875,6 @@ public abstract class AbstractBDBMessageStore implements MessageStore } } - public void createBrokerLink(final BrokerLink link) throws AMQStoreException - { - if (_stateManager.isInState(State.ACTIVE)) - { - DatabaseEntry key = new DatabaseEntry(); - UUIDTupleBinding.getInstance().objectToEntry(link.getQMFId(), key); - - DatabaseEntry value = new DatabaseEntry(); - LongBinding.longToEntry(link.getCreateTime(), value); - StringMapBinding.getInstance().objectToEntry(link.getArguments(), value); - - try - { - _linkDb.put(null, key, value); - } - catch (DatabaseException e) - { - throw new AMQStoreException("Error writing Link " + link - + " to database: " + e.getMessage(), e); - } - } - } - - public void deleteBrokerLink(final BrokerLink link) throws AMQStoreException - { - DatabaseEntry key = new DatabaseEntry(); - UUIDTupleBinding.getInstance().objectToEntry(link.getQMFId(), key); - try - { - OperationStatus status = _linkDb.delete(null, key); - if (status == OperationStatus.NOTFOUND) - { - throw new AMQStoreException("Link " + link + " not found"); - } - } - catch (DatabaseException e) - { - throw new AMQStoreException("Error deleting the Link " + link + " from database: " + e.getMessage(), e); - } - } - - public void createBridge(final Bridge bridge) throws AMQStoreException - { - if (_stateManager.isInState(State.ACTIVE)) - { - DatabaseEntry key = new DatabaseEntry(); - UUIDTupleBinding.getInstance().objectToEntry(bridge.getQMFId(), key); - - DatabaseEntry value = new DatabaseEntry(); - UUIDTupleBinding.getInstance().objectToEntry(bridge.getLink().getQMFId(),value); - LongBinding.longToEntry(bridge.getCreateTime(),value); - StringMapBinding.getInstance().objectToEntry(bridge.getArguments(), value); - - try - { - _bridgeDb.put(null, key, value); - } - catch (DatabaseException e) - { - throw new AMQStoreException("Error writing Bridge " + bridge - + " to database: " + e.getMessage(), e); - } - - } - } - - public void deleteBridge(final Bridge bridge) throws AMQStoreException - { - DatabaseEntry key = new DatabaseEntry(); - UUIDTupleBinding.getInstance().objectToEntry(bridge.getQMFId(), key); - try - { - OperationStatus status = _bridgeDb.delete(null, key); - if (status == OperationStatus.NOTFOUND) - { - throw new AMQStoreException("Bridge " + bridge + " not found"); - } - } - catch (DatabaseException e) - { - throw new AMQStoreException("Error deleting the Bridge " + bridge + " from database: " + e.getMessage(), e); - } - } /** * Places a message onto a specified queue, in a given transaction. diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/Asserts.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/Asserts.java index 2595007574..d5df067178 100644 --- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/Asserts.java +++ b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/Asserts.java @@ -65,7 +65,7 @@ public class Asserts @SuppressWarnings("unchecked") Collection<String> exchangeTypes = (Collection<String>) virtualHost.get(VirtualHost.SUPPORTED_EXCHANGE_TYPES); assertEquals("Unexpected value of attribute " + VirtualHost.SUPPORTED_EXCHANGE_TYPES, - new HashSet<String>(Arrays.asList("headers", "topic", "direct", "fanout", "management")), + new HashSet<String>(Arrays.asList("headers", "topic", "direct", "fanout")), new HashSet<String>(exchangeTypes)); @SuppressWarnings("unchecked") diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ExchangeRestTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ExchangeRestTest.java index 363652d37c..7910c17b32 100644 --- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ExchangeRestTest.java +++ b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ExchangeRestTest.java @@ -44,7 +44,7 @@ public class ExchangeRestTest extends QpidRestTestCase { List<Map<String, Object>> exchanges = getRestTestHelper().getJsonAsList("/rest/exchange/test"); assertNotNull("Users cannot be null", exchanges); - assertEquals("Unexpected number of exchanges", 6, EXPECTED_EXCHANGES.length); + assertEquals("Unexpected number of exchanges", exchanges.size(), EXPECTED_EXCHANGES.length); for (String exchangeName : EXPECTED_EXCHANGES) { Map<String, Object> exchange = getRestTestHelper().find(Exchange.NAME, exchangeName, exchanges); diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/QpidRestTestCase.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/QpidRestTestCase.java index 958e68ab70..997a4053a5 100644 --- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/QpidRestTestCase.java +++ b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/QpidRestTestCase.java @@ -30,7 +30,7 @@ public class QpidRestTestCase extends QpidBrokerTestCase public static final String[] EXPECTED_HOSTS = { "development", "test", "localhost" }; public static final String[] EXPECTED_QUEUES = { "queue", "ping" }; public static final String[] EXPECTED_EXCHANGES = { "amq.fanout", "amq.match", "amq.direct", "amq.topic", - "qpid.management", "<<default>>" }; + "<<default>>" }; private RestTestHelper _restTestHelper = new RestTestHelper(findFreePort()); diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/QueueRestTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/QueueRestTest.java index d7732af688..bf57a2664f 100644 --- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/QueueRestTest.java +++ b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/QueueRestTest.java @@ -131,7 +131,7 @@ public class QueueRestTest extends QpidRestTestCase { String queueName = getTestQueueName(); String bindingName = queueName + 2; - String[] exchanges = { "amq.direct", "amq.fanout", "amq.topic", "amq.match", "qpid.management", "<<default>>" }; + String[] exchanges = { "amq.direct", "amq.fanout", "amq.topic", "amq.match", "<<default>>" }; for (int i = 0; i < exchanges.length; i++) { diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/VirtualHostRestTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/VirtualHostRestTest.java index 4bd936a948..9e4431f92d 100644 --- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/VirtualHostRestTest.java +++ b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/VirtualHostRestTest.java @@ -48,7 +48,7 @@ public class VirtualHostRestTest extends QpidRestTestCase { List<Map<String, Object>> hosts = getRestTestHelper().getJsonAsList("/rest/virtualhost/"); assertNotNull("Hosts data cannot be null", hosts); - assertEquals("Unexpected number of hosts", 3, hosts.size()); + assertEquals("Unexpected number of hosts", EXPECTED_HOSTS.length, hosts.size()); for (String hostName : EXPECTED_HOSTS) { Map<String, Object> host = getRestTestHelper().find("name", hostName, hosts); @@ -67,15 +67,14 @@ public class VirtualHostRestTest extends QpidRestTestCase @SuppressWarnings("unchecked") Map<String, Object> statistics = (Map<String, Object>) hostDetails.get(Asserts.STATISTICS_ATTRIBUTE); - assertEquals("Unexpected number of exchanges in statistics", 6, statistics.get(VirtualHost.EXCHANGE_COUNT)); - assertEquals("Unexpected number of queues in statistics", 2, statistics.get(VirtualHost.QUEUE_COUNT)); + assertEquals("Unexpected number of exchanges in statistics", EXPECTED_EXCHANGES.length, statistics.get(VirtualHost.EXCHANGE_COUNT)); + assertEquals("Unexpected number of queues in statistics", EXPECTED_QUEUES.length, statistics.get(VirtualHost.QUEUE_COUNT)); assertEquals("Unexpected number of connections in statistics", 1, statistics.get(VirtualHost.CONNECTION_COUNT)); @SuppressWarnings("unchecked") List<Map<String, Object>> exchanges = (List<Map<String, Object>>) hostDetails.get(VIRTUALHOST_EXCHANGES_ATTRIBUTE); - assertEquals("Unexpected number of exchanges", 6, exchanges.size()); + assertEquals("Unexpected number of exchanges", EXPECTED_EXCHANGES.length, exchanges.size()); Asserts.assertDurableExchange("amq.fanout", "fanout", getRestTestHelper().find(Exchange.NAME, "amq.fanout", exchanges)); - Asserts.assertDurableExchange("qpid.management", "management", getRestTestHelper().find(Exchange.NAME, "qpid.management", exchanges)); Asserts.assertDurableExchange("amq.topic", "topic", getRestTestHelper().find(Exchange.NAME, "amq.topic", exchanges)); Asserts.assertDurableExchange("amq.direct", "direct", getRestTestHelper().find(Exchange.NAME, "amq.direct", exchanges)); Asserts.assertDurableExchange("amq.match", "headers", getRestTestHelper().find(Exchange.NAME, "amq.match", exchanges)); @@ -83,7 +82,7 @@ public class VirtualHostRestTest extends QpidRestTestCase @SuppressWarnings("unchecked") List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VIRTUALHOST_QUEUES_ATTRIBUTE); - assertEquals("Unexpected number of queues", 2, queues.size()); + assertEquals("Unexpected number of queues", EXPECTED_QUEUES.length, queues.size()); Map<String, Object> queue = getRestTestHelper().find(Queue.NAME, "queue", queues); Map<String, Object> ping = getRestTestHelper().find(Queue.NAME, "ping", queues); Asserts.assertQueue("queue", "standard", queue); diff --git a/qpid/java/broker/build.xml b/qpid/java/broker/build.xml index 938066728e..42b544469c 100644 --- a/qpid/java/broker/build.xml +++ b/qpid/java/broker/build.xml @@ -28,23 +28,7 @@ <property name="output.dir" value="${module.precompiled}/org/apache/qpid/server/filter/jms/selector"/> - <property name="qmf.input.file" value="${project.root}/../specs/management-schema.xml"/> - <property name="qmf.xsl.file" value="${project.root}/broker/src/xsl/qmf.xsl"/> - <property name="qmf.output.dir" value="${module.precompiled}/org/apache/qpid/qmf/schema"/> - <property name="qmf.output.file" value="BrokerSchema.java"/> - - <target name="precompile" depends="gen_logging,gen_qmf"/> - - <target name="check_qmf_deps"> - <uptodate property="gen_qmf.notRequired" targetfile="${qmf.output.dir}/${qmf.output.file}"> - <srcfiles file="${qmf.input.file}"/> - <srcfiles file="${qmf.xsl.file}"/> - </uptodate> - </target> - - <target name="gen_qmf" depends="check_qmf_deps" unless="gen_qmf.notRequired"> - <xslt in="${qmf.input.file}" out="${qmf.output.dir}/${qmf.output.file}" style="${qmf.xsl.file}"/> - </target> + <target name="precompile" depends="gen_logging"/> <target name="copy-etc-release" if="module.etc.exists" description="copy etc directory if it exists to build tree"> <copy todir="${module.release}/etc" failonerror="false" flatten="true"> diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/CompletionCode.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/CompletionCode.java deleted file mode 100644 index 706ab3974a..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/CompletionCode.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * - * 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.qmf; - -public enum CompletionCode -{ - OK, - UNKNOWN_OBJECT, - UNKNOWN_METHOD, - NOT_IMPLEMENTED, - INVALID_PARAMETER, - FEATURE_NOT_IMPLEMENTED, - FORBIDDEN, - EXCEPTION, - UNKNOWN_PACKAGE, - UNKNOWN_CLASS; -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/ManagementExchange.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/ManagementExchange.java deleted file mode 100644 index 27ab580642..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/ManagementExchange.java +++ /dev/null @@ -1,586 +0,0 @@ -/* - * - * 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.qmf; - -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.ConfigStore; -import org.apache.qpid.server.configuration.ConfiguredObject; -import org.apache.qpid.server.configuration.ExchangeConfigType; -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.exchange.topic.TopicExchangeResult; -import org.apache.qpid.server.exchange.topic.TopicMatcherResult; -import org.apache.qpid.server.exchange.topic.TopicNormalizer; -import org.apache.qpid.server.exchange.topic.TopicParser; -import org.apache.qpid.server.message.InboundMessage; -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.model.UUIDGenerator; -import org.apache.qpid.server.queue.AMQQueue; -import org.apache.qpid.server.queue.BaseQueue; -import org.apache.qpid.server.virtualhost.HouseKeepingTask; -import org.apache.qpid.server.virtualhost.VirtualHost; - -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.CopyOnWriteArraySet; -import java.util.concurrent.atomic.AtomicLong; - -public class ManagementExchange implements Exchange, QMFService.Listener -{ - private static final AMQShortString QPID_MANAGEMENT = new AMQShortString("qpid.management"); - private static final AMQShortString QPID_MANAGEMENT_TYPE = new AMQShortString("management"); - - private VirtualHost _virtualHost; - - private final TopicParser _parser = new TopicParser(); - - private final Map<AMQShortString, TopicExchangeResult> _topicExchangeResults = - new ConcurrentHashMap<AMQShortString, TopicExchangeResult>(); - - private final Set<Binding> _bindingSet = new CopyOnWriteArraySet<Binding>(); - private UUID _id; - private UUID _qmfId; - private static final String AGENT_BANK = "0"; - - private int _bindingCountHigh; - private final AtomicLong _msgReceived = new AtomicLong(); - private final AtomicLong _bytesReceived = new AtomicLong(); - - private final CopyOnWriteArrayList<BindingListener> _listeners = new CopyOnWriteArrayList<Exchange.BindingListener>(); - - //TODO : persist creation time - private long _createTime = System.currentTimeMillis(); - - - private class ManagementQueue implements BaseQueue - { - private final UUID QUEUE_ID = UUIDGenerator.generateRandomUUID(); - private final String NAME_AS_STRING = "##__mgmt_pseudo_queue__##" + QUEUE_ID.toString(); - private final AMQShortString NAME_AS_SHORT_STRING = new AMQShortString(NAME_AS_STRING); - - public void enqueue(ServerMessage message) throws AMQException - { - long size = message.getSize(); - - ByteBuffer buf = ByteBuffer.allocate((int) size); - - int offset = 0; - - while(offset < size) - { - offset += message.getContent(buf,offset); - } - - buf.flip(); - QMFCommandDecoder commandDecoder = new QMFCommandDecoder(getQMFService(),buf); - QMFCommand cmd; - while((cmd = commandDecoder.decode()) != null) - { - cmd.process(_virtualHost, message); - } - - } - - public void enqueue(ServerMessage message, boolean sync, PostEnqueueAction action) throws AMQException - { - enqueue(message); - } - - public void enqueue(ServerMessage message, PostEnqueueAction action) throws AMQException - { - enqueue(message); - } - - public boolean isDurable() - { - return false; - } - - public AMQShortString getNameShortString() - { - return NAME_AS_SHORT_STRING; - } - - @Override - public UUID getId() - { - return QUEUE_ID; - } - } - - - private final ManagementQueue _mgmtQueue = new ManagementQueue(); - - public ManagementExchange() - { - } - - public static final ExchangeType<ManagementExchange> TYPE = new ExchangeType<ManagementExchange>() - { - - public AMQShortString getName() - { - return QPID_MANAGEMENT_TYPE; - } - - public Class<ManagementExchange> getExchangeClass() - { - return ManagementExchange.class; - } - - public ManagementExchange newInstance(UUID id, VirtualHost host, - AMQShortString name, - boolean durable, - int ticket, - boolean autoDelete) throws AMQException - { - ManagementExchange exch = new ManagementExchange(); - exch.initialise(id, host, name, durable, ticket, autoDelete); - return exch; - } - - public AMQShortString getDefaultExchangeName() - { - return QPID_MANAGEMENT; - } - }; - - - public AMQShortString getNameShortString() - { - return QPID_MANAGEMENT; - } - - public AMQShortString getTypeShortString() - { - return QPID_MANAGEMENT_TYPE; - } - - public void initialise(UUID id, VirtualHost host, AMQShortString name, boolean durable, int ticket, boolean autoDelete) - throws AMQException - { - if(!QPID_MANAGEMENT.equals(name)) - { - throw new AMQException("Can't create more than one Management exchange"); - } - _virtualHost = host; - _id = id; - _virtualHost.scheduleHouseKeepingTask(_virtualHost.getBroker().getManagementPublishInterval(), new UpdateTask(_virtualHost)); - _qmfId = getConfigStore().createId(); - getConfigStore().addConfiguredObject(this); - getQMFService().addListener(this); - } - - public UUID getId() - { - return _id; - } - - @Override - public UUID getQMFId() - { - return _qmfId; - } - - public ExchangeConfigType getConfigType() - { - return ExchangeConfigType.getInstance(); - } - - public ConfiguredObject getParent() - { - return _virtualHost; - } - - public boolean isDurable() - { - return true; - } - - public VirtualHost getVirtualHost() - { - return _virtualHost; - } - - public String getName() - { - return QPID_MANAGEMENT.toString(); - } - - public ExchangeType getType() - { - return TYPE; - } - - public boolean isAutoDelete() - { - return false; - } - - public int getTicket() - { - return 0; - } - - public void close() throws AMQException - { - getConfigStore().removeConfiguredObject(this); - } - - public ConfigStore getConfigStore() - { - return getVirtualHost().getConfigStore(); - } - - public synchronized void addBinding(final Binding b) - { - - if(_bindingSet.add(b)) - { - AMQShortString routingKey = TopicNormalizer.normalize(new AMQShortString(b.getBindingKey())); - - TopicExchangeResult result = _topicExchangeResults.get(routingKey); - if(result == null) - { - result = new TopicExchangeResult(); - result.addUnfilteredQueue(b.getQueue()); - _parser.addBinding(routingKey, result); - _topicExchangeResults.put(routingKey,result); - } - else - { - result.addUnfilteredQueue(b.getQueue()); - } - - result.addBinding(b); - } - - for(BindingListener listener : _listeners) - { - listener.bindingAdded(this, b); - } - - if(_bindingSet.size() > _bindingCountHigh) - { - _bindingCountHigh = _bindingSet.size(); - } - - String bindingKey = b.getBindingKey(); - - if(bindingKey.startsWith("schema.") || bindingKey.startsWith("*.") || bindingKey.startsWith("#.")) - { - publishAllSchema(); - } - if(bindingKey.startsWith("console.") || bindingKey.startsWith("*.") || bindingKey.startsWith("#.")) - { - publishAllConsole(); - } - - } - - void publishAllConsole() - { - QMFService qmfService = getQMFService(); - - long sampleTime = System.currentTimeMillis(); - - for(QMFPackage pkg : qmfService.getSupportedSchemas()) - { - for(QMFClass qmfClass : pkg.getClasses()) - { - Collection<QMFObject> qmfObjects = qmfService.getObjects(qmfClass); - - publishObjectsToConsole(sampleTime, qmfObjects); - } - - } - - } - - private QMFService getQMFService() - { - return _virtualHost.getApplicationRegistry().getQMFService(); - } - - void publishObjectsToConsole(final long sampleTime, - final Collection<QMFObject> qmfObjects) - { - if(!qmfObjects.isEmpty() && hasBindings()) - { - QMFClass qmfClass = qmfObjects.iterator().next().getQMFClass(); - ArrayList<QMFCommand> commands = new ArrayList<QMFCommand>(); - - - for(QMFObject obj : qmfObjects) - { - commands.add(obj.asConfigInfoCmd(sampleTime)); - commands.add(obj.asInstrumentInfoCmd(sampleTime)); - } - - publishToConsole(qmfClass, commands); - } - } - - private void publishToConsole(final QMFClass qmfClass, final ArrayList<QMFCommand> commands) - { - if(!commands.isEmpty() && hasBindings()) - { - String routingKey = "console.obj.1." + AGENT_BANK + "." + qmfClass.getPackage().getName() + "." + qmfClass.getName(); - QMFMessage message = new QMFMessage(routingKey,commands.toArray(new QMFCommand[commands.size()])); - - Collection<TopicMatcherResult> results = _parser.parse(new AMQShortString(routingKey)); - HashSet<AMQQueue> queues = new HashSet<AMQQueue>(); - for(TopicMatcherResult result : results) - { - TopicExchangeResult res = (TopicExchangeResult)result; - - for(Binding b : res.getBindings()) - { - b.incrementMatches(); - } - - queues.addAll(((TopicExchangeResult)result).getUnfilteredQueues()); - } - for(AMQQueue queue : queues) - { - try - { - queue.enqueue(message); - } - catch (AMQException e) - { - throw new RuntimeException(e); - } - } - } - } - - void publishAllSchema() - { - - } - - public synchronized void removeBinding(final Binding binding) - { - if(_bindingSet.remove(binding)) - { - AMQShortString bindingKey = TopicNormalizer.normalize(new AMQShortString(binding.getBindingKey())); - TopicExchangeResult result = _topicExchangeResults.get(bindingKey); - result.removeBinding(binding); - result.removeUnfilteredQueue(binding.getQueue()); - } - - for(BindingListener listener : _listeners) - { - listener.bindingRemoved(this, binding); - } - } - - public synchronized Collection<Binding> getBindings() - { - return new ArrayList<Binding>(_bindingSet); - } - - public ArrayList<BaseQueue> route(InboundMessage message) - { - ArrayList<BaseQueue> queues = new ArrayList<BaseQueue>(1); - _msgReceived.incrementAndGet(); - _bytesReceived.addAndGet(message.getSize()); - queues.add(_mgmtQueue); - return queues; - } - - public boolean isBound(String bindingKey, Map<String, Object> arguments, AMQQueue queue) - { - return false; //TODO - } - - public boolean isBound(AMQShortString routingKey, FieldTable arguments, AMQQueue queue) - { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - public boolean isBound(AMQShortString routingKey, AMQQueue queue) - { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - public boolean isBound(AMQShortString routingKey) - { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - public boolean isBound(AMQQueue queue) - { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - public boolean hasBindings() - { - return !_bindingSet.isEmpty(); - } - - public boolean isBound(String bindingKey, AMQQueue queue) - { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - public boolean isBound(String bindingKey) - { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - public void addCloseTask(final Task task) - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public void removeCloseTask(final Task task) - { - //To change body of implemented methods use File | Settings | File Templates. - } - - - - public Exchange getAlternateExchange() - { - return null; - } - - public Map<String, Object> getArguments() - { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - public void setAlternateExchange(Exchange exchange) - { - - } - - public void removeReference(ExchangeReferrer exchange) - { - } - - public void addReference(ExchangeReferrer exchange) - { - } - - public boolean hasReferrers() - { - return true; - } - - - - private class UpdateTask extends HouseKeepingTask - { - public UpdateTask(VirtualHost vhost) - { - super(vhost); - } - - public void execute() - { - publishAllConsole(); - publishAllSchema(); - } - - } - - public void objectCreated(final QMFObject obj) - { - publishObjectsToConsole(System.currentTimeMillis(), Collections.singleton(obj)); - } - - public void objectDeleted(final QMFObject obj) - { - publishObjectsToConsole(System.currentTimeMillis(), Collections.singleton(obj)); - } - - public long getBindingCount() - { - return getBindings().size(); - } - - public long getBindingCountHigh() - { - return _bindingCountHigh; - } - - public long getMsgReceives() - { - return _msgReceived.get(); - } - - public long getMsgRoutes() - { - return getMsgReceives(); - } - - public long getMsgDrops() - { - return 0l; - } - - public long getByteReceives() - { - return _bytesReceived.get(); - } - - public long getByteRoutes() - { - return getByteReceives(); - } - - public long getByteDrops() - { - return 0l; - } - - public long getCreateTime() - { - return _createTime; - } - - public void addBindingListener(final BindingListener listener) - { - _listeners.add(listener); - } - - public void removeBindingListener(final BindingListener listener) - { - _listeners.remove(listener); - } - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFBrokerRequestCommand.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFBrokerRequestCommand.java deleted file mode 100644 index 69284abc48..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFBrokerRequestCommand.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.log4j.Logger; - -import org.apache.qpid.AMQException; -import org.apache.qpid.server.exchange.Exchange; -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.queue.BaseQueue; -import org.apache.qpid.server.virtualhost.VirtualHost; -import org.apache.qpid.transport.codec.BBDecoder; - -import java.util.List; - -public class QMFBrokerRequestCommand extends QMFCommand -{ - - private static final Logger _qmfLogger = Logger.getLogger("qpid.qmf"); - - - public QMFBrokerRequestCommand(QMFCommandHeader header, BBDecoder buf) - { - super(header); - } - - public void process(VirtualHost virtualHost, ServerMessage message) - { - String exchangeName = message.getMessageHeader().getReplyToExchange(); - String queueName = message.getMessageHeader().getReplyToRoutingKey(); - - _qmfLogger.debug("Execute: " + this); - - QMFCommand[] commands = new QMFCommand[2]; - commands[0] = new QMFBrokerResponseCommand(this, virtualHost); - commands[1] = new QMFCommandCompletionCommand(this); - - Exchange exchange = virtualHost.getExchangeRegistry().getExchange(exchangeName); - - for(QMFCommand cmd : commands) - { - QMFMessage responseMessage = new QMFMessage(queueName, cmd); - - - List<? extends BaseQueue> queues = exchange.route(responseMessage); - - - for(BaseQueue q : queues) - { - try - { - q.enqueue(responseMessage); - } - catch (AMQException e) - { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - } - } - } - } - - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFBrokerResponseCommand.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFBrokerResponseCommand.java deleted file mode 100644 index 34b2a851dc..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFBrokerResponseCommand.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.qpid.server.virtualhost.VirtualHost; -import org.apache.qpid.transport.codec.BBEncoder; - -public class QMFBrokerResponseCommand extends QMFCommand -{ - private QMFCommandHeader _header; - private VirtualHost _virtualHost; - - public QMFBrokerResponseCommand(QMFBrokerRequestCommand qmfBrokerRequestCommand, VirtualHost virtualHost) - { - super( new QMFCommandHeader(qmfBrokerRequestCommand.getHeader().getVersion(), - qmfBrokerRequestCommand.getHeader().getSeq(), - QMFOperation.BROKER_RESPONSE)); - _virtualHost = virtualHost; - } - - public void encode(BBEncoder encoder) - { - super.encode(encoder); - encoder.writeUuid(_virtualHost.getBrokerId()); - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFClass.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFClass.java deleted file mode 100644 index 7d566567a1..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFClass.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * - * 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.qmf; - -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -abstract public class QMFClass -{ - - - public enum Type - { - OBJECT((byte)1), - EVENT((byte)2); - - private final byte _value; - - Type(byte value) - { - _value = value; - } - - public byte getValue() - { - return _value; - } - } - - private final Type _type; - private QMFPackage _package; - private final String _name; - private byte[] _schemaHash; - - private Map<String, QMFProperty> _properties = new LinkedHashMap<String, QMFProperty>(); - private Map<String, QMFStatistic> _statistics = new LinkedHashMap<String, QMFStatistic>(); - private Map<String, QMFMethod> _methods = new LinkedHashMap<String, QMFMethod>(); - - - - public QMFClass(Type type, String name, byte[] schemaHash, List<QMFProperty> properties, - List<QMFStatistic> statistics, List<QMFMethod> methods) - { - this(type, name, schemaHash); - setProperties(properties); - setStatistics(statistics); - setMethods(methods); - } - - - public QMFClass(Type type, String name, byte[] schemaHash) - - { - _type = type; - _name = name; - _schemaHash = schemaHash; - - } - - protected void setProperties(List<QMFProperty> properties) - { - for(QMFProperty prop : properties) - { - _properties.put(prop.getName(), prop); - } - } - - protected void setStatistics(List<QMFStatistic> statistics) - { - for(QMFStatistic stat : statistics) - { - _statistics.put(stat.getName(), stat); - } - } - - - protected void setMethods(List<QMFMethod> methods) - { - for(QMFMethod method : methods) - { - _methods.put(method.getName(), method); - } - } - - public void setPackage(QMFPackage aPackage) - { - _package = aPackage; - for(QMFProperty prop : _properties.values()) - { - prop.setQMFClass(this); - } - // TODO Statisics, Methods - } - - public Type getType() - { - return _type; - } - - public QMFPackage getPackage() - { - return _package; - } - - public String getName() - { - return _name; - } - - public byte[] getSchemaHash() - { - return _schemaHash; - } - - public Collection<QMFProperty> getProperties() - { - return _properties.values(); - } - - public Collection<QMFStatistic> getStatistics() - { - return _statistics.values(); - } - - public Collection<QMFMethod> getMethods() - { - return _methods.values(); - } - - public QMFMethod getMethod(String methodName) - { - return _methods.get(methodName); - } - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFClassIndicationCommand.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFClassIndicationCommand.java deleted file mode 100644 index 613e1e5978..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFClassIndicationCommand.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.qpid.transport.codec.BBEncoder; - -public class QMFClassIndicationCommand extends QMFCommand -{ - private QMFClass _qmfClass; - - public QMFClassIndicationCommand(QMFClassQueryCommand qmfClassQueryCommand, QMFClass qmfClass) - { - super(new QMFCommandHeader(qmfClassQueryCommand.getHeader().getVersion(), - qmfClassQueryCommand.getHeader().getSeq(), - QMFOperation.CLASS_INDICATION)); - _qmfClass = qmfClass; - } - - - @Override - public void encode(BBEncoder encoder) - { - super.encode(encoder); - encoder.writeUint8(_qmfClass.getType().getValue()); - encoder.writeStr8(_qmfClass.getPackage().getName()); - encoder.writeStr8(_qmfClass.getName()); - encoder.writeBin128(_qmfClass.getSchemaHash()); - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFClassQueryCommand.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFClassQueryCommand.java deleted file mode 100644 index 5676bb7306..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFClassQueryCommand.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.log4j.Logger; - -import org.apache.qpid.AMQException; -import org.apache.qpid.server.exchange.Exchange; -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.queue.BaseQueue; -import org.apache.qpid.server.registry.IApplicationRegistry; -import org.apache.qpid.server.virtualhost.VirtualHost; -import org.apache.qpid.transport.codec.BBDecoder; - -import java.util.Collection; -import java.util.List; - -public class QMFClassQueryCommand extends QMFCommand -{ - private static final Logger _qmfLogger = Logger.getLogger("qpid.qmf"); - - - private final String _package; - - public QMFClassQueryCommand(QMFCommandHeader header, BBDecoder decoder) - { - super(header); - _package = decoder.readStr8(); - } - - public void process(VirtualHost virtualHost, ServerMessage message) - { - String exchangeName = message.getMessageHeader().getReplyToExchange(); - String routingKey = message.getMessageHeader().getReplyToRoutingKey(); - - _qmfLogger.debug("Execute: " + this); - - IApplicationRegistry appRegistry = virtualHost.getApplicationRegistry(); - QMFService service = appRegistry.getQMFService(); - - QMFPackage qmfPackage = service.getPackage(_package); - Collection<QMFClass> qmfClasses = qmfPackage.getClasses(); - - QMFCommand[] commands = new QMFCommand[ qmfClasses.size() + 1 ]; - - int i = 0; - for(QMFClass qmfClass : qmfClasses) - { - commands[i++] = new QMFClassIndicationCommand(this, qmfClass); - } - commands[ commands.length - 1 ] = new QMFCommandCompletionCommand(this); - - - for(QMFCommand cmd : commands) - { - - - QMFMessage responseMessage = new QMFMessage(routingKey, cmd); - - Exchange exchange = virtualHost.getExchangeRegistry().getExchange(exchangeName); - - List<? extends BaseQueue> queues = exchange.route(responseMessage); - - for(BaseQueue q : queues) - { - try - { - q.enqueue(responseMessage); - } - catch (AMQException e) - { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - } - } - } - } - - - @Override - public String toString() - { - return "QMFClassQueryCommand{" + - "package='" + _package + '\'' + - '}'; - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFCommand.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFCommand.java deleted file mode 100644 index 4f143701af..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFCommand.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.virtualhost.VirtualHost; -import org.apache.qpid.transport.codec.BBEncoder; - -public abstract class QMFCommand -{ - - private final QMFCommandHeader _header; - - protected QMFCommand(QMFCommandHeader header) - { - _header = header; - } - - - public void process(final VirtualHost virtualHost, final ServerMessage message) - { - throw new UnsupportedOperationException(); - } - - public void encode(BBEncoder encoder) - { - _header.encode(encoder); - - } - - public QMFCommandHeader getHeader() - { - return _header; - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFCommandCompletionCommand.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFCommandCompletionCommand.java deleted file mode 100644 index 397ad4090e..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFCommandCompletionCommand.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.qpid.transport.codec.BBEncoder; - -public class QMFCommandCompletionCommand extends QMFCommand -{ - - private final CompletionCode _status; - private final String _text; - - public QMFCommandCompletionCommand(QMFCommand command) - { - this(command, CompletionCode.OK, ""); - } - public QMFCommandCompletionCommand(QMFCommand command, CompletionCode status, String text) - { - super( new QMFCommandHeader(command.getHeader().getVersion(), - command.getHeader().getSeq(), - QMFOperation.COMMAND_COMPLETION)); - - _status = status; - _text = text; - } - - - @Override - public void encode(BBEncoder encoder) - { - super.encode(encoder); - encoder.writeInt32(_status.ordinal()); - encoder.writeStr8(_text); - } - - @Override - public String toString() - { - return "QMFCommandCompletionCommand{" + - "status=" + _status + - ",text='" + _text + '\'' + - '}'; - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFCommandDecoder.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFCommandDecoder.java deleted file mode 100644 index ac036dfa19..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFCommandDecoder.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.qpid.transport.codec.BBDecoder; - -import java.nio.ByteBuffer; - -public class QMFCommandDecoder -{ - private BBDecoder _decoder; - - - private static final QMFOperation[] OP_CODES = new QMFOperation[256]; - private final QMFService _qmfService; - - static - { - for(QMFOperation op : QMFOperation.values()) - { - OP_CODES[op.getOpcode()] = op; - } - } - - public QMFCommandDecoder(final QMFService qmfService, ByteBuffer buf) - { - _qmfService = qmfService; - _decoder = new BBDecoder(); - _decoder.init(buf); - } - - public QMFCommand decode() - { - if(_decoder.hasRemaining()) - { - QMFCommandHeader header = readQMFHeader(); - - switch(header.getOperation()) - { - case BROKER_REQUEST: - return new QMFBrokerRequestCommand(header, _decoder); - case PACKAGE_QUERY: - return new QMFPackageQueryCommand(header, _decoder); - case CLASS_QUERY: - return new QMFClassQueryCommand(header, _decoder); - case SCHEMA_REQUEST: - return new QMFSchemaRequestCommand(header, _decoder); - case METHOD_REQUEST: - return new QMFMethodRequestCommand(header, _decoder, _qmfService); - case GET_QUERY: - return new QMFGetQueryCommand(header, _decoder); - default: - System.out.println("Unknown command"); - - } - - return null; - } - else - { - return null; - } - } - - private QMFCommandHeader readQMFHeader() - { - if(_decoder.readInt8() == (byte) 'A' - && _decoder.readInt8() == (byte) 'M') - { - byte version = _decoder.readInt8(); - short opCode = _decoder.readUint8(); - int seq = _decoder.readInt32(); - - return new QMFCommandHeader(version, seq, OP_CODES[opCode]); - - } - return null; - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFCommandHeader.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFCommandHeader.java deleted file mode 100644 index c4d771317f..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFCommandHeader.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.qpid.transport.codec.BBEncoder; - -public class QMFCommandHeader -{ - private final byte _version; - private final int _seq; - - private final QMFOperation _operation; - - public QMFCommandHeader(byte version, int seq, QMFOperation operation) - { - _version = version; - _seq = seq; - _operation = operation; - } - - public byte getVersion() - { - return _version; - } - - public int getSeq() - { - return _seq; - } - - public QMFOperation getOperation() - { - return _operation; - } - - public void encode(BBEncoder encoder) - { - encoder.writeUint8((short)'A'); - encoder.writeUint8((short)'M'); - encoder.writeInt8(_version); - encoder.writeUint8((short)_operation.getOpcode()); - encoder.writeInt32(_seq); - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFEventClass.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFEventClass.java deleted file mode 100644 index ec471f18e8..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFEventClass.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * 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.qmf; - -import java.util.List; - -public abstract class QMFEventClass extends QMFClass -{ - public QMFEventClass(String name, - byte[] schemaHash, - List<QMFProperty> properties, - List<QMFStatistic> statistics, List<QMFMethod> methods) - { - super(Type.EVENT, name, schemaHash, properties, statistics, methods); - } - - public QMFEventClass(String name, byte[] schemaHash) - { - super(Type.EVENT, name, schemaHash); - } - - abstract public QMFEventSeverity getSeverity(); - -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFEventCommand.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFEventCommand.java deleted file mode 100644 index 833ccfbca4..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFEventCommand.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.qpid.transport.codec.BBEncoder; - -public abstract class QMFEventCommand<T extends QMFEventClass> extends QMFCommand -{ - private final long _timestamp; - - protected QMFEventCommand() - { - super(new QMFCommandHeader((byte)'2',0, QMFOperation.EVENT)); - _timestamp = System.currentTimeMillis(); - } - - abstract public T getEventClass(); - - @Override - public void encode(final BBEncoder encoder) - { - super.encode(encoder); - encoder.writeStr8(getEventClass().getPackage().getName()); - encoder.writeStr8(getEventClass().getName()); - encoder.writeBin128(new byte[16]); - encoder.writeUint64(_timestamp * 1000000L); - encoder.writeUint8((short) getEventClass().getSeverity().ordinal()); - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFEventSeverity.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFEventSeverity.java deleted file mode 100644 index 9f9c832732..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFEventSeverity.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * 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.qmf; - -public enum QMFEventSeverity -{ - EMERGENCY, - ALERT, - CRITICAL, - ERROR, - WARN, - NOTICE, - INFORM, - DEBUG -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFGetQueryCommand.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFGetQueryCommand.java deleted file mode 100644 index b1f958d4ba..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFGetQueryCommand.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.log4j.Logger; - -import org.apache.qpid.AMQException; -import org.apache.qpid.server.exchange.Exchange; -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.queue.BaseQueue; -import org.apache.qpid.server.registry.IApplicationRegistry; -import org.apache.qpid.server.virtualhost.VirtualHost; -import org.apache.qpid.transport.codec.BBDecoder; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -public class QMFGetQueryCommand extends QMFCommand -{ - - private static final Logger _qmfLogger = Logger.getLogger("qpid.qmf"); - - private String _className; - private String _packageName; - private UUID _objectId; - - public QMFGetQueryCommand(QMFCommandHeader header, BBDecoder decoder) - { - super(header); - - Map<String, Object> _map = decoder.readMap(); - _className = (String) _map.get("_class"); - _packageName = (String) _map.get("_package"); - byte[] objectIdBytes = (byte[]) _map.get("_objectId"); - - if(objectIdBytes != null) - { - long msb = 0; - long lsb = 0; - - for (int i = 0; i != 8; i++) - { - msb = (msb << 8) | (objectIdBytes[i] & 0xff); - } - for (int i = 8; i != 16; i++) - { - lsb = (lsb << 8) | (objectIdBytes[i] & 0xff); - } - _objectId = new UUID(msb, lsb); - } - else - { - _objectId = null; - } - - - } - - public void process(VirtualHost virtualHost, ServerMessage message) - { - String exchangeName = message.getMessageHeader().getReplyToExchange(); - String routingKey = message.getMessageHeader().getReplyToRoutingKey(); - - IApplicationRegistry appRegistry = virtualHost.getApplicationRegistry(); - QMFService service = appRegistry.getQMFService(); - - _qmfLogger.debug("Execute: " + this); - - List<QMFCommand> commands = new ArrayList<QMFCommand>(); - final long sampleTime = System.currentTimeMillis() * 1000000l; - - Collection<QMFPackage> packages; - - if(_packageName != null && _packageName.length() != 0) - { - QMFPackage qmfPackage = service.getPackage(_packageName); - if(qmfPackage == null) - { - packages = Collections.EMPTY_LIST; - } - else - { - packages = Collections.singleton(qmfPackage); - } - } - else - { - packages = service.getSupportedSchemas(); - } - - for(QMFPackage qmfPackage : packages) - { - - Collection<QMFClass> qmfClasses; - - if(_className != null && _className.length() != 0) - { - QMFClass qmfClass = qmfPackage.getQMFClass(_className); - if(qmfClass == null) - { - qmfClasses = Collections.EMPTY_LIST; - } - else - { - qmfClasses = Collections.singleton(qmfClass); - } - } - else - { - qmfClasses = qmfPackage.getClasses(); - } - - - for(QMFClass qmfClass : qmfClasses) - { - Collection<QMFObject> objects; - - if(_objectId != null) - { - QMFObject obj = service.getObjectById(qmfClass, _objectId); - if(obj == null) - { - objects = Collections.EMPTY_LIST; - } - else - { - objects = Collections.singleton(obj); - } - } - else - { - objects = service.getObjects(qmfClass); - } - - for(QMFObject object : objects) - { - - commands.add(object.asGetQueryResponseCmd(this, sampleTime)); - } - } - - - } - - - commands.add( new QMFCommandCompletionCommand(this)); - - - for(QMFCommand cmd : commands) - { - - _qmfLogger.debug("Respond: " + cmd); - QMFMessage responseMessage = new QMFMessage(routingKey, cmd); - - Exchange exchange = virtualHost.getExchangeRegistry().getExchange(exchangeName); - - List<? extends BaseQueue> queues = exchange.route(responseMessage); - - for(BaseQueue q : queues) - { - try - { - q.enqueue(responseMessage); - } - catch (AMQException e) - { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - } - } - } - } - - @Override - public String toString() - { - return "QMFGetQueryCommand{" + - "packageName='" + _packageName + '\'' + - ", className='" + _className + '\'' + - ", objectId=" + _objectId + - '}'; - } -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFMessage.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFMessage.java deleted file mode 100644 index 1b173c7e11..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFMessage.java +++ /dev/null @@ -1,256 +0,0 @@ -/* - * - * 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.qmf; - -import java.util.Collection; -import java.util.Collections; -import org.apache.commons.lang.NotImplementedException; - -import org.apache.qpid.framing.AMQShortString; -import org.apache.qpid.server.configuration.SessionConfig; -import org.apache.qpid.server.message.AMQMessageHeader; -import org.apache.qpid.server.message.InboundMessage; -import org.apache.qpid.server.message.MessageReference; -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.store.StoredMessage; -import org.apache.qpid.transport.codec.BBEncoder; - -import java.nio.ByteBuffer; -import java.util.Set; - -public class QMFMessage implements ServerMessage, InboundMessage, AMQMessageHeader -{ - - private ByteBuffer _content; - private String _routingKey; - - public QMFMessage(String routingKey, QMFCommand command) - { - this(routingKey, new QMFCommand[] { command }); - } - - - public QMFMessage(String routingKey, QMFCommand[] commands) - { - _routingKey = routingKey; - BBEncoder encoder = new BBEncoder(256); - - for(QMFCommand cmd : commands) - { - cmd.encode(encoder); - } - - - _content = encoder.buffer(); - } - - public String getRoutingKey() - { - return _routingKey; - } - - public AMQShortString getRoutingKeyShortString() - { - return AMQShortString.valueOf(_routingKey); - } - - public AMQMessageHeader getMessageHeader() - { - return this; - } - - public StoredMessage getStoredMessage() - { - throw new NotImplementedException(); - } - - public boolean isPersistent() - { - return false; - } - - public boolean isRedelivered() - { - return false; - } - - public long getSize() - { - return _content.limit(); - } - - public boolean isImmediate() - { - return false; - } - - public String getCorrelationId() - { - return null; - } - - public long getExpiration() - { - return 0; - } - - public String getUserId() - { - return null; - } - - public String getAppId() - { - return null; - } - - public String getMessageId() - { - return null; - } - - public String getMimeType() - { - return null; - } - - public String getEncoding() - { - return null; - } - - public byte getPriority() - { - return 4; - } - - public long getTimestamp() - { - return 0; - } - - public String getType() - { - return null; - } - - public String getReplyTo() - { - return null; - } - - public String getReplyToExchange() - { - return null; - } - - public String getReplyToRoutingKey() - { - return null; - } - - public Object getHeader(String name) - { - return null; - } - - public boolean containsHeaders(Set<String> names) - { - return false; - } - - @Override - public Collection<String> getHeaderNames() - { - return Collections.EMPTY_SET; - } - - public boolean containsHeader(String name) - { - return false; - } - - public MessageReference newReference() - { - return new QMFMessageReference(this); - } - - public long getMessageNumber() - { - return 0l; - } - - public long getArrivalTime() - { - return 0; - } - - public int getContent(ByteBuffer buf, int offset) - { - ByteBuffer src = _content.duplicate(); - src.position(offset); - src = src.slice(); - int len = src.remaining(); - if(len > buf.remaining()) - { - len = buf.remaining(); - } - - buf.put(src); - - return len; - } - - - public ByteBuffer getContent(int offset, int size) - { - ByteBuffer src = _content.duplicate(); - src.position(offset); - src = src.slice(); - src.limit(size); - return src; - } - - private static class QMFMessageReference extends MessageReference<QMFMessage> - { - public QMFMessageReference(QMFMessage message) - { - super(message); - } - - protected void onReference(QMFMessage message) - { - - } - - protected void onRelease(QMFMessage message) - { - - } - } - - public SessionConfig getSessionConfig() - { - return null; - } - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFMethod.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFMethod.java deleted file mode 100644 index 1d1cd24724..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFMethod.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.qpid.transport.codec.BBDecoder; -import org.apache.qpid.transport.codec.Encoder; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; - -public abstract class QMFMethod<T extends QMFObject> -{ - private final LinkedHashMap<String,Object> _map = new LinkedHashMap<String,Object>(); - private final List<Argument> _arguments = new ArrayList<Argument>(); - - private static final String NAME = "name"; - private static final String TYPE = "type"; - private static final String REF_PACKAGE = "refPackage"; - private static final String REF_CLASS = "refClass"; - private static final String UNIT = "unit"; - private static final String MIN = "min"; - private static final String MAX = "max"; - private static final String MAX_LENGTH = "maxlen"; - private static final String DESCRIPTION = "desc"; - private static final String DEFAULT = "default"; - private static final String DIRECTION = "dir"; - private static final String ARG_COUNT = "argCount"; - - - - public enum Direction - { - I, - O, - IO; - } - - public class Argument - { - private final LinkedHashMap<String,Object> _map = new LinkedHashMap<String,Object>(); - - public Argument(String name, QMFType type) - { - _map.put(NAME, name); - _map.put(TYPE, type.codeValue()); - } - - public void setRefPackage(String refPackage) - { - _map.put(REF_PACKAGE, refPackage); - } - - public void setRefClass(String refClass) - { - _map.put(REF_CLASS, refClass); - } - - public void setUnit(String unit) - { - _map.put(UNIT, unit); - } - - public void setMax(Number max) - { - _map.put(MAX, max); - } - - public void setMin(Number min) - { - _map.put(MIN, min); - } - - public void setMaxLength(int len) - { - _map.put(MAX_LENGTH, len); - } - - public void setDefault(Object dflt) - { - _map.put(DEFAULT, dflt); - } - - public void setDescription(String desc) - { - _map.put(DESCRIPTION, desc); - } - - public void setDirection(Direction direction) - { - _map.put(DIRECTION, direction.toString()); - } - - public void encode(Encoder encoder) - { - encoder.writeMap(_map); - } - - public String getName() - { - return (String) _map.get(NAME); - } - } - - public QMFMethod(String name, String description) - { - _map.put(NAME, name); - _map.put(ARG_COUNT, 0); - if(description != null) - { - _map.put(DESCRIPTION, description); - } - - } - - abstract public QMFMethodInvocation<T> parse(final BBDecoder decoder); - - protected void addArgument(Argument arg) - { - _arguments.add(arg); - _map.put(ARG_COUNT, _arguments.size()); - } - - - public void encode(Encoder encoder) - { - encoder.writeMap(_map); - for(Argument arg : _arguments) - { - arg.encode(encoder); - } - } - - public String getName() - { - return (String) _map.get(NAME); - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFMethodInvocation.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFMethodInvocation.java deleted file mode 100644 index 5348c2783f..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFMethodInvocation.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * - * 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.qmf; - -public interface QMFMethodInvocation<T extends QMFObject> -{ - QMFMethodResponseCommand execute(T obj, QMFMethodRequestCommand cmd); -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFMethodRequestCommand.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFMethodRequestCommand.java deleted file mode 100644 index 1a4ce228b5..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFMethodRequestCommand.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.log4j.Logger; - -import org.apache.qpid.AMQException; -import org.apache.qpid.server.exchange.Exchange; -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.queue.BaseQueue; -import org.apache.qpid.server.virtualhost.VirtualHost; -import org.apache.qpid.transport.codec.BBDecoder; - -import java.util.List; -import java.util.UUID; - -public class QMFMethodRequestCommand extends QMFCommand -{ - private static final Logger _qmfLogger = Logger.getLogger("qpid.qmf"); - - private QMFMethodInvocation _methodInstance; - private QMFObject _object; - - public QMFMethodRequestCommand(final QMFCommandHeader header, final BBDecoder decoder, final QMFService qmfService) - { - super(header); - UUID objectId = decoder.readUuid(); - String packageName = decoder.readStr8(); - String className = decoder.readStr8(); - byte[] hash = decoder.readBin128(); - String methodName = decoder.readStr8(); - - QMFPackage qmfPackage = qmfService.getPackage(packageName); - QMFClass qmfClass = qmfPackage.getQMFClass(className); - _object = qmfService.getObjectById(qmfClass, objectId); - QMFMethod method = qmfClass.getMethod(methodName); - _methodInstance = method.parse(decoder); - - } - - public void process(final VirtualHost virtualHost, final ServerMessage message) - { - String exchangeName = message.getMessageHeader().getReplyToExchange(); - String queueName = message.getMessageHeader().getReplyToRoutingKey(); - - QMFCommand[] commands = new QMFCommand[2]; - - _qmfLogger.debug("Execute: " + _methodInstance + " on " + _object); - - commands[0] = _methodInstance.execute(_object, this); - commands[1] = new QMFCommandCompletionCommand(this); - - Exchange exchange = virtualHost.getExchangeRegistry().getExchange(exchangeName); - - for(QMFCommand cmd : commands) - { - QMFMessage responseMessage = new QMFMessage(queueName, cmd); - - - List<? extends BaseQueue> queues = exchange.route(responseMessage); - - - for(BaseQueue q : queues) - { - try - { - q.enqueue(responseMessage); - } - catch (AMQException e) - { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - } - } - } - - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFMethodResponseCommand.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFMethodResponseCommand.java deleted file mode 100644 index 5fea014ad8..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFMethodResponseCommand.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.qpid.transport.codec.BBEncoder; - -public class QMFMethodResponseCommand extends QMFCommand -{ - private CompletionCode _status = null; - private String _msg = null; - - public QMFMethodResponseCommand(final QMFMethodRequestCommand cmd, - CompletionCode status, - String msg) - { - super( new QMFCommandHeader(cmd.getHeader().getVersion(), - cmd.getHeader().getSeq(), - QMFOperation.METHOD_RESPONSE)); - - if(status == null) - { - _status = CompletionCode.OK; - } - else - { - _status = status; - } - - _msg = msg; - } - - public CompletionCode getStatus() - { - return _status; - } - - public String getStatusText() - { - return _msg; - } - - @Override - public void encode(final BBEncoder encoder) - { - super.encode(encoder); - - encoder.writeUint32(_status.ordinal()); - - if(_msg == null) - { - encoder.writeStr16(_status.toString()); - } - else - { - encoder.writeStr16(_msg); - } - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFObject.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFObject.java deleted file mode 100644 index c3604dca44..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFObject.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * - * 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.qmf; - -import java.util.UUID; - -public abstract class QMFObject<C extends QMFClass, D extends QMFObject.Delegate> -{ - private long _deleteTime; - - public interface Delegate - { - UUID getQMFId(); - long getCreateTime(); - } - - - private D _delegate; - - protected QMFObject(D delegate) - { - _delegate = delegate; - } - - public D getDelegate() - { - return _delegate; - } - - abstract public C getQMFClass(); - - public final UUID getId() - { - return _delegate.getQMFId(); - } - - public final long getCreateTime() - { - return _delegate.getCreateTime(); - } - - public final void setDeleteTime() - { - _deleteTime = System.currentTimeMillis(); - } - - public final long getDeleteTime() - { - return _deleteTime; - } - - - - abstract public QMFCommand asConfigInfoCmd(long sampleTime); - abstract public QMFCommand asInstrumentInfoCmd(long sampleTime); - abstract public QMFCommand asGetQueryResponseCmd(final QMFGetQueryCommand queryCommand, long sampleTime); - - @Override - public String toString() - { - return _delegate.toString(); - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFObjectClass.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFObjectClass.java deleted file mode 100644 index fefdecb8d7..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFObjectClass.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * 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.qmf; - -import java.util.List; - -public abstract class QMFObjectClass<T extends QMFObject, S extends QMFObject.Delegate> extends QMFClass -{ - public QMFObjectClass(String name, - byte[] schemaHash, - List<QMFProperty> properties, - List<QMFStatistic> statistics, List<QMFMethod> methods) - { - super(QMFClass.Type.OBJECT, name, schemaHash, properties, statistics, methods); - } - - public QMFObjectClass(String name, byte[] schemaHash) - { - super(QMFClass.Type.OBJECT, name, schemaHash); - } - - - public abstract T newInstance(S delegate); - - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFOperation.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFOperation.java deleted file mode 100644 index 6736b5d460..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFOperation.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * - * 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.qmf; - -public enum QMFOperation -{ - - - BROKER_REQUEST('B'), - BROKER_RESPONSE('b'), // This message contains a broker response, sent from the broker in response to a broker request message. - COMMAND_COMPLETION('z'), // This message is sent to indicate the completion of a request. - CLASS_QUERY('Q'), // Class query messages are used by a management console to request a list of schema classes that are known by the management broker. - CLASS_INDICATION('q'), // Sent by the management broker, a class indication notifies the peer of the existence of a schema class. - SCHEMA_REQUEST('S'), // Schema request messages are used to request the full schema details for a class. - SCHEMA_RESPONSE('s'), // Schema response message contain a full description of the schema for a class. - HEARTBEAT_INDEICATION('h'), // This message is published once per publish-interval. It can be used by a client to positively determine which objects did not change during the interval (since updates are not published for objects with no changes). - CONFIG_INDICATION('c'), - INSTRUMENTATION_INDICATION('i'), - GET_QUERY_RESPONSE('g'), // This message contains a content record. Content records contain the values of all properties or statistics in an object. Such records are broadcast on a periodic interval if 1) a change has been made in the value of one of the elements, or 2) if a new management client has bound a queue to the management exchange. - GET_QUERY('G'), // Sent by a management console, a get query requests that the management broker provide content indications for all objects that match the query criteria. - METHOD_REQUEST('M'), // This message contains a method request. - METHOD_RESPONSE('m'), // This message contains a method result. - PACKAGE_QUERY('P'), // This message contains a schema package query request, requesting that the broker dump the list of known packages - PACKAGE_INDICATION('p'), // This message contains a schema package indication, identifying a package known by the broker - AGENT_ATTACH_REUQEST('A'), // This message is sent by a remote agent when it wishes to attach to a management broker - AGENT_ATTACH_RESPONSE('a'), // The management broker sends this response if an attaching remote agent is permitted to join - CONSOLE_ADDED_INDICATION('x'), // This message is sent to all remote agents by the management broker when a new console binds to the management exchange - EVENT('e') - ; - - - private final char _opcode; - - private static final QMFOperation[] OP_CODES = new QMFOperation[256]; - - - QMFOperation(char opcode) - { - _opcode = opcode; - } - - - public char getOpcode() - { - return _opcode; - } - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFPackage.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFPackage.java deleted file mode 100644 index 63b43475aa..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFPackage.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * - * 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.qmf; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -public class QMFPackage -{ - private final String _name; - private final Map<String, QMFClass> _classes = new HashMap<String, QMFClass>(); - - public QMFPackage(String name) - { - _name = name; - } - - public QMFPackage(String name, Collection<QMFClass> classes) - { - this(name); - setClasses(classes); - } - - protected void setClasses(Collection<QMFClass> classes) - { - for(QMFClass qmfClass : classes) - { - qmfClass.setPackage(this); - _classes.put(qmfClass.getName(), qmfClass); - } - } - - public String getName() - { - return _name; - } - - public Collection<QMFClass> getClasses() - { - return _classes.values(); - } - - public QMFClass getQMFClass(String className) - { - return _classes.get(className); - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFPackageIndicationCommand.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFPackageIndicationCommand.java deleted file mode 100644 index 9c8fa1e2c6..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFPackageIndicationCommand.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.qpid.transport.codec.BBEncoder; - -public class QMFPackageIndicationCommand extends QMFCommand -{ - private String _supportedSchema; - - public QMFPackageIndicationCommand(QMFPackageQueryCommand qmfPackageQueryCommand, String supportedSchema) - { - super( new QMFCommandHeader(qmfPackageQueryCommand.getHeader().getVersion(), - qmfPackageQueryCommand.getHeader().getSeq(), - QMFOperation.PACKAGE_INDICATION)); - _supportedSchema = supportedSchema; - - } - - public void encode(BBEncoder encoder) - { - super.encode(encoder); - encoder.writeStr8(_supportedSchema); - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFPackageQueryCommand.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFPackageQueryCommand.java deleted file mode 100644 index c74c7da252..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFPackageQueryCommand.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.log4j.Logger; - -import org.apache.qpid.AMQException; -import org.apache.qpid.server.exchange.Exchange; -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.queue.BaseQueue; -import org.apache.qpid.server.registry.IApplicationRegistry; -import org.apache.qpid.server.virtualhost.VirtualHost; -import org.apache.qpid.transport.codec.BBDecoder; - -import java.util.Collection; -import java.util.List; - -public class QMFPackageQueryCommand extends QMFCommand -{ - - private static final Logger _qmfLogger = Logger.getLogger("qpid.qmf"); - - public QMFPackageQueryCommand(QMFCommandHeader header, BBDecoder decoder) - { - super(header); - } - - public void process(VirtualHost virtualHost, ServerMessage message) - { - String exchangeName = message.getMessageHeader().getReplyToExchange(); - String routingKey = message.getMessageHeader().getReplyToRoutingKey(); - - - IApplicationRegistry appRegistry = virtualHost.getApplicationRegistry(); - QMFService service = appRegistry.getQMFService(); - - Collection<QMFPackage> supportedSchemas = service.getSupportedSchemas(); - - QMFCommand[] commands = new QMFCommand[ supportedSchemas.size() + 1 ]; - - _qmfLogger.debug("Exectuting " + this); - - int i = 0; - for(QMFPackage p : supportedSchemas) - { - commands[i++] = new QMFPackageIndicationCommand(this, p.getName()); - } - commands[ commands.length - 1 ] = new QMFCommandCompletionCommand(this); - - - for(QMFCommand cmd : commands) - { - - QMFMessage responseMessage = new QMFMessage(routingKey, cmd); - - Exchange exchange = virtualHost.getExchangeRegistry().getExchange(exchangeName); - - List<? extends BaseQueue> queues = exchange.route(responseMessage); - - - for(BaseQueue q : queues) - { - try - { - q.enqueue(responseMessage); - } - catch (AMQException e) - { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - } - } - } - } - - public String toString() - { - return "QMFPackageQueryCommand"; - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFProperty.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFProperty.java deleted file mode 100644 index 5314466e2a..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFProperty.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.qpid.transport.codec.Encoder; - -import java.util.LinkedHashMap; -import java.util.Map; - -public class QMFProperty -{ - private final Map<String, Object> _map = new LinkedHashMap<String, Object>(); - private static final String NAME = "name"; - private static final String TYPE = "type"; - private static final String ACCESS = "access"; - private static final String INDEX = "index"; - private static final String OPTIONAL = "optional"; - private static final String REF_PACKAGE = "refPackage"; - private static final String REF_CLASS = "refClass"; - private static final String UNIT = "unit"; - private static final String MIN = "min"; - private static final String MAX = "max"; - private static final String MAX_LENGTH = "maxlen"; - private static final String DESCRIPTION = "desc"; - - - public static enum AccessCode - { - RC, - RW, - RO; - - public int codeValue() - { - return ordinal()+1; - } - } - - public QMFProperty(String name, QMFType type, AccessCode accessCode, boolean index, boolean optional) - { - _map.put(NAME, name); - _map.put(TYPE, type.codeValue()); - _map.put(ACCESS, accessCode.codeValue()); - _map.put(INDEX, index ? 1 : 0); - _map.put(OPTIONAL, optional ? 1 :0); - } - - - public void setQMFClass(QMFClass qmfClass) - { - } - - public void setReferencedClass(String refClass) - { - _map.put(REF_CLASS, refClass); - } - - public void setReferencedPackage(String refPackage) - { - _map.put(REF_CLASS, refPackage); - } - - - public String getName() - { - return (String) _map.get(NAME); - } - - - public void setUnit(String unit) - { - _map.put(UNIT, unit); - } - - public void setMin(Number min) - { - _map.put(MIN, min); - } - - public void setMax(Number max) - { - _map.put(MAX, max); - } - - public void setMaxLength(int maxlen) - { - _map.put(MAX_LENGTH, maxlen); - } - - - public void setDescription(String description) - { - _map.put(DESCRIPTION, description); - } - - public void encode(Encoder encoder) - { - encoder.writeMap(_map); - } - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFSchemaRequestCommand.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFSchemaRequestCommand.java deleted file mode 100644 index 57c67fa7f6..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFSchemaRequestCommand.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.log4j.Logger; - -import org.apache.qpid.AMQException; -import org.apache.qpid.server.exchange.Exchange; -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.queue.BaseQueue; -import org.apache.qpid.server.registry.IApplicationRegistry; -import org.apache.qpid.server.virtualhost.VirtualHost; -import org.apache.qpid.transport.codec.BBDecoder; - -import java.util.List; - -public class QMFSchemaRequestCommand extends QMFCommand -{ - private static final Logger _qmfLogger = Logger.getLogger("qpid.qmf"); - - private final String _packageName; - private final String _className; - private final byte[] _hash; - - public QMFSchemaRequestCommand(QMFCommandHeader header, BBDecoder decoder) - { - super(header); - _packageName = decoder.readStr8(); - _className = decoder.readStr8(); - _hash = decoder.readBin128(); - } - - public void process(VirtualHost virtualHost, ServerMessage message) - { - _qmfLogger.debug("Execute: " + this); - - String exchangeName = message.getMessageHeader().getReplyToExchange(); - String routingKey = message.getMessageHeader().getReplyToRoutingKey(); - - IApplicationRegistry appRegistry = virtualHost.getApplicationRegistry(); - QMFService service = appRegistry.getQMFService(); - - QMFPackage qmfPackage = service.getPackage(_packageName); - QMFClass qmfClass = qmfPackage.getQMFClass( _className ); - - QMFCommand[] commands = new QMFCommand[2]; - commands[0] = new QMFSchemaResponseCommand(this, qmfClass); - commands[ 1 ] = new QMFCommandCompletionCommand(this); - - - - Exchange exchange = virtualHost.getExchangeRegistry().getExchange(exchangeName); - - for(QMFCommand cmd : commands) - { - QMFMessage responseMessage = new QMFMessage(routingKey, cmd); - - - List<? extends BaseQueue> queues = exchange.route(responseMessage); - - for(BaseQueue q : queues) - { - try - { - q.enqueue(responseMessage); - } - catch (AMQException e) - { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - } - } - } - } - - @Override - public String toString() - { - return "QMFSchemaRequestCommand{" + - " packageName='" + _packageName + '\'' + - ", className='" + _className + '\'' + - '}'; - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFSchemaResponseCommand.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFSchemaResponseCommand.java deleted file mode 100644 index 4bd0e41989..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFSchemaResponseCommand.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.qpid.transport.codec.BBEncoder; - -import java.util.Collection; - -public class QMFSchemaResponseCommand extends QMFCommand -{ - private final QMFClass _qmfClass; - - - public QMFSchemaResponseCommand(QMFSchemaRequestCommand qmfSchemaRequestCommand, QMFClass qmfClass) - { - super(new QMFCommandHeader(qmfSchemaRequestCommand.getHeader().getVersion(), - qmfSchemaRequestCommand.getHeader().getSeq(), - QMFOperation.SCHEMA_RESPONSE)); - _qmfClass = qmfClass; - } - - @Override - public void encode(BBEncoder encoder) - { - super.encode(encoder); - encoder.writeUint8(_qmfClass.getType().getValue()); - encoder.writeStr8(_qmfClass.getPackage().getName()); - encoder.writeStr8(_qmfClass.getName()); - encoder.writeBin128(_qmfClass.getSchemaHash()); - - Collection<QMFProperty> props = _qmfClass.getProperties(); - Collection<QMFStatistic> stats = _qmfClass.getStatistics(); - Collection<QMFMethod> methods = _qmfClass.getMethods(); - - encoder.writeUint16(props.size()); - if(_qmfClass.getType() == QMFClass.Type.OBJECT) - { - encoder.writeUint16(stats.size()); - encoder.writeUint16(methods.size()); - } - - for(QMFProperty prop : props) - { - prop.encode(encoder); - } - - if(_qmfClass.getType() == QMFClass.Type.OBJECT) - { - - for(QMFStatistic stat : stats) - { - stat.encode(encoder); - } - - for(QMFMethod method : methods) - { - method.encode(encoder); - } - } - - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFService.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFService.java deleted file mode 100644 index d713976919..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFService.java +++ /dev/null @@ -1,2086 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.qpid.AMQException; -import org.apache.qpid.common.Closeable; -import org.apache.qpid.qmf.schema.BrokerSchema; -import org.apache.qpid.server.configuration.*; -import org.apache.qpid.server.registry.IApplicationRegistry; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CopyOnWriteArrayList; - -public class QMFService implements ConfigStore.ConfigEventListener, Closeable -{ - - - private IApplicationRegistry _applicationRegistry; - private ConfigStore _configStore; - - - private final Map<String, QMFPackage> _supportedSchemas = new HashMap<String, QMFPackage>(); - private static final Map<String, ConfigObjectType> _qmfClassMapping = new HashMap<String, ConfigObjectType>(); - - static - { - _qmfClassMapping.put("system", SystemConfigType.getInstance()); - _qmfClassMapping.put("broker", BrokerConfigType.getInstance()); - _qmfClassMapping.put("vhost", VirtualHostConfigType.getInstance()); - _qmfClassMapping.put("exchange", ExchangeConfigType.getInstance()); - _qmfClassMapping.put("queue", QueueConfigType.getInstance()); - _qmfClassMapping.put("binding", BindingConfigType.getInstance()); - _qmfClassMapping.put("connection", ConnectionConfigType.getInstance()); - _qmfClassMapping.put("session", SessionConfigType.getInstance()); - _qmfClassMapping.put("subscription", SubscriptionConfigType.getInstance()); - _qmfClassMapping.put("link", LinkConfigType.getInstance()); - _qmfClassMapping.put("bridge", BridgeConfigType.getInstance()); - } - - private final Map<ConfigObjectType, ConfigObjectAdapter> _adapterMap = - new HashMap<ConfigObjectType, ConfigObjectAdapter>(); - private final Map<ConfigObjectType,QMFClass> _classMap = - new HashMap<ConfigObjectType,QMFClass>(); - - - private final ConcurrentHashMap<QMFClass,ConcurrentHashMap<ConfiguredObject, QMFObject>> _managedObjects = - new ConcurrentHashMap<QMFClass,ConcurrentHashMap<ConfiguredObject, QMFObject>>(); - - private final ConcurrentHashMap<QMFClass,ConcurrentHashMap<UUID, QMFObject>> _managedObjectsById = - new ConcurrentHashMap<QMFClass,ConcurrentHashMap<UUID, QMFObject>>(); - - private static final BrokerSchema PACKAGE = BrokerSchema.getPackage(); - - public static interface Listener - { - public void objectCreated(QMFObject obj); - public void objectDeleted(QMFObject obj); - } - - private final CopyOnWriteArrayList<Listener> _listeners = new CopyOnWriteArrayList<Listener>(); - - abstract class ConfigObjectAdapter<Q extends QMFObject<S,D>, S extends QMFObjectClass<Q,D>, D extends QMFObject.Delegate, T extends ConfigObjectType<T,C>, C extends ConfiguredObject<T,C>> - { - private final T _type; - private final S _qmfClass; - - - protected ConfigObjectAdapter(final T type, final S qmfClass) - { - _type = type; - _qmfClass = qmfClass; - _adapterMap.put(type,this); - _classMap.put(type,qmfClass); - } - - public T getType() - { - return _type; - } - - public S getQMFClass() - { - return _qmfClass; - } - - protected final Q newInstance(D delegate) - { - return _qmfClass.newInstance(delegate); - } - - public abstract Q createQMFObject(C configObject); - } - - private ConfigObjectAdapter<BrokerSchema.SystemObject, - BrokerSchema.SystemClass, - BrokerSchema.SystemDelegate, - SystemConfigType, - SystemConfig> _systemObjectAdapter = - new ConfigObjectAdapter<BrokerSchema.SystemObject, - BrokerSchema.SystemClass, - BrokerSchema.SystemDelegate, - SystemConfigType, - SystemConfig>(SystemConfigType.getInstance(), - PACKAGE.getQMFClassInstance(BrokerSchema.SystemClass.class)) - { - - - public BrokerSchema.SystemObject createQMFObject( - final SystemConfig configObject) - { - return newInstance(new SystemDelegate(configObject)); - } - }; - - private ConfigObjectAdapter<BrokerSchema.BrokerObject, - BrokerSchema.BrokerClass, - BrokerSchema.BrokerDelegate, - BrokerConfigType, - BrokerConfig> _brokerObjectAdapter = - new ConfigObjectAdapter<BrokerSchema.BrokerObject, - BrokerSchema.BrokerClass, - BrokerSchema.BrokerDelegate, - BrokerConfigType, - BrokerConfig>(BrokerConfigType.getInstance(), - PACKAGE.getQMFClassInstance(BrokerSchema.BrokerClass.class)) - { - - public BrokerSchema.BrokerObject createQMFObject( - final BrokerConfig configObject) - { - return newInstance(new BrokerDelegate(configObject)); - } - }; - - private ConfigObjectAdapter<BrokerSchema.VhostObject, - BrokerSchema.VhostClass, - BrokerSchema.VhostDelegate, - VirtualHostConfigType, - VirtualHostConfig> _vhostObjectAdapter = - new ConfigObjectAdapter<BrokerSchema.VhostObject, - BrokerSchema.VhostClass, - BrokerSchema.VhostDelegate, - VirtualHostConfigType, - VirtualHostConfig>(VirtualHostConfigType.getInstance(), - PACKAGE.getQMFClassInstance(BrokerSchema.VhostClass.class)) - { - - public BrokerSchema.VhostObject createQMFObject( - final VirtualHostConfig configObject) - { - return newInstance(new VhostDelegate(configObject)); - } - }; - - - private ConfigObjectAdapter<BrokerSchema.ExchangeObject, - BrokerSchema.ExchangeClass, - BrokerSchema.ExchangeDelegate, - ExchangeConfigType, - ExchangeConfig> _exchangeObjectAdapter = - new ConfigObjectAdapter<BrokerSchema.ExchangeObject, - BrokerSchema.ExchangeClass, - BrokerSchema.ExchangeDelegate, - ExchangeConfigType, - ExchangeConfig>(ExchangeConfigType.getInstance(), - PACKAGE.getQMFClassInstance(BrokerSchema.ExchangeClass.class)) - { - - public BrokerSchema.ExchangeObject createQMFObject( - final ExchangeConfig configObject) - { - return newInstance(new ExchangeDelegate(configObject)); - } - }; - - - private ConfigObjectAdapter<BrokerSchema.QueueObject, - BrokerSchema.QueueClass, - BrokerSchema.QueueDelegate, - QueueConfigType, - QueueConfig> _queueObjectAdapter = - new ConfigObjectAdapter<BrokerSchema.QueueObject, - BrokerSchema.QueueClass, - BrokerSchema.QueueDelegate, - QueueConfigType, - QueueConfig>(QueueConfigType.getInstance(), - PACKAGE.getQMFClassInstance(BrokerSchema.QueueClass.class)) - { - - public BrokerSchema.QueueObject createQMFObject( - final QueueConfig configObject) - { - return newInstance(new QueueDelegate(configObject)); - } - }; - - - private ConfigObjectAdapter<BrokerSchema.BindingObject, - BrokerSchema.BindingClass, - BrokerSchema.BindingDelegate, - BindingConfigType, - BindingConfig> _bindingObjectAdapter = - new ConfigObjectAdapter<BrokerSchema.BindingObject, - BrokerSchema.BindingClass, - BrokerSchema.BindingDelegate, - BindingConfigType, - BindingConfig>(BindingConfigType.getInstance(), - PACKAGE.getQMFClassInstance(BrokerSchema.BindingClass.class)) - { - - public BrokerSchema.BindingObject createQMFObject( - final BindingConfig configObject) - { - return newInstance(new BindingDelegate(configObject)); - } - }; - - - private ConfigObjectAdapter<BrokerSchema.ConnectionObject, - BrokerSchema.ConnectionClass, - BrokerSchema.ConnectionDelegate, - ConnectionConfigType, - ConnectionConfig> _connectionObjectAdapter = - new ConfigObjectAdapter<BrokerSchema.ConnectionObject, - BrokerSchema.ConnectionClass, - BrokerSchema.ConnectionDelegate, - ConnectionConfigType, - ConnectionConfig>(ConnectionConfigType.getInstance(), - PACKAGE.getQMFClassInstance(BrokerSchema.ConnectionClass.class)) - { - - public BrokerSchema.ConnectionObject createQMFObject( - final ConnectionConfig configObject) - { - return newInstance(new ConnectionDelegate(configObject)); - } - }; - - - private ConfigObjectAdapter<BrokerSchema.SessionObject, - BrokerSchema.SessionClass, - BrokerSchema.SessionDelegate, - SessionConfigType, - SessionConfig> _sessionObjectAdapter = - new ConfigObjectAdapter<BrokerSchema.SessionObject, - BrokerSchema.SessionClass, - BrokerSchema.SessionDelegate, - SessionConfigType, - SessionConfig>(SessionConfigType.getInstance(), - PACKAGE.getQMFClassInstance(BrokerSchema.SessionClass.class)) - { - - public BrokerSchema.SessionObject createQMFObject( - final SessionConfig configObject) - { - return newInstance(new SessionDelegate(configObject)); - } - }; - - private ConfigObjectAdapter<BrokerSchema.SubscriptionObject, - BrokerSchema.SubscriptionClass, - BrokerSchema.SubscriptionDelegate, - SubscriptionConfigType, - SubscriptionConfig> _subscriptionObjectAdapter = - new ConfigObjectAdapter<BrokerSchema.SubscriptionObject, - BrokerSchema.SubscriptionClass, - BrokerSchema.SubscriptionDelegate, - SubscriptionConfigType, - SubscriptionConfig>(SubscriptionConfigType.getInstance(), - PACKAGE.getQMFClassInstance(BrokerSchema.SubscriptionClass.class)) - { - - public BrokerSchema.SubscriptionObject createQMFObject( - final SubscriptionConfig configObject) - { - return newInstance(new SubscriptionDelegate(configObject)); - } - }; - - - private ConfigObjectAdapter<BrokerSchema.LinkObject, - BrokerSchema.LinkClass, - BrokerSchema.LinkDelegate, - LinkConfigType, - LinkConfig> _linkObjectAdapter = - new ConfigObjectAdapter<BrokerSchema.LinkObject, - BrokerSchema.LinkClass, - BrokerSchema.LinkDelegate, - LinkConfigType, - LinkConfig>(LinkConfigType.getInstance(), - PACKAGE.getQMFClassInstance(BrokerSchema.LinkClass.class)) - { - - public BrokerSchema.LinkObject createQMFObject( - final LinkConfig configObject) - { - return newInstance(new LinkDelegate(configObject)); - } - }; - - - private ConfigObjectAdapter<BrokerSchema.BridgeObject, - BrokerSchema.BridgeClass, - BrokerSchema.BridgeDelegate, - BridgeConfigType, - BridgeConfig> _bridgeObjectAdapter = - new ConfigObjectAdapter<BrokerSchema.BridgeObject, - BrokerSchema.BridgeClass, - BrokerSchema.BridgeDelegate, - BridgeConfigType, - BridgeConfig>(BridgeConfigType.getInstance(), - PACKAGE.getQMFClassInstance(BrokerSchema.BridgeClass.class)) - { - - public BrokerSchema.BridgeObject createQMFObject( - final BridgeConfig configObject) - { - return newInstance(new BridgeDelegate(configObject)); - } - }; - - - - public QMFService(ConfigStore configStore, IApplicationRegistry applicationRegistry) - { - _configStore = configStore; - _applicationRegistry = applicationRegistry; - registerSchema(PACKAGE); - - for(ConfigObjectType v : _qmfClassMapping.values()) - { - configStore.addConfigEventListener(v, this); - } - init(); - } - - public void close() - { - for(ConfigObjectType v : _qmfClassMapping.values()) - { - _configStore.removeConfigEventListener(v, this); - } - _listeners.clear(); - - _managedObjects.clear(); - _managedObjectsById.clear(); - _classMap.clear(); - _adapterMap.clear(); - _supportedSchemas.clear(); - } - - - public void registerSchema(QMFPackage qmfPackage) - { - _supportedSchemas.put(qmfPackage.getName(), qmfPackage); - } - - - public Collection<QMFPackage> getSupportedSchemas() - { - return _supportedSchemas.values(); - } - - public QMFPackage getPackage(String aPackage) - { - return _supportedSchemas.get(aPackage); - } - - public void onEvent(final ConfiguredObject object, final ConfigStore.Event evt) - { - - switch (evt) - { - case CREATED: - manageObject(object); - break; - - case DELETED: - unmanageObject(object); - break; - } - } - - public QMFObject getObjectById(QMFClass qmfclass, UUID id) - { - ConcurrentHashMap<UUID, QMFObject> map = _managedObjectsById.get(qmfclass); - if(map != null) - { - - UUID key = new UUID(id.getMostSignificantBits() & (0xFFFl << 48), id.getLeastSignificantBits()); - return map.get(key); - - } - else - { - return null; - } - } - - private void unmanageObject(final ConfiguredObject object) - { - final QMFClass qmfClass = _classMap.get(object.getConfigType()); - - if(qmfClass == null) - { - return; - } - - ConcurrentHashMap<ConfiguredObject, QMFObject> classObjects = _managedObjects.get(qmfClass); - if(classObjects != null) - { - QMFObject qmfObject = classObjects.remove(object); - if(qmfObject != null) - { - _managedObjectsById.get(qmfClass).remove(object.getQMFId()); - objectRemoved(qmfObject); - } - } - } - - private void manageObject(final ConfiguredObject object) - { - ConfigObjectAdapter adapter = _adapterMap.get(object.getConfigType()); - QMFObject qmfObject = adapter.createQMFObject(object); - final QMFClass qmfClass = qmfObject.getQMFClass(); - ConcurrentHashMap<ConfiguredObject, QMFObject> classObjects = _managedObjects.get(qmfClass); - - if(classObjects == null) - { - classObjects = new ConcurrentHashMap<ConfiguredObject, QMFObject>(); - if(_managedObjects.putIfAbsent(qmfClass, classObjects) != null) - { - classObjects = _managedObjects.get(qmfClass); - } - } - - ConcurrentHashMap<UUID, QMFObject> classObjectsById = _managedObjectsById.get(qmfClass); - if(classObjectsById == null) - { - classObjectsById = new ConcurrentHashMap<UUID, QMFObject>(); - if(_managedObjectsById.putIfAbsent(qmfClass, classObjectsById) != null) - { - classObjectsById = _managedObjectsById.get(qmfClass); - } - } - - classObjectsById.put(object.getQMFId(),qmfObject); - - if(classObjects.putIfAbsent(object, qmfObject) == null) - { - objectAdded(qmfObject); - } - } - - private void objectRemoved(final QMFObject qmfObject) - { - qmfObject.setDeleteTime(); - for(Listener l : _listeners) - { - l.objectDeleted(qmfObject); - } - } - - private void objectAdded(final QMFObject qmfObject) - { - for(Listener l : _listeners) - { - l.objectCreated(qmfObject); - } - } - - public void addListener(Listener l) - { - _listeners.add(l); - } - - public void removeListener(Listener l) - { - _listeners.remove(l); - } - - - private void init() - { - for(QMFClass qmfClass : PACKAGE.getClasses()) - { - ConfigObjectType configType = getConfigType(qmfClass); - if(configType != null) - { - Collection<ConfiguredObject> objects = _configStore.getConfiguredObjects(configType); - for(ConfiguredObject object : objects) - { - manageObject(object); - } - } - } - } - - public Collection<QMFObject> getObjects(QMFClass qmfClass) - { - ConcurrentHashMap<ConfiguredObject, QMFObject> classObjects = _managedObjects.get(qmfClass); - if(classObjects != null) - { - return classObjects.values(); - } - else - { - return Collections.EMPTY_SET; - } - } - - private QMFObject adapt(final ConfiguredObject object) - { - if(object == null) - { - return null; - } - - QMFClass qmfClass = _classMap.get(object.getConfigType()); - ConcurrentHashMap<ConfiguredObject, QMFObject> classObjects = _managedObjects.get(qmfClass); - if(classObjects != null) - { - QMFObject qmfObject = classObjects.get(object); - if(qmfObject != null) - { - return qmfObject; - } - } - - return _adapterMap.get(object.getConfigType()).createQMFObject(object); - } - - private ConfigObjectType getConfigType(final QMFClass qmfClass) - { - return _qmfClassMapping.get(qmfClass.getName()); - } - - private static class SystemDelegate implements BrokerSchema.SystemDelegate - { - private final SystemConfig _obj; - - public SystemDelegate(final SystemConfig obj) - { - _obj = obj; - } - - public UUID getSystemId() - { - return _obj.getQMFId(); - } - - public String getOsName() - { - return _obj.getOperatingSystemName(); - } - - public String getNodeName() - { - return _obj.getNodeName(); - } - - public String getRelease() - { - return _obj.getOSRelease(); - } - - public String getVersion() - { - return _obj.getOSVersion(); - } - - public String getMachine() - { - return _obj.getOSArchitecture(); - } - - public UUID getQMFId() - { - return _obj.getQMFId(); - } - - public long getCreateTime() - { - return _obj.getCreateTime(); - } - - public String toString() - { - return _obj.toString(); - } - } - - private class BrokerDelegate implements BrokerSchema.BrokerDelegate - { - private final BrokerConfig _obj; - - public BrokerDelegate(final BrokerConfig obj) - { - _obj = obj; - } - - public BrokerSchema.SystemObject getSystemRef() - { - return (BrokerSchema.SystemObject) adapt(_obj.getSystem()); - } - - public String getName() - { - return "amqp-broker"; - } - - public Integer getPort() - { - return _obj.getPort(); - } - - public Integer getWorkerThreads() - { - return _obj.getWorkerThreads(); - } - - public Integer getMaxConns() - { - return _obj.getMaxConnections(); - } - - public Integer getConnBacklog() - { - return _obj.getConnectionBacklogLimit(); - } - - public Long getStagingThreshold() - { - return _obj.getStagingThreshold(); - } - - public Boolean getMgmtPublish() - { - return true; - } - - public Integer getMgmtPubInterval() - { - return _obj.getManagementPublishInterval(); - } - - public String getVersion() - { - return _obj.getVersion(); - } - - public String getDataDir() - { - return _obj.getDataDirectory(); - } - - public Long getUptime() - { - return (System.currentTimeMillis() - _obj.getCreateTime()) * 1000000L; - } - - public Long getQueueCount() - { - // TODO - return 0L; - } - - public Long getMsgTotalEnqueues() - { - // TODO - return 0L; - } - - public Long getMsgTotalDequeues() - { - // TODO - return 0L; - } - - public Long getByteTotalEnqueues() - { - // TODO - return 0L; - } - - public Long getByteTotalDequeues() - { - // TODO - return 0L; - } - - public Long getMsgDepth() - { - // TODO - return 0L; - } - - public Long getByteDepth() - { - // TODO - return 0L; - } - - public Long getMsgPersistEnqueues() - { - // TODO - return 0L; - } - - public Long getMsgPersistDequeues() - { - // TODO - return 0L; - } - - public Long getBytePersistEnqueues() - { - // TODO - return 0L; - } - - public Long getBytePersistDequeues() - { - // TODO - return 0L; - } - - public Long getMsgTxnEnqueues() - { - // TODO - return 0L; - } - - public Long getMsgTxnDequeues() - { - // TODO - return 0L; - } - - public Long getByteTxnEnqueues() - { - // TODO - return 0L; - } - - public Long getByteTxnDequeues() - { - // TODO - return 0L; - } - - public Long getMsgFtdEnqueues() - { - // TODO - return 0L; - } - - public Long getMsgFtdDequeues() - { - // TODO - return 0L; - } - - public Long getByteFtdEnqueues() - { - // TODO - return 0L; - } - - public Long getByteFtdDequeues() - { - // TODO - return 0L; - } - - public Long getMsgFtdDepth() - { - // TODO - return 0L; - } - - public Long getByteFtdDepth() - { - // TODO - return 0L; - } - - public Long getReleases() - { - // TODO - return 0L; - } - - public Long getAcquires() - { - // TODO - return 0L; - } - - public Long getDiscardsNoRoute() - { - // TODO - return 0L; - } - - public Long getDiscardsTtl() - { - // TODO - return 0L; - } - - public Long getDiscardsRing() - { - // TODO - return 0L; - } - - public Long getDiscardsLvq() - { - // TODO - return 0L; - } - - public Long getDiscardsOverflow() - { - // TODO - return 0L; - } - - public Long getDiscardsSubscriber() - { - // TODO - return 0L; - } - - public Long getDiscardsPurge() - { - // TODO - return 0L; - } - - public Long getReroutes() - { - // TODO - return 0L; - } - - public Long getAbandoned() - { - // TODO - return 0L; - } - - public Long getAbandonedViaAlt() - { - // TODO - return 0L; - } - - public BrokerSchema.BrokerClass.EchoMethodResponseCommand echo(final BrokerSchema.BrokerClass.EchoMethodResponseCommandFactory factory, - final Long sequence, - final String body) - { - return factory.createResponseCommand(sequence, body); - } - - public BrokerSchema.BrokerClass.ConnectMethodResponseCommand connect(final BrokerSchema.BrokerClass.ConnectMethodResponseCommandFactory factory, - final String host, - final Long port, - final Boolean durable, - final String authMechanism, - final String username, - final String password, - final String transport) - { - _obj.createBrokerConnection(transport, host, port.intValue(), durable, authMechanism, username, password); - - return factory.createResponseCommand(); - } - - public BrokerSchema.BrokerClass.QueueMoveMessagesMethodResponseCommand queueMoveMessages(final BrokerSchema.BrokerClass.QueueMoveMessagesMethodResponseCommandFactory factory, - final String srcQueue, - final String destQueue, - final Long qty, - final Map filter) // TODO: move based on group identifier - { - // TODO - return factory.createResponseCommand(CompletionCode.NOT_IMPLEMENTED); - } - - public BrokerSchema.BrokerClass.GetLogLevelMethodResponseCommand getLogLevel(final BrokerSchema.BrokerClass.GetLogLevelMethodResponseCommandFactory factory) - { - // TODO: The Java broker has numerous loggers, so we can't really implement this method properly. - return factory.createResponseCommand(CompletionCode.NOT_IMPLEMENTED); - } - - public BrokerSchema.BrokerClass.SetLogLevelMethodResponseCommand setLogLevel(final BrokerSchema.BrokerClass.SetLogLevelMethodResponseCommandFactory factory, String level) - { - // TODO: The Java broker has numerous loggers, so we can't really implement this method properly. - return factory.createResponseCommand(CompletionCode.NOT_IMPLEMENTED); - } - - public BrokerSchema.BrokerClass.GetTimestampConfigMethodResponseCommand getTimestampConfig(final BrokerSchema.BrokerClass.GetTimestampConfigMethodResponseCommandFactory factory) - { - // TODO: timestamp support - return factory.createResponseCommand(CompletionCode.NOT_IMPLEMENTED); - } - - public BrokerSchema.BrokerClass.SetTimestampConfigMethodResponseCommand setTimestampConfig(final BrokerSchema.BrokerClass.SetTimestampConfigMethodResponseCommandFactory factory, - final java.lang.Boolean receive) - { - // TODO: timestamp support - return factory.createResponseCommand(CompletionCode.NOT_IMPLEMENTED); - } - - public BrokerSchema.BrokerClass.CreateMethodResponseCommand create(final BrokerSchema.BrokerClass.CreateMethodResponseCommandFactory factory, - final String type, - final String name, - final Map properties, - final java.lang.Boolean lenient) - { - //TODO: - return factory.createResponseCommand(CompletionCode.NOT_IMPLEMENTED); - } - - public BrokerSchema.BrokerClass.DeleteMethodResponseCommand delete(final BrokerSchema.BrokerClass.DeleteMethodResponseCommandFactory factory, - final String type, - final String name, - final Map options) - { - //TODO: - return factory.createResponseCommand(CompletionCode.NOT_IMPLEMENTED); - } - - public BrokerSchema.BrokerClass.QueryMethodResponseCommand query(final BrokerSchema.BrokerClass.QueryMethodResponseCommandFactory factory, - final String type, - final String name) - { - //TODO: - return factory.createResponseCommand(CompletionCode.NOT_IMPLEMENTED); - } - - public UUID getQMFId() - { - return _obj.getQMFId(); - } - - public long getCreateTime() - { - return _obj.getCreateTime(); - } - - public String toString() - { - return _obj.toString(); - } - } - - private class VhostDelegate implements BrokerSchema.VhostDelegate - { - private final VirtualHostConfig _obj; - - public VhostDelegate(final VirtualHostConfig obj) - { - _obj = obj; - } - - public BrokerSchema.BrokerObject getBrokerRef() - { - return (BrokerSchema.BrokerObject) adapt(_obj.getBroker()); - } - - public String getName() - { - return _obj.getName(); - } - - public String getFederationTag() - { - return _obj.getFederationTag(); - } - - public UUID getQMFId() - { - return _obj.getQMFId(); - } - - public long getCreateTime() - { - return _obj.getCreateTime(); - } - - public String toString() - { - return _obj.toString(); - } - } - - private class ExchangeDelegate implements BrokerSchema.ExchangeDelegate - { - private final ExchangeConfig _obj; - - public ExchangeDelegate(final ExchangeConfig obj) - { - _obj = obj; - } - - public BrokerSchema.VhostObject getVhostRef() - { - return (BrokerSchema.VhostObject) adapt(_obj.getVirtualHost()); - } - - public String getName() - { - return _obj.getName(); - } - - public String getType() - { - return _obj.getType().getName().toString(); - } - - public Boolean getDurable() - { - return _obj.isDurable(); - } - - public Boolean getAutoDelete() - { - return _obj.isAutoDelete(); - } - - public BrokerSchema.ExchangeObject getAltExchange() - { - if(_obj.getAlternateExchange() != null) - { - return (BrokerSchema.ExchangeObject) adapt(_obj.getAlternateExchange()); - } - else - { - return null; - } - } - - public Map getArguments() - { - return _obj.getArguments(); - } - - public Long getProducerCount() - { - // TODO - return 0l; - } - - public Long getProducerCountHigh() - { - // TODO - return 0l; - } - - public Long getProducerCountLow() - { - // TODO - return 0l; - } - - public Long getBindingCount() - { - return _obj.getBindingCount(); - } - - public Long getBindingCountHigh() - { - return _obj.getBindingCountHigh(); - } - - public Long getBindingCountLow() - { - // TODO - return 0l; - } - - public Long getMsgReceives() - { - return _obj.getMsgReceives(); - } - - public Long getMsgDrops() - { - return getMsgReceives() - getMsgRoutes(); - } - - public Long getMsgRoutes() - { - return _obj.getMsgRoutes(); - } - - public Long getByteReceives() - { - return _obj.getByteReceives(); - } - - public Long getByteDrops() - { - return getByteReceives() - getByteRoutes(); - } - - public Long getByteRoutes() - { - return _obj.getByteRoutes(); - } - - public UUID getQMFId() - { - return _obj.getQMFId(); - } - - public long getCreateTime() - { - return _obj.getCreateTime(); - } - - public String toString() - { - return _obj.toString(); - } - } - - private class QueueDelegate implements BrokerSchema.QueueDelegate - { - private final QueueConfig _obj; - - public QueueDelegate(final QueueConfig obj) - { - _obj = obj; - } - - public BrokerSchema.VhostObject getVhostRef() - { - return (BrokerSchema.VhostObject) adapt(_obj.getVirtualHost()); - } - - public String getName() - { - return _obj.getName(); - } - - public Boolean getDurable() - { - return _obj.isDurable(); - } - - public Boolean getAutoDelete() - { - return _obj.isAutoDelete(); - } - - public Boolean getExclusive() - { - return _obj.isExclusive(); - } - - public BrokerSchema.ExchangeObject getAltExchange() - { - if(_obj.getAlternateExchange() != null) - { - return (BrokerSchema.ExchangeObject) adapt(_obj.getAlternateExchange()); - } - else - { - return null; - } - } - - public Long getMsgTotalEnqueues() - { - return _obj.getReceivedMessageCount(); - } - - public Long getMsgTotalDequeues() - { - return _obj.getMessageDequeueCount(); - } - - public Long getMsgTxnEnqueues() - { - return _obj.getMsgTxnEnqueues(); - } - - public Long getMsgTxnDequeues() - { - return _obj.getMsgTxnDequeues(); - } - - public Long getMsgPersistEnqueues() - { - return _obj.getPersistentMsgEnqueues(); - } - - public Long getMsgPersistDequeues() - { - return _obj.getPersistentMsgDequeues(); - } - - public Long getMsgDepth() - { - return (long) _obj.getMessageCount(); - } - - public Long getByteDepth() - { - return _obj.getQueueDepth(); - } - - public Long getByteTotalEnqueues() - { - return _obj.getTotalEnqueueSize(); - } - - public Long getByteTotalDequeues() - { - return _obj.getTotalDequeueSize(); - } - - public Long getByteTxnEnqueues() - { - return _obj.getByteTxnEnqueues(); - } - - public Long getByteTxnDequeues() - { - return _obj.getByteTxnDequeues(); - } - - public Long getBytePersistEnqueues() - { - return _obj.getPersistentByteEnqueues(); - } - - public Long getBytePersistDequeues() - { - return _obj.getPersistentByteDequeues(); - } - - public Long getMsgFtdEnqueues() - { - // TODO - return 0L; - } - - public Long getMsgFtdDequeues() - { - // TODO - return 0L; - } - - public Long getByteFtdEnqueues() - { - // TODO - return 0L; - } - - public Long getByteFtdDequeues() - { - // TODO - return 0L; - } - - public Long getMsgFtdDepth() - { - // TODO - return 0L; - } - - public Long getByteFtdDepth() - { - // TODO - return 0L; - } - - public Long getReleases() - { - // TODO - return 0L; - } - - public Long getAcquires() - { - // TODO - return 0L; - } - - public Long getDiscardsTtl() - { - // TODO - return 0L; - } - - public Long getDiscardsRing() - { - // TODO - return 0L; - } - - public Long getDiscardsLvq() - { - // TODO - return 0L; - } - - public Long getDiscardsOverflow() - { - // TODO - return 0L; - } - - public Long getDiscardsSubscriber() - { - // TODO - return 0L; - } - - public Long getDiscardsPurge() - { - // TODO - return 0L; - } - - public Long getReroutes() - { - // TODO - return 0L; - } - - public Long getConsumerCount() - { - return (long) _obj.getConsumerCount(); - } - - public Long getConsumerCountHigh() - { - return (long) _obj.getConsumerCountHigh(); - } - - public Long getConsumerCountLow() - { - // TODO - return 0l; - } - - public Long getBindingCount() - { - return (long) _obj.getBindingCount(); - } - - public Long getBindingCountHigh() - { - return (long) _obj.getBindingCountHigh(); - } - - public Long getBindingCountLow() - { - // TODO - return 0l; - } - - public Long getUnackedMessages() - { - return _obj.getUnackedMessageCount(); - } - - public Long getUnackedMessagesHigh() - { - return _obj.getUnackedMessageCountHigh(); - } - - public Long getUnackedMessagesLow() - { - // TODO - return 0l; - } - - public Long getMessageLatencySamples() - { - // TODO - return 0l; - } - - public Long getMessageLatencyMin() - { - // TODO - return 0l; - } - - public Long getMessageLatencyMax() - { - // TODO - return 0l; - } - - public Long getMessageLatencyAverage() - { - // TODO - return 0l; - } - - public Boolean getFlowStopped() - { - return Boolean.FALSE; - } - - public Long getFlowStoppedCount() - { - return 0L; - } - - public BrokerSchema.QueueClass.PurgeMethodResponseCommand purge(final BrokerSchema.QueueClass.PurgeMethodResponseCommandFactory factory, - final Long request, - final Map filter) // TODO: support for purge-by-group-identifier - { - try - { - _obj.purge(request); - } catch (AMQException e) - { - // TODO - throw new RuntimeException(); - } - return factory.createResponseCommand(); - } - - public BrokerSchema.QueueClass.RerouteMethodResponseCommand reroute(final BrokerSchema.QueueClass.RerouteMethodResponseCommandFactory factory, - final Long request, - final Boolean useAltExchange, - final String exchange, - final Map filter) // TODO: support for re-route-by-group-identifier - { - //TODO - return factory.createResponseCommand(CompletionCode.NOT_IMPLEMENTED); - } - - - public Map getArguments() - { - return _obj.getArguments(); - } - - public UUID getQMFId() - { - return _obj.getQMFId(); - } - - public long getCreateTime() - { - return _obj.getCreateTime(); - } - - public String toString() - { - return _obj.toString(); - } - } - - private class BindingDelegate implements BrokerSchema.BindingDelegate - { - private final BindingConfig _obj; - - public BindingDelegate(final BindingConfig obj) - { - _obj = obj; - } - - public BrokerSchema.ExchangeObject getExchangeRef() - { - return (BrokerSchema.ExchangeObject) adapt(_obj.getExchange()); - } - - public BrokerSchema.QueueObject getQueueRef() - { - return (BrokerSchema.QueueObject) adapt(_obj.getQueue()); - } - - public String getBindingKey() - { - return _obj.getBindingKey(); - } - - public Map getArguments() - { - return _obj.getArguments(); - } - - public String getOrigin() - { - return _obj.getOrigin(); - } - - public Long getMsgMatched() - { - // TODO - return _obj.getMatches(); - } - - public UUID getQMFId() - { - return _obj.getQMFId(); - } - - public long getCreateTime() - { - return _obj.getCreateTime(); - } - - public String toString() - { - return _obj.toString(); - } - } - - private class ConnectionDelegate implements BrokerSchema.ConnectionDelegate - { - private final ConnectionConfig _obj; - - public ConnectionDelegate(final ConnectionConfig obj) - { - _obj = obj; - } - - public BrokerSchema.VhostObject getVhostRef() - { - return (BrokerSchema.VhostObject) adapt(_obj.getVirtualHost()); - } - - public String getAddress() - { - return _obj.getAddress(); - } - - public Boolean getIncoming() - { - return _obj.isIncoming(); - } - - public Boolean getSystemConnection() - { - return _obj.isSystemConnection(); - } - - public Boolean getFederationLink() - { - return _obj.isFederationLink(); - } - - public String getAuthIdentity() - { - return _obj.getAuthId(); - } - - public String getRemoteProcessName() - { - return _obj.getRemoteProcessName(); - } - - public Long getRemotePid() - { - Integer remotePID = _obj.getRemotePID(); - return remotePID == null ? null : (long) remotePID; - } - - public Long getRemoteParentPid() - { - Integer remotePPID = _obj.getRemoteParentPID(); - return remotePPID == null ? null : (long) remotePPID; - - } - - public Boolean getClosing() - { - return false; - } - - public Long getFramesFromClient() - { - // TODO - return 0l; - } - - public Long getFramesToClient() - { - // TODO - return 0l; - } - - public Long getBytesFromClient() - { - // TODO - return 0l; - } - - public Long getBytesToClient() - { - // TODO - return 0l; - } - - public Long getMsgsFromClient() - { - // TODO - return 0l; - } - - public Long getMsgsToClient() - { - // TODO - return 0l; - } - - public BrokerSchema.ConnectionClass.CloseMethodResponseCommand close(final BrokerSchema.ConnectionClass.CloseMethodResponseCommandFactory factory) - { - _obj.mgmtClose(); - - return factory.createResponseCommand(); - } - - public UUID getQMFId() - { - return _obj.getQMFId(); - } - - public long getCreateTime() - { - return _obj.getCreateTime(); - } - - public Boolean getShadow() - { - return _obj.isShadow(); - } - - public Boolean getUserProxyAuth() - { - // TODO - return false; - } - - public String getSaslMechanism() - { - // TODO - return null; - } - public Integer getSaslSsf() - { - // TODO - return 0; - } - - - public String toString() - { - return _obj.toString(); - } - } - - private class SessionDelegate implements BrokerSchema.SessionDelegate - { - private final SessionConfig _obj; - - public SessionDelegate(final SessionConfig obj) - { - _obj = obj; - } - - public BrokerSchema.VhostObject getVhostRef() - { - return (BrokerSchema.VhostObject) adapt(_obj.getVirtualHost()); - } - - public String getName() - { - return _obj.getSessionName(); - } - - public Integer getChannelId() - { - return _obj.getChannel(); - } - - public BrokerSchema.ConnectionObject getConnectionRef() - { - return (BrokerSchema.ConnectionObject) adapt(_obj.getConnectionConfig()); - } - - public Long getDetachedLifespan() - { - return _obj.getDetachedLifespan(); - } - - public Boolean getAttached() - { - return _obj.isAttached(); - } - - public Long getExpireTime() - { - return _obj.getExpiryTime(); - } - - public Long getMaxClientRate() - { - return _obj.getMaxClientRate(); - } - - public Long getFramesOutstanding() - { - // TODO - return 0l; - } - - public Long getUnackedMessages() - { - // TODO - return 0l; - } - - public Long getTxnStarts() - { - return _obj.getTxnStarts(); - } - - public Long getTxnCommits() - { - return _obj.getTxnCommits(); - } - - public Long getTxnRejects() - { - return _obj.getTxnRejects(); - } - - public Long getTxnCount() - { - return _obj.getTxnCount(); - } - - public Long getClientCredit() - { - // TODO - return 0l; - } - - public BrokerSchema.SessionClass.SolicitAckMethodResponseCommand solicitAck(final BrokerSchema.SessionClass.SolicitAckMethodResponseCommandFactory factory) - { - //TODO - return factory.createResponseCommand(CompletionCode.NOT_IMPLEMENTED); - } - - public BrokerSchema.SessionClass.DetachMethodResponseCommand detach(final BrokerSchema.SessionClass.DetachMethodResponseCommandFactory factory) - { - //TODO - return factory.createResponseCommand(CompletionCode.NOT_IMPLEMENTED); - } - - public BrokerSchema.SessionClass.ResetLifespanMethodResponseCommand resetLifespan(final BrokerSchema.SessionClass.ResetLifespanMethodResponseCommandFactory factory) - { - //TODO - return factory.createResponseCommand(CompletionCode.NOT_IMPLEMENTED); - } - - public BrokerSchema.SessionClass.CloseMethodResponseCommand close(final BrokerSchema.SessionClass.CloseMethodResponseCommandFactory factory) - { - try - { - _obj.mgmtClose(); - } - catch (AMQException e) - { - return factory.createResponseCommand(CompletionCode.EXCEPTION, e.getMessage()); - } - - return factory.createResponseCommand(); - } - - public UUID getQMFId() - { - return _obj.getQMFId(); - } - - public long getCreateTime() - { - return _obj.getCreateTime(); - } - - public String toString() - { - return _obj.toString(); - } - } - - private class SubscriptionDelegate implements BrokerSchema.SubscriptionDelegate - { - private final SubscriptionConfig _obj; - - private SubscriptionDelegate(final SubscriptionConfig obj) - { - _obj = obj; - } - - - public BrokerSchema.SessionObject getSessionRef() - { - return (BrokerSchema.SessionObject) adapt(_obj.getSessionConfig()); - } - - public BrokerSchema.QueueObject getQueueRef() - { - return (BrokerSchema.QueueObject) adapt(_obj.getQueue()); - } - - public String getName() - { - return _obj.getName(); - } - - public Boolean getBrowsing() - { - return _obj.isBrowsing(); - } - - public Boolean getAcknowledged() - { - return _obj.isExplicitAcknowledge(); - } - - public Boolean getExclusive() - { - return _obj.isExclusive(); - } - - public String getCreditMode() - { - return _obj.getCreditMode(); - } - - public Map getArguments() - { - return _obj.getArguments(); - } - - public Long getDelivered() - { - return _obj.getDelivered(); - } - - public UUID getQMFId() - { - return _obj.getQMFId(); - } - - public long getCreateTime() - { - return _obj.getCreateTime(); - } - - public String toString() - { - return _obj.toString(); - } - } - - private class BridgeDelegate implements BrokerSchema.BridgeDelegate - { - private final BridgeConfig _obj; - - private BridgeDelegate(final BridgeConfig obj) - { - _obj = obj; - } - - public BrokerSchema.LinkObject getLinkRef() - { - return (BrokerSchema.LinkObject) adapt(_obj.getLink()); - } - - public Integer getChannelId() - { - return _obj.getChannelId(); - } - - public Boolean getDurable() - { - return _obj.isDurable(); - } - - public String getSrc() - { - return _obj.getSource(); - } - - public String getDest() - { - return _obj.getDestination(); - } - - public String getKey() - { - return _obj.getKey(); - } - - public Boolean getSrcIsQueue() - { - return _obj.isQueueBridge(); - } - - public Boolean getSrcIsLocal() - { - return _obj.isLocalSource(); - } - - public String getTag() - { - return _obj.getTag(); - } - - public String getExcludes() - { - return _obj.getExcludes(); - } - - public Boolean getDynamic() - { - return _obj.isDynamic(); - } - - public Integer getSync() - { - return _obj.getAckBatching(); - } - - /* support TBD */ - public String getName() - { - return null; - } - - public BrokerSchema.BridgeClass.CloseMethodResponseCommand close(final BrokerSchema.BridgeClass.CloseMethodResponseCommandFactory factory) - { - return null; - } - - public UUID getQMFId() - { - return _obj.getQMFId(); - } - - public long getCreateTime() - { - return _obj.getCreateTime(); - } - - public String toString() - { - return _obj.toString(); - } - } - - private class LinkDelegate implements BrokerSchema.LinkDelegate - { - private final LinkConfig _obj; - - private LinkDelegate(final LinkConfig obj) - { - _obj = obj; - } - - public BrokerSchema.VhostObject getVhostRef() - { - return (BrokerSchema.VhostObject) adapt(_obj.getVirtualHost()); - } - - public String getHost() - { - return _obj.getHost(); - } - - public Integer getPort() - { - return _obj.getPort(); - } - - public String getTransport() - { - return _obj.getTransport(); - } - - public Boolean getDurable() - { - return _obj.isDurable(); - } - - public String getState() - { - return _obj.getState(); - } - - public String getLastError() - { - return _obj.getLastError(); - } - - /* support TBD */ - public String getName() - { - return null; - } - - /* support TBD */ - public BrokerSchema.ConnectionObject getConnectionRef() - { - return (BrokerSchema.ConnectionObject) null; - } - - public BrokerSchema.LinkClass.CloseMethodResponseCommand close(final BrokerSchema.LinkClass.CloseMethodResponseCommandFactory factory) - { - _obj.close(); - return factory.createResponseCommand(); - } - - public BrokerSchema.LinkClass.BridgeMethodResponseCommand bridge(final BrokerSchema.LinkClass.BridgeMethodResponseCommandFactory factory, - final Boolean durable, - final String src, - final String dest, - final String key, - final String tag, - final String excludes, - final Boolean srcIsQueue, - final Boolean srcIsLocal, - final Boolean dynamic, - final Integer sync) - { - _obj.createBridge(durable, dynamic, srcIsQueue, srcIsLocal, src, dest, key, tag, excludes); - return factory.createResponseCommand(); - } - - public UUID getQMFId() - { - return _obj.getQMFId(); - } - - public long getCreateTime() - { - return _obj.getCreateTime(); - } - - @Override - public String toString() - { - return _obj.toString(); - } - } - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFStatistic.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFStatistic.java deleted file mode 100644 index 89d650e03b..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFStatistic.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * - * 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.qmf; - -import org.apache.qpid.transport.codec.Encoder; - -import java.util.LinkedHashMap; - -public class QMFStatistic -{ - private final LinkedHashMap<String,Object> _map = new LinkedHashMap<String,Object>(); - private static final String NAME = "name"; - private static final String TYPE = "type"; - private static final String UNIT = "unit"; - private static final String DESCRIPTION = "desc"; - - - public QMFStatistic(String name, QMFType type, String unit, String description) - { - _map.put(NAME, name); - _map.put(TYPE, type.codeValue()); - if(unit != null) - { - _map.put(UNIT, unit); - } - if(description != null) - { - _map.put(DESCRIPTION, description); - } - - } - - public void encode(Encoder encoder) - { - encoder.writeMap(_map); - } - - public String getName() - { - return (String) _map.get(NAME); - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFType.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFType.java deleted file mode 100644 index 0e01c27db5..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFType.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * - * 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.qmf; - -public enum QMFType -{ - - UINT8, - UINT16, - UINT32, - UINT64, - UNKNOWN, - STR8, - STR16, - ABSTIME, - DELTATIME, - OBJECTREFERENCE, - BOOLEAN, - FLOAT, - DOUBLE, - UUID, - MAP, - INT8, - INT16, - INT32, - INT64, - OBJECT, - LIST, - ARRAY; - - public int codeValue() - { - return ordinal()+1; - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java index e197dddfde..4367d7ee53 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java @@ -53,11 +53,6 @@ import org.apache.qpid.framing.abstraction.MessagePublishInfo; import org.apache.qpid.protocol.AMQConstant; import org.apache.qpid.server.ack.UnacknowledgedMessageMap; import org.apache.qpid.server.ack.UnacknowledgedMessageMapImpl; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.ConfiguredObject; -import org.apache.qpid.server.configuration.ConnectionConfig; -import org.apache.qpid.server.configuration.SessionConfig; -import org.apache.qpid.server.configuration.SessionConfigType; import org.apache.qpid.server.exchange.Exchange; import org.apache.qpid.server.flow.FlowCreditManager; import org.apache.qpid.server.flow.Pre0_10CreditManager; @@ -97,7 +92,7 @@ import org.apache.qpid.server.txn.ServerTransaction; import org.apache.qpid.server.virtualhost.VirtualHost; import org.apache.qpid.transport.TransportException; -public class AMQChannel implements SessionConfig, AMQSessionModel, AsyncAutoCommitTransaction.FutureRecorder +public class AMQChannel implements AMQSessionModel, AsyncAutoCommitTransaction.FutureRecorder { public static final int DEFAULT_PREFETCH = 4096; @@ -169,12 +164,12 @@ public class AMQChannel implements SessionConfig, AMQSessionModel, AsyncAutoComm private List<QueueEntry> _resendList = new ArrayList<QueueEntry>(); private static final AMQShortString IMMEDIATE_DELIVERY_REPLY_TEXT = new AMQShortString("Immediate delivery is not possible."); - private final UUID _qmfId; private long _createTime = System.currentTimeMillis(); private final ClientDeliveryMethod _clientDeliveryMethod; private final TransactionTimeoutHelper _transactionTimeoutHelper; + private final UUID _id = UUID.randomUUID(); public AMQChannel(AMQProtocolSession session, int channelId, MessageStore messageStore) throws AMQException @@ -184,11 +179,8 @@ public class AMQChannel implements SessionConfig, AMQSessionModel, AsyncAutoComm _actor = new AMQPChannelActor(this, session.getLogActor().getRootMessageLogger()); _logSubject = new ChannelLogSubject(this); - _qmfId = getConfigStore().createId(); _actor.message(ChannelMessages.CREATE()); - getConfigStore().addConfiguredObject(this); - _messageStore = messageStore; // by default the session is non-transactional @@ -199,11 +191,6 @@ public class AMQChannel implements SessionConfig, AMQSessionModel, AsyncAutoComm _transactionTimeoutHelper = new TransactionTimeoutHelper(_logSubject); } - public ConfigStore getConfigStore() - { - return getVirtualHost().getConfigStore(); - } - /** Sets this channel to be part of a local transaction */ public void setLocalTransactional() { @@ -556,9 +543,6 @@ public class AMQChannel implements SessionConfig, AMQSessionModel, AsyncAutoComm { _logger.error("Caught TransportException whilst attempting to requeue:" + e); } - - getConfigStore().removeConfiguredObject(this); - } private void unsubscribeAllConsumers() throws AMQException @@ -1153,6 +1137,12 @@ public class AMQChannel implements SessionConfig, AMQSessionModel, AsyncAutoComm } + @Override + public UUID getId() + { + return _id; + } + public AMQConnectionModel getConnectionModel() { return _session; @@ -1168,6 +1158,12 @@ public class AMQChannel implements SessionConfig, AMQSessionModel, AsyncAutoComm return _logSubject; } + @Override + public int compareTo(AMQSessionModel o) + { + return getId().compareTo(o.getId()); + } + private class MessageDeliveryAction implements ServerTransaction.Action { private IncomingMessage _incommingMessage; @@ -1469,63 +1465,16 @@ public class AMQChannel implements SessionConfig, AMQSessionModel, AsyncAutoComm return getProtocolSession().getVirtualHost(); } - - public ConfiguredObject getParent() - { - return getVirtualHost(); - } - - public SessionConfigType getConfigType() - { - return SessionConfigType.getInstance(); - } - public int getChannel() { return getChannelId(); } - public boolean isAttached() - { - return true; - } - - public long getDetachedLifespan() - { - return 0; - } - - public ConnectionConfig getConnectionConfig() - { - return (AMQProtocolEngine)getProtocolSession(); - } - - public Long getExpiryTime() - { - return null; - } - - public Long getMaxClientRate() - { - return null; - } - public boolean isDurable() { return false; } - @Override - public UUID getQMFId() - { - return _qmfId; - } - - public String getSessionName() - { - return getConnectionConfig().getAddress() + "/" + getChannelId(); - } - public long getCreateTime() { return _createTime; @@ -1681,10 +1630,6 @@ public class AMQChannel implements SessionConfig, AMQSessionModel, AsyncAutoComm } } - public int compareTo(AMQSessionModel session) - { - return getQMFId().compareTo(session.getQMFId()); - } @Override public int getConsumerCount() diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/binding/Binding.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/binding/Binding.java index 9b3be624e0..469a4bb9d0 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/binding/Binding.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/binding/Binding.java @@ -35,13 +35,15 @@ public class Binding private final Exchange _exchange; private final Map<String, Object> _arguments; private final UUID _id; - private final UUID _qmfId; private final AtomicLong _matches = new AtomicLong(); - public Binding(UUID id, UUID qmfId, final String bindingKey, final AMQQueue queue, final Exchange exchange, final Map<String, Object> arguments) + public Binding(UUID id, + final String bindingKey, + final AMQQueue queue, + final Exchange exchange, + final Map<String, Object> arguments) { _id = id; - _qmfId = qmfId; _bindingKey = bindingKey; _queue = queue; _exchange = exchange; @@ -53,11 +55,6 @@ public class Binding return _id; } - public UUID getQMFId() - { - return _qmfId; - } - public String getBindingKey() { return _bindingKey; diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/binding/BindingFactory.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/binding/BindingFactory.java index b805056311..69ff081528 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/binding/BindingFactory.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/binding/BindingFactory.java @@ -24,10 +24,6 @@ import org.apache.qpid.AMQException; import org.apache.qpid.AMQInternalException; import org.apache.qpid.AMQSecurityException; import org.apache.qpid.framing.AMQShortString; -import org.apache.qpid.server.configuration.BindingConfig; -import org.apache.qpid.server.configuration.BindingConfigType; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.ConfiguredObject; import org.apache.qpid.server.exchange.Exchange; import org.apache.qpid.server.logging.actors.CurrentActor; import org.apache.qpid.server.logging.messages.BindingMessages; @@ -52,7 +48,7 @@ public class BindingFactory _virtualHost = vhost; } - private final class BindingImpl extends Binding implements AMQQueue.Task, Exchange.Task, BindingConfig + private final class BindingImpl extends Binding implements AMQQueue.Task, Exchange.Task { private final BindingLogSubject _logSubject; //TODO : persist creation time @@ -60,7 +56,7 @@ public class BindingFactory private BindingImpl(UUID id, String bindingKey, final AMQQueue queue, final Exchange exchange, final Map<String, Object> arguments) { - super(id, queue.getVirtualHost().getConfigStore().createId(), bindingKey, queue, exchange, arguments); + super(id, bindingKey, queue, exchange, arguments); _logSubject = new BindingLogSubject(bindingKey,exchange,queue); } @@ -96,16 +92,6 @@ public class BindingFactory return _createTime; } - public BindingConfigType getConfigType() - { - return BindingConfigType.getInstance(); - } - - public ConfiguredObject getParent() - { - return _virtualHost; - } - public boolean isDurable() { return getQueue().isDurable() && getExchange().isDurable(); @@ -186,7 +172,6 @@ public class BindingFactory exchange.addCloseTask(b); queue.addBinding(b); exchange.addBinding(b); - getConfigStore().addConfiguredObject(b); b.logCreation(); return true; @@ -197,11 +182,6 @@ public class BindingFactory } } - private ConfigStore getConfigStore() - { - return _virtualHost.getConfigStore(); - } - public void restoreBinding(final UUID id, final String bindingKey, final AMQQueue queue, final Exchange exchange, final Map<String, Object> argumentMap) throws AMQSecurityException, AMQInternalException { makeBinding(id, bindingKey,queue,exchange,argumentMap,true, false); @@ -257,7 +237,6 @@ public class BindingFactory _virtualHost.getMessageStore().unbindQueue(b); } b.logDestruction(); - getConfigStore().removeConfiguredObject(b); } return b; diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BindingConfig.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BindingConfig.java deleted file mode 100644 index 233134abc5..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BindingConfig.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.Map; - - -public interface BindingConfig extends ConfiguredObject<BindingConfigType, BindingConfig> -{ - - ExchangeConfig getExchange(); - - QueueConfig getQueue(); - - String getBindingKey(); - - Map<String, Object> getArguments(); - - String getOrigin(); - - long getMatches(); -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BindingConfigType.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BindingConfigType.java deleted file mode 100644 index 1ed6b38758..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BindingConfigType.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -public final class BindingConfigType extends ConfigObjectType<BindingConfigType, BindingConfig> -{ - private static final List<BindingProperty<?>> BINDING_PROPERTIES = new ArrayList<BindingProperty<?>>(); - - public static interface BindingProperty<S> extends ConfigProperty<BindingConfigType, BindingConfig, S> - { - } - - private abstract static class BindingReadWriteProperty<S> extends ConfigProperty.ReadWriteConfigProperty<BindingConfigType, BindingConfig, S> implements BindingProperty<S> - { - public BindingReadWriteProperty(String name) - { - super(name); - BINDING_PROPERTIES.add(this); - } - } - - private abstract static class BindingReadOnlyProperty<S> extends ConfigProperty.ReadOnlyConfigProperty<BindingConfigType, BindingConfig, S> implements BindingProperty<S> - { - public BindingReadOnlyProperty(String name) - { - super(name); - BINDING_PROPERTIES.add(this); - } - } - - public static final BindingReadOnlyProperty<ExchangeConfig> EXCHANGE_PROPERTY = new BindingReadOnlyProperty<ExchangeConfig>("exchange") - { - public ExchangeConfig getValue(BindingConfig object) - { - return object.getExchange(); - } - }; - - public static final BindingReadOnlyProperty<QueueConfig> QUEUE_PROPERTY = new BindingReadOnlyProperty<QueueConfig>("queue") - { - public QueueConfig getValue(BindingConfig object) - { - return object.getQueue(); - } - }; - - public static final BindingReadOnlyProperty<String> BINDING_KEY_PROPERTY = new BindingReadOnlyProperty<String>("bindingKey") - { - public String getValue(BindingConfig object) - { - return object.getBindingKey(); - } - }; - - public static final BindingReadOnlyProperty<Map<String,Object>> ARGUMENTS = new BindingReadOnlyProperty<Map<String,Object>>("arguments") - { - public Map<String,Object> getValue(BindingConfig object) - { - return object.getArguments(); - } - }; - - public static final BindingReadOnlyProperty<String> ORIGIN_PROPERTY = new BindingReadOnlyProperty<String>("origin") - { - public String getValue(BindingConfig object) - { - return object.getOrigin(); - } - }; - - private static final BindingConfigType INSTANCE = new BindingConfigType(); - - private BindingConfigType() - { - } - - public Collection<BindingProperty<?>> getProperties() - { - return Collections.unmodifiableList(BINDING_PROPERTIES); - } - - public static BindingConfigType getInstance() - { - return INSTANCE; - } - - - -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BridgeConfig.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BridgeConfig.java deleted file mode 100644 index 00ed5fd0dd..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BridgeConfig.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * - * 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.server.configuration; - -public interface BridgeConfig extends ConfiguredObject<BridgeConfigType, BridgeConfig> -{ - - boolean isDynamic(); - - boolean isQueueBridge(); - - boolean isLocalSource(); - - String getSource(); - - String getDestination(); - - String getKey(); - - String getTag(); - - String getExcludes(); - - LinkConfig getLink(); - - Integer getChannelId(); - - int getAckBatching(); -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BridgeConfigType.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BridgeConfigType.java deleted file mode 100644 index 888feeff0c..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BridgeConfigType.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -public final class BridgeConfigType extends ConfigObjectType<BridgeConfigType, BridgeConfig> -{ - private static final List<BridgeProperty<?>> BRIDGE_PROPERTIES = new ArrayList<BridgeProperty<?>>(); - - public static interface BridgeProperty<S> extends ConfigProperty<BridgeConfigType, BridgeConfig, S> - { - } - - private abstract static class BridgeReadWriteProperty<S> extends ConfigProperty.ReadWriteConfigProperty<BridgeConfigType, BridgeConfig, S> implements BridgeProperty<S> - { - public BridgeReadWriteProperty(String name) - { - super(name); - BRIDGE_PROPERTIES.add(this); - } - } - - private abstract static class BridgeReadOnlyProperty<S> extends ConfigProperty.ReadOnlyConfigProperty<BridgeConfigType, BridgeConfig, S> implements BridgeProperty<S> - { - public BridgeReadOnlyProperty(String name) - { - super(name); - BRIDGE_PROPERTIES.add(this); - } - } - - public static final BridgeReadOnlyProperty<LinkConfig> LINK_PROPERTY = new BridgeReadOnlyProperty<LinkConfig>("link") - { - public LinkConfig getValue(BridgeConfig object) - { - return object.getLink(); - } - }; - - public static final BridgeReadOnlyProperty<Integer> CHANNEL_ID_PROPERTY = new BridgeReadOnlyProperty<Integer>("channelId") - { - public Integer getValue(BridgeConfig object) - { - return object.getChannelId(); - } - }; - - public static final BridgeReadOnlyProperty<Boolean> DURABLE_PROPERTY = new BridgeReadOnlyProperty<Boolean>("durable") - { - public Boolean getValue(BridgeConfig object) - { - return object.isDurable(); - } - }; - - public static final BridgeReadOnlyProperty<String> SOURCE_PROPERTY = new BridgeReadOnlyProperty<String>("source") - { - public String getValue(BridgeConfig object) - { - return object.getSource(); - } - }; - - public static final BridgeReadOnlyProperty<String> DESTINATION_PROPERTY = new BridgeReadOnlyProperty<String>("destination") - { - public String getValue(BridgeConfig object) - { - return object.getDestination(); - } - }; - - public static final BridgeReadOnlyProperty<String> KEY_PROPERTY = new BridgeReadOnlyProperty<String>("key") - { - public String getValue(BridgeConfig object) - { - return object.getKey(); - } - }; - - public static final BridgeReadOnlyProperty<Boolean> QUEUE_BRIDGE_PROPERTY = new BridgeReadOnlyProperty<Boolean>("queueBridge") - { - public Boolean getValue(BridgeConfig object) - { - return object.isQueueBridge(); - } - }; - - public static final BridgeReadOnlyProperty<Boolean> LOCAL_SOURCE_PROPERTY = new BridgeReadOnlyProperty<Boolean>("localSource") - { - public Boolean getValue(BridgeConfig object) - { - return object.isLocalSource(); - } - }; - - public static final BridgeReadOnlyProperty<String> TAG_PROPERTY = new BridgeReadOnlyProperty<String>("tag") - { - public String getValue(BridgeConfig object) - { - return object.getTag(); - } - }; - - public static final BridgeReadOnlyProperty<String> EXCLUDES_PROPERTY = new BridgeReadOnlyProperty<String>("excludes") - { - public String getValue(BridgeConfig object) - { - return object.getExcludes(); - } - }; - - public static final BridgeReadOnlyProperty<Boolean> DYNAMIC_PROPERTY = new BridgeReadOnlyProperty<Boolean>("dynamic") - { - public Boolean getValue(BridgeConfig object) - { - return object.isDynamic(); - } - }; - - public static final BridgeReadOnlyProperty<Integer> ACK_BATCHING_PROPERTY = new BridgeReadOnlyProperty<Integer>("ackBatching") - { - public Integer getValue(BridgeConfig object) - { - return object.getAckBatching(); - } - }; - - - private static final BridgeConfigType INSTANCE = new BridgeConfigType(); - - private BridgeConfigType() - { - } - - public Collection<BridgeProperty<?>> getProperties() - { - return Collections.unmodifiableList(BRIDGE_PROPERTIES); - } - - public static BridgeConfigType getInstance() - { - return INSTANCE; - } - - - -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BrokerConfig.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BrokerConfig.java deleted file mode 100644 index 7dffc2d3c0..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BrokerConfig.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.List; - - -public interface BrokerConfig extends ConfiguredObject<BrokerConfigType,BrokerConfig> -{ - void setSystem(SystemConfig system); - - SystemConfig getSystem(); - - Integer getPort(); - - Integer getWorkerThreads(); - - Integer getMaxConnections(); - - Integer getConnectionBacklogLimit(); - - Long getStagingThreshold(); - - Integer getManagementPublishInterval(); - - String getVersion(); - - String getDataDirectory(); - - String getFederationTag(); - - /** - * List of feature(s) to be advertised to clients on connection. - * Feature names are strings, beginning with qpid. followed by more or more - * words separated by minus signs e.g. qpid.jms-selector. - * - * If there are no features, this method must return an empty array. - * - * @return list of feature names - */ - List<String> getFeatures(); - - void addVirtualHost(VirtualHostConfig virtualHost); - - void createBrokerConnection(String transport, - String host, - int port, - boolean durable, - String authMechanism, - String username, String password); - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BrokerConfigType.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BrokerConfigType.java deleted file mode 100644 index 64a59c3f61..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/BrokerConfigType.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -public final class BrokerConfigType extends ConfigObjectType<BrokerConfigType, BrokerConfig> -{ - private static final List<BrokerProperty<?>> BROKER_PROPERTIES = new ArrayList<BrokerProperty<?>>(); - - public static interface BrokerProperty<S> extends ConfigProperty<BrokerConfigType, BrokerConfig, S> - { - } - - private abstract static class BrokerReadWriteProperty<S> extends ConfigProperty.ReadWriteConfigProperty<BrokerConfigType, BrokerConfig, S> implements BrokerProperty<S> - { - public BrokerReadWriteProperty(String name) - { - super(name); - BROKER_PROPERTIES.add(this); - } - } - - private abstract static class BrokerReadOnlyProperty<S> extends ConfigProperty.ReadOnlyConfigProperty<BrokerConfigType, BrokerConfig, S> implements BrokerProperty<S> - { - public BrokerReadOnlyProperty(String name) - { - super(name); - BROKER_PROPERTIES.add(this); - } - } - - public static final BrokerReadOnlyProperty<SystemConfig> SYSTEM_PROPERTY = new BrokerReadOnlyProperty<SystemConfig>("system") - { - public SystemConfig getValue(BrokerConfig object) - { - return object.getSystem(); - } - }; - - public static final BrokerReadOnlyProperty<Integer> PORT_PROPERTY = new BrokerReadOnlyProperty<Integer>("port") - { - public Integer getValue(BrokerConfig object) - { - return object.getPort(); - } - }; - - public static final BrokerReadOnlyProperty<Integer> WORKER_THREADS_PROPERTY = new BrokerReadOnlyProperty<Integer>("workerThreads") - { - public Integer getValue(BrokerConfig object) - { - return object.getWorkerThreads(); - } - }; - - public static final BrokerReadOnlyProperty<Integer> MAX_CONNECTIONS_PROPERTY = new BrokerReadOnlyProperty<Integer>("maxConnections") - { - public Integer getValue(BrokerConfig object) - { - return object.getMaxConnections(); - } - }; - - public static final BrokerReadOnlyProperty<Integer> CONNECTION_BACKLOG_LIMIT_PROPERTY = new BrokerReadOnlyProperty<Integer>("connectionBacklog") - { - public Integer getValue(BrokerConfig object) - { - return object.getConnectionBacklogLimit(); - } - }; - - public static final BrokerReadOnlyProperty<Long> STAGING_THRESHOLD_PROPERTY = new BrokerReadOnlyProperty<Long>("stagingThreshold") - { - public Long getValue(BrokerConfig object) - { - return object.getStagingThreshold(); - } - }; - - public static final BrokerReadOnlyProperty<Integer> MANAGEMENT_PUBLISH_INTERVAL_PROPERTY = new BrokerReadOnlyProperty<Integer>("mgmtPublishInterval") - { - public Integer getValue(BrokerConfig object) - { - return object.getManagementPublishInterval(); - } - }; - - public static final BrokerReadOnlyProperty<String> VERSION_PROPERTY = new BrokerReadOnlyProperty<String>("version") - { - public String getValue(BrokerConfig object) - { - return object.getVersion(); - } - }; - - public static final BrokerReadOnlyProperty<String> DATA_DIR_PROPERTY = new BrokerReadOnlyProperty<String>("dataDirectory") - { - public String getValue(BrokerConfig object) - { - return object.getDataDirectory(); - } - }; - - private static final BrokerConfigType INSTANCE = new BrokerConfigType(); - - private BrokerConfigType() - { - } - - public Collection<BrokerProperty<?>> getProperties() - { - return Collections.unmodifiableList(BROKER_PROPERTIES); - } - - public static BrokerConfigType getInstance() - { - return INSTANCE; - } - - - -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConfigObjectType.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConfigObjectType.java deleted file mode 100644 index c45aaaf1ee..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConfigObjectType.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.Collection; - -public abstract class ConfigObjectType<T extends ConfigObjectType<T,C>, C extends ConfiguredObject<T,C>> -{ - public abstract Collection<? extends ConfigProperty<T, C, ?>> getProperties(); - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConfigProperty.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConfigProperty.java deleted file mode 100644 index 2d88ba00a0..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConfigProperty.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * - * 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.server.configuration; - -public interface ConfigProperty<T extends ConfigObjectType<T,C>, C extends ConfiguredObject<T,C>, S> -{ - public String getName(); - - public S getValue(C object); - - public void setValue(C object, S value); - - public void clearValue(C object); - - public abstract static class ReadWriteConfigProperty<T extends ConfigObjectType<T,C>, C extends ConfiguredObject<T,C>,S> implements ConfigProperty<T, C, S> - { - private final String _name; - - protected ReadWriteConfigProperty(String name) - { - _name = name; - } - - public final String getName() - { - return _name; - } - } - - public abstract static class ReadOnlyConfigProperty<T extends ConfigObjectType<T,C>, C extends ConfiguredObject<T,C>, S> extends ReadWriteConfigProperty<T, C, S> - { - protected ReadOnlyConfigProperty(String name) - { - super(name); - } - - public final void setValue(C object, S value) - { - throw new UnsupportedOperationException("Cannot set value '"+getName()+"' as this property is read-only"); - } - - public final void clearValue(C object) - { - throw new UnsupportedOperationException("Cannot set value '"+getName()+"' as this property is read-only"); - } - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConfigStore.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConfigStore.java deleted file mode 100644 index c519a0c0fa..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConfigStore.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.Collection; -import java.util.Collections; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.atomic.AtomicLong; -import java.util.concurrent.atomic.AtomicReference; - -public class ConfigStore -{ - private ConcurrentHashMap<ConfigObjectType, ConcurrentHashMap<UUID, ConfiguredObject>> _typeMap = - new ConcurrentHashMap<ConfigObjectType, ConcurrentHashMap<UUID, ConfiguredObject>>(); - - private ConcurrentHashMap<ConfigObjectType, CopyOnWriteArrayList<ConfigEventListener>> _listenerMap = - new ConcurrentHashMap<ConfigObjectType, CopyOnWriteArrayList<ConfigEventListener>>(); - - private AtomicReference<SystemConfig> _root = new AtomicReference<SystemConfig>(null); - - private final AtomicLong _objectIdSource = new AtomicLong(0l); - private final AtomicLong _persistentObjectIdSource = new AtomicLong(0l); - - // TODO - should load/increment this on broker startup - private long _sequenceNumber = 1L; - - public enum Event - { - CREATED, DELETED - } - - public interface ConfigEventListener<T extends ConfigObjectType<T,C>, C extends ConfiguredObject<T, C>> - { - void onEvent(C object, Event evt); - } - - private ConfigStore() - { - } - - public <T extends ConfigObjectType<T, C>, C extends ConfiguredObject<T, C>> ConfiguredObject<T, C> getConfiguredObject(ConfigObjectType<T,C> type, UUID id) - { - ConcurrentHashMap<UUID, ConfiguredObject> typeMap = _typeMap.get(type); - if(typeMap != null) - { - return typeMap.get(id); - } - else - { - return null; - } - - } - - public <T extends ConfigObjectType<T, C>, C extends ConfiguredObject<T, C>> Collection<? extends C> getConfiguredObjects(ConfigObjectType<T,C> type) - { - ConcurrentHashMap typeMap = _typeMap.get(type); - if(typeMap != null) - { - return typeMap.values(); - } - else - { - return Collections.EMPTY_LIST; - } - - } - - public <T extends ConfigObjectType<T, C>, C extends ConfiguredObject<T, C>> void addConfiguredObject(ConfiguredObject<T, C> object) - { - ConcurrentHashMap typeMap = _typeMap.get(object.getConfigType()); - if(typeMap == null) - { - typeMap = new ConcurrentHashMap(); - ConcurrentHashMap oldMap = _typeMap.putIfAbsent(object.getConfigType(), typeMap); - if(oldMap != null) - { - typeMap = oldMap; - } - - } - - typeMap.put(object.getQMFId(), object); - sendEvent(Event.CREATED, object); - } - - - public <T extends ConfigObjectType<T, C>, C extends ConfiguredObject<T, C>> void removeConfiguredObject(ConfiguredObject<T, C> object) - { - ConcurrentHashMap typeMap = _typeMap.get(object.getConfigType()); - if(typeMap != null) - { - typeMap.remove(object.getQMFId()); - sendEvent(Event.DELETED, object); - } - } - - public <T extends ConfigObjectType<T, C>, C extends ConfiguredObject<T, C>> void addConfigEventListener(T type, ConfigEventListener<T,C> listener) - { - CopyOnWriteArrayList listeners = _listenerMap.get(type); - if(listeners == null) - { - listeners = new CopyOnWriteArrayList(); - CopyOnWriteArrayList oldListeners = _listenerMap.putIfAbsent(type, listeners); - if(oldListeners != null) - { - listeners = oldListeners; - } - - } - - listeners.add(listener); - - } - - public <T extends ConfigObjectType<T, C>, C extends ConfiguredObject<T, C>> void removeConfigEventListener(T type, ConfigEventListener<T,C> listener) - { - CopyOnWriteArrayList listeners = _listenerMap.get(type); - if(listeners != null) - { - listeners.remove(listener); - } - } - - private void sendEvent(Event e, ConfiguredObject o) - { - CopyOnWriteArrayList<ConfigEventListener> listeners = _listenerMap.get(o.getConfigType()); - if(listeners != null) - { - for(ConfigEventListener listener : listeners) - { - listener.onEvent(o, e); - } - } - } - - public boolean setRoot(SystemConfig object) - { - if(_root.compareAndSet(null,object)) - { - addConfiguredObject(object); - return true; - } - else - { - return false; - } - } - - public UUID createId() - { - return new UUID(((_sequenceNumber & 0xFFFl)<<48), _objectIdSource.incrementAndGet()); - } - - public UUID createPersistentId() - { - return new UUID(0L, _persistentObjectIdSource.incrementAndGet()); - } - - public void persistentIdInUse(UUID id) - { - long lsb = id.getLeastSignificantBits(); - long currentId; - while((currentId = _persistentObjectIdSource.get()) < lsb) - { - _persistentObjectIdSource.compareAndSet(currentId, lsb); - } - } - - public SystemConfig getRoot() - { - return _root.get(); - } - - public static ConfigStore newInstance() - { - return new ConfigStore(); - } - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConfiguredObject.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConfiguredObject.java deleted file mode 100644 index ff4e38d9f7..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConfiguredObject.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.UUID; - -public interface ConfiguredObject<T extends ConfigObjectType<T,C>, C extends ConfiguredObject<T, C>> -{ - public UUID getQMFId(); - - public T getConfigType(); - - public ConfiguredObject<T,C> getParent(); - - public boolean isDurable(); - - long getCreateTime(); -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConnectionConfig.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConnectionConfig.java deleted file mode 100644 index 0dd36fe1fe..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConnectionConfig.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * 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.server.configuration; - -public interface ConnectionConfig extends ConfiguredObject<ConnectionConfigType, ConnectionConfig> -{ - VirtualHostConfig getVirtualHost(); - - String getAddress(); - - Boolean isIncoming(); - - Boolean isSystemConnection(); - - Boolean isFederationLink(); - - String getAuthId(); - - String getRemoteProcessName(); - - Integer getRemotePID(); - - Integer getRemoteParentPID(); - - ConfigStore getConfigStore(); - - Boolean isShadow(); - - void mgmtClose(); -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConnectionConfigType.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConnectionConfigType.java deleted file mode 100644 index 5631fda37c..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ConnectionConfigType.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -public final class ConnectionConfigType extends ConfigObjectType<ConnectionConfigType, ConnectionConfig> -{ - private static final List<ConnectionProperty<?>> CONNECTION_PROPERTIES = new ArrayList<ConnectionProperty<?>>(); - - public static interface ConnectionProperty<S> extends ConfigProperty<ConnectionConfigType, ConnectionConfig, S> - { - } - - private abstract static class ConnectionReadWriteProperty<S> extends ConfigProperty.ReadWriteConfigProperty<ConnectionConfigType, ConnectionConfig, S> implements ConnectionProperty<S> - { - public ConnectionReadWriteProperty(String name) - { - super(name); - CONNECTION_PROPERTIES.add(this); - } - } - - private abstract static class ConnectionReadOnlyProperty<S> extends ConfigProperty.ReadOnlyConfigProperty<ConnectionConfigType, ConnectionConfig, S> implements ConnectionProperty<S> - { - public ConnectionReadOnlyProperty(String name) - { - super(name); - CONNECTION_PROPERTIES.add(this); - } - } - - public static final ConnectionReadOnlyProperty<VirtualHostConfig> VIRTUAL_HOST_PROPERTY = new ConnectionReadOnlyProperty<VirtualHostConfig>("virtualHost") - { - public VirtualHostConfig getValue(ConnectionConfig object) - { - return object.getVirtualHost(); - } - }; - - public static final ConnectionReadOnlyProperty<String> ADDRESS_PROPERTY = new ConnectionReadOnlyProperty<String>("address") - { - public String getValue(ConnectionConfig object) - { - return object.getAddress(); - } - }; - - public static final ConnectionReadOnlyProperty<Boolean> INCOMING_PROPERTY = new ConnectionReadOnlyProperty<Boolean>("incoming") - { - public Boolean getValue(ConnectionConfig object) - { - return object.isIncoming(); - } - }; - - public static final ConnectionReadOnlyProperty<Boolean> SYSTEM_CONNECTION_PROPERTY = new ConnectionReadOnlyProperty<Boolean>("systemConnection") - { - public Boolean getValue(ConnectionConfig object) - { - return object.isSystemConnection(); - } - }; - - public static final ConnectionReadOnlyProperty<Boolean> FEDERATION_LINK_PROPERTY = new ConnectionReadOnlyProperty<Boolean>("federationLink") - { - public Boolean getValue(ConnectionConfig object) - { - return object.isFederationLink(); - } - }; - - public static final ConnectionReadOnlyProperty<String> AUTH_ID_PROPERTY = new ConnectionReadOnlyProperty<String>("authId") - { - public String getValue(ConnectionConfig object) - { - return object.getAuthId(); - } - }; - - public static final ConnectionReadOnlyProperty<String> REMOTE_PROCESS_NAME_PROPERTY = new ConnectionReadOnlyProperty<String>("remoteProcessName") - { - public String getValue(ConnectionConfig object) - { - return object.getRemoteProcessName(); - } - }; - - - public static final ConnectionReadOnlyProperty<Integer> REMOTE_PID_PROPERTY = new ConnectionReadOnlyProperty<Integer>("remotePid") - { - public Integer getValue(ConnectionConfig object) - { - return object.getRemotePID(); - } - }; - - public static final ConnectionReadOnlyProperty<Integer> REMOTE_PARENT_PID_PROPERTY = new ConnectionReadOnlyProperty<Integer>("remoteParentPid") - { - public Integer getValue(ConnectionConfig object) - { - return object.getRemoteParentPID(); - } - }; - - private static final ConnectionConfigType INSTANCE = new ConnectionConfigType(); - - private ConnectionConfigType() - { - } - - public Collection<ConnectionProperty<?>> getProperties() - { - return Collections.unmodifiableList(CONNECTION_PROPERTIES); - } - - public static ConnectionConfigType getInstance() - { - return INSTANCE; - } - - - -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ExchangeConfig.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ExchangeConfig.java deleted file mode 100644 index 6633d93adf..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ExchangeConfig.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * - * 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.server.configuration; - -import org.apache.qpid.server.exchange.ExchangeType; - -import java.util.Map; - - -public interface ExchangeConfig extends ConfiguredObject<ExchangeConfigType, ExchangeConfig> -{ - VirtualHostConfig getVirtualHost(); - - String getName(); - - ExchangeType getType(); - - boolean isAutoDelete(); - - ExchangeConfig getAlternateExchange(); - - Map<String, Object> getArguments(); - - - long getBindingCount(); - - long getBindingCountHigh(); - - long getMsgReceives(); - - long getMsgRoutes(); - - long getMsgDrops(); - - long getByteReceives(); - - long getByteRoutes(); - - long getByteDrops(); - -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ExchangeConfigType.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ExchangeConfigType.java deleted file mode 100644 index c7744117c4..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ExchangeConfigType.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -public final class ExchangeConfigType extends ConfigObjectType<ExchangeConfigType, ExchangeConfig> -{ - private static final List<ExchangeProperty<?>> EXCHANGE_PROPERTIES = new ArrayList<ExchangeProperty<?>>(); - - public static interface ExchangeProperty<S> extends ConfigProperty<ExchangeConfigType, ExchangeConfig, S> - { - } - - private abstract static class ExchangeReadWriteProperty<S> extends ConfigProperty.ReadWriteConfigProperty<ExchangeConfigType, ExchangeConfig, S> implements ExchangeProperty<S> - { - public ExchangeReadWriteProperty(String name) - { - super(name); - EXCHANGE_PROPERTIES.add(this); - } - } - - private abstract static class ExchangeReadOnlyProperty<S> extends ConfigProperty.ReadOnlyConfigProperty<ExchangeConfigType, ExchangeConfig, S> implements ExchangeProperty<S> - { - public ExchangeReadOnlyProperty(String name) - { - super(name); - EXCHANGE_PROPERTIES.add(this); - } - } - - public static final ExchangeReadOnlyProperty<VirtualHostConfig> VIRTUAL_HOST_PROPERTY = new ExchangeReadOnlyProperty<VirtualHostConfig>("virtualHost") - { - public VirtualHostConfig getValue(ExchangeConfig object) - { - return object.getVirtualHost(); - } - }; - - public static final ExchangeReadOnlyProperty<String> NAME_PROPERTY = new ExchangeReadOnlyProperty<String>("name") - { - public String getValue(ExchangeConfig object) - { - return object.getName(); - } - }; - - public static final ExchangeReadOnlyProperty<Boolean> AUTODELETE_PROPERTY = new ExchangeReadOnlyProperty<Boolean>("autodelete") - { - public Boolean getValue(ExchangeConfig object) - { - return object.isAutoDelete(); - } - }; - - - public static final ExchangeReadOnlyProperty<ExchangeConfig> ALTERNATE_EXCHANGE_PROPERTY = new ExchangeReadOnlyProperty<ExchangeConfig>("alternateExchange") - { - public ExchangeConfig getValue(ExchangeConfig object) - { - return object.getAlternateExchange(); - } - }; - - public static final ExchangeReadOnlyProperty<Map<String,Object>> ARGUMENTS = new ExchangeReadOnlyProperty<Map<String,Object>>("arguments") - { - public Map<String,Object> getValue(ExchangeConfig object) - { - return object.getArguments(); - } - }; - - private static final ExchangeConfigType INSTANCE = new ExchangeConfigType(); - - private ExchangeConfigType() - { - } - - public Collection<ExchangeProperty<?>> getProperties() - { - return Collections.unmodifiableList(EXCHANGE_PROPERTIES); - } - - public static ExchangeConfigType getInstance() - { - return INSTANCE; - } - - - -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/LinkConfig.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/LinkConfig.java deleted file mode 100644 index 2c37a94db0..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/LinkConfig.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * - * 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.server.configuration; - -public interface LinkConfig extends ConfiguredObject<LinkConfigType, LinkConfig> -{ - VirtualHostConfig getVirtualHost(); - - - String getTransport(); - - String getHost(); - - int getPort(); - - String getRemoteVhost(); - - String getAuthMechanism(); - - String getUsername(); - - String getPassword(); - - void close(); - - void createBridge(boolean durable, - boolean dynamic, - boolean srcIsQueue, - boolean srcIsLocal, - String src, - String dest, - String key, String tag, String excludes); - - String getState(); - - String getLastError(); -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/LinkConfigType.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/LinkConfigType.java deleted file mode 100644 index 847cae87f5..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/LinkConfigType.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -public final class LinkConfigType extends ConfigObjectType<LinkConfigType, LinkConfig> -{ - private static final List<LinkProperty<?>> LINK_PROPERTIES = new ArrayList<LinkProperty<?>>(); - - public static interface LinkProperty<S> extends ConfigProperty<LinkConfigType, LinkConfig, S> - { - } - - private abstract static class LinkReadWriteProperty<S> extends ConfigProperty.ReadWriteConfigProperty<LinkConfigType, LinkConfig, S> implements LinkProperty<S> - { - public LinkReadWriteProperty(String name) - { - super(name); - LINK_PROPERTIES.add(this); - } - } - - private abstract static class LinkReadOnlyProperty<S> extends ConfigProperty.ReadOnlyConfigProperty<LinkConfigType, LinkConfig, S> implements LinkProperty<S> - { - public LinkReadOnlyProperty(String name) - { - super(name); - LINK_PROPERTIES.add(this); - } - } - - public static final LinkReadOnlyProperty<VirtualHostConfig> VIRTUAL_HOST_PROPERTY = new LinkReadOnlyProperty<VirtualHostConfig>("virtualHost") - { - public VirtualHostConfig getValue(LinkConfig object) - { - return object.getVirtualHost(); - } - }; - - public static final LinkReadOnlyProperty<String> TRANSPORT_PROPERTY = new LinkReadOnlyProperty<String>("transport") - { - public String getValue(LinkConfig object) - { - return object.getTransport(); - } - }; - - public static final LinkReadOnlyProperty<String> HOST_PROPERTY = new LinkReadOnlyProperty<String>("host") - { - public String getValue(LinkConfig object) - { - return object.getHost(); - } - }; - - public static final LinkReadOnlyProperty<Integer> PORT_PROPERTY = new LinkReadOnlyProperty<Integer>("port") - { - public Integer getValue(LinkConfig object) - { - return object.getPort(); - } - }; - - public static final LinkReadOnlyProperty<String> REMOTE_VHOST_PROPERTY = new LinkReadOnlyProperty<String>("remoteVhost") - { - public String getValue(LinkConfig object) - { - return object.getRemoteVhost(); - } - }; - - public static final LinkReadOnlyProperty<String> AUTH_MECHANISM_PROPERTY = new LinkReadOnlyProperty<String>("authMechanism") - { - public String getValue(LinkConfig object) - { - return object.getAuthMechanism(); - } - }; - - public static final LinkReadOnlyProperty<String> USERNAME_PROPERTY = new LinkReadOnlyProperty<String>("username") - { - public String getValue(LinkConfig object) - { - return object.getUsername(); - } - }; - - public static final LinkReadOnlyProperty<String> PASSWORD_PROPERTY = new LinkReadOnlyProperty<String>("password") - { - public String getValue(LinkConfig object) - { - return object.getPassword(); - } - }; - - private static final LinkConfigType INSTANCE = new LinkConfigType(); - - private LinkConfigType() - { - } - - public Collection<LinkProperty<?>> getProperties() - { - return Collections.unmodifiableList(LINK_PROPERTIES); - } - - public static LinkConfigType getInstance() - { - return INSTANCE; - } - - - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/QueueConfig.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/QueueConfig.java deleted file mode 100644 index 1ef5edeb51..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/QueueConfig.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * - * 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.server.configuration; - -import org.apache.qpid.AMQException; - -import java.util.Map; - - -public interface QueueConfig extends ConfiguredObject<QueueConfigType, QueueConfig> -{ - VirtualHostConfig getVirtualHost(); - - String getName(); - - boolean isExclusive(); - - boolean isAutoDelete(); - - ExchangeConfig getAlternateExchange(); - - Map<String, Object> getArguments(); - - long getReceivedMessageCount(); - - int getMessageCount(); - - long getQueueDepth(); - - int getConsumerCount(); - - int getConsumerCountHigh(); - - int getBindingCount(); - - int getBindingCountHigh(); - - ConfigStore getConfigStore(); - - long getMessageDequeueCount(); - - long getTotalEnqueueSize(); - - long getTotalDequeueSize(); - - long getByteTxnEnqueues(); - - long getByteTxnDequeues(); - - long getMsgTxnEnqueues(); - - long getMsgTxnDequeues(); - - long getPersistentByteEnqueues(); - - long getPersistentByteDequeues(); - - long getPersistentMsgEnqueues(); - - long getPersistentMsgDequeues(); - - long getUnackedMessageCount(); - - long getUnackedMessageCountHigh(); - - void purge(long request) throws AMQException; -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/QueueConfigType.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/QueueConfigType.java deleted file mode 100644 index f958ef5350..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/QueueConfigType.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -public final class QueueConfigType extends ConfigObjectType<QueueConfigType, QueueConfig> -{ - private static final List<QueueProperty<?>> QUEUE_PROPERTIES = new ArrayList<QueueProperty<?>>(); - - public static interface QueueProperty<S> extends ConfigProperty<QueueConfigType, QueueConfig, S> - { - } - - private abstract static class QueueReadWriteProperty<S> extends ConfigProperty.ReadWriteConfigProperty<QueueConfigType, QueueConfig, S> implements QueueProperty<S> - { - public QueueReadWriteProperty(String name) - { - super(name); - QUEUE_PROPERTIES.add(this); - } - } - - private abstract static class QueueReadOnlyProperty<S> extends ConfigProperty.ReadOnlyConfigProperty<QueueConfigType, QueueConfig, S> implements QueueProperty<S> - { - public QueueReadOnlyProperty(String name) - { - super(name); - QUEUE_PROPERTIES.add(this); - } - } - - public static final QueueReadOnlyProperty<VirtualHostConfig> VISTUAL_HOST_PROPERTY = new QueueReadOnlyProperty<VirtualHostConfig>("virtualHost") - { - public VirtualHostConfig getValue(QueueConfig object) - { - return object.getVirtualHost(); - } - }; - - public static final QueueReadOnlyProperty<String> NAME_PROPERTY = new QueueReadOnlyProperty<String>("name") - { - public String getValue(QueueConfig object) - { - return object.getName(); - } - }; - - public static final QueueReadOnlyProperty<Boolean> AUTODELETE_PROPERTY = new QueueReadOnlyProperty<Boolean>("autodelete") - { - public Boolean getValue(QueueConfig object) - { - return object.isAutoDelete(); - } - }; - - public static final QueueReadOnlyProperty<Boolean> EXCLUSIVE_PROPERTY = new QueueReadOnlyProperty<Boolean>("exclusive") - { - public Boolean getValue(QueueConfig object) - { - return object.isExclusive(); - } - }; - - public static final QueueReadOnlyProperty<ExchangeConfig> ALTERNATE_EXCHANGE_PROPERTY = new QueueReadOnlyProperty<ExchangeConfig>("alternateExchange") - { - public ExchangeConfig getValue(QueueConfig object) - { - return object.getAlternateExchange(); - } - }; - - public static final QueueReadOnlyProperty<Map<String,Object>> ARGUMENTS = new QueueReadOnlyProperty<Map<String,Object>>("arguments") - { - public Map<String,Object> getValue(QueueConfig object) - { - return object.getArguments(); - } - }; - - - private static final QueueConfigType INSTANCE = new QueueConfigType(); - - private QueueConfigType() - { - } - - public Collection<QueueProperty<?>> getProperties() - { - return Collections.unmodifiableList(QUEUE_PROPERTIES); - } - - public static QueueConfigType getInstance() - { - return INSTANCE; - } - - - -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SessionConfig.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SessionConfig.java deleted file mode 100644 index 8fef642eff..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SessionConfig.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * - * 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.server.configuration; - -import org.apache.qpid.AMQException; - -public interface SessionConfig extends ConfiguredObject<SessionConfigType, SessionConfig> -{ - VirtualHostConfig getVirtualHost(); - - String getSessionName(); - - int getChannel(); - - ConnectionConfig getConnectionConfig(); - - boolean isAttached(); - - long getDetachedLifespan(); - - Long getExpiryTime(); - - Long getMaxClientRate(); - - Long getTxnStarts(); - - Long getTxnCommits(); - - Long getTxnRejects(); - - Long getTxnCount(); - - boolean isTransactional(); - - void mgmtClose() throws AMQException; -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SessionConfigType.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SessionConfigType.java deleted file mode 100644 index 1685cfab60..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SessionConfigType.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -public final class SessionConfigType extends ConfigObjectType<SessionConfigType, SessionConfig> -{ - private static final List<SessionProperty<?>> SESSION_PROPERTIES = new ArrayList<SessionProperty<?>>(); - - public static interface SessionProperty<S> extends ConfigProperty<SessionConfigType, SessionConfig, S> - { - } - - private abstract static class SessionReadWriteProperty<S> extends ConfigProperty.ReadWriteConfigProperty<SessionConfigType, SessionConfig, S> implements SessionProperty<S> - { - public SessionReadWriteProperty(String name) - { - super(name); - SESSION_PROPERTIES.add(this); - } - } - - private abstract static class SessionReadOnlyProperty<S> extends ConfigProperty.ReadOnlyConfigProperty<SessionConfigType, SessionConfig, S> implements SessionProperty<S> - { - public SessionReadOnlyProperty(String name) - { - super(name); - SESSION_PROPERTIES.add(this); - } - } - - public static final SessionReadOnlyProperty<VirtualHostConfig> VIRTUAL_HOST_PROPERTY = new SessionReadOnlyProperty<VirtualHostConfig>("virtualHost") - { - public VirtualHostConfig getValue(SessionConfig object) - { - return object.getVirtualHost(); - } - }; - - public static final SessionReadOnlyProperty<String> NAME_PROPERTY = new SessionReadOnlyProperty<String>("name") - { - public String getValue(SessionConfig object) - { - return object.getSessionName(); - } - }; - - public static final SessionReadOnlyProperty<Integer> CHANNEL_ID_PROPERTY = new SessionReadOnlyProperty<Integer>("channelId") - { - public Integer getValue(SessionConfig object) - { - return object.getChannel(); - } - }; - - public static final SessionReadOnlyProperty<ConnectionConfig> CONNECTION_PROPERTY = new SessionReadOnlyProperty<ConnectionConfig>("connection") - { - public ConnectionConfig getValue(SessionConfig object) - { - return object.getConnectionConfig(); - } - }; - - public static final SessionReadOnlyProperty<Boolean> ATTACHED_PROPERTY = new SessionReadOnlyProperty<Boolean>("attached") - { - public Boolean getValue(SessionConfig object) - { - return object.isAttached(); - } - }; - - public static final SessionReadOnlyProperty<Long> DETACHED_LIFESPAN_PROPERTY = new SessionReadOnlyProperty<Long>("detachedLifespan") - { - public Long getValue(SessionConfig object) - { - return object.getDetachedLifespan(); - } - }; - - public static final SessionReadOnlyProperty<Long> EXPIRE_TIME_PROPERTY = new SessionReadOnlyProperty<Long>("expireTime") - { - public Long getValue(SessionConfig object) - { - return object.getExpiryTime(); - } - }; - - public static final SessionReadOnlyProperty<Long> MAX_CLIENT_RATE_PROPERTY = new SessionReadOnlyProperty<Long>("maxClientRate") - { - public Long getValue(SessionConfig object) - { - return object.getMaxClientRate(); - } - }; - - private static final SessionConfigType INSTANCE = new SessionConfigType(); - - private SessionConfigType() - { - } - - public Collection<SessionProperty<?>> getProperties() - { - return Collections.unmodifiableList(SESSION_PROPERTIES); - } - - public static SessionConfigType getInstance() - { - return INSTANCE; - } - - - -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SubscriptionConfig.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SubscriptionConfig.java deleted file mode 100644 index b101d70553..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SubscriptionConfig.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.Map; - - -public interface SubscriptionConfig extends ConfiguredObject<SubscriptionConfigType, SubscriptionConfig> -{ - - SessionConfig getSessionConfig(); - - QueueConfig getQueue(); - - String getName(); - - Map<String, Object> getArguments(); - - String getCreditMode(); - - boolean isBrowsing(); - - boolean isExclusive(); - - boolean isExplicitAcknowledge(); - - Long getDelivered(); -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SubscriptionConfigType.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SubscriptionConfigType.java deleted file mode 100644 index 7b7848dd87..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SubscriptionConfigType.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * - * 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.server.configuration; - - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -public final class SubscriptionConfigType extends ConfigObjectType<SubscriptionConfigType, SubscriptionConfig> -{ - private static final List<SubscriptionProperty<?>> SUBSCRIPTION_PROPERTIES = new ArrayList<SubscriptionProperty<?>>(); - - public static interface SubscriptionProperty<S> extends ConfigProperty<SubscriptionConfigType, SubscriptionConfig, S> - { - } - - private abstract static class SubscriptionReadWriteProperty<S> extends ConfigProperty.ReadWriteConfigProperty<SubscriptionConfigType, SubscriptionConfig, S> implements SubscriptionProperty<S> - { - public SubscriptionReadWriteProperty(String name) - { - super(name); - SUBSCRIPTION_PROPERTIES.add(this); - } - } - - private abstract static class SubscriptionReadOnlyProperty<S> extends ConfigProperty.ReadOnlyConfigProperty<SubscriptionConfigType, SubscriptionConfig, S> implements SubscriptionProperty<S> - { - public SubscriptionReadOnlyProperty(String name) - { - super(name); - SUBSCRIPTION_PROPERTIES.add(this); - } - } - - public static final SubscriptionReadOnlyProperty<SessionConfig> SESSION_PROPERTY = new SubscriptionReadOnlyProperty<SessionConfig>("session") - { - public SessionConfig getValue(SubscriptionConfig object) - { - return object.getSessionConfig(); - } - }; - - public static final SubscriptionReadOnlyProperty<QueueConfig> QUEUE_PROPERTY = new SubscriptionReadOnlyProperty<QueueConfig>("queue") - { - public QueueConfig getValue(SubscriptionConfig object) - { - return object.getQueue(); - } - }; - - public static final SubscriptionReadOnlyProperty<String> NAME_PROPERTY = new SubscriptionReadOnlyProperty<String>("name") - { - public String getValue(SubscriptionConfig object) - { - return object.getName(); - } - }; - - public static final SubscriptionReadOnlyProperty<Map<String,Object>> ARGUMENTS = new SubscriptionReadOnlyProperty<Map<String,Object>>("arguments") - { - public Map<String,Object> getValue(SubscriptionConfig object) - { - return object.getArguments(); - } - }; - - public static final SubscriptionReadOnlyProperty<String> CREDIT_MODE_PROPERTY = new SubscriptionReadOnlyProperty<String>("creditMode") - { - public String getValue(SubscriptionConfig object) - { - return object.getCreditMode(); - } - }; - - public static final SubscriptionReadOnlyProperty<Boolean> BROWSING_PROPERTY = new SubscriptionReadOnlyProperty<Boolean>("browsing") - { - public Boolean getValue(SubscriptionConfig object) - { - return object.isBrowsing(); - } - }; - - public static final SubscriptionReadOnlyProperty<Boolean> EXCLUSIVE_PROPERTY = new SubscriptionReadOnlyProperty<Boolean>("exclusive") - { - public Boolean getValue(SubscriptionConfig object) - { - return object.isExclusive(); - } - }; - - public static final SubscriptionReadOnlyProperty<Boolean> EXPLICIT_ACK_PROPERTY = new SubscriptionReadOnlyProperty<Boolean>("explicitAck") - { - public Boolean getValue(SubscriptionConfig object) - { - return object.isExplicitAcknowledge(); - } - }; - - private static final SubscriptionConfigType INSTANCE = new SubscriptionConfigType(); - - private SubscriptionConfigType() - { - } - - public Collection<SubscriptionProperty<?>> getProperties() - { - return Collections.unmodifiableList(SUBSCRIPTION_PROPERTIES); - } - - - public static SubscriptionConfigType getInstance() - { - return INSTANCE; - } - - - -}
\ No newline at end of file diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SystemConfig.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SystemConfig.java deleted file mode 100644 index 8a9029fbfd..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SystemConfig.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * 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.server.configuration; - -public interface SystemConfig extends ConfiguredObject<SystemConfigType,SystemConfig> -{ - String getName(); - - String getOperatingSystemName(); - - String getNodeName(); - - - String getOSRelease(); - - String getOSVersion(); - - String getOSArchitecture(); - - void addBroker(BrokerConfig broker); - - void removeBroker(BrokerConfig broker); -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SystemConfigImpl.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SystemConfigImpl.java deleted file mode 100644 index 80c2e8b2f1..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SystemConfigImpl.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; - -public class SystemConfigImpl implements SystemConfig -{ - private static final String OS_NAME = System.getProperty("os.name"); - private static final String OS_ARCH = System.getProperty("os.arch"); - private static final String OS_VERSION = System.getProperty("os.version"); - - private final UUID _qmfId; - private String _name; - - private final String _host; - - private final Map<UUID, BrokerConfig> _brokers = new ConcurrentHashMap<UUID, BrokerConfig>(); - - private final long _createTime = System.currentTimeMillis(); - private final ConfigStore _store; - - public SystemConfigImpl(ConfigStore store) - { - this(store.createId(), store); - } - - public SystemConfigImpl(UUID qmfId, ConfigStore store) - { - _qmfId = qmfId; - _store = store; - String host; - try - { - InetAddress addr = InetAddress.getLocalHost(); - host = addr.getHostName(); - } - catch (UnknownHostException e) - { - host="localhost"; - } - _host = host; - } - - public String getName() - { - return _name; - } - - public String getOperatingSystemName() - { - return OS_NAME; - } - - public String getNodeName() - { - return _host; - } - - public String getOSRelease() - { - return OS_VERSION; - } - - public String getOSVersion() - { - return ""; - } - - public String getOSArchitecture() - { - return OS_ARCH; - } - - @Override - public UUID getQMFId() - { - return _qmfId; - } - - public SystemConfigType getConfigType() - { - return SystemConfigType.getInstance(); - } - - public ConfiguredObject getParent() - { - return null; - } - - public boolean isDurable() - { - return false; - } - - public void addBroker(final BrokerConfig broker) - { - broker.setSystem(this); - _store.addConfiguredObject(broker); - _brokers.put(broker.getQMFId(), broker); - } - - public void removeBroker(final BrokerConfig broker) - { - _brokers.remove(broker.getQMFId()); - _store.removeConfiguredObject(broker); - } - - public long getCreateTime() - { - return _createTime; - } - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SystemConfigType.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SystemConfigType.java deleted file mode 100644 index 4a383cce7a..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/SystemConfigType.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -public final class SystemConfigType extends ConfigObjectType<SystemConfigType, SystemConfig> -{ - private static final List<SystemProperty<?>> SYSTEM_PROPERTIES = new ArrayList<SystemProperty<?>>(); - - public static interface SystemProperty<S> extends ConfigProperty<SystemConfigType, SystemConfig, S> - { - } - - private abstract static class SystemReadWriteProperty<S> extends ConfigProperty.ReadWriteConfigProperty<SystemConfigType, SystemConfig, S> implements SystemProperty<S> - { - public SystemReadWriteProperty(String name) - { - super(name); - SYSTEM_PROPERTIES.add(this); - } - } - - private abstract static class SystemReadOnlyProperty<S> extends ConfigProperty.ReadOnlyConfigProperty<SystemConfigType, SystemConfig, S> implements SystemProperty<S> - { - public SystemReadOnlyProperty(String name) - { - super(name); - SYSTEM_PROPERTIES.add(this); - } - } - - public static final SystemReadOnlyProperty<String> NAME_PROPERTY = new SystemReadOnlyProperty<String>("name") - { - public String getValue(SystemConfig object) - { - return object.getName(); - } - }; - - public static final SystemReadOnlyProperty<UUID> ID_PROPERTY = new SystemReadOnlyProperty<UUID>("id") - { - public UUID getValue(SystemConfig object) - { - return object.getQMFId(); - } - }; - - public static final SystemReadOnlyProperty<String> OS_NAME_PROPERTY = new SystemReadOnlyProperty<String>("osName") - { - public String getValue(SystemConfig object) - { - return object.getOperatingSystemName(); - } - }; - - public static final SystemReadOnlyProperty<String> NODE_NAME_PROPERTY = new SystemReadOnlyProperty<String>("nodeName") - { - public String getValue(SystemConfig object) - { - return object.getNodeName(); - } - }; - - public static final SystemReadOnlyProperty<String> RELEASE_PROPERTY = new SystemReadOnlyProperty<String>("release") - { - public String getValue(SystemConfig object) - { - return object.getOSRelease(); - } - }; - - public static final SystemReadOnlyProperty<String> VERSION_PROPERTY = new SystemReadOnlyProperty<String>("version") - { - public String getValue(SystemConfig object) - { - return object.getOSVersion(); - } - }; - - public static final SystemReadOnlyProperty<String> MACHINE_PROPERTY = new SystemReadOnlyProperty<String>("machine") - { - public String getValue(SystemConfig object) - { - return object.getOSArchitecture(); - } - }; - - private static final SystemConfigType INSTANCE = new SystemConfigType(); - - private SystemConfigType() - { - } - - public Collection<SystemProperty<?>> getProperties() - { - return Collections.unmodifiableList(SYSTEM_PROPERTIES); - } - - - - public static SystemConfigType getInstance() - { - return INSTANCE; - } - - - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfig.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfig.java deleted file mode 100644 index b96ddc56c6..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfig.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * 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.server.configuration; - -public interface VirtualHostConfig extends ConfiguredObject<VirtualHostConfigType, VirtualHostConfig> -{ - String getName(); - - BrokerConfig getBroker(); - - String getFederationTag(); - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfigType.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfigType.java deleted file mode 100644 index 16e08e3934..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfigType.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -public class VirtualHostConfigType extends ConfigObjectType<VirtualHostConfigType, VirtualHostConfig> -{ - private static final List<VirtualHostProperty<?>> VIRTUAL_HOST_PROPERTIES = new ArrayList<VirtualHostProperty<?>>(); - private static final VirtualHostConfigType INSTANCE = new VirtualHostConfigType(); -public static interface VirtualHostProperty<S> extends ConfigProperty<VirtualHostConfigType, VirtualHostConfig, S> - { - } - - private abstract static class VirtualHostReadWriteProperty<S> extends ConfigProperty.ReadWriteConfigProperty<VirtualHostConfigType, VirtualHostConfig, S> implements VirtualHostProperty<S> - { - public VirtualHostReadWriteProperty(String name) - { - super(name); - VIRTUAL_HOST_PROPERTIES.add(this); - } - } - - private abstract static class VirtualHostReadOnlyProperty<S> extends ConfigProperty.ReadOnlyConfigProperty<VirtualHostConfigType, VirtualHostConfig, S> implements VirtualHostProperty<S> - { - public VirtualHostReadOnlyProperty(String name) - { - super(name); - VIRTUAL_HOST_PROPERTIES.add(this); - } - } - - - public static final VirtualHostReadOnlyProperty<String> NAME_PROPERTY = new VirtualHostReadOnlyProperty<String>("name") - { - public String getValue(VirtualHostConfig object) - { - return object.getName(); - } - }; - - - public static final VirtualHostReadOnlyProperty<BrokerConfig> BROKER_PROPERTY = new VirtualHostReadOnlyProperty<BrokerConfig>("broker") - { - public BrokerConfig getValue(VirtualHostConfig object) - { - return object.getBroker(); - } - }; - - public static final VirtualHostReadOnlyProperty<String> FEDERATION_TAG_PROPERTY = new VirtualHostReadOnlyProperty<String>("federationTag") - { - public String getValue(VirtualHostConfig object) - { - return object.getFederationTag(); - } - }; - - - - public Collection<? extends ConfigProperty<VirtualHostConfigType, VirtualHostConfig, ?>> getProperties() - { - return Collections.unmodifiableList(VIRTUAL_HOST_PROPERTIES); - } - - - private VirtualHostConfigType() - { - } - - public static VirtualHostConfigType getInstance() - { - return INSTANCE; - } - - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java index 512a8c6996..36cdfee6cc 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java @@ -23,9 +23,6 @@ package org.apache.qpid.server.exchange; import org.apache.qpid.AMQException; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.server.binding.Binding; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.ConfiguredObject; -import org.apache.qpid.server.configuration.ExchangeConfigType; import org.apache.qpid.server.logging.LogSubject; import org.apache.qpid.server.logging.actors.CurrentActor; import org.apache.qpid.server.logging.messages.ExchangeMessages; @@ -86,8 +83,6 @@ public abstract class AbstractExchange implements Exchange //TODO : persist creation time private long _createTime = System.currentTimeMillis(); - private UUID _qmfId; - public AbstractExchange(final ExchangeType<? extends Exchange> type) { _type = type; @@ -113,19 +108,12 @@ public abstract class AbstractExchange implements Exchange _ticket = ticket; _id = id; - _qmfId = getConfigStore().createId(); - getConfigStore().addConfiguredObject(this); _logSubject = new ExchangeLogSubject(this, this.getVirtualHost()); // Log Exchange creation CurrentActor.get().message(ExchangeMessages.CREATED(String.valueOf(getTypeShortString()), String.valueOf(name), durable)); } - public ConfigStore getConfigStore() - { - return getVirtualHost().getConfigStore(); - } - public boolean isDurable() { return _durable; @@ -146,7 +134,6 @@ public abstract class AbstractExchange implements Exchange if(_closed.compareAndSet(false,true)) { - getConfigStore().removeConfiguredObject(this); if(_alternateExchange != null) { _alternateExchange.removeReference(this); @@ -298,29 +285,11 @@ public abstract class AbstractExchange implements Exchange return _id; } - @Override - public UUID getQMFId() - { - return _qmfId; - } - - public ExchangeConfigType getConfigType() - { - return ExchangeConfigType.getInstance(); - } - - public ConfiguredObject getParent() - { - return _virtualHost; - } - public long getBindingCount() { return getBindings().size(); } - - public final List<? extends BaseQueue> route(final InboundMessage message) { _receivedMessageCount.incrementAndGet(); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java index 5058f91995..3fd8da9b6f 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java @@ -27,7 +27,6 @@ import org.apache.qpid.AMQSecurityException; import org.apache.qpid.AMQUnknownExchangeType; import org.apache.qpid.exchange.ExchangeDefaults; import org.apache.qpid.framing.AMQShortString; -import org.apache.qpid.qmf.ManagementExchange; import org.apache.qpid.server.configuration.VirtualHostConfiguration; import org.apache.qpid.server.model.UUIDGenerator; import org.apache.qpid.server.registry.ApplicationRegistry; @@ -54,7 +53,6 @@ public class DefaultExchangeFactory implements ExchangeFactory registerExchangeType(TopicExchange.TYPE); registerExchangeType(HeadersExchange.TYPE); registerExchangeType(FanoutExchange.TYPE); - registerExchangeType(ManagementExchange.TYPE); } public void registerExchangeType(ExchangeType<? extends Exchange> type) @@ -73,10 +71,6 @@ public class DefaultExchangeFactory implements ExchangeFactory new ArrayList<ExchangeType<? extends Exchange>>(); publicTypes.addAll(_exchangeClassMap.values()); - //Remove the ManagementExchange type if present, as these - //are private and cannot be created by external means - publicTypes.remove(ManagementExchange.TYPE); - return publicTypes; } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/Exchange.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/Exchange.java index 762686e68d..62d432cb68 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/Exchange.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/Exchange.java @@ -26,7 +26,6 @@ import org.apache.qpid.AMQSecurityException; 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.ExchangeConfig; import org.apache.qpid.server.message.InboundMessage; import org.apache.qpid.server.queue.AMQQueue; import org.apache.qpid.server.queue.BaseQueue; @@ -38,9 +37,23 @@ import java.util.List; import java.util.Map; import java.util.UUID; -public interface Exchange extends ExchangeReferrer, ExchangeConfig +public interface Exchange extends ExchangeReferrer { + String getName(); + + ExchangeType getType(); + + long getBindingCount(); + + long getByteDrops(); + + long getByteReceives(); + + long getMsgDrops(); + + long getMsgReceives(); + public interface BindingListener { void bindingAdded(Exchange exchange, Binding binding); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java index 0ce16bd3f7..480d4e4215 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java @@ -291,7 +291,7 @@ public class TopicExchange extends AbstractExchange public boolean isBound(AMQShortString routingKey, FieldTable arguments, AMQQueue queue) { - Binding binding = new Binding(null, null, routingKey.toString(), queue, this, FieldTable.convertToMap(arguments)); + Binding binding = new Binding(null, routingKey.toString(), queue, this, FieldTable.convertToMap(arguments)); if (arguments == null) { @@ -314,7 +314,7 @@ public class TopicExchange extends AbstractExchange public boolean isBound(String bindingKey, Map<String, Object> arguments, AMQQueue queue) { - Binding binding = new Binding(null, null, bindingKey, queue, this, arguments); + Binding binding = new Binding(null, bindingKey, queue, this, arguments); if (arguments == null) { return _bindings.containsKey(binding); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/federation/Bridge.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/federation/Bridge.java deleted file mode 100644 index 7eb476b15a..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/federation/Bridge.java +++ /dev/null @@ -1,913 +0,0 @@ -/* - * - * 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.server.federation; - -import org.apache.qpid.AMQException; -import org.apache.qpid.AMQStoreException; -import org.apache.qpid.server.binding.Binding; -import org.apache.qpid.server.configuration.BridgeConfig; -import org.apache.qpid.server.configuration.BridgeConfigType; -import org.apache.qpid.server.configuration.ConfiguredObject; -import org.apache.qpid.server.exchange.Exchange; -import org.apache.qpid.server.exchange.ExchangeRegistry; -import org.apache.qpid.server.flow.FlowCreditManager_0_10; -import org.apache.qpid.server.flow.WindowCreditManager; -import org.apache.qpid.server.message.MessageMetaData_0_10; -import org.apache.qpid.server.message.MessageTransferMessage; -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.queue.AMQQueue; -import org.apache.qpid.server.queue.AMQQueueFactory; -import org.apache.qpid.server.queue.BaseQueue; -import org.apache.qpid.server.queue.QueueRegistry; -import org.apache.qpid.server.store.MessageStore; -import org.apache.qpid.server.store.StoredMessage; -import org.apache.qpid.server.subscription.SubscriptionFactoryImpl; -import org.apache.qpid.server.subscription.Subscription_0_10; -import org.apache.qpid.server.transport.ServerSession; -import org.apache.qpid.server.txn.AutoCommitTransaction; -import org.apache.qpid.server.txn.ServerTransaction; -import org.apache.qpid.server.virtualhost.VirtualHost; -import org.apache.qpid.transport.DeliveryProperties; -import org.apache.qpid.transport.MessageAcceptMode; -import org.apache.qpid.transport.MessageAcquireMode; -import org.apache.qpid.transport.MessageCreditUnit; -import org.apache.qpid.transport.MessageFlowMode; -import org.apache.qpid.transport.MessageReject; -import org.apache.qpid.transport.MessageRejectCode; -import org.apache.qpid.transport.MessageTransfer; -import org.apache.qpid.transport.Option; -import org.apache.qpid.transport.RangeSet; -import org.apache.qpid.transport.RangeSetFactory; -import org.apache.qpid.transport.Session; -import org.apache.qpid.transport.SessionException; -import org.apache.qpid.transport.SessionListener; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -public class Bridge implements BridgeConfig -{ - private static final String DURABLE = "durable"; - private static final String DYNAMIC = "dynamic"; - private static final String SRC_IS_QUEUE = "srcIsQueue"; - private static final String SRC_IS_LOCAL = "srcIsLocal"; - private static final String SOURCE = "source"; - private static final String DESTINATION = "destination"; - private static final String KEY = "key"; - private static final String TAG = "tag"; - private static final String EXCLUDES = "excludes"; - private final boolean _durable; - private final boolean _dynamic; - private final boolean _queueBridge; - private final boolean _localSource; - private final String _source; - private final String _destination; - private final String _key; - private final String _tag; - private final String _excludes; - private final BrokerLink _link; - private UUID _qmfId; - private long _createTime = System.currentTimeMillis(); - - private Session _session; - - private BridgeImpl _delegate; - - private final int _bridgeNo; - private AutoCommitTransaction _transaction; - - public Bridge(final BrokerLink brokerLink, - final int bridgeNo, - final boolean durable, - final boolean dynamic, - final boolean srcIsQueue, - final boolean srcIsLocal, - final String src, - final String dest, - final String key, - final String tag, - final String excludes) - { - _link = brokerLink; - _bridgeNo = bridgeNo; - _durable = durable; - _dynamic = dynamic; - _queueBridge = srcIsQueue; - _localSource = srcIsLocal; - _source = src; - _destination = dest; - _key = key; - _tag = tag; - _excludes = excludes; - _qmfId = durable ? brokerLink.getConfigStore().createPersistentId() : brokerLink.getConfigStore().createId(); - - _transaction = new AutoCommitTransaction(getVirtualHost().getMessageStore()); - - if(durable) - { - try - { - brokerLink.getVirtualHost().getMessageStore().createBridge(this); - } - catch (AMQStoreException e) - { - throw new RuntimeException(e); - } - } - - createDelegate(); - } - - private void createDelegate() - { - if(_dynamic) - { - if(_localSource) - { - // TODO - } - else - { - if(_queueBridge) - { - // TODO - } - else - { - _delegate = new DynamicExchangeBridge(); - } - } - } - else - { - if(_localSource) - { - if(_queueBridge) - { - _delegate = new StaticQueuePushBridge(); - } - else - { - _delegate = new StaticExchangePushBridge(); - } - } - else - { - if(_queueBridge) - { - _delegate = new StaticQueuePullBridge(); - } - else - { - _delegate = new StaticExchangePullBridge(); - } - } - } - } - - public Bridge(final BrokerLink brokerLink, - final int bridgeNo, - final UUID id, - final long createTime, - final Map<String, String> arguments) - { - _link = brokerLink; - _bridgeNo = bridgeNo; - _qmfId = id; - brokerLink.getConfigStore().persistentIdInUse(id); - _createTime = createTime; - - _durable = Boolean.valueOf(arguments.get(DURABLE)); - _dynamic = Boolean.valueOf(arguments.get(DYNAMIC)); - _queueBridge = Boolean.valueOf(arguments.get(SRC_IS_QUEUE)); - _localSource = Boolean.valueOf(arguments.get(SRC_IS_LOCAL)); - _source = arguments.get(SOURCE); - _destination = arguments.get(DESTINATION); - _key = arguments.get(KEY); - _tag = arguments.get(TAG); - _excludes = arguments.get(EXCLUDES); - - //TODO. - _transaction = new AutoCommitTransaction(getVirtualHost().getMessageStore()); - - - if(_durable) - { - try - { - brokerLink.getVirtualHost().getMessageStore().createBridge(this); - } - catch (AMQStoreException e) - { - throw new RuntimeException(e); - } - } - - createDelegate(); - } - - - public Map<String,String> getArguments() - { - Map<String,String> arguments = new HashMap<String, String>(); - - arguments.put(DURABLE, String.valueOf(_durable)); - arguments.put(DYNAMIC, String.valueOf(_dynamic)); - arguments.put(SRC_IS_QUEUE, String.valueOf(_queueBridge)); - arguments.put(SRC_IS_LOCAL, String.valueOf(_localSource)); - arguments.put(SOURCE, _source); - arguments.put(DESTINATION, _destination); - arguments.put(KEY, _key); - arguments.put(TAG, _tag); - arguments.put(EXCLUDES, _excludes); - - return Collections.unmodifiableMap(arguments); - } - - @Override - public UUID getQMFId() - { - return _qmfId; - } - - public BridgeConfigType getConfigType() - { - return BridgeConfigType.getInstance(); - } - - public ConfiguredObject getParent() - { - return getLink(); - } - - public boolean isDurable() - { - return _durable; - } - - public boolean isDynamic() - { - return _dynamic; - } - - public boolean isQueueBridge() - { - return _queueBridge; - } - - public boolean isLocalSource() - { - return _localSource; - } - - public String getSource() - { - return _source; - } - - public String getDestination() - { - return _destination; - } - - public String getKey() - { - return _key; - } - - public String getTag() - { - return _tag; - } - - public String getExcludes() - { - return _excludes; - } - - public BrokerLink getLink() - { - return _link; - } - - public Integer getChannelId() - { - return (_session == null) ? 0 : _session.getChannel(); - } - - public int getAckBatching() - { - return 0; - } - - public long getCreateTime() - { - return _createTime; - } - - @Override - public boolean equals(final Object o) - { - if (this == o) - { - return true; - } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - final Bridge bridge = (Bridge) o; - - if (_durable != bridge._durable) - { - return false; - } - if (_dynamic != bridge._dynamic) - { - return false; - } - if (_localSource != bridge._localSource) - { - return false; - } - if (_queueBridge != bridge._queueBridge) - { - return false; - } - if (_destination != null ? !_destination.equals(bridge._destination) : bridge._destination != null) - { - return false; - } - if (_excludes != null ? !_excludes.equals(bridge._excludes) : bridge._excludes != null) - { - return false; - } - if (_key != null ? !_key.equals(bridge._key) : bridge._key != null) - { - return false; - } - if (_source != null ? !_source.equals(bridge._source) : bridge._source != null) - { - return false; - } - if (_tag != null ? !_tag.equals(bridge._tag) : bridge._tag != null) - { - return false; - } - - return true; - } - - @Override - public int hashCode() - { - int result = (_durable ? 1 : 0); - result = 31 * result + (_dynamic ? 1 : 0); - result = 31 * result + (_queueBridge ? 1 : 0); - result = 31 * result + (_localSource ? 1 : 0); - result = 31 * result + (_source != null ? _source.hashCode() : 0); - result = 31 * result + (_destination != null ? _destination.hashCode() : 0); - result = 31 * result + (_key != null ? _key.hashCode() : 0); - result = 31 * result + (_tag != null ? _tag.hashCode() : 0); - result = 31 * result + (_excludes != null ? _excludes.hashCode() : 0); - return result; - } - - public void setSession(final Session session) - { - _session = session; - _delegate.setSession(session); - } - - private long getMessageWindowSize() - { - return 10l; - } - - - VirtualHost getVirtualHost() - { - return _link.getVirtualHost(); - } - - public void close() - { - // TODO - _delegate.close(); - _session = null; - } - - - - private interface BridgeImpl - { - void setSession(Session session); - - void close(); - } - - private abstract class AbstractPullBridge implements BridgeImpl, SessionListener - { - public final void setSession(final Session session) - { - session.setSessionListener(this); - onSession(); - - } - - abstract void onSession(); - - - - public void message(final Session ssn, final MessageTransfer xfr) - { - ExchangeRegistry exchangeRegistry = getVirtualHost().getExchangeRegistry(); - - Exchange exchange = exchangeRegistry.getExchange(_destination); - - // TODO - deal with exchange not existing - - DeliveryProperties delvProps = null; - if(xfr.getHeader() != null && (delvProps = xfr.getHeader().getDeliveryProperties()) != null && delvProps.hasTtl() && - !delvProps.hasExpiration()) - { - delvProps.setExpiration(System.currentTimeMillis() + delvProps.getTtl()); - } - - MessageMetaData_0_10 messageMetaData = new MessageMetaData_0_10(xfr); - final MessageStore store = getVirtualHost().getMessageStore(); - StoredMessage<MessageMetaData_0_10> storeMessage = store.addMessage(messageMetaData); - storeMessage.addContent(0,xfr.getBody()); - storeMessage.flushToStore(); - MessageTransferMessage message = new MessageTransferMessage(storeMessage, ((ServerSession)_session).getReference()); - - List<? extends BaseQueue> queues = exchange.route(message); - - - - if(queues != null && queues.size() != 0) - { - enqueue(message, queues); - } - else - { - if(delvProps == null || !delvProps.hasDiscardUnroutable() || !delvProps.getDiscardUnroutable()) - { - if(xfr.getAcceptMode() == MessageAcceptMode.EXPLICIT) - { - RangeSet rejects = RangeSetFactory.createRangeSet(); - rejects.add(xfr.getId()); - MessageReject reject = new MessageReject(rejects, MessageRejectCode.UNROUTABLE, "Unroutable"); - ssn.invoke(reject); - } - else - { - Exchange alternate = exchange.getAlternateExchange(); - if(alternate != null) - { - queues = alternate.route(message); - if(queues != null && queues.size() != 0) - { - enqueue(message, queues); - } - else - { - //TODO - log the message discard - } - } - else - { - //TODO - log the message discard - } - - - } - } - - - } - - ssn.processed(xfr); - - } - - - private void enqueue(final ServerMessage message, final List<? extends BaseQueue> queues) - { - _transaction.enqueue(queues,message, new ServerTransaction.Action() - { - - private BaseQueue[] _queues = queues.toArray(new BaseQueue[queues.size()]); - - public void postCommit() - { - for(int i = 0; i < _queues.length; i++) - { - try - { - _queues[i].enqueue(message); - } - catch (AMQException e) - { - // TODO - - throw new RuntimeException(e); - } - } - } - - public void onRollback() - { - // NO-OP - } - }, 0L); - } - - public void exception(final Session session, final SessionException exception) - { - // TODO - Handle exceptions - } - - public void closed(final Session session) - { - // TODO - handle close - } - - public void opened(final Session session) - { - // this method never called - } - - public void resumed(final Session session) - { - // will never resume these sessions - } - - - - } - - private final class StaticExchangePullBridge extends AbstractPullBridge - { - private final String _tmpQueueName = "bridge_queue_" + _bridgeNo + "_" + _link.getFederationTag();; - - public void onSession() - { - - final HashMap<String, Object> options = new HashMap<String, Object>(); - options.put("qpid.trace.exclude", _link.getFederationTag()); - options.put("qpid.trace.id",_link.getRemoteFederationTag()); - _session.queueDeclare(_tmpQueueName,null, options, Option.AUTO_DELETE, Option.EXCLUSIVE); - _session.sync(); - // todo check exception - final Map<String,Object> bindingArgs = new HashMap<String,Object>(); - _session.exchangeBind(_tmpQueueName, _source, _key, bindingArgs); - _session.sync(); - // todo check exception - - final Map<String,Object> subscribeOptions = Collections.EMPTY_MAP; - final String subName = String.valueOf(_bridgeNo); - _session.messageSubscribe(_tmpQueueName, - subName,MessageAcceptMode.NONE,MessageAcquireMode.PRE_ACQUIRED,null,0l, subscribeOptions); - _session.sync(); - // todo check exception - - _session.messageSetFlowMode(subName,MessageFlowMode.WINDOW); - _session.messageFlow(subName, MessageCreditUnit.MESSAGE, getMessageWindowSize()); - _session.messageFlow(subName, MessageCreditUnit.BYTE, 0xFFFFFFFF); - - } - - public void close() - { - // TODO - } - } - - private final class StaticQueuePullBridge extends AbstractPullBridge - { - - public void onSession() - { - - final Map<String,Object> subscribeOptions = Collections.EMPTY_MAP; - final String subName = String.valueOf(_bridgeNo); - _session.messageSubscribe(_source, - subName,MessageAcceptMode.NONE,MessageAcquireMode.PRE_ACQUIRED,null,0l, subscribeOptions); - _session.sync(); - // todo check exception - - _session.messageSetFlowMode(subName,MessageFlowMode.WINDOW); - _session.messageFlow(subName, MessageCreditUnit.MESSAGE, getMessageWindowSize()); - _session.messageFlow(subName, MessageCreditUnit.BYTE, 0xFFFFFFFF); - - } - - public void close() - { - // TODO - } - } - - private final class DynamicExchangeBridge extends AbstractPullBridge implements Exchange.BindingListener - { - private final String _tmpQueueName = "bridge_queue_" + _bridgeNo + "_" + _link.getFederationTag(); - - private final ConcurrentMap<Binding,Binding> _bindings = new ConcurrentHashMap<Binding,Binding>(); - - - void onSession() - { - - - final HashMap<String, Object> options = new HashMap<String, Object>(); - options.put("qpid.trace.exclude", _link.getFederationTag()); - options.put("qpid.trace.id",_link.getRemoteFederationTag()); - _session.queueDeclare(_tmpQueueName,null, options, Option.AUTO_DELETE, Option.EXCLUSIVE); - _session.sync(); - // todo - check exception - - final Map<String,Object> subscribeOptions = Collections.EMPTY_MAP; - final String subName = String.valueOf(_bridgeNo); - _session.messageSubscribe(_tmpQueueName, - subName,MessageAcceptMode.NONE,MessageAcquireMode.PRE_ACQUIRED,null,0l, subscribeOptions); - _session.sync(); - // todo check exception - _session.messageSetFlowMode(subName,MessageFlowMode.WINDOW); - _session.messageFlow(subName, MessageCreditUnit.MESSAGE, getMessageWindowSize()); - _session.messageFlow(subName, MessageCreditUnit.BYTE, 0xFFFFFFFF); - _session.sync(); - // todo check exception - - - ExchangeRegistry exchangeRegistry = getVirtualHost().getExchangeRegistry(); - - Exchange exchange = exchangeRegistry.getExchange(_destination); - - // TODO - check null - - exchange.addBindingListener(this); - - Collection<Binding> bindings = exchange.getBindings(); - for(Binding binding : bindings) - { - propogateBinding(binding); - } - - } - - private void propogateBinding(final Binding binding) - { - if(_bindings.putIfAbsent(binding,binding)== null) - { - Map<String,Object> arguments = new HashMap<String,Object>(binding.getArguments()); - - if(arguments.get("qpid.fed.origin") == null) - { - arguments.put("qpid.fed.op",""); - arguments.put("qpid.fed.origin",_link.getFederationTag()); - arguments.put("qpid.fed.tags",_link.getFederationTag()); - } - else - { - String tags = (String) arguments.get("qpid.fed.tags"); - if(tags == null) - { - tags = _link.getFederationTag(); - } - else - { - if(Arrays.asList(tags.split(",")).contains(_link.getFederationTag())) - { - return; - } - tags += "," + _link.getFederationTag(); - } - arguments.put("qpid.fed.tags", tags); - } - - _session.exchangeBind(_tmpQueueName, _source, binding.getBindingKey(), arguments); - _session.sync(); - // TODO - check exception? - - } - } - - private void propogateBindingRemoval(final Binding binding) - { - if(_bindings.remove(binding) != null) - { - // TODO - this is wrong!!!! - _session.exchangeUnbind(_tmpQueueName, _source, binding.getBindingKey()); - } - } - - - public void bindingAdded(final Exchange exchange, final Binding binding) - { - propogateBinding(binding); - } - - public void bindingRemoved(final Exchange exchange, final Binding binding) - { - propogateBindingRemoval(binding); - } - - public void close() - { - // TODO - } - } - - private class StaticExchangePushBridge implements BridgeImpl, SessionListener - { - private final String _tmpQueueName = "bridge_queue_" + _bridgeNo + "_" + _link.getFederationTag(); - private AMQQueue _queue; - - public void setSession(final Session session) - { - assert session instanceof ServerSession; - - session.setSessionListener(this); - - ExchangeRegistry exchangeRegistry = getVirtualHost().getExchangeRegistry(); - - Exchange exchange = exchangeRegistry.getExchange(_source); - - // TODO - Check null - - final HashMap<String, Object> options = new HashMap<String, Object>(); - options.put("qpid.trace.exclude", _link.getFederationTag()); - options.put("qpid.trace.id",_link.getRemoteFederationTag()); - - try - { - _queue = AMQQueueFactory.createAMQQueueImpl(null, - _tmpQueueName, - isDurable(), - _link.getFederationTag(), - false, - false, - getVirtualHost(), options); - } - catch (AMQException e) - { - // TODO - throw new RuntimeException(e); - } - - FlowCreditManager_0_10 creditManager = new WindowCreditManager(0xFFFFFFFF,getMessageWindowSize()); - - //TODO Handle the passing of non-null Filters and Arguments here - - Subscription_0_10 sub = SubscriptionFactoryImpl.INSTANCE.createSubscription((ServerSession)session, - _destination, - MessageAcceptMode.NONE, - MessageAcquireMode.PRE_ACQUIRED, - MessageFlowMode.WINDOW, - creditManager, null,null); - - ((ServerSession)session).register(_destination, sub); - - try - { - _queue.registerSubscription(sub, true); - getVirtualHost().getBindingFactory().addBinding(_key, _queue, exchange, Collections.<String, Object>emptyMap()); - } - catch (AMQException e) - { - // TODO - throw new RuntimeException(e); - } - } - - public void close() - { - // TODO - } - - public void opened(final Session session) - { - // this method never called - } - - public void resumed(final Session session) - { - // this session will never be resumed - } - - public void message(final Session ssn, final MessageTransfer xfr) - { - // messages should not be sent ... should probably log error - } - - public void exception(final Session session, final SessionException exception) - { - // TODO - } - - public void closed(final Session session) - { - // TODO - } - } - - private class StaticQueuePushBridge implements BridgeImpl, SessionListener - { - private AMQQueue _queue; - - public void setSession(final Session session) - { - assert session instanceof ServerSession; - - session.setSessionListener(this); - - QueueRegistry queueRegistry = getVirtualHost().getQueueRegistry(); - - _queue = queueRegistry.getQueue(_source); - - // TODO - null check - - FlowCreditManager_0_10 creditManager = new WindowCreditManager(0xFFFFFFFF,getMessageWindowSize()); - - //TODO Handle the passing of non-null Filters and Arguments here - - Subscription_0_10 sub = SubscriptionFactoryImpl.INSTANCE.createSubscription((ServerSession)session, - _destination, - MessageAcceptMode.NONE, - MessageAcquireMode.PRE_ACQUIRED, - MessageFlowMode.WINDOW, - creditManager, null,null); - - ((ServerSession)session).register(_destination, sub); - - try - { - _queue.registerSubscription(sub, false); - } - catch (AMQException e) - { - // TODO - throw new RuntimeException(e); - } - - } - - public void close() - { - // TODO - } - - public void opened(final Session session) - { - // never called - } - - public void resumed(final Session session) - { - // session will not resume - } - - public void message(final Session ssn, final MessageTransfer xfr) - { - // should never be called ... should probably log error - } - - public void exception(final Session session, final SessionException exception) - { - // TODO - } - - public void closed(final Session session) - { - // TODO - } - } - -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/federation/BrokerLink.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/federation/BrokerLink.java deleted file mode 100644 index 1ef57c53cb..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/federation/BrokerLink.java +++ /dev/null @@ -1,692 +0,0 @@ -/* - * - * 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.server.federation; - -import org.apache.qpid.AMQStoreException; -import org.apache.qpid.common.ServerPropertyNames; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.ConfiguredObject; -import org.apache.qpid.server.configuration.ConnectionConfig; -import org.apache.qpid.server.configuration.ConnectionConfigType; -import org.apache.qpid.server.configuration.LinkConfig; -import org.apache.qpid.server.configuration.LinkConfigType; -import org.apache.qpid.server.transport.ServerSession; -import org.apache.qpid.server.virtualhost.VirtualHost; -import org.apache.qpid.transport.Binary; -import org.apache.qpid.transport.ClientDelegate; -import org.apache.qpid.transport.Connection; -import org.apache.qpid.transport.ConnectionException; -import org.apache.qpid.transport.ConnectionListener; -import org.apache.qpid.transport.ConnectionSettings; -import org.apache.qpid.transport.Session; -import org.apache.qpid.transport.SessionDelegate; -import org.apache.qpid.transport.TransportException; - -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.NameCallback; -import javax.security.auth.callback.PasswordCallback; -import javax.security.auth.callback.UnsupportedCallbackException; -import javax.security.sasl.Sasl; -import javax.security.sasl.SaslClient; -import javax.security.sasl.SaslException; -import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; -import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; - -public class BrokerLink implements LinkConfig, ConnectionListener -{ - - private static final int CORE_POOL_SIZE = 4; - - private static final ScheduledThreadPoolExecutor _threadPool = - new ScheduledThreadPoolExecutor(CORE_POOL_SIZE); - private static final String TRANSPORT = "transport"; - private static final String HOST = "host"; - private static final String PORT = "port"; - private static final String REMOTE_VHOST = "remoteVhost"; - private static final String DURABLE = "durable"; - private static final String AUTH_MECHANISM = "authMechanism"; - private static final String USERNAME = "username"; - private static final String PASSWORD = "password"; - - - private final String _transport; - private final String _host; - private final int _port; - private final String _remoteVhost; - private final boolean _durable; - private final String _authMechanism; - private final String _username; - private final String _password; - private final VirtualHost _virtualHost; - private UUID _qmfId; - private AtomicBoolean _closing = new AtomicBoolean(); - private final long _createTime; - private Connection _qpidConnection; - private AtomicReference<Thread> _executor = new AtomicReference<Thread>(); - private AtomicInteger _bridgeId = new AtomicInteger(); - - private final ConcurrentHashMap<Bridge,Bridge> _bridges = new ConcurrentHashMap<Bridge,Bridge>(); - private final ConcurrentHashMap<Bridge,Bridge> _activeBridges = new ConcurrentHashMap<Bridge,Bridge>(); - private final ConcurrentLinkedQueue<Bridge> _pendingBridges = new ConcurrentLinkedQueue<Bridge>(); - private String _remoteFederationTag; - - private ConnectionConfig _connectionConfig; - private ConnectionException _exception; - private String _lastErrorMessage; - private int _retryDelay = 1; - private final Runnable _makeConnectionTask = new Runnable() - { - public void run() - { - doMakeConnection(); - } - }; - - - - - public static enum State - { - OPERATIONAL, - DOWN, - ESTABLISHING, - DELETED - } - - - private volatile State _state = State.DOWN; - - private static final AtomicReferenceFieldUpdater<BrokerLink, State> _stateUpdater = - AtomicReferenceFieldUpdater.newUpdater(BrokerLink.class, State.class, "_state"); - - private class ConnectionConfigAdapter implements ConnectionConfig - { - private long _adapterCreateTime = System.currentTimeMillis(); - private UUID _qmfId = BrokerLink.this.getConfigStore().createId(); - - public VirtualHost getVirtualHost() - { - return BrokerLink.this.getVirtualHost(); - } - - public String getAddress() - { - return _host+":"+_port; - } - - public Boolean isIncoming() - { - return false; - } - - public Boolean isSystemConnection() - { - return true; - } - - public Boolean isFederationLink() - { - return true; - } - - public String getAuthId() - { - return _username; - } - - public String getRemoteProcessName() - { - return null; - } - - public Integer getRemotePID() - { - return null; - } - - public Integer getRemoteParentPID() - { - return null; - } - - public ConfigStore getConfigStore() - { - return getVirtualHost().getConfigStore(); - } - - @Override - public UUID getQMFId() - { - return _qmfId; - } - - public ConnectionConfigType getConfigType() - { - return ConnectionConfigType.getInstance(); - } - - public ConfiguredObject getParent() - { - return getVirtualHost(); - } - - public boolean isDurable() - { - return false; - } - - public long getCreateTime() - { - return _adapterCreateTime; - } - - public Boolean isShadow() - { - return false; - } - - public void mgmtClose() - { - _connectionConfig.mgmtClose(); - } - } - - private class SessionFactory implements Connection.SessionFactory - { - - public Session newSession(final Connection conn, final Binary name, final long expiry) - { - return new ServerSession(conn, new SessionDelegate(), name, expiry, _connectionConfig); - } - }; - - public BrokerLink(final VirtualHost virtualHost, UUID qmfId, long createTime, Map<String, String> arguments) - { - _virtualHost = virtualHost; - _qmfId = qmfId; - virtualHost.getConfigStore().persistentIdInUse(qmfId); - _createTime = createTime; - _transport = arguments.get(TRANSPORT); - - _host = arguments.get(HOST); - _port = Integer.parseInt(arguments.get(PORT)); - _remoteVhost = arguments.get(REMOTE_VHOST); - _durable = Boolean.parseBoolean(arguments.get(DURABLE)); - _authMechanism = arguments.get("authMechanism"); - _username = arguments.get("username"); - _password = arguments.get("password"); - - if(_durable) - { - try - { - _virtualHost.getMessageStore().createBrokerLink(this); - } - catch (AMQStoreException e) - { - throw new RuntimeException(e); - } - } - - - _qpidConnection = new Connection(); - _connectionConfig = new ConnectionConfigAdapter(); - _qpidConnection.addConnectionListener(this); - - - makeConnection(); - - } - - - public BrokerLink(final VirtualHost virtualHost, - final String transport, - final String host, - final int port, - final String remoteVhost, - final boolean durable, - final String authMechanism, - final String username, - final String password) - { - _virtualHost = virtualHost; - _transport = transport; - _createTime = System.currentTimeMillis(); - _host = host; - _port = port; - _remoteVhost = remoteVhost; - _durable = durable; - _authMechanism = authMechanism; - _username = username; - _password = password; - _qmfId = durable ? virtualHost.getConfigStore().createPersistentId() : virtualHost.getConfigStore().createId(); - - if(durable) - { - try - { - _virtualHost.getMessageStore().createBrokerLink(this); - } - catch (AMQStoreException e) - { - throw new RuntimeException(e); - } - } - _qpidConnection = new Connection(); - _connectionConfig = new ConnectionConfigAdapter(); - _qpidConnection.addConnectionListener(this); - - makeConnection(); - } - - public Map<String,String> getArguments() - { - Map<String,String> arguments = new HashMap<String, String>(); - - arguments.put(TRANSPORT, _transport); - arguments.put(HOST, _host); - arguments.put(PORT, String.valueOf(_port)); - arguments.put(REMOTE_VHOST, _remoteVhost); - arguments.put(DURABLE, String.valueOf(_durable)); - arguments.put(AUTH_MECHANISM, _authMechanism); - arguments.put(USERNAME, _username); - arguments.put(PASSWORD, _password); - - return Collections.unmodifiableMap(arguments); - } - - private final boolean updateState(State expected, State newState) - { - return _stateUpdater.compareAndSet(this,expected,newState); - } - - private void makeConnection() - { - _threadPool.execute(_makeConnectionTask); - } - - - - private void doMakeConnection() - { - if(updateState(State.DOWN, State.ESTABLISHING)) - { - try - { - _qpidConnection.setConnectionDelegate(new ClientDelegate(new ConnectionSettings()) - { - protected SaslClient createSaslClient(List<Object> brokerMechs) throws ConnectionException, - SaslException - { - Map<String,Object> saslProps = new HashMap<String,Object>(); - - - CallbackHandler cbh = new CallbackHandler() - { - public void handle(final Callback[] callbacks) - throws IOException, UnsupportedCallbackException - { - for (int i = 0; i < callbacks.length; i++) - { - Callback cb = callbacks[i]; - if (cb instanceof NameCallback) - { - ((NameCallback)cb).setName(_username); - } - else if (cb instanceof PasswordCallback) - { - ((PasswordCallback)cb).setPassword(_password.toCharArray()); - } - else - { - throw new UnsupportedCallbackException(cb); - } - } - - } - }; - final SaslClient sc = Sasl.createSaslClient(new String[] {"PLAIN"}, null, - getConnectionSettings().getSaslProtocol(), - getConnectionSettings().getSaslServerName(), - saslProps, cbh); - - return sc; - }}); - - _qpidConnection.connect(_host, _port, _remoteVhost, _username, _password, "ssl".equals(_transport), _authMechanism); - - final Map<String,Object> serverProps = _qpidConnection.getServerProperties(); - - _remoteFederationTag = (String) serverProps.get(ServerPropertyNames.FEDERATION_TAG); - if(_remoteFederationTag == null) - { - _remoteFederationTag = UUID.fromString(_transport+":"+_host+":"+_port).toString(); - } - _qpidConnection.setSessionFactory(new SessionFactory()); - - updateState(State.ESTABLISHING, State.OPERATIONAL); - - _retryDelay = 1; - - for(Bridge bridge : _bridges.values()) - { - if(_state != State.OPERATIONAL) - { - break; - } - addBridge(bridge); - } - - - } - catch (TransportException e) - { - _lastErrorMessage = e.getMessage(); - if(_retryDelay < 60) - { - _retryDelay <<= 1; - } - - updateState(State.ESTABLISHING, State.DOWN); - _activeBridges.clear(); - scheduleConnectionRetry(); - } - } - } - - private void scheduleConnectionRetry() - { - if(_state != State.DELETED) - { - _threadPool.schedule(_makeConnectionTask, _retryDelay, TimeUnit.SECONDS); - } - } - - public VirtualHost getVirtualHost() - { - return _virtualHost; - } - - public String getTransport() - { - return _transport; - } - - public String getHost() - { - return _host; - } - - public int getPort() - { - return _port; - } - - public String getRemoteVhost() - { - return _remoteVhost; - } - - @Override - public UUID getQMFId() - { - return _qmfId; - } - - public LinkConfigType getConfigType() - { - return LinkConfigType.getInstance(); - } - - public ConfiguredObject getParent() - { - return getVirtualHost(); - } - - public boolean isDurable() - { - return _durable; - } - - public String getAuthMechanism() - { - return _authMechanism; - } - - public String getUsername() - { - return _username; - } - - public String getPassword() - { - return _password; - } - - @Override - public boolean equals(final Object o) - { - if (this == o) - { - return true; - } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - final BrokerLink that = (BrokerLink) o; - - if (_port != that._port) - { - return false; - } - if (_host != null ? !_host.equals(that._host) : that._host != null) - { - return false; - } - if (_remoteVhost != null ? !_remoteVhost.equals(that._remoteVhost) : that._remoteVhost != null) - { - return false; - } - if (_transport != null ? !_transport.equals(that._transport) : that._transport != null) - { - return false; - } - - return true; - } - - @Override - public int hashCode() - { - int result = _transport != null ? _transport.hashCode() : 0; - result = 31 * result + (_host != null ? _host.hashCode() : 0); - result = 31 * result + _port; - result = 31 * result + (_remoteVhost != null ? _remoteVhost.hashCode() : 0); - return result; - } - - public void close() - { - if(_closing.compareAndSet(false,true)) - { - // TODO - close connection - for(Bridge bridge : _bridges.values()) - { - bridge.close(); - } - _bridges.clear(); - - _virtualHost.removeBrokerConnection(this); - } - } - - public long getCreateTime() - { - return _createTime; - } - - public void createBridge(final boolean durable, - final boolean dynamic, - final boolean srcIsQueue, - final boolean srcIsLocal, - final String src, - final String dest, - final String key, - final String tag, - final String excludes) - { - if(!_closing.get()) - { - Bridge bridge = new Bridge(this, _bridgeId.incrementAndGet(), durable,dynamic,srcIsQueue,srcIsLocal,src,dest,key,tag,excludes); - if(_bridges.putIfAbsent(bridge, bridge) == null) - { - - addBridge(bridge); - } - } - - - } - - public void createBridge(final UUID id, final long createTime, final Map<String, String> arguments) - { - if(!_closing.get()) - { - Bridge bridge = new Bridge(this, _bridgeId.incrementAndGet(), id, createTime, arguments); - if(_bridges.putIfAbsent(bridge, bridge) == null) - { - - addBridge(bridge); - } - } - } - - - private void addBridge(final Bridge bridge) - { - getConfigStore().addConfiguredObject(bridge); - - if(_state == State.OPERATIONAL && (_activeBridges.putIfAbsent(bridge,bridge) == null)) - { - - - Session session = _qpidConnection.createSession("Bridge(" - + (bridge.isDurable() ? "durable" : "transient") - + "," + (bridge.isDynamic() ? "dynamic" : "static") - + "," + (bridge.isQueueBridge() ? "queue" : "exchange") - + "," + (bridge.isLocalSource() ? "local-src" : "remote-src") - + ",[Source: '" + bridge.getSource() + "']" - + ",[Destination: '" + bridge.getDestination() + "']" - + ",[Key: '" + bridge.getKey() + "']" - + ",[Tag: '" + bridge.getTag() + "']" - + ".[Excludes: '" + bridge.getExcludes() + "'])"); - bridge.setSession(session); - - - if(_closing.get()) - { - bridge.close(); - } - } - - } - - public void opened(final Connection connection) - { - // this method not called - } - - public void exception(final Connection connection, final ConnectionException exception) - { - _exception = exception; - _lastErrorMessage = exception.getMessage(); - - } - - public void closed(final Connection connection) - { - State currentState = _state; - if(currentState != State.DOWN && currentState != State.DELETED && updateState(currentState, State.DOWN)) - { - scheduleConnectionRetry(); - } - } - - public ConfigStore getConfigStore() - { - return getVirtualHost().getConfigStore(); - } - - public String getFederationTag() - { - return getVirtualHost().getFederationTag(); - } - - public String getRemoteFederationTag() - { - return _remoteFederationTag; - } - - public String getState() - { - return _state.name(); - } - - public String getLastError() - { - return _lastErrorMessage; - } - - @Override - public String toString() - { - return "BrokerLink{" + - " _id=" + _qmfId + - ", _transport='" + _transport + '\'' + - ", _host='" + _host + '\'' + - ", _port=" + _port + - ", _remoteVhost='" + _remoteVhost + '\'' + - ", _durable=" + _durable + - ", _authMechanism='" + _authMechanism + '\'' + - ", _username='" + _username + '\'' + - ", _password='" + _password + '\'' + - ", _virtualHost=" + _virtualHost + - ", _createTime=" + _createTime + - ", _remoteFederationTag='" + _remoteFederationTag + '\'' + - ", _state=" + _state + - '}'; - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/ChannelLogSubject.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/ChannelLogSubject.java index 859d7e2a27..bcb9cb2ac4 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/ChannelLogSubject.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/ChannelLogSubject.java @@ -76,7 +76,7 @@ public class ChannelLogSubject extends AbstractLogSubject setLogStringWithFormat(CHANNEL_FORMAT, connection == null ? -1L : connection.getConnectionId(), session.getAuthorizedPrincipal() == null ? "?" : session.getAuthorizedPrincipal().getName(), - (connection == null || connection.getConfig() == null) ? "?" : connection.getConfig().getAddress(), + (connection == null || connection.getRemoteAddressString() == null) ? "?" : connection.getRemoteAddressString(), session.getVirtualHost().getName(), session.getChannel()); } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/model/VirtualHost.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/model/VirtualHost.java index 24a3d43386..01257d588f 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/model/VirtualHost.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/model/VirtualHost.java @@ -60,7 +60,6 @@ public interface VirtualHost extends ConfiguredObject String ALERT_THRESHOLD_QUEUE_DEPTH_BYTES = "alertThresholdQueueDepthBytes"; String ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES = "alertThresholdQueueDepthMessages"; String DEAD_LETTER_QUEUE_ENABLED = "deadLetterQueueEnabled"; - String FEDERATION_TAG = "federationTag"; String HOUSEKEEPING_CHECK_PERIOD = "housekeepingCheckPeriod"; String MAXIMUM_DELIVERY_ATTEMPTS = "maximumDeliveryAttempts"; String QUEUE_FLOW_CONTROL_SIZE_BYTES = "queueFlowControlSizeBytes"; @@ -96,7 +95,6 @@ public interface VirtualHost extends ConfiguredObject SUPPORTED_EXCHANGE_TYPES, SUPPORTED_QUEUE_TYPES, DEAD_LETTER_QUEUE_ENABLED, - FEDERATION_TAG, HOUSEKEEPING_CHECK_PERIOD, MAXIMUM_DELIVERY_ATTEMPTS, QUEUE_FLOW_CONTROL_SIZE_BYTES, diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java index 35838e51d2..fbd9c31527 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java @@ -754,10 +754,6 @@ final class VirtualHostAdapter extends AbstractAdapter implements VirtualHost, E { return _virtualHost.getConfiguration().isDeadLetterQueueEnabled(); } - else if(FEDERATION_TAG.equals(name)) - { - return _virtualHost.getFederationTag(); - } else if(HOUSEKEEPING_CHECK_PERIOD.equals(name)) { return _virtualHost.getConfiguration().getHousekeepingCheckPeriod(); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolEngine.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolEngine.java index aac7562be2..00055d4a99 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolEngine.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolEngine.java @@ -52,10 +52,6 @@ import org.apache.qpid.protocol.AMQMethodEvent; import org.apache.qpid.protocol.AMQMethodListener; import org.apache.qpid.protocol.ServerProtocolEngine; import org.apache.qpid.server.AMQChannel; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.ConfiguredObject; -import org.apache.qpid.server.configuration.ConnectionConfig; -import org.apache.qpid.server.configuration.ConnectionConfigType; import org.apache.qpid.server.handler.ServerMethodDispatcherImpl; import org.apache.qpid.server.logging.LogActor; import org.apache.qpid.server.logging.LogSubject; @@ -82,7 +78,7 @@ import org.apache.qpid.transport.TransportException; import org.apache.qpid.transport.network.NetworkConnection; import org.apache.qpid.util.BytesDataOutput; -public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSession, ConnectionConfig +public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSession { private static final Logger _logger = Logger.getLogger(AMQProtocolEngine.class); @@ -143,8 +139,6 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi private long _maxFrameSize; private final AtomicBoolean _closing = new AtomicBoolean(false); - private final UUID _qmfId; - private final ConfigStore _configStore; private long _createTime = System.currentTimeMillis(); private StatisticsCounter _messagesDelivered, _dataDelivered, _messagesReceived, _dataReceived; @@ -171,9 +165,6 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi _logSubject = new ConnectionLogSubject(this); - _configStore = virtualHostRegistry.getConfigStore(); - _qmfId = _configStore.createId(); - _actor.message(ConnectionMessages.OPEN(null, null, null, false, false, false)); initialiseStatistics(); @@ -797,8 +788,6 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi closeAllChannels(); - getConfigStore().removeConfiguredObject(this); - for (Task task : _taskList) { task.doTask(this); @@ -984,7 +973,6 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi _virtualHost.getConnectionRegistry().registerConnection(this); - _configStore.addConfiguredObject(this); } public void addSessionCloseTask(Task task) @@ -1186,32 +1174,11 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi return null; } - public ConfigStore getConfigStore() - { - return _configStore; - } - - public ConnectionConfigType getConfigType() - { - return ConnectionConfigType.getInstance(); - } - - public ConfiguredObject getParent() - { - return getVirtualHost(); - } - public boolean isDurable() { return false; } - @Override - public UUID getQMFId() - { - return _qmfId; - } - public long getConnectionId() { return getSessionID(); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQSessionModel.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQSessionModel.java index a8f62b0fa2..9d9bbe807b 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQSessionModel.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQSessionModel.java @@ -36,8 +36,7 @@ import org.apache.qpid.server.queue.SimpleAMQQueue; */ public interface AMQSessionModel extends Comparable<AMQSessionModel> { - /** Unique session ID across entire broker*/ - public UUID getQMFId(); + public UUID getId(); public AMQConnectionModel getConnectionModel(); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/MultiVersionProtocolEngine.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/MultiVersionProtocolEngine.java index 152f591e66..cb7680e9b6 100755 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/MultiVersionProtocolEngine.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/MultiVersionProtocolEngine.java @@ -305,8 +305,10 @@ public class MultiVersionProtocolEngine implements ServerProtocolEngine new org.apache.qpid.server.transport.ServerConnectionDelegate(_appRegistry, _fqdn, _appRegistry.getSubjectCreator(getLocalAddress())); ServerConnection conn = new ServerConnection(_id); - conn.setConnectionDelegate(connDelegate); + conn.setConnectionDelegate(connDelegate); + conn.setRemoteAddress(_network.getRemoteAddress()); + conn.setLocalAddress(_network.getLocalAddress()); return new ProtocolEngine_0_10( conn, _network, _appRegistry); } }; diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_0_10.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_0_10.java index fd6e9300ec..d7d26cc772 100755 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_0_10.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_0_10.java @@ -21,11 +21,6 @@ package org.apache.qpid.server.protocol; import org.apache.qpid.protocol.ServerProtocolEngine; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.ConfiguredObject; -import org.apache.qpid.server.configuration.ConnectionConfig; -import org.apache.qpid.server.configuration.ConnectionConfigType; -import org.apache.qpid.server.configuration.VirtualHostConfig; import org.apache.qpid.server.logging.messages.ConnectionMessages; import org.apache.qpid.server.registry.IApplicationRegistry; import org.apache.qpid.server.transport.ServerConnection; @@ -39,7 +34,7 @@ import java.net.SocketAddress; import java.nio.ByteBuffer; import java.util.UUID; -public class ProtocolEngine_0_10 extends InputHandler implements ServerProtocolEngine, ConnectionConfig +public class ProtocolEngine_0_10 extends InputHandler implements ServerProtocolEngine { public static final int MAX_FRAME_SIZE = 64 * 1024 - 1; @@ -47,7 +42,6 @@ public class ProtocolEngine_0_10 extends InputHandler implements ServerProtocol private long _readBytes; private long _writtenBytes; private ServerConnection _connection; - private final UUID _qmfId; private final IApplicationRegistry _appRegistry; private long _createTime = System.currentTimeMillis(); @@ -57,9 +51,7 @@ public class ProtocolEngine_0_10 extends InputHandler implements ServerProtocol { super(new Assembler(conn)); _connection = conn; - _connection.setConnectionConfig(this); - _qmfId = appRegistry.getConfigStore().createId(); _appRegistry = appRegistry; if(network != null) @@ -68,14 +60,6 @@ public class ProtocolEngine_0_10 extends InputHandler implements ServerProtocol } - _connection.onOpen(new Runnable() - { - public void run() - { - getConfigStore().addConfiguredObject(ProtocolEngine_0_10.this); - } - }); - } public void setNetworkConnection(NetworkConnection network) @@ -130,72 +114,16 @@ public class ProtocolEngine_0_10 extends InputHandler implements ServerProtocol //Todo } - public VirtualHostConfig getVirtualHost() - { - return _connection.getVirtualHost(); - } - public String getAddress() { return getRemoteAddress().toString(); } - public Boolean isIncoming() - { - return true; - } - - public Boolean isSystemConnection() - { - return false; - } - - public Boolean isFederationLink() - { - return false; - } - public String getAuthId() { return _connection.getAuthorizedPrincipal() == null ? null : _connection.getAuthorizedPrincipal().getName(); } - public String getRemoteProcessName() - { - return null; - } - - public Integer getRemotePID() - { - return null; - } - - public Integer getRemoteParentPID() - { - return null; - } - - public ConfigStore getConfigStore() - { - return _appRegistry.getConfigStore(); - } - - @Override - public UUID getQMFId() - { - return _qmfId; - } - - public ConnectionConfigType getConfigType() - { - return ConnectionConfigType.getInstance(); - } - - public ConfiguredObject getParent() - { - return getVirtualHost(); - } - public boolean isDurable() { return false; @@ -205,7 +133,6 @@ public class ProtocolEngine_0_10 extends InputHandler implements ServerProtocol public void closed() { super.closed(); - getConfigStore().removeConfiguredObject(this); } public long getCreateTime() @@ -213,16 +140,6 @@ public class ProtocolEngine_0_10 extends InputHandler implements ServerProtocol return _createTime; } - public Boolean isShadow() - { - return false; - } - - public void mgmtClose() - { - _connection.mgmtClose(); - } - public long getConnectionId() { return _connection.getConnectionId(); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_1_0_0.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_1_0_0.java index ba5348c0ed..da70e497d6 100755 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_1_0_0.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_1_0_0.java @@ -39,8 +39,6 @@ import org.apache.qpid.amqp_1_0.transport.FrameOutputHandler; import org.apache.qpid.amqp_1_0.type.Binary; import org.apache.qpid.amqp_1_0.type.FrameBody; import org.apache.qpid.protocol.ServerProtocolEngine; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.ConnectionConfigType; import org.apache.qpid.server.protocol.v1_0.Connection_1_0; import org.apache.qpid.server.registry.IApplicationRegistry; import org.apache.qpid.server.security.SubjectCreator; @@ -55,7 +53,6 @@ public class ProtocolEngine_1_0_0 implements ServerProtocolEngine, FrameOutputHa //private NetworkConnection _networkDriver; private long _readBytes; private long _writtenBytes; - private final UUID _id; private final IApplicationRegistry _appRegistry; private long _createTime = System.currentTimeMillis(); private ConnectionEndpoint _conn; @@ -102,7 +99,6 @@ public class ProtocolEngine_1_0_0 implements ServerProtocolEngine, FrameOutputHa public ProtocolEngine_1_0_0(final IApplicationRegistry appRegistry, long id) { - _id = appRegistry.getConfigStore().createId(); _appRegistry = appRegistry; _connectionId = id; } @@ -175,22 +171,6 @@ public class ProtocolEngine_1_0_0 implements ServerProtocolEngine, FrameOutputHa return getRemoteAddress().toString(); } - - public ConfigStore getConfigStore() - { - return _appRegistry.getConfigStore(); - } - - public UUID getId() - { - return _id; - } - - public ConnectionConfigType getConfigType() - { - return ConnectionConfigType.getInstance(); - } - public boolean isDurable() { return false; diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_1_0_0_SASL.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_1_0_0_SASL.java index b80080b991..71d6df27e0 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_1_0_0_SASL.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_1_0_0_SASL.java @@ -40,8 +40,6 @@ import org.apache.qpid.amqp_1_0.transport.FrameOutputHandler; import org.apache.qpid.amqp_1_0.type.Binary; import org.apache.qpid.amqp_1_0.type.FrameBody; import org.apache.qpid.protocol.ServerProtocolEngine; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.ConnectionConfigType; import org.apache.qpid.server.protocol.v1_0.Connection_1_0; import org.apache.qpid.server.registry.ApplicationRegistry; import org.apache.qpid.server.registry.IApplicationRegistry; @@ -53,7 +51,6 @@ public class ProtocolEngine_1_0_0_SASL implements ServerProtocolEngine, FrameOut { private long _readBytes; private long _writtenBytes; - private final UUID _id; private final IApplicationRegistry _appRegistry; private long _createTime = System.currentTimeMillis(); private ConnectionEndpoint _conn; @@ -116,7 +113,6 @@ public class ProtocolEngine_1_0_0_SASL implements ServerProtocolEngine, FrameOut public ProtocolEngine_1_0_0_SASL(final NetworkConnection networkDriver, final IApplicationRegistry appRegistry, long id) { - _id = appRegistry.getConfigStore().createId(); _connectionId = id; _appRegistry = appRegistry; @@ -216,22 +212,6 @@ public class ProtocolEngine_1_0_0_SASL implements ServerProtocolEngine, FrameOut return getRemoteAddress().toString(); } - - public ConfigStore getConfigStore() - { - return _appRegistry.getConfigStore(); - } - - public UUID getId() - { - return _id; - } - - public ConnectionConfigType getConfigType() - { - return ConnectionConfigType.getInstance(); - } - public boolean isDurable() { return false; diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/v1_0/Message_1_0.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/v1_0/Message_1_0.java index 140a815f57..baecb5b0fe 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/v1_0/Message_1_0.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/v1_0/Message_1_0.java @@ -25,7 +25,6 @@ import java.lang.ref.WeakReference; import java.nio.ByteBuffer; import java.util.List; import org.apache.qpid.framing.AMQShortString; -import org.apache.qpid.server.configuration.SessionConfig; import org.apache.qpid.server.message.InboundMessage; import org.apache.qpid.server.message.MessageMetaData_1_0; import org.apache.qpid.server.message.MessageReference; @@ -136,11 +135,6 @@ public class Message_1_0 implements ServerMessage, InboundMessage return buf; } - public SessionConfig getSessionConfig() - { - return null; //TODO - } - public List<ByteBuffer> getFragments() { return _fragments; diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java index 999ffc55e5..a019a4b78d 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java @@ -456,8 +456,9 @@ public class Session_1_0 implements SessionEventListener, AMQSessionModel, LogSu { } + @Override - public UUID getQMFId() + public UUID getId() { return _id; } @@ -580,13 +581,6 @@ public class Session_1_0 implements SessionEventListener, AMQSessionModel, LogSu return 0; } - @Override - public int compareTo(AMQSessionModel o) - { - return getQMFId().compareTo(o.getQMFId()); - } - - public String toLogString() { @@ -604,4 +598,9 @@ public class Session_1_0 implements SessionEventListener, AMQSessionModel, LogSu + "] "; } + @Override + public int compareTo(AMQSessionModel o) + { + return getId().compareTo(o.getId()); + } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java index d3efd63ee0..868c803ae7 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java @@ -23,7 +23,6 @@ package org.apache.qpid.server.queue; import org.apache.qpid.AMQException; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.server.binding.Binding; -import org.apache.qpid.server.configuration.QueueConfig; import org.apache.qpid.server.configuration.plugins.ConfigurationPlugin; import org.apache.qpid.server.exchange.Exchange; import org.apache.qpid.server.exchange.ExchangeReferrer; @@ -39,9 +38,10 @@ import java.util.List; import java.util.Map; import java.util.Set; -public interface AMQQueue extends Comparable<AMQQueue>, ExchangeReferrer, TransactionLogResource, BaseQueue, - QueueConfig +public interface AMQQueue extends Comparable<AMQQueue>, ExchangeReferrer, TransactionLogResource, BaseQueue { + String getName(); + public interface NotificationListener { void notifyClients(NotificationCheck notification, AMQQueue queue, String notificationMsg); @@ -315,4 +315,18 @@ public interface AMQQueue extends Comparable<AMQQueue>, ExchangeReferrer, Transa */ String getDescription(); + long getPersistentByteDequeues(); + + long getPersistentMsgDequeues(); + + long getPersistentByteEnqueues(); + + long getPersistentMsgEnqueues(); + + long getTotalDequeueSize(); + + long getTotalEnqueueSize(); + + long getUnackedMessageCount(); + } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java index d42bd6cf03..3376bfa53f 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java @@ -41,9 +41,6 @@ import org.apache.qpid.AMQSecurityException; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.pool.ReferenceCountingExecutorService; import org.apache.qpid.server.binding.Binding; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.ConfiguredObject; -import org.apache.qpid.server.configuration.QueueConfigType; import org.apache.qpid.server.configuration.QueueConfiguration; import org.apache.qpid.server.configuration.plugins.ConfigurationPlugin; import org.apache.qpid.server.exchange.Exchange; @@ -185,7 +182,6 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, Mes //TODO : persist creation time private long _createTime = System.currentTimeMillis(); - private UUID _qmfId; private ConfigurationPlugin _queueConfiguration; /** the maximum delivery count for each message on this queue or 0 if maximum delivery count is not to be enforced. */ @@ -243,7 +239,6 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, Mes _arguments = arguments == null ? new HashMap<String, Object>() : new HashMap<String, Object>(arguments); _id = id; - _qmfId = getConfigStore().createId(); _asyncDelivery = ReferenceCountingExecutorService.getInstance().acquireExecutorService(); _logSubject = new QueueLogSubject(this); @@ -259,8 +254,6 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, Mes durable, !durable, _entries.getPriorities() > 0)); - getConfigStore().addConfiguredObject(this); - if(arguments != null && arguments.containsKey(QPID_GROUP_HEADER_KEY)) { if(arguments.containsKey(QPID_SHARED_MSG_GROUP) && String.valueOf(arguments.get(QPID_SHARED_MSG_GROUP)).equals("1")) @@ -331,22 +324,6 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, Mes return _id; } - @Override - public UUID getQMFId() - { - return _qmfId; - } - - public QueueConfigType getConfigType() - { - return QueueConfigType.getInstance(); - } - - public ConfiguredObject getParent() - { - return getVirtualHost(); - } - public boolean isDurable() { return _durable; @@ -1383,7 +1360,6 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, Mes } _virtualHost.getQueueRegistry().unregisterQueue(_name); - getConfigStore().removeConfiguredObject(this); List<QueueEntry> entries = getMessagesOnTheQueue(new QueueEntryFilter() { @@ -2189,11 +2165,6 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, Mes return _queueConfiguration; } - public ConfigStore getConfigStore() - { - return getVirtualHost().getConfigStore(); - } - public long getMessageDequeueCount() { return _dequeueCount.get(); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java index f31275fa36..967c58debb 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java @@ -27,13 +27,8 @@ import org.osgi.framework.BundleContext; import org.apache.qpid.common.Closeable; import org.apache.qpid.common.QpidProperties; -import org.apache.qpid.qmf.QMFService; -import org.apache.qpid.server.configuration.BrokerConfig; -import org.apache.qpid.server.configuration.ConfigStore; import org.apache.qpid.server.configuration.ConfigurationManager; import org.apache.qpid.server.configuration.ServerConfiguration; -import org.apache.qpid.server.configuration.SystemConfig; -import org.apache.qpid.server.configuration.SystemConfigImpl; import org.apache.qpid.server.configuration.VirtualHostConfiguration; import org.apache.qpid.server.logging.actors.AbstractActor; import org.apache.qpid.server.logging.actors.BrokerActor; @@ -97,16 +92,8 @@ public abstract class ApplicationRegistry implements IApplicationRegistry private CompositeStartupMessageLogger _startupMessageLogger; - private UUID _brokerId = UUID.randomUUID(); - - private QMFService _qmfService; - - private BrokerConfig _brokerConfig; - private Broker _broker; - private ConfigStore _configStore; - private Timer _reportingTimer; private StatisticsCounter _messagesDelivered, _dataDelivered, _messagesReceived, _dataReceived; @@ -164,21 +151,6 @@ public abstract class ApplicationRegistry implements IApplicationRegistry _startupMessageLogger = startupMessageLogger; } - protected void setBrokerId(UUID brokerId) - { - _brokerId = brokerId; - } - - protected QMFService getQmfService() - { - return _qmfService; - } - - protected void setQmfService(QMFService qmfService) - { - _qmfService = qmfService; - } - public static void initialise(IApplicationRegistry instance) throws Exception { if(instance == null) @@ -194,16 +166,6 @@ public abstract class ApplicationRegistry implements IApplicationRegistry _logger.info("Initialising Application Registry(" + instance + ")"); - final ConfigStore store = ConfigStore.newInstance(); - store.setRoot(new SystemConfigImpl(store)); - instance.setConfigStore(store); - - final BrokerConfig brokerConfig = new BrokerConfigAdapter(instance); - - final SystemConfig system = store.getRoot(); - system.addBroker(brokerConfig); - instance.setBrokerConfig(brokerConfig); - try { instance.initialise(); @@ -213,29 +175,11 @@ public abstract class ApplicationRegistry implements IApplicationRegistry _instance.set(null); //remove the Broker instance, then re-throw - try - { - system.removeBroker(brokerConfig); - } - catch(Throwable t) - { - //ignore - } throw e; } } - public ConfigStore getConfigStore() - { - return _configStore; - } - - public void setConfigStore(final ConfigStore configStore) - { - _configStore = configStore; - } - public static boolean isConfigured() { return _instance.get() != null; @@ -319,8 +263,6 @@ public abstract class ApplicationRegistry implements IApplicationRegistry configure(); - _qmfService = new QMFService(getConfigStore(), this); - logStartupMessages(CurrentActor.get()); _securityManager = new SecurityManager(_configuration, _pluginManager); @@ -534,16 +476,8 @@ public abstract class ApplicationRegistry implements IApplicationRegistry close(_authenticationManagerRegistry); - close(_qmfService); - close(_pluginManager); - BrokerConfig broker = getBrokerConfig(); - if(broker != null) - { - broker.getSystem().removeBroker(broker); - } - CurrentActor.get().message(BrokerMessages.STOPPED()); } finally @@ -656,29 +590,13 @@ public abstract class ApplicationRegistry implements IApplicationRegistry public UUID getBrokerId() { - return _brokerId; - } - - public QMFService getQMFService() - { - return _qmfService; - } - - public BrokerConfig getBrokerConfig() - { - return _brokerConfig; - } - - public void setBrokerConfig(final BrokerConfig broker) - { - _brokerConfig = broker; + return getBroker().getId(); } public VirtualHost createVirtualHost(final VirtualHostConfiguration vhostConfig) throws Exception { VirtualHostImpl virtualHost = new VirtualHostImpl(this, vhostConfig); _virtualHostRegistry.registerVirtualHost(virtualHost); - getBrokerConfig().addVirtualHost(virtualHost); return virtualHost; } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/BrokerConfigAdapter.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/BrokerConfigAdapter.java deleted file mode 100644 index 950a090b43..0000000000 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/BrokerConfigAdapter.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * - * 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.server.registry; - -import org.apache.qpid.common.QpidProperties; -import org.apache.qpid.common.ServerPropertyNames; -import org.apache.qpid.server.configuration.BrokerConfig; -import org.apache.qpid.server.configuration.BrokerConfigType; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.ConfiguredObject; -import org.apache.qpid.server.configuration.SystemConfig; -import org.apache.qpid.server.configuration.VirtualHostConfig; -import org.apache.qpid.server.virtualhost.VirtualHost; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; - -public class BrokerConfigAdapter implements BrokerConfig -{ - private final IApplicationRegistry _instance; - private SystemConfig _system; - - private final Map<UUID, VirtualHostConfig> _vhosts = new ConcurrentHashMap<UUID, VirtualHostConfig>(); - private final long _createTime = System.currentTimeMillis(); - private UUID _qmfId; - private String _federationTag; - - public BrokerConfigAdapter(final IApplicationRegistry instance) - { - _instance = instance; - _qmfId = instance.getConfigStore().createId(); - _federationTag = UUID.randomUUID().toString(); - } - - public void setSystem(final SystemConfig system) - { - _system = system; - } - - public SystemConfig getSystem() - { - return _system; - } - - public Integer getPort() - { - List ports = _instance.getConfiguration().getPorts(); - if(ports.size() > 0) - { - return Integer.valueOf(ports.get(0).toString()); - } - else - { - return 0; - } - } - - public Integer getWorkerThreads() - { - return _instance.getConfiguration().getConnectorProcessors(); - } - - public Integer getMaxConnections() - { - return 0; - } - - public Integer getConnectionBacklogLimit() - { - return 0; - } - - public Long getStagingThreshold() - { - return 0L; - } - - public Integer getManagementPublishInterval() - { - return 10000; - } - - public String getVersion() - { - return QpidProperties.getReleaseVersion() + " [Build: " + QpidProperties.getBuildVersion() + "]"; - } - - public String getDataDirectory() - { - return _instance.getConfiguration().getQpidWork(); - } - - public void addVirtualHost(final VirtualHostConfig virtualHost) - { - _vhosts.put(virtualHost.getQMFId(), virtualHost); - getConfigStore().addConfiguredObject(virtualHost); - - } - - private ConfigStore getConfigStore() - { - return _instance.getConfigStore(); - } - - public long getCreateTime() - { - return _createTime; - } - - public void createBrokerConnection(final String transport, - final String host, - final int port, - final boolean durable, - final String authMechanism, - final String username, - final String password) - { - VirtualHost vhost = _instance.getVirtualHostRegistry().getDefaultVirtualHost(); - vhost.createBrokerConnection(transport, host, port, "", durable, authMechanism, username, password); - } - - @Override - public UUID getQMFId() - { - return _qmfId; - } - - public BrokerConfigType getConfigType() - { - return BrokerConfigType.getInstance(); - } - - public ConfiguredObject getParent() - { - return _system; - } - - public boolean isDurable() - { - return false; - } - - public String getFederationTag() - { - return _federationTag; - } - - /** - * @see org.apache.qpid.server.configuration.BrokerConfig#getFeatures() - */ - public List<String> getFeatures() - { - final List<String> features = new ArrayList<String>(); - if (!_instance.getConfiguration().getDisabledFeatures().contains(ServerPropertyNames.FEATURE_QPID_JMS_SELECTOR)) - { - features.add(ServerPropertyNames.FEATURE_QPID_JMS_SELECTOR); - } - - return Collections.unmodifiableList(features); - } - - @Override - public String toString() - { - return "BrokerConfigAdapter{" + - "_id=" + _qmfId + - ", _system=" + _system + - ", _vhosts=" + _vhosts + - ", _createTime=" + _createTime + - ", _federationTag='" + _federationTag + '\'' + - '}'; - } -} diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java index 5959b6fbe2..8f8872882f 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java @@ -20,9 +20,6 @@ */ package org.apache.qpid.server.registry; -import org.apache.qpid.qmf.QMFService; -import org.apache.qpid.server.configuration.BrokerConfig; -import org.apache.qpid.server.configuration.ConfigStore; import org.apache.qpid.server.configuration.ConfigurationManager; import org.apache.qpid.server.configuration.ServerConfiguration; import org.apache.qpid.server.configuration.VirtualHostConfiguration; @@ -96,20 +93,10 @@ public interface IApplicationRegistry extends StatisticsGatherer public UUID getBrokerId(); - QMFService getQMFService(); - - void setBrokerConfig(BrokerConfig broker); - - BrokerConfig getBrokerConfig(); - Broker getBroker(); VirtualHost createVirtualHost(VirtualHostConfiguration vhostConfig) throws Exception; - ConfigStore getConfigStore(); - - void setConfigStore(ConfigStore store); - void initialiseStatisticsReporting(); Map<InetSocketAddress, QpidAcceptor> getAcceptors(); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/ConfigurationRecoveryHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/ConfigurationRecoveryHandler.java index ede01d247e..ab7ef3f55b 100755 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/ConfigurationRecoveryHandler.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/ConfigurationRecoveryHandler.java @@ -46,19 +46,7 @@ public interface ConfigurationRecoveryHandler public static interface BindingRecoveryHandler { void binding(UUID bindingId, UUID exchangeId, UUID queueId, String bindingName, ByteBuffer buf); - BrokerLinkRecoveryHandler completeBindingRecovery(); - } - - public static interface BrokerLinkRecoveryHandler - { - BridgeRecoveryHandler brokerLink(UUID id, long createTime, Map<String,String> arguments); - void completeBrokerLinkRecovery(); - } - - public static interface BridgeRecoveryHandler - { - void bridge(UUID id, long createTime, Map<String,String> arguments); - void completeBridgeRecoveryForLink(); + void completeBindingRecovery(); } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java index 655887e5c2..4e7bbf04a6 100755 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java @@ -26,8 +26,6 @@ import org.apache.qpid.AMQStoreException; import org.apache.qpid.framing.FieldTable; import org.apache.qpid.server.binding.Binding; import org.apache.qpid.server.exchange.Exchange; -import org.apache.qpid.server.federation.Bridge; -import org.apache.qpid.server.federation.BrokerLink; import org.apache.qpid.server.queue.AMQQueue; public interface DurableConfigurationStore @@ -122,12 +120,5 @@ public interface DurableConfigurationStore * @throws AMQStoreException If the operation fails for any reason. */ void updateQueue(AMQQueue queue) throws AMQStoreException; - - void createBrokerLink(BrokerLink link) throws AMQStoreException; - - void deleteBrokerLink(BrokerLink link) throws AMQStoreException; - - void createBridge(Bridge bridge) throws AMQStoreException; - - void deleteBridge(Bridge bridge) throws AMQStoreException; + } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/NullMessageStore.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/NullMessageStore.java index be08e309e6..c6bffbc1de 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/NullMessageStore.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/NullMessageStore.java @@ -24,8 +24,6 @@ import org.apache.qpid.AMQStoreException; import org.apache.qpid.framing.FieldTable; import org.apache.qpid.server.binding.Binding; import org.apache.qpid.server.exchange.Exchange; -import org.apache.qpid.server.federation.Bridge; -import org.apache.qpid.server.federation.BrokerLink; import org.apache.qpid.server.queue.AMQQueue; public abstract class NullMessageStore implements MessageStore @@ -78,26 +76,6 @@ public abstract class NullMessageStore implements MessageStore } @Override - public void createBrokerLink(final BrokerLink link) throws AMQStoreException - { - } - - @Override - public void deleteBrokerLink(final BrokerLink link) throws AMQStoreException - { - } - - @Override - public void createBridge(final Bridge bridge) throws AMQStoreException - { - } - - @Override - public void deleteBridge(final Bridge bridge) throws AMQStoreException - { - } - - @Override public void configureMessageStore(String name, MessageStoreRecoveryHandler recoveryHandler, TransactionLogRecoveryHandler tlogRecoveryHandler, Configuration config) throws Exception diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/State.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/State.java index 2783637b2a..1d0936cec4 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/State.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/State.java @@ -20,8 +20,6 @@ */ package org.apache.qpid.server.store; -import org.apache.qpid.server.configuration.ConfiguredObject; - public enum State { /** The initial state of the store. In practice, the store immediately transitions to the subsequent states. */ @@ -30,7 +28,7 @@ public enum State INITIALISING, /** * The initial set-up of the store has completed. - * If the store is persistent, it has not yet loaded configuration for {@link ConfiguredObject}'s from disk. + * If the store is persistent, it has not yet loaded configuration from disk. * * From the point of view of the user, the store is essentially stopped. */ diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java index 154d7e6535..fca8d59836 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java @@ -23,7 +23,6 @@ package org.apache.qpid.server.store.derby; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.IOException; @@ -41,7 +40,6 @@ import java.sql.SQLException; import java.sql.Statement; import java.sql.Types; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; @@ -55,12 +53,9 @@ import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.FieldTable; import org.apache.qpid.server.binding.Binding; import org.apache.qpid.server.exchange.Exchange; -import org.apache.qpid.server.federation.Bridge; -import org.apache.qpid.server.federation.BrokerLink; import org.apache.qpid.server.message.EnqueableMessage; import org.apache.qpid.server.queue.AMQQueue; import org.apache.qpid.server.store.ConfigurationRecoveryHandler; -import org.apache.qpid.server.store.ConfigurationRecoveryHandler.BrokerLinkRecoveryHandler; import org.apache.qpid.server.store.ConfiguredObjectHelper; import org.apache.qpid.server.store.ConfiguredObjectRecord; import org.apache.qpid.server.store.Event; @@ -572,8 +567,7 @@ public class DerbyMessageStore implements MessageStore BindingRecoveryHandler brh = qrh.completeQueueRecovery(); _configuredObjectHelper.recoverBindings(brh, configuredObjects); - BrokerLinkRecoveryHandler lrh = brh.completeBindingRecovery(); - recoverBrokerLinks(lrh); + brh.completeBindingRecovery(); } catch (SQLException e) { @@ -581,144 +575,6 @@ public class DerbyMessageStore implements MessageStore } } - private void recoverBrokerLinks(final ConfigurationRecoveryHandler.BrokerLinkRecoveryHandler lrh) - throws SQLException - { - _logger.info("Recovering broker links..."); - - Connection conn = null; - try - { - conn = newAutoCommitConnection(); - - PreparedStatement stmt = conn.prepareStatement(SELECT_ALL_FROM_LINKS); - - try - { - ResultSet rs = stmt.executeQuery(); - - try - { - - while(rs.next()) - { - UUID id = new UUID(rs.getLong(2), rs.getLong(1)); - long createTime = rs.getLong(3); - Blob argumentsAsBlob = rs.getBlob(4); - - byte[] dataAsBytes = argumentsAsBlob.getBytes(1,(int) argumentsAsBlob.length()); - - DataInputStream dis = new DataInputStream(new ByteArrayInputStream(dataAsBytes)); - int size = dis.readInt(); - - Map<String,String> arguments = new HashMap<String, String>(); - - for(int i = 0; i < size; i++) - { - arguments.put(dis.readUTF(), dis.readUTF()); - } - - ConfigurationRecoveryHandler.BridgeRecoveryHandler brh = lrh.brokerLink(id, createTime, arguments); - - recoverBridges(brh, id); - - } - } - catch (IOException e) - { - throw new SQLException(e.getMessage(), e); - } - finally - { - rs.close(); - } - } - finally - { - stmt.close(); - } - - } - finally - { - if(conn != null) - { - conn.close(); - } - } - - } - - private void recoverBridges(final ConfigurationRecoveryHandler.BridgeRecoveryHandler brh, final UUID linkId) - throws SQLException - { - _logger.info("Recovering bridges for link " + linkId + "..."); - - Connection conn = null; - try - { - conn = newAutoCommitConnection(); - - PreparedStatement stmt = conn.prepareStatement(SELECT_ALL_FROM_BRIDGES); - - try - { - stmt.setLong(1, linkId.getLeastSignificantBits()); - stmt.setLong(2, linkId.getMostSignificantBits()); - - ResultSet rs = stmt.executeQuery(); - - try - { - - while(rs.next()) - { - UUID id = new UUID(rs.getLong(2), rs.getLong(1)); - long createTime = rs.getLong(3); - Blob argumentsAsBlob = rs.getBlob(6); - - byte[] dataAsBytes = argumentsAsBlob.getBytes(1,(int) argumentsAsBlob.length()); - - DataInputStream dis = new DataInputStream(new ByteArrayInputStream(dataAsBytes)); - int size = dis.readInt(); - - Map<String,String> arguments = new HashMap<String, String>(); - - for(int i = 0; i < size; i++) - { - arguments.put(dis.readUTF(), dis.readUTF()); - } - - brh.bridge(id, createTime, arguments); - - } - brh.completeBridgeRecoveryForLink(); - } - catch (IOException e) - { - throw new SQLException(e.getMessage(), e); - } - finally - { - rs.close(); - } - } - finally - { - stmt.close(); - } - - } - finally - { - if(conn != null) - { - conn.close(); - } - } - - } - @Override public void close() throws Exception { @@ -975,71 +831,6 @@ public class DerbyMessageStore implements MessageStore } } - @Override - public void createBrokerLink(final BrokerLink link) throws AMQStoreException - { - _logger.debug("public void createBrokerLink(BrokerLink = " + link + "): called"); - - if (_stateManager.isInState(State.ACTIVE)) - { - try - { - Connection conn = newAutoCommitConnection(); - - PreparedStatement stmt = conn.prepareStatement(FIND_LINK); - try - { - - stmt.setLong(1, link.getQMFId().getLeastSignificantBits()); - stmt.setLong(2, link.getQMFId().getMostSignificantBits()); - ResultSet rs = stmt.executeQuery(); - try - { - - // If we don't have any data in the result set then we can add this queue - if (!rs.next()) - { - PreparedStatement insertStmt = conn.prepareStatement(INSERT_INTO_LINKS); - - try - { - - insertStmt.setLong(1, link.getQMFId().getLeastSignificantBits()); - insertStmt.setLong(2, link.getQMFId().getMostSignificantBits()); - insertStmt.setLong(3, link.getCreateTime()); - - byte[] argumentBytes = convertStringMapToBytes(link.getArguments()); - ByteArrayInputStream bis = new ByteArrayInputStream(argumentBytes); - - insertStmt.setBinaryStream(4,bis,argumentBytes.length); - - insertStmt.execute(); - } - finally - { - insertStmt.close(); - } - } - } - finally - { - rs.close(); - } - } - finally - { - stmt.close(); - } - conn.close(); - - } - catch (SQLException e) - { - throw new AMQStoreException("Error writing " + link + " to database: " + e.getMessage(), e); - } - } - } - private byte[] convertStringMapToBytes(final Map<String, String> arguments) throws AMQStoreException { byte[] argumentBytes; @@ -1072,139 +863,7 @@ public class DerbyMessageStore implements MessageStore return argumentBytes; } - @Override - public void deleteBrokerLink(final BrokerLink link) throws AMQStoreException - { - _logger.debug("public void deleteBrokerLink( " + link + "): called"); - Connection conn = null; - PreparedStatement stmt = null; - try - { - conn = newAutoCommitConnection(); - stmt = conn.prepareStatement(DELETE_FROM_LINKS); - stmt.setLong(1, link.getQMFId().getLeastSignificantBits()); - stmt.setLong(2, link.getQMFId().getMostSignificantBits()); - int results = stmt.executeUpdate(); - - if (results == 0) - { - throw new AMQStoreException("Link " + link + " not found"); - } - } - catch (SQLException e) - { - throw new AMQStoreException("Error deleting Link " + link + " from database: " + e.getMessage(), e); - } - finally - { - closePreparedStatement(stmt); - closeConnection(conn); - } - - - } - - @Override - public void createBridge(final Bridge bridge) throws AMQStoreException - { - _logger.debug("public void createBridge(BrokerLink = " + bridge + "): called"); - if (_stateManager.isInState(State.ACTIVE)) - { - try - { - Connection conn = newAutoCommitConnection(); - - PreparedStatement stmt = conn.prepareStatement(FIND_BRIDGE); - try - { - - UUID id = bridge.getQMFId(); - stmt.setLong(1, id.getLeastSignificantBits()); - stmt.setLong(2, id.getMostSignificantBits()); - ResultSet rs = stmt.executeQuery(); - try - { - - // If we don't have any data in the result set then we can add this queue - if (!rs.next()) - { - PreparedStatement insertStmt = conn.prepareStatement(INSERT_INTO_BRIDGES); - - try - { - - insertStmt.setLong(1, id.getLeastSignificantBits()); - insertStmt.setLong(2, id.getMostSignificantBits()); - - insertStmt.setLong(3, bridge.getCreateTime()); - - UUID linkId = bridge.getLink().getQMFId(); - insertStmt.setLong(4, linkId.getLeastSignificantBits()); - insertStmt.setLong(5, linkId.getMostSignificantBits()); - - byte[] argumentBytes = convertStringMapToBytes(bridge.getArguments()); - ByteArrayInputStream bis = new ByteArrayInputStream(argumentBytes); - - insertStmt.setBinaryStream(6,bis,argumentBytes.length); - - insertStmt.execute(); - } - finally - { - insertStmt.close(); - } - } - } - finally - { - rs.close(); - } - } - finally - { - stmt.close(); - } - conn.close(); - - } - catch (SQLException e) - { - throw new AMQStoreException("Error writing " + bridge + " to database: " + e.getMessage(), e); - } - } - } - - @Override - public void deleteBridge(final Bridge bridge) throws AMQStoreException - { - _logger.debug("public void deleteBridge( " + bridge + "): called"); - Connection conn = null; - PreparedStatement stmt = null; - try - { - conn = newAutoCommitConnection(); - stmt = conn.prepareStatement(DELETE_FROM_BRIDGES); - stmt.setLong(1, bridge.getQMFId().getLeastSignificantBits()); - stmt.setLong(2, bridge.getQMFId().getMostSignificantBits()); - int results = stmt.executeUpdate(); - - if (results == 0) - { - throw new AMQStoreException("Bridge " + bridge + " not found"); - } - } - catch (SQLException e) - { - throw new AMQStoreException("Error deleting bridge " + bridge + " from database: " + e.getMessage(), e); - } - finally - { - closePreparedStatement(stmt); - closeConnection(conn); - } - - } @Override public Transaction newTransaction() diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java index c92853e400..6c5cb2e721 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java @@ -27,11 +27,6 @@ import org.apache.qpid.common.AMQPFilterTypes; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.FieldTable; import org.apache.qpid.server.AMQChannel; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.ConfiguredObject; -import org.apache.qpid.server.configuration.SessionConfig; -import org.apache.qpid.server.configuration.SubscriptionConfig; -import org.apache.qpid.server.configuration.SubscriptionConfigType; import org.apache.qpid.server.filter.FilterManager; import org.apache.qpid.server.filter.FilterManagerFactory; import org.apache.qpid.server.flow.FlowCreditManager; @@ -61,8 +56,7 @@ import java.util.concurrent.locks.ReentrantLock; * Encapsulation of a supscription to a queue. <p/> Ties together the protocol session of a subscriber, the consumer tag * that was given out by the broker and the channel id. <p/> */ -public abstract class SubscriptionImpl implements Subscription, FlowCreditManager.FlowCreditManagerListener, - SubscriptionConfig +public abstract class SubscriptionImpl implements Subscription, FlowCreditManager.FlowCreditManagerListener { private StateListener _stateListener = new StateListener() @@ -91,7 +85,6 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage private final long _subscriptionID; private LogSubject _logSubject; private LogActor _logActor; - private UUID _qmfId; private final AtomicLong _deliveredCount = new AtomicLong(0); private final AtomicLong _deliveredBytes = new AtomicLong(0); @@ -373,11 +366,6 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage return _channel; } - public ConfigStore getConfigStore() - { - return getQueue().getConfigStore(); - } - public Long getDelivered() { return _deliveredCount.get(); @@ -391,9 +379,6 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage } _queue = queue; - _qmfId = getConfigStore().createId(); - getConfigStore().addConfiguredObject(this); - _logSubject = new SubscriptionLogSubject(this); _logActor = new SubscriptionActor(CurrentActor.get().getRootMessageLogger(), this); @@ -547,8 +532,6 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage { _stateChangeLock.unlock(); } - getConfigStore().removeConfiguredObject(this); - //Log Subscription closed CurrentActor.get().message(_logSubject, SubscriptionMessages.CLOSE()); } @@ -752,11 +735,6 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage return "WINDOW"; } - public SessionConfig getSessionConfig() - { - return getChannel(); - } - public boolean isBrowsing() { return isBrowser(); @@ -767,32 +745,16 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage return true; } - @Override - public UUID getQMFId() - { - return _qmfId; - } - public boolean isDurable() { return false; } - public SubscriptionConfigType getConfigType() - { - return SubscriptionConfigType.getInstance(); - } - public boolean isExclusive() { return getQueue().hasExclusiveSubscriber(); } - public ConfiguredObject getParent() - { - return getSessionConfig(); - } - public String getName() { return String.valueOf(_consumerTag); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java index dfd9315226..b9bba49fab 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java @@ -24,11 +24,6 @@ import org.apache.qpid.AMQException; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.BasicContentHeaderProperties; import org.apache.qpid.framing.FieldTable; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.ConfiguredObject; -import org.apache.qpid.server.configuration.SessionConfig; -import org.apache.qpid.server.configuration.SubscriptionConfig; -import org.apache.qpid.server.configuration.SubscriptionConfigType; import org.apache.qpid.server.exchange.Exchange; import org.apache.qpid.server.filter.FilterManager; import org.apache.qpid.server.flow.CreditCreditManager; @@ -86,7 +81,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -public class Subscription_0_10 implements Subscription, FlowCreditManager.FlowCreditManagerListener, SubscriptionConfig, LogSubject +public class Subscription_0_10 implements Subscription, FlowCreditManager.FlowCreditManagerListener, LogSubject { private final long _subscriptionID; @@ -125,7 +120,6 @@ public class Subscription_0_10 implements Subscription, FlowCreditManager.FlowCr private LogActor _logActor; private final Map<String, Object> _properties = new ConcurrentHashMap<String, Object>(); - private UUID _qmfId; private String _traceExclude; private String _trace; private final long _createTime = System.currentTimeMillis(); @@ -192,8 +186,6 @@ public class Subscription_0_10 implements Subscription, FlowCreditManager.FlowCr Map<String, Object> arguments = queue.getArguments(); _traceExclude = (String) arguments.get("qpid.trace.exclude"); _trace = (String) arguments.get("qpid.trace.id"); - _qmfId = getConfigStore().createId(); - getConfigStore().addConfiguredObject(this); String filterLogString = null; _logActor = GenericActor.getInstance(this); @@ -283,7 +275,6 @@ public class Subscription_0_10 implements Subscription, FlowCreditManager.FlowCr } } _creditManager.removeListener(this); - getConfigStore().removeConfiguredObject(this); CurrentActor.get().message(getLogSubject(), SubscriptionMessages.CLOSE()); } finally @@ -295,11 +286,6 @@ public class Subscription_0_10 implements Subscription, FlowCreditManager.FlowCr } - public ConfigStore getConfigStore() - { - return getQueue().getConfigStore(); - } - public Long getDelivered() { return _deliveredCount.get(); @@ -970,12 +956,6 @@ public class Subscription_0_10 implements Subscription, FlowCreditManager.FlowCr return _session; } - - public SessionConfig getSessionConfig() - { - return getSessionModel(); - } - public boolean isBrowsing() { return _acquireMode == MessageAcquireMode.NOT_ACQUIRED; @@ -986,20 +966,11 @@ public class Subscription_0_10 implements Subscription, FlowCreditManager.FlowCr return getQueue().hasExclusiveSubscriber(); } - public ConfiguredObject getParent() - { - return getSessionConfig(); - } - public boolean isDurable() { return false; } - public SubscriptionConfigType getConfigType() - { - return SubscriptionConfigType.getInstance(); - } public boolean isExplicitAcknowledge() { @@ -1011,12 +982,6 @@ public class Subscription_0_10 implements Subscription, FlowCreditManager.FlowCr return _flowMode.toString(); } - @Override - public UUID getQMFId() - { - return _qmfId; - } - public String getName() { return _destination; diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnection.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnection.java index f21026794f..99818ae2d3 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnection.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnection.java @@ -20,6 +20,7 @@ */ package org.apache.qpid.server.transport; +import java.net.SocketAddress; import java.security.Principal; import java.text.MessageFormat; import java.util.ArrayList; @@ -30,7 +31,6 @@ import java.util.concurrent.atomic.AtomicLong; import javax.security.auth.Subject; import org.apache.qpid.AMQException; import org.apache.qpid.protocol.AMQConstant; -import org.apache.qpid.server.configuration.ConnectionConfig; import org.apache.qpid.server.logging.LogActor; import org.apache.qpid.server.logging.LogSubject; import org.apache.qpid.server.logging.actors.CurrentActor; @@ -55,7 +55,6 @@ import static org.apache.qpid.server.logging.subjects.LogSubjectFormat.USER_FORM public class ServerConnection extends Connection implements AMQConnectionModel, LogSubject, AuthorizationHolder { - private ConnectionConfig _config; private Runnable _onOpenTask; private AtomicBoolean _logClosed = new AtomicBoolean(false); private LogActor _actor = GenericActor.getInstance(this); @@ -147,16 +146,6 @@ public class ServerConnection extends Connection implements AMQConnectionModel, initialiseStatistics(); } - public void setConnectionConfig(final ConnectionConfig config) - { - _config = config; - } - - public ConnectionConfig getConfig() - { - return _config; - } - public void onOpen(final Runnable task) { _onOpenTask = task; @@ -228,7 +217,7 @@ public class ServerConnection extends Connection implements AMQConnectionModel, MessageFormat.format(CONNECTION_FORMAT, getConnectionId(), getClientId(), - getConfig().getAddress(), + getRemoteAddressString(), getVirtualHost().getName()) + "] "; } @@ -238,7 +227,7 @@ public class ServerConnection extends Connection implements AMQConnectionModel, MessageFormat.format(USER_FORMAT, getConnectionId(), getClientId(), - getConfig().getAddress()) + getRemoteAddressString()) + "] "; } @@ -247,7 +236,7 @@ public class ServerConnection extends Connection implements AMQConnectionModel, return "[" + MessageFormat.format(SOCKET_FORMAT, getConnectionId(), - getConfig().getAddress()) + getRemoteAddressString()) + "] "; } } @@ -417,7 +406,7 @@ public class ServerConnection extends Connection implements AMQConnectionModel, public String getRemoteAddressString() { - return getConfig().getAddress(); + return String.valueOf(getRemoteAddress()); } public String getUserName() @@ -489,4 +478,16 @@ public class ServerConnection extends Connection implements AMQConnectionModel, { _peerPrincipal = peerPrincipal; } + + @Override + public void setRemoteAddress(SocketAddress remoteAddress) + { + super.setRemoteAddress(remoteAddress); + } + + @Override + public void setLocalAddress(SocketAddress localAddress) + { + super.setLocalAddress(localAddress); + } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionDelegate.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionDelegate.java index 615fce2909..70f5afe5ac 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionDelegate.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionDelegate.java @@ -28,12 +28,11 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.StringTokenizer; +import java.util.UUID; import javax.security.sasl.SaslException; import javax.security.sasl.SaslServer; import org.apache.qpid.common.ServerPropertyNames; import org.apache.qpid.properties.ConnectionStartProperties; -import org.apache.qpid.protocol.ProtocolEngine; -import org.apache.qpid.server.configuration.BrokerConfig; import org.apache.qpid.server.protocol.AMQConnectionModel; import org.apache.qpid.server.registry.IApplicationRegistry; import org.apache.qpid.server.security.SecurityManager; @@ -61,7 +60,7 @@ public class ServerConnectionDelegate extends ServerDelegate public ServerConnectionDelegate(IApplicationRegistry appRegistry, String localFQDN, SubjectCreator subjectCreator) { - this(createConnectionProperties(appRegistry.getBrokerConfig()), Collections.singletonList((Object)"en_US"), appRegistry, localFQDN, subjectCreator); + this(createConnectionProperties(appRegistry), Collections.singletonList((Object)"en_US"), appRegistry, localFQDN, subjectCreator); } private ServerConnectionDelegate(Map<String, Object> properties, @@ -78,11 +77,23 @@ public class ServerConnectionDelegate extends ServerDelegate _subjectCreator = subjectCreator; } - private static Map<String, Object> createConnectionProperties(final BrokerConfig brokerConfig) + private static List<String> getFeatures(IApplicationRegistry appRegistry) + { + final List<String> features = new ArrayList<String>(); + if (!appRegistry.getConfiguration().getDisabledFeatures().contains(ServerPropertyNames.FEATURE_QPID_JMS_SELECTOR)) + { + features.add(ServerPropertyNames.FEATURE_QPID_JMS_SELECTOR); + } + + return Collections.unmodifiableList(features); + } + + private static Map<String, Object> createConnectionProperties(final IApplicationRegistry applicationRegistry) { final Map<String,Object> map = new HashMap<String,Object>(2); - map.put(ServerPropertyNames.FEDERATION_TAG, brokerConfig.getFederationTag()); - final List<String> features = brokerConfig.getFeatures(); + // Federation tag is used by the client to identify the broker instance + map.put(ServerPropertyNames.FEDERATION_TAG, applicationRegistry.getBrokerId().toString()); + final List<String> features = getFeatures(applicationRegistry); if (features != null && features.size() > 0) { map.put(ServerPropertyNames.QPID_FEATURES, features); @@ -174,7 +185,7 @@ public class ServerConnectionDelegate extends ServerDelegate { sconn.setVirtualHost(vhost); - if (!vhost.getSecurityManager().accessVirtualhost(vhostName, ((ProtocolEngine) sconn.getConfig()).getRemoteAddress())) + if (!vhost.getSecurityManager().accessVirtualhost(vhostName, sconn.getRemoteAddress())) { sconn.setState(Connection.State.CLOSING); sconn.invoke(new ConnectionClose(ConnectionCloseCode.CONNECTION_FORCED, "Permission denied '"+vhostName+"'")); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSession.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSession.java index f82b25b3d6..eed55a2e85 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSession.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSession.java @@ -44,11 +44,6 @@ import org.apache.qpid.AMQStoreException; import org.apache.qpid.protocol.AMQConstant; import org.apache.qpid.protocol.ProtocolEngine; import org.apache.qpid.server.TransactionTimeoutHelper; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.ConfiguredObject; -import org.apache.qpid.server.configuration.ConnectionConfig; -import org.apache.qpid.server.configuration.SessionConfig; -import org.apache.qpid.server.configuration.SessionConfigType; import org.apache.qpid.server.logging.LogActor; import org.apache.qpid.server.logging.LogSubject; import org.apache.qpid.server.logging.actors.CurrentActor; @@ -91,7 +86,7 @@ import static org.apache.qpid.server.logging.subjects.LogSubjectFormat.CHANNEL_F import static org.apache.qpid.util.Serial.gt; public class ServerSession extends Session - implements AuthorizationHolder, SessionConfig, + implements AuthorizationHolder, AMQSessionModel, LogSubject, AsyncAutoCommitTransaction.FutureRecorder { private static final Logger _logger = LoggerFactory.getLogger(ServerSession.class); @@ -100,8 +95,7 @@ public class ServerSession extends Session private static final int PRODUCER_CREDIT_TOPUP_THRESHOLD = 1 << 30; private static final int UNFINISHED_COMMAND_QUEUE_THRESHOLD = 500; - private final UUID _id; - private ConnectionConfig _connectionConfig; + private final UUID _id = UUID.randomUUID(); private long _createTime = System.currentTimeMillis(); private LogActor _actor = GenericActor.getInstance(this); @@ -147,19 +141,12 @@ public class ServerSession extends Session private final TransactionTimeoutHelper _transactionTimeoutHelper; - ServerSession(Connection connection, SessionDelegate delegate, Binary name, long expiry) - { - this(connection, delegate, name, expiry, ((ServerConnection)connection).getConfig()); - } - public ServerSession(Connection connection, SessionDelegate delegate, Binary name, long expiry, ConnectionConfig connConfig) + public ServerSession(Connection connection, SessionDelegate delegate, Binary name, long expiry) { super(connection, delegate, name, expiry); - _connectionConfig = connConfig; _transaction = new AsyncAutoCommitTransaction(this.getMessageStore(),this); _logSubject = new ChannelLogSubject(this); - _id = getConfigStore().createId(); - getConfigStore().addConfiguredObject(this); _transactionTimeoutHelper = new TransactionTimeoutHelper(_logSubject); } @@ -184,12 +171,6 @@ public class ServerSession extends Session invoke(new MessageStop("")); } - private ConfigStore getConfigStore() - { - return getConnectionConfig().getConfigStore(); - } - - @Override protected boolean isFull(int id) { @@ -389,8 +370,6 @@ public class ServerSession extends Session } _messageDispositionListenerMap.clear(); - getConfigStore().removeConfiguredObject(this); - for (Task task : _taskList) { task.doTask(this); @@ -682,23 +661,7 @@ public class ServerSession extends Session public VirtualHost getVirtualHost() { - return (VirtualHost) _connectionConfig.getVirtualHost(); - } - - @Override - public UUID getQMFId() - { - return _id; - } - - public SessionConfigType getConfigType() - { - return SessionConfigType.getInstance(); - } - - public ConfiguredObject getParent() - { - return getVirtualHost(); + return getConnection().getVirtualHost(); } public boolean isDurable() @@ -706,44 +669,16 @@ public class ServerSession extends Session return false; } - public boolean isAttached() - { - return true; - } - - public long getDetachedLifespan() - { - return 0; - } - - public Long getExpiryTime() - { - return null; - } - - public Long getMaxClientRate() - { - return null; - } - - public ConnectionConfig getConnectionConfig() - { - return _connectionConfig; - } - - public String getSessionName() - { - return getName().toString(); - } public long getCreateTime() { return _createTime; } - public void mgmtClose() + @Override + public UUID getId() { - close(); + return _id; } public AMQConnectionModel getConnectionModel() @@ -878,9 +813,7 @@ public class ServerSession extends Session ? getConnection().getConnectionId() : -1; - String remoteAddress = _connectionConfig instanceof ProtocolEngine - ? ((ProtocolEngine) _connectionConfig).getRemoteAddress().toString() - : ""; + String remoteAddress = String.valueOf(getConnection().getRemoteAddress()); return "[" + MessageFormat.format(CHANNEL_FORMAT, connectionId, @@ -1065,14 +998,16 @@ public class ServerSession extends Session super.setClose(close); } - public int compareTo(AMQSessionModel session) + @Override + public int getConsumerCount() { - return getQMFId().compareTo(session.getQMFId()); + return _subscriptions.values().size(); } @Override - public int getConsumerCount() + public int compareTo(AMQSessionModel o) { - return _subscriptions.values().size(); + return getId().compareTo(o.getId()); } + } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java index f810360662..ff39e7ae0d 100755 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java @@ -25,13 +25,10 @@ import java.util.UUID; import java.util.concurrent.ScheduledFuture; import org.apache.qpid.common.Closeable; import org.apache.qpid.server.binding.BindingFactory; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.VirtualHostConfig; import org.apache.qpid.server.configuration.VirtualHostConfiguration; import org.apache.qpid.server.connection.IConnectionRegistry; import org.apache.qpid.server.exchange.ExchangeFactory; import org.apache.qpid.server.exchange.ExchangeRegistry; -import org.apache.qpid.server.federation.BrokerLink; import org.apache.qpid.server.protocol.v1_0.LinkRegistry; import org.apache.qpid.server.queue.QueueRegistry; import org.apache.qpid.server.registry.IApplicationRegistry; @@ -41,7 +38,7 @@ import org.apache.qpid.server.store.DurableConfigurationStore; import org.apache.qpid.server.store.MessageStore; import org.apache.qpid.server.txn.DtxRegistry; -public interface VirtualHost extends DurableConfigurationStore.Source, VirtualHostConfig, Closeable, StatisticsGatherer +public interface VirtualHost extends DurableConfigurationStore.Source, Closeable, StatisticsGatherer { IConnectionRegistry getConnectionRegistry(); @@ -81,21 +78,8 @@ public interface VirtualHost extends DurableConfigurationStore.Source, VirtualHo BindingFactory getBindingFactory(); - void createBrokerConnection(String transport, - String host, - int port, - String vhost, - boolean durable, - String authMechanism, String username, String password); - - public BrokerLink createBrokerConnection(UUID id, long createTime, Map<String,String> arguments); - - ConfigStore getConfigStore(); - DtxRegistry getDtxRegistry(); - void removeBrokerConnection(BrokerLink brokerLink); - LinkRegistry getLinkRegistry(String remoteContainerId); ScheduledFuture<?> scheduleTask(long delay, Runnable timeoutTask); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java index ea2f0f15e4..ff5f5c738a 100755 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java @@ -35,7 +35,6 @@ import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.FieldTable; import org.apache.qpid.server.binding.BindingFactory; import org.apache.qpid.server.exchange.Exchange; -import org.apache.qpid.server.federation.BrokerLink; import org.apache.qpid.server.logging.actors.CurrentActor; import org.apache.qpid.server.logging.messages.TransactionLogMessages; import org.apache.qpid.server.logging.subjects.MessageStoreLogSubject; @@ -65,7 +64,6 @@ public class VirtualHostConfigRecoveryHandler implements ConfigurationRecoveryHa ConfigurationRecoveryHandler.QueueRecoveryHandler, ConfigurationRecoveryHandler.ExchangeRecoveryHandler, ConfigurationRecoveryHandler.BindingRecoveryHandler, - ConfigurationRecoveryHandler.BrokerLinkRecoveryHandler, MessageStoreRecoveryHandler, MessageStoreRecoveryHandler.StoredMessageRecoveryHandler, TransactionLogRecoveryHandler, @@ -190,19 +188,6 @@ public class VirtualHostConfigRecoveryHandler implements ConfigurationRecoveryHa { } - public BridgeRecoveryHandler brokerLink(final UUID id, - final long createTime, - final Map<String, String> arguments) - { - BrokerLink blink = _virtualHost.createBrokerConnection(id, createTime, arguments); - return new BridgeRecoveryHandlerImpl(blink); - - } - - public void completeBrokerLinkRecovery() - { - } - public void dtxRecord(long format, byte[] globalId, byte[] branchId, Transaction.Record[] enqueues, Transaction.Record[] dequeues) @@ -412,9 +397,8 @@ public class VirtualHostConfigRecoveryHandler implements ConfigurationRecoveryHa } - public BrokerLinkRecoveryHandler completeBindingRecovery() + public void completeBindingRecovery() { - return this; } public void complete() @@ -529,22 +513,4 @@ public class VirtualHostConfigRecoveryHandler implements ConfigurationRecoveryHa } } - private class BridgeRecoveryHandlerImpl implements BridgeRecoveryHandler - { - private final BrokerLink _blink; - - public BridgeRecoveryHandlerImpl(final BrokerLink blink) - { - _blink = blink; - } - - public void bridge(final UUID id, final long createTime, final Map<String, String> arguments) - { - _blink.createBridge(id, createTime, arguments); - } - - public void completeBridgeRecoveryForLink() - { - } - } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java index d9dc0aa64e..7e1ffb7ed8 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java @@ -35,12 +35,8 @@ import org.apache.log4j.Logger; import org.apache.qpid.AMQException; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.server.binding.BindingFactory; -import org.apache.qpid.server.configuration.BrokerConfig; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.ConfiguredObject; import org.apache.qpid.server.configuration.ExchangeConfiguration; import org.apache.qpid.server.configuration.QueueConfiguration; -import org.apache.qpid.server.configuration.VirtualHostConfigType; import org.apache.qpid.server.configuration.VirtualHostConfiguration; import org.apache.qpid.server.connection.ConnectionRegistry; import org.apache.qpid.server.connection.IConnectionRegistry; @@ -49,7 +45,6 @@ import org.apache.qpid.server.exchange.DefaultExchangeRegistry; import org.apache.qpid.server.exchange.Exchange; import org.apache.qpid.server.exchange.ExchangeFactory; import org.apache.qpid.server.exchange.ExchangeRegistry; -import org.apache.qpid.server.federation.BrokerLink; import org.apache.qpid.server.logging.actors.CurrentActor; import org.apache.qpid.server.logging.messages.VirtualHostMessages; import org.apache.qpid.server.logging.subjects.MessageStoreLogSubject; @@ -79,24 +74,18 @@ public class VirtualHostImpl implements VirtualHost, IConnectionRegistry.Registr private static final int HOUSEKEEPING_SHUTDOWN_TIMEOUT = 5; - private final UUID _qmfId; - private final String _name; private final UUID _id; private final long _createTime = System.currentTimeMillis(); - private final ConcurrentHashMap<BrokerLink,BrokerLink> _links = new ConcurrentHashMap<BrokerLink, BrokerLink>(); - private final ScheduledThreadPoolExecutor _houseKeepingTasks; private final IApplicationRegistry _appRegistry; private final SecurityManager _securityManager; - private final BrokerConfig _brokerConfig; - private final VirtualHostConfiguration _vhostConfig; private final QueueRegistry _queueRegistry; @@ -133,12 +122,10 @@ public class VirtualHostImpl implements VirtualHost, IConnectionRegistry.Registr } _appRegistry = appRegistry; - _brokerConfig = _appRegistry.getBrokerConfig(); _vhostConfig = hostConfig; _name = _vhostConfig.getName(); _dtxRegistry = new DtxRegistry(); - _qmfId = _appRegistry.getConfigStore().createId(); _id = UUIDGenerator.generateVhostUUID(_name); CurrentActor.get().message(VirtualHostMessages.CREATED(_name)); @@ -187,22 +174,6 @@ public class VirtualHostImpl implements VirtualHost, IConnectionRegistry.Registr return _id; } - @Override - public UUID getQMFId() - { - return _qmfId; - } - - public VirtualHostConfigType getConfigType() - { - return VirtualHostConfigType.getInstance(); - } - - public ConfiguredObject getParent() - { - return getBroker(); - } - public boolean isDurable() { return false; @@ -468,16 +439,6 @@ public class VirtualHostImpl implements VirtualHost, IConnectionRegistry.Registr return _name; } - public BrokerConfig getBroker() - { - return _brokerConfig; - } - - public String getFederationTag() - { - return _brokerConfig.getFederationTag(); - } - public long getCreateTime() { return _createTime; @@ -604,51 +565,6 @@ public class VirtualHostImpl implements VirtualHost, IConnectionRegistry.Registr _dataReceived = new StatisticsCounter("bytes-received-" + getName()); } - public BrokerLink createBrokerConnection(UUID id, long createTime, Map<String,String> arguments) - { - BrokerLink blink = new BrokerLink(this, id, createTime, arguments); - // TODO - cope with duplicate broker link creation requests - _links.putIfAbsent(blink,blink); - getConfigStore().addConfiguredObject(blink); - return blink; - } - - public void createBrokerConnection(final String transport, - final String host, - final int port, - final String vhost, - final boolean durable, - final String authMechanism, - final String username, - final String password) - { - BrokerLink blink = new BrokerLink(this, transport, host, port, vhost, durable, authMechanism, username, password); - - // TODO - cope with duplicate broker link creation requests - _links.putIfAbsent(blink,blink); - getConfigStore().addConfiguredObject(blink); - - } - - public void removeBrokerConnection(final String transport, - final String host, - final int port, - final String vhost) - { - removeBrokerConnection(new BrokerLink(this, transport, host, port, vhost, false, null,null,null)); - - } - - public void removeBrokerConnection(BrokerLink blink) - { - blink = _links.get(blink); - if(blink != null) - { - blink.close(); - getConfigStore().removeConfiguredObject(blink); - } - } - public synchronized LinkRegistry getLinkRegistry(String remoteContainerId) { LinkRegistry linkRegistry = _linkRegistry.get(remoteContainerId); @@ -660,11 +576,6 @@ public class VirtualHostImpl implements VirtualHost, IConnectionRegistry.Registr return linkRegistry; } - public ConfigStore getConfigStore() - { - return getApplicationRegistry().getConfigStore(); - } - public DtxRegistry getDtxRegistry() { return _dtxRegistry; diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.java index 1be472844a..9f26c00841 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostRegistry.java @@ -1,59 +1,58 @@ -/*
- *
- * 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.server.virtualhost;
-
-import org.apache.qpid.common.Closeable;
-import org.apache.qpid.server.configuration.ConfigStore;
+/* + * + * 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.server.virtualhost; + +import org.apache.qpid.common.Closeable; import org.apache.qpid.server.exchange.ExchangeRegistry; -import org.apache.qpid.server.registry.ApplicationRegistry;
-
-import java.util.ArrayList;
-import java.util.Collection;
+import org.apache.qpid.server.registry.ApplicationRegistry; + +import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; -import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-
-public class VirtualHostRegistry implements Closeable
-{
- private final Map<String, VirtualHost> _registry = new ConcurrentHashMap<String, VirtualHost>();
-
-
- private String _defaultVirtualHostName;
- private ApplicationRegistry _applicationRegistry;
+import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + + +public class VirtualHostRegistry implements Closeable +{ + private final Map<String, VirtualHost> _registry = new ConcurrentHashMap<String, VirtualHost>(); + + + private String _defaultVirtualHostName; + private ApplicationRegistry _applicationRegistry; private final Collection<RegistryChangeListener> _listeners = Collections.synchronizedCollection(new ArrayList<RegistryChangeListener>()); -
- public VirtualHostRegistry(ApplicationRegistry applicationRegistry)
- {
- _applicationRegistry = applicationRegistry;
- }
-
- public synchronized void registerVirtualHost(VirtualHost host) throws Exception
- {
- if(_registry.containsKey(host.getName()))
- {
- throw new Exception("Virtual Host with name " + host.getName() + " already registered.");
- }
- _registry.put(host.getName(),host);
+ + public VirtualHostRegistry(ApplicationRegistry applicationRegistry) + { + _applicationRegistry = applicationRegistry; + } + + public synchronized void registerVirtualHost(VirtualHost host) throws Exception + { + if(_registry.containsKey(host.getName())) + { + throw new Exception("Virtual Host with name " + host.getName() + " already registered."); + } + _registry.put(host.getName(),host); synchronized (_listeners) { for(RegistryChangeListener listener : _listeners) @@ -61,11 +60,11 @@ public class VirtualHostRegistry implements Closeable listener.virtualHostRegistered(host); } } - }
-
- public synchronized void unregisterVirtualHost(VirtualHost host)
- {
- _registry.remove(host.getName());
+ } + + public synchronized void unregisterVirtualHost(VirtualHost host) + { + _registry.remove(host.getName()); synchronized (_listeners) { for(RegistryChangeListener listener : _listeners) @@ -73,57 +72,52 @@ public class VirtualHostRegistry implements Closeable listener.virtualHostUnregistered(host); } } - }
-
- public VirtualHost getVirtualHost(String name)
- {
- if(name == null || name.trim().length() == 0 || "/".equals(name.trim()))
- {
- name = getDefaultVirtualHostName();
- }
-
- return _registry.get(name);
- }
-
- public VirtualHost getDefaultVirtualHost()
- {
- return getVirtualHost(getDefaultVirtualHostName());
- }
-
- private String getDefaultVirtualHostName()
- {
- return _defaultVirtualHostName;
- }
-
- public void setDefaultVirtualHostName(String defaultVirtualHostName)
- {
- _defaultVirtualHostName = defaultVirtualHostName;
- }
-
-
- public Collection<VirtualHost> getVirtualHosts()
- {
- return new ArrayList<VirtualHost>(_registry.values());
- }
-
- public ApplicationRegistry getApplicationRegistry()
- {
- return _applicationRegistry;
- }
-
- public ConfigStore getConfigStore()
- {
- return _applicationRegistry.getConfigStore();
- }
-
- public void close()
- {
- for (VirtualHost virtualHost : getVirtualHosts())
- {
- virtualHost.close();
- }
-
- }
+ } + + public VirtualHost getVirtualHost(String name) + { + if(name == null || name.trim().length() == 0 || "/".equals(name.trim())) + { + name = getDefaultVirtualHostName(); + } + + return _registry.get(name); + } + + public VirtualHost getDefaultVirtualHost() + { + return getVirtualHost(getDefaultVirtualHostName()); + } + + private String getDefaultVirtualHostName() + { + return _defaultVirtualHostName; + } + + public void setDefaultVirtualHostName(String defaultVirtualHostName) + { + _defaultVirtualHostName = defaultVirtualHostName; + } + + + public Collection<VirtualHost> getVirtualHosts() + { + return new ArrayList<VirtualHost>(_registry.values()); + } + + public ApplicationRegistry getApplicationRegistry() + { + return _applicationRegistry; + } + + public void close() + { + for (VirtualHost virtualHost : getVirtualHosts()) + { + virtualHost.close(); + } + + } public static interface RegistryChangeListener { @@ -137,4 +131,4 @@ public class VirtualHostRegistry implements Closeable _listeners.add(listener); } -}
+} diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/MockConnectionConfig.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/MockConnectionConfig.java deleted file mode 100644 index 00e5cd1222..0000000000 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/MockConnectionConfig.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * - * 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.server.configuration; - -import java.util.UUID; - -public class MockConnectionConfig implements ConnectionConfig -{ - - public MockConnectionConfig(UUID _qmfId, ConnectionConfigType _configType, - ConfiguredObject<ConnectionConfigType, ConnectionConfig> _parent, boolean _durable, - long _createTime, VirtualHostConfig _virtualHost, String _address, Boolean _incoming, - Boolean _systemConnection, Boolean _federationLink, String _authId, String _remoteProcessName, - Integer _remotePID, Integer _remoteParentPID, ConfigStore _configStore, Boolean _shadow) - { - super(); - this._qmfId = _qmfId; - this._configType = _configType; - this._parent = _parent; - this._durable = _durable; - this._createTime = _createTime; - this._virtualHost = _virtualHost; - this._address = _address; - this._incoming = _incoming; - this._systemConnection = _systemConnection; - this._federationLink = _federationLink; - this._authId = _authId; - this._remoteProcessName = _remoteProcessName; - this._remotePID = _remotePID; - this._remoteParentPID = _remoteParentPID; - this._configStore = _configStore; - this._shadow = _shadow; - } - - private UUID _qmfId; - private ConnectionConfigType _configType; - private ConfiguredObject<ConnectionConfigType, ConnectionConfig> _parent; - private boolean _durable; - private long _createTime; - private VirtualHostConfig _virtualHost; - private String _address; - private Boolean _incoming; - private Boolean _systemConnection; - private Boolean _federationLink; - private String _authId; - private String _remoteProcessName; - private Integer _remotePID; - private Integer _remoteParentPID; - private ConfigStore _configStore; - private Boolean _shadow; - - @Override - public UUID getQMFId() - { - return _qmfId; - } - - @Override - public ConnectionConfigType getConfigType() - { - return _configType; - } - - @Override - public ConfiguredObject<ConnectionConfigType, ConnectionConfig> getParent() - { - return _parent; - } - - @Override - public boolean isDurable() - { - return _durable; - } - - @Override - public long getCreateTime() - { - return _createTime; - } - - @Override - public VirtualHostConfig getVirtualHost() - { - return _virtualHost; - } - - @Override - public String getAddress() - { - return _address; - } - - @Override - public Boolean isIncoming() - { - return _incoming; - } - - @Override - public Boolean isSystemConnection() - { - return _systemConnection; - } - - @Override - public Boolean isFederationLink() - { - return _federationLink; - } - - @Override - public String getAuthId() - { - return _authId; - } - - @Override - public String getRemoteProcessName() - { - return _remoteProcessName; - } - - @Override - public Integer getRemotePID() - { - return _remotePID; - } - - @Override - public Integer getRemoteParentPID() - { - return _remoteParentPID; - } - - @Override - public ConfigStore getConfigStore() - { - return _configStore; - } - - @Override - public Boolean isShadow() - { - return _shadow; - } - - @Override - public void mgmtClose() - { - } - -} diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java index 50e7f0588b..bd54c930dd 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java @@ -238,12 +238,11 @@ public class VirtualHostConfigurationTest extends InternalBrokerBaseCase VirtualHost vhost = ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHost(getName()); - assertEquals("Default houseKeeping task count incorrect.", 2, + assertEquals("Default houseKeeping task count incorrect.", 1, vhost.getHouseKeepingTaskCount()); - // Currently the two are tasks: - // ExpiredMessageTask from VirtualHost - // UpdateTask from the QMF ManagementExchange + // Currently the task is: + // ExpiredMessageTask from VirtualHostC } /** diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java index 4befd26ece..656490c9d8 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java @@ -29,7 +29,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.UUID; import java.util.concurrent.atomic.AtomicLong; import org.apache.log4j.Logger; @@ -83,7 +82,7 @@ public class AbstractHeadersExchangeTestBase extends InternalBrokerBaseCase protected void unbind(TestQueue queue, String... bindings) throws AMQException { String queueName = queue.getName(); - exchange.onUnbind(new Binding(null, null, queueName, queue, exchange, getHeadersMap(bindings))); + exchange.onUnbind(new Binding(null, queueName, queue, exchange, getHeadersMap(bindings))); } protected int getCount() @@ -95,7 +94,7 @@ public class AbstractHeadersExchangeTestBase extends InternalBrokerBaseCase { TestQueue queue = new TestQueue(new AMQShortString(queueName)); queues.add(queue); - exchange.onBind(new Binding(null, null, key, queue, exchange, args)); + exchange.onBind(new Binding(null, key, queue, exchange, args)); return queue; } diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersBindingTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersBindingTest.java index 3988edcb3c..833df34fd8 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersBindingTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersBindingTest.java @@ -160,7 +160,7 @@ public class HeadersBindingTest extends TestCase matchHeaders.setString("A", "Value of A"); - Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders); + Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders); assertTrue(new HeadersBinding(b).matches(matchHeaders)); } @@ -171,7 +171,7 @@ public class HeadersBindingTest extends TestCase matchHeaders.setString("A", "Value of A"); matchHeaders.setString("B", "Value of B"); - Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders); + Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders); assertTrue(new HeadersBinding(b).matches(matchHeaders)); } @@ -181,7 +181,7 @@ public class HeadersBindingTest extends TestCase matchHeaders.setString("A", "Altered value of A"); - Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders); + Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders); assertFalse(new HeadersBinding(b).matches(matchHeaders)); } @@ -192,7 +192,7 @@ public class HeadersBindingTest extends TestCase matchHeaders.setString("A", "Value of A"); - Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders); + Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders); assertTrue(new HeadersBinding(b).matches(matchHeaders)); } @@ -204,7 +204,7 @@ public class HeadersBindingTest extends TestCase matchHeaders.setString("A", "Value of A"); - Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders); + Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders); assertFalse(new HeadersBinding(b).matches(matchHeaders)); } @@ -217,7 +217,7 @@ public class HeadersBindingTest extends TestCase matchHeaders.setString("A", "Value of A"); matchHeaders.setString("B", "Value of B"); - Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders); + Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders); assertTrue(new HeadersBinding(b).matches(matchHeaders)); } @@ -231,7 +231,7 @@ public class HeadersBindingTest extends TestCase matchHeaders.setString("B", "Value of B"); matchHeaders.setString("C", "Value of C"); - Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders); + Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders); assertTrue(new HeadersBinding(b).matches(matchHeaders)); } @@ -245,7 +245,7 @@ public class HeadersBindingTest extends TestCase matchHeaders.setString("B", "Altered value of B"); matchHeaders.setString("C", "Value of C"); - Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders); + Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders); assertFalse(new HeadersBinding(b).matches(matchHeaders)); } @@ -256,7 +256,7 @@ public class HeadersBindingTest extends TestCase matchHeaders.setString("A", "Value of A"); - Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders); + Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders); assertTrue(new HeadersBinding(b).matches(matchHeaders)); } @@ -268,7 +268,7 @@ public class HeadersBindingTest extends TestCase matchHeaders.setString("A", "Value of A"); - Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders); + Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders); assertTrue(new HeadersBinding(b).matches(matchHeaders)); } @@ -281,7 +281,7 @@ public class HeadersBindingTest extends TestCase matchHeaders.setString("A", "Value of A"); matchHeaders.setString("B", "Value of B"); - Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders); + Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders); assertTrue(new HeadersBinding(b).matches(matchHeaders)); } @@ -295,7 +295,7 @@ public class HeadersBindingTest extends TestCase matchHeaders.setString("B", "Value of B"); matchHeaders.setString("C", "Value of C"); - Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders); + Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders); assertTrue(new HeadersBinding(b).matches(matchHeaders)); } @@ -309,7 +309,7 @@ public class HeadersBindingTest extends TestCase matchHeaders.setString("B", "Altered value of B"); matchHeaders.setString("C", "Value of C"); - Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders); + Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders); assertTrue(new HeadersBinding(b).matches(matchHeaders)); } @@ -323,7 +323,7 @@ public class HeadersBindingTest extends TestCase matchHeaders.setString("B", "Altered value of B"); matchHeaders.setString("C", "Value of C"); - Binding b = new Binding(null, null, getQueueName(), _queue, null, bindHeaders); + Binding b = new Binding(null, getQueueName(), _queue, null, bindHeaders); assertFalse(new HeadersBinding(b).matches(matchHeaders)); } diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java index 92274afece..d06649a77d 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java @@ -66,7 +66,7 @@ public class TopicExchangeTest extends InternalBrokerBaseCase public void testNoRoute() throws AMQException { AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a*#b", false, null, false, false, _vhost, null); - _exchange.registerQueue(new Binding(null, null, "a.*.#.b",queue, _exchange, null)); + _exchange.registerQueue(new Binding(null, "a.*.#.b",queue, _exchange, null)); IncomingMessage message = createMessage("a.b"); @@ -78,7 +78,7 @@ public class TopicExchangeTest extends InternalBrokerBaseCase public void testDirectMatch() throws AMQException { AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "ab", false, null, false, false, _vhost, null); - _exchange.registerQueue(new Binding(null, null, "a.b",queue, _exchange, null)); + _exchange.registerQueue(new Binding(null, "a.b",queue, _exchange, null)); IncomingMessage message = createMessage("a.b"); @@ -105,7 +105,7 @@ public class TopicExchangeTest extends InternalBrokerBaseCase public void testStarMatch() throws AMQException { AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a*", false, null, false, false, _vhost, null); - _exchange.registerQueue(new Binding(null, null, "a.*",queue, _exchange, null)); + _exchange.registerQueue(new Binding(null, "a.*",queue, _exchange, null)); IncomingMessage message = createMessage("a.b"); @@ -144,7 +144,7 @@ public class TopicExchangeTest extends InternalBrokerBaseCase public void testHashMatch() throws AMQException { AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a#", false, null, false, false, _vhost, null); - _exchange.registerQueue(new Binding(null, null, "a.#",queue, _exchange, null)); + _exchange.registerQueue(new Binding(null, "a.#",queue, _exchange, null)); IncomingMessage message = createMessage("a.b.c"); @@ -207,7 +207,7 @@ public class TopicExchangeTest extends InternalBrokerBaseCase public void testMidHash() throws AMQException { AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a", false, null, false, false, _vhost, null); - _exchange.registerQueue(new Binding(null, null, "a.*.#.b",queue, _exchange, null)); + _exchange.registerQueue(new Binding(null, "a.*.#.b",queue, _exchange, null)); IncomingMessage message = createMessage("a.c.d.b"); @@ -237,7 +237,7 @@ public class TopicExchangeTest extends InternalBrokerBaseCase public void testMatchafterHash() throws AMQException { AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a#", false, null, false, false, _vhost, null); - _exchange.registerQueue(new Binding(null, null, "a.*.#.b.c",queue, _exchange, null)); + _exchange.registerQueue(new Binding(null, "a.*.#.b.c",queue, _exchange, null)); IncomingMessage message = createMessage("a.c.b.b"); @@ -283,7 +283,7 @@ public class TopicExchangeTest extends InternalBrokerBaseCase public void testHashAfterHash() throws AMQException { AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a#", false, null, false, false, _vhost, null); - _exchange.registerQueue(new Binding(null, null, "a.*.#.b.c.#.d",queue, _exchange, null)); + _exchange.registerQueue(new Binding(null, "a.*.#.b.c.#.d",queue, _exchange, null)); IncomingMessage message = createMessage("a.c.b.b.c"); @@ -310,7 +310,7 @@ public class TopicExchangeTest extends InternalBrokerBaseCase public void testHashHash() throws AMQException { AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a#", false, null, false, false, _vhost, null); - _exchange.registerQueue(new Binding(null, null, "a.#.*.#.d",queue, _exchange, null)); + _exchange.registerQueue(new Binding(null, "a.#.*.#.d",queue, _exchange, null)); IncomingMessage message = createMessage("a.c.b.b.c"); @@ -336,7 +336,7 @@ public class TopicExchangeTest extends InternalBrokerBaseCase public void testSubMatchFails() throws AMQException { AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a", false, null, false, false, _vhost, null); - _exchange.registerQueue(new Binding(null, null, "a.b.c.d",queue, _exchange, null)); + _exchange.registerQueue(new Binding(null, "a.b.c.d",queue, _exchange, null)); IncomingMessage message = createMessage("a.b.c"); @@ -366,7 +366,7 @@ public class TopicExchangeTest extends InternalBrokerBaseCase public void testMoreRouting() throws AMQException { AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a", false, null, false, false, _vhost, null); - _exchange.registerQueue(new Binding(null, null, "a.b",queue, _exchange, null)); + _exchange.registerQueue(new Binding(null, "a.b",queue, _exchange, null)); IncomingMessage message = createMessage("a.b.c"); @@ -381,7 +381,7 @@ public class TopicExchangeTest extends InternalBrokerBaseCase public void testMoreQueue() throws AMQException { AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(UUIDGenerator.generateRandomUUID(), "a", false, null, false, false, _vhost, null); - _exchange.registerQueue(new Binding(null, null, "a.b",queue, _exchange, null)); + _exchange.registerQueue(new Binding(null, "a.b",queue, _exchange, null)); IncomingMessage message = createMessage("a"); diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java index bcb8d54636..c6235f2f45 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java @@ -23,9 +23,6 @@ package org.apache.qpid.server.queue; import org.apache.qpid.AMQException; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.server.binding.Binding; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.ConfiguredObject; -import org.apache.qpid.server.configuration.QueueConfigType; import org.apache.qpid.server.configuration.plugins.ConfigurationPlugin; import org.apache.qpid.server.exchange.Exchange; import org.apache.qpid.server.logging.LogSubject; @@ -106,11 +103,6 @@ public class MockAMQQueue implements AMQQueue return 0; } - public ConfigStore getConfigStore() - { - return getVirtualHost().getConfigStore(); - } - public long getMessageDequeueCount() { return 0; @@ -186,22 +178,6 @@ public class MockAMQQueue implements AMQQueue return null; } - @Override - public UUID getQMFId() - { - return null; - } - - public QueueConfigType getConfigType() - { - return null; - } - - public ConfiguredObject getParent() - { - return null; - } - public boolean isDurable() { return false; diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/store/DurableConfigurationStoreTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/store/DurableConfigurationStoreTest.java index cd8d91d835..f0ecfb6407 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/store/DurableConfigurationStoreTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/store/DurableConfigurationStoreTest.java @@ -51,10 +51,6 @@ import org.apache.qpid.server.message.EnqueableMessage; import org.apache.qpid.server.model.UUIDGenerator; import org.apache.qpid.server.queue.AMQQueue; import org.apache.qpid.server.queue.MockStoredMessage; -import org.apache.qpid.server.store.ConfigurationRecoveryHandler; -import org.apache.qpid.server.store.MessageStore; -import org.apache.qpid.server.store.MessageStoreRecoveryHandler; -import org.apache.qpid.server.store.TransactionLogRecoveryHandler; import org.apache.qpid.server.store.ConfigurationRecoveryHandler.BindingRecoveryHandler; import org.apache.qpid.server.store.ConfigurationRecoveryHandler.ExchangeRecoveryHandler; import org.apache.qpid.server.store.ConfigurationRecoveryHandler.QueueRecoveryHandler; @@ -76,7 +72,6 @@ public class DurableConfigurationStoreTest extends QpidTestCase private QueueRecoveryHandler _queueRecoveryHandler; private ExchangeRecoveryHandler _exchangeRecoveryHandler; private BindingRecoveryHandler _bindingRecoveryHandler; - private ConfigurationRecoveryHandler.BrokerLinkRecoveryHandler _linkRecoveryHandler; private MessageStoreRecoveryHandler _messageStoreRecoveryHandler; private StoredMessageRecoveryHandler _storedMessageRecoveryHandler; private TransactionLogRecoveryHandler _logRecoveryHandler; @@ -116,7 +111,6 @@ public class DurableConfigurationStoreTest extends QpidTestCase when(_recoveryHandler.begin(isA(MessageStore.class))).thenReturn(_exchangeRecoveryHandler); when(_exchangeRecoveryHandler.completeExchangeRecovery()).thenReturn(_queueRecoveryHandler); when(_queueRecoveryHandler.completeQueueRecovery()).thenReturn(_bindingRecoveryHandler); - when(_bindingRecoveryHandler.completeBindingRecovery()).thenReturn(_linkRecoveryHandler); when(_logRecoveryHandler.begin(any(MessageStore.class))).thenReturn(_queueEntryRecoveryHandler); when(_queueEntryRecoveryHandler.completeQueueEntryRecovery()).thenReturn(_dtxRecordRecoveryHandler); when(_exchange.getNameShortString()).thenReturn(AMQShortString.valueOf(EXCHANGE_NAME)); @@ -161,7 +155,7 @@ public class DurableConfigurationStoreTest extends QpidTestCase public void testBindQueue() throws Exception { AMQQueue queue = createTestQueue(QUEUE_NAME, "queueOwner", false); - Binding binding = new Binding(UUIDGenerator.generateRandomUUID(), null, ROUTING_KEY, queue, + Binding binding = new Binding(UUIDGenerator.generateRandomUUID(), ROUTING_KEY, queue, _exchange, FieldTable.convertToMap(_bindingArgs)); _store.bindQueue(binding); @@ -175,7 +169,7 @@ public class DurableConfigurationStoreTest extends QpidTestCase public void testUnbindQueue() throws Exception { AMQQueue queue = createTestQueue(QUEUE_NAME, "queueOwner", false); - Binding binding = new Binding(UUIDGenerator.generateRandomUUID(), null, ROUTING_KEY, queue, + Binding binding = new Binding(UUIDGenerator.generateRandomUUID(), ROUTING_KEY, queue, _exchange, FieldTable.convertToMap(_bindingArgs)); _store.bindQueue(binding); diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/subscription/MockSubscription.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/subscription/MockSubscription.java index 8c5d2684ff..a3552639d1 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/subscription/MockSubscription.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/subscription/MockSubscription.java @@ -294,17 +294,12 @@ public class MockSubscription implements Subscription private static class MockSessionModel implements AMQSessionModel { + private final UUID _id = UUID.randomUUID(); @Override - public int compareTo(AMQSessionModel o) - { - return 0; - } - - @Override - public UUID getQMFId() + public UUID getId() { - return null; + return _id; } @Override @@ -409,6 +404,12 @@ public class MockSubscription implements Subscription { return 0; } + + @Override + public int compareTo(AMQSessionModel o) + { + return getId().compareTo(o.getId()); + } } private static class MockConnectionModel implements AMQConnectionModel diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/subscription/SubscriptionFactoryImplTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/subscription/SubscriptionFactoryImplTest.java index 29f45bf7f4..e7b0725edf 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/subscription/SubscriptionFactoryImplTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/subscription/SubscriptionFactoryImplTest.java @@ -71,10 +71,9 @@ public class SubscriptionFactoryImplTest extends InternalBrokerBaseCase ServerConnection conn = new ServerConnection(1); ProtocolEngine_0_10 engine = new ProtocolEngine_0_10(conn, new TestNetworkConnection(), getRegistry()); conn.setVirtualHost(getVirtualHost()); - conn.setConnectionConfig(engine); ServerSessionDelegate sesDel = new ServerSessionDelegate(); Binary name = new Binary(new byte[]{new Byte("1")}); - ServerSession session = new ServerSession(conn, sesDel, name, 0, engine); + ServerSession session = new ServerSession(conn, sesDel, name, 0); Subscription sub_0_10 = SubscriptionFactoryImpl.INSTANCE.createSubscription(session, "1", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, MessageFlowMode.WINDOW, new WindowCreditManager(), null, null); diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/transport/ServerSessionTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/transport/ServerSessionTest.java index d775b0f2f8..ac3c0d5722 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/transport/ServerSessionTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/transport/ServerSessionTest.java @@ -1,5 +1,4 @@ /* - * * 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 @@ -16,13 +15,9 @@ * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * */ package org.apache.qpid.server.transport; -import java.util.UUID; - -import org.apache.qpid.server.configuration.MockConnectionConfig; import org.apache.qpid.server.registry.ApplicationRegistry; import org.apache.qpid.server.util.InternalBrokerBaseCase; import org.apache.qpid.server.virtualhost.VirtualHost; @@ -43,25 +38,19 @@ public class ServerSessionTest extends InternalBrokerBaseCase public void testCompareTo() throws Exception { ServerConnection connection = new ServerConnection(1); - connection.setConnectionConfig(createConnectionConfig()); + connection.setVirtualHost(_virtualHost); ServerSession session1 = new ServerSession(connection, new ServerSessionDelegate(), - new Binary(getName().getBytes()), 0 , connection.getConfig()); + new Binary(getName().getBytes()), 0); // create a session with the same name but on a different connection ServerConnection connection2 = new ServerConnection(2); - connection2.setConnectionConfig(createConnectionConfig()); + connection2.setVirtualHost(_virtualHost); ServerSession session2 = new ServerSession(connection2, new ServerSessionDelegate(), - new Binary(getName().getBytes()), 0 , connection2.getConfig()); + new Binary(getName().getBytes()), 0); assertFalse("Unexpected compare result", session1.compareTo(session2) == 0); assertEquals("Unexpected compare result", 0, session1.compareTo(session1)); } - private MockConnectionConfig createConnectionConfig() - { - return new MockConnectionConfig(UUID.randomUUID(), null, null, - false, 1, _virtualHost, "address", Boolean.TRUE, Boolean.TRUE, Boolean.TRUE, - "authid", "remoteProcessName", new Integer(1967), new Integer(1970), _virtualHost.getConfigStore(), Boolean.FALSE); - } } diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/txn/MockServerMessage.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/txn/MockServerMessage.java index f3b6cab626..aa5b555b3b 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/txn/MockServerMessage.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/txn/MockServerMessage.java @@ -22,7 +22,6 @@ package org.apache.qpid.server.txn; import org.apache.commons.lang.NotImplementedException; -import org.apache.qpid.server.configuration.SessionConfig; import org.apache.qpid.server.message.AMQMessageHeader; import org.apache.qpid.server.message.MessageReference; import org.apache.qpid.server.message.ServerMessage; @@ -68,11 +67,6 @@ class MockServerMessage implements ServerMessage throw new NotImplementedException(); } - public SessionConfig getSessionConfig() - { - throw new NotImplementedException(); - } - public String getRoutingKey() { throw new NotImplementedException(); diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java index 290c465785..5e02fda40b 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java @@ -22,16 +22,10 @@ package org.apache.qpid.server.virtualhost; import java.util.concurrent.ScheduledFuture; import org.apache.qpid.server.binding.BindingFactory; -import org.apache.qpid.server.configuration.BrokerConfig; -import org.apache.qpid.server.configuration.ConfigStore; -import org.apache.qpid.server.configuration.ConfiguredObject; -import org.apache.qpid.server.configuration.VirtualHostConfig; -import org.apache.qpid.server.configuration.VirtualHostConfigType; import org.apache.qpid.server.configuration.VirtualHostConfiguration; import org.apache.qpid.server.connection.IConnectionRegistry; import org.apache.qpid.server.exchange.ExchangeFactory; import org.apache.qpid.server.exchange.ExchangeRegistry; -import org.apache.qpid.server.federation.BrokerLink; import org.apache.qpid.server.protocol.v1_0.LinkRegistry; import org.apache.qpid.server.queue.QueueRegistry; import org.apache.qpid.server.registry.IApplicationRegistry; @@ -58,18 +52,6 @@ public class MockVirtualHost implements VirtualHost } - public void createBrokerConnection(String transport, String host, int port, - String vhost, boolean durable, String authMechanism, - String username, String password) - { - - } - - public BrokerLink createBrokerConnection(final UUID id, final long createTime, final Map<String, String> arguments) - { - return null; - } - public IApplicationRegistry getApplicationRegistry() { return null; @@ -90,11 +72,6 @@ public class MockVirtualHost implements VirtualHost return null; } - public ConfigStore getConfigStore() - { - return null; - } - public DtxRegistry getDtxRegistry() { return null; @@ -160,12 +137,6 @@ public class MockVirtualHost implements VirtualHost return null; } - - public void removeBrokerConnection(BrokerLink brokerLink) - { - - } - public LinkRegistry getLinkRegistry(String remoteContainerId) { return null; @@ -186,25 +157,6 @@ public class MockVirtualHost implements VirtualHost } - public BrokerConfig getBroker() - { - return null; - } - - public String getFederationTag() - { - return null; - } - - public void setBroker(BrokerConfig brokerConfig) - { - - } - - public VirtualHostConfigType getConfigType() - { - return null; - } public long getCreateTime() { @@ -216,17 +168,6 @@ public class MockVirtualHost implements VirtualHost return null; } - @Override - public UUID getQMFId() - { - return null; - } - - public ConfiguredObject<VirtualHostConfigType, VirtualHostConfig> getParent() - { - return null; - } - public boolean isDurable() { return false; diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/plugins/policies/TopicDeletePolicyTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/plugins/policies/TopicDeletePolicyTest.java index aa8448b99d..fdd163b323 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/plugins/policies/TopicDeletePolicyTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/plugins/policies/TopicDeletePolicyTest.java @@ -146,7 +146,7 @@ public class TopicDeletePolicyTest extends InternalBrokerBaseCase MockAMQQueue queue = createOwnedQueue(); - queue.addBinding(new Binding(null, null, "bindingKey", queue, new DirectExchange(), null)); + queue.addBinding(new Binding(null, "bindingKey", queue, new DirectExchange(), null)); policy.performPolicy(queue); @@ -165,7 +165,7 @@ public class TopicDeletePolicyTest extends InternalBrokerBaseCase MockAMQQueue queue = createOwnedQueue(); - queue.addBinding(new Binding(null, null, "bindingKey", queue, new TopicExchange(), null)); + queue.addBinding(new Binding(null, "bindingKey", queue, new TopicExchange(), null)); queue.setAutoDelete(false); @@ -186,7 +186,7 @@ public class TopicDeletePolicyTest extends InternalBrokerBaseCase final MockAMQQueue queue = createOwnedQueue(); - queue.addBinding(new Binding(null, null, "bindingKey", queue, new TopicExchange(), null)); + queue.addBinding(new Binding(null, "bindingKey", queue, new TopicExchange(), null)); setQueueToAutoDelete(queue); @@ -207,7 +207,7 @@ public class TopicDeletePolicyTest extends InternalBrokerBaseCase MockAMQQueue queue = createOwnedQueue(); - queue.addBinding(new Binding(null, null, "bindingKey", queue, new TopicExchange(), null)); + queue.addBinding(new Binding(null, "bindingKey", queue, new TopicExchange(), null)); policy.performPolicy(queue); @@ -233,7 +233,7 @@ public class TopicDeletePolicyTest extends InternalBrokerBaseCase MockAMQQueue queue = createOwnedQueue(); - queue.addBinding(new Binding(null, null, "bindingKey", queue, new TopicExchange(), null)); + queue.addBinding(new Binding(null, "bindingKey", queue, new TopicExchange(), null)); policy.performPolicy(queue); @@ -253,7 +253,7 @@ public class TopicDeletePolicyTest extends InternalBrokerBaseCase MockAMQQueue queue = createOwnedQueue(); - queue.addBinding(new Binding(null, null, "bindingKey", queue, new TopicExchange(), null)); + queue.addBinding(new Binding(null, "bindingKey", queue, new TopicExchange(), null)); policy.performPolicy(queue); diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java index e87851cf7d..bdb5c9d206 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java @@ -74,7 +74,6 @@ public class Connection extends ConnectionInvoker public static final int MAX_CHANNEL_MAX = 0xFFFF; public static final int MIN_USABLE_CHANNEL_NUM = 0; - public enum State { NEW, CLOSED, OPENING, OPEN, CLOSING, CLOSE_RCVD, RESUMING } static class DefaultConnectionListener implements ConnectionListener @@ -233,8 +232,8 @@ public class Connection extends ConnectionInvoker } NetworkConnection network = transport.connect(settings, secureReceiver, null); - _remoteAddress = network.getRemoteAddress(); - _localAddress = network.getLocalAddress(); + setRemoteAddress(network.getRemoteAddress()); + setLocalAddress(network.getLocalAddress()); final Sender<ByteBuffer> secureSender = securityLayer.sender(network.getSender()); if(secureSender instanceof ConnectionListener) @@ -728,6 +727,17 @@ public class Connection extends ConnectionInvoker return _localAddress; } + protected void setRemoteAddress(SocketAddress remoteAddress) + { + _remoteAddress = remoteAddress; + } + + protected void setLocalAddress(SocketAddress localAddress) + { + _localAddress = localAddress; + } + + private void invokeSessionDetached(int channel, SessionDetachCode sessionDetachCode) { SessionDetached sessionDetached = new SessionDetached(); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java index 9db04b64b3..6d38004451 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java @@ -27,8 +27,6 @@ import org.apache.qpid.AMQStoreException; import org.apache.qpid.framing.FieldTable; import org.apache.qpid.server.binding.Binding; import org.apache.qpid.server.exchange.Exchange; -import org.apache.qpid.server.federation.Bridge; -import org.apache.qpid.server.federation.BrokerLink; import org.apache.qpid.server.message.EnqueableMessage; import org.apache.qpid.server.message.ServerMessage; import org.apache.qpid.server.queue.AMQQueue; @@ -322,35 +320,6 @@ public class SlowMessageStore implements MessageStore doPostDelay("updateQueue"); } - - public void createBrokerLink(final BrokerLink link) throws AMQStoreException - { - doPreDelay("createBrokerLink"); - _durableConfigurationStore.createBrokerLink(link); - doPostDelay("createBrokerLink"); - } - - public void deleteBrokerLink(final BrokerLink link) throws AMQStoreException - { - doPreDelay("deleteBrokerLink"); - _durableConfigurationStore.deleteBrokerLink(link); - doPostDelay("deleteBrokerLink"); - } - - public void createBridge(final Bridge bridge) throws AMQStoreException - { - doPreDelay("createBridge"); - _durableConfigurationStore.createBridge(bridge); - doPostDelay("createBridge"); - } - - public void deleteBridge(final Bridge bridge) throws AMQStoreException - { - doPreDelay("deleteBridge"); - _durableConfigurationStore.deleteBridge(bridge); - doPostDelay("deleteBridge"); - } - @Override public void activate() throws Exception { |
