diff options
author | Keith Wall <kwall@apache.org> | 2014-06-07 19:00:39 +0000 |
---|---|---|
committer | Keith Wall <kwall@apache.org> | 2014-06-07 19:00:39 +0000 |
commit | 4db0b188233c547a691492d707e5fc9a5a1f4c1c (patch) | |
tree | fc46479ca0a47ae5c490956bf4566820ac18868e /java/broker-core/src | |
parent | 8de53f5c5de353635b6bd435df993df83db7357a (diff) | |
download | qpid-python-4db0b188233c547a691492d707e5fc9a5a1f4c1c.tar.gz |
QPID-5800: [Java Broker] Remove the now redundant MessageStore/DurableConfigurationStore factories
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1601162 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker-core/src')
12 files changed, 8 insertions, 305 deletions
diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java b/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java index 4443a3199d..53c1e7f7f4 100644 --- a/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java +++ b/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java @@ -41,7 +41,7 @@ public interface Broker<X extends Broker<X>> extends ConfiguredObject<X>, EventL String PROCESS_PID = "processPid"; String PRODUCT_VERSION = "productVersion"; String SUPPORTED_VIRTUALHOST_TYPES = "supportedVirtualHostTypes"; - String SUPPORTED_VIRTUALHOST_STORE_TYPES = "supportedVirtualHostStoreTypes"; + String SUPPORTED_VIRTUALHOSTNODE_TYPES = "supportedVirtualHostNodeTypes"; String SUPPORTED_AUTHENTICATION_PROVIDERS = "supportedAuthenticationProviders"; String SUPPORTED_PREFERENCES_PROVIDER_TYPES = "supportedPreferencesProviderTypes"; String DEFAULT_VIRTUAL_HOST = "defaultVirtualHost"; @@ -93,9 +93,6 @@ public interface Broker<X extends Broker<X>> extends ConfiguredObject<X>, EventL Collection<String> getSupportedVirtualHostNodeTypes(); @DerivedAttribute - Collection<String> getSupportedVirtualHostStoreTypes(); - - @DerivedAttribute Collection<String> getSupportedAuthenticationProviders(); @DerivedAttribute diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java b/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java index e6d7f44e0c..77eda0dc67 100644 --- a/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java +++ b/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java @@ -47,7 +47,6 @@ import org.apache.qpid.server.logging.messages.BrokerMessages; import org.apache.qpid.server.logging.messages.VirtualHostMessages; import org.apache.qpid.server.model.*; import org.apache.qpid.server.model.port.AbstractPortWithAuthProvider; -import org.apache.qpid.server.plugin.MessageStoreFactory; import org.apache.qpid.server.security.SecurityManager; import org.apache.qpid.server.security.SubjectCreator; import org.apache.qpid.server.security.access.Operation; @@ -71,13 +70,10 @@ public class BrokerAdapter extends AbstractConfiguredObject<BrokerAdapter> imple private EventLogger _eventLogger; - //private final VirtualHostRegistry _virtualHostRegistry; private final LogRecorder _logRecorder; private final SecurityManager _securityManager; - private final Collection<String> _supportedVirtualHostStoreTypes; - private AuthenticationProvider<?> _managementModeAuthenticationProvider; private BrokerOptions _brokerOptions; @@ -109,7 +105,6 @@ public class BrokerAdapter extends AbstractConfiguredObject<BrokerAdapter> imple _eventLogger = parent.getEventLogger(); _brokerOptions = parent.getBrokerOptions(); _securityManager = new SecurityManager(this, _brokerOptions.isManagementMode()); - _supportedVirtualHostStoreTypes = MessageStoreFactory.FACTORY_LOADER.getSupportedTypes(); if (_brokerOptions.isManagementMode()) { Map<String,Object> authManagerAttrs = new HashMap<String, Object>(); @@ -311,12 +306,6 @@ public class BrokerAdapter extends AbstractConfiguredObject<BrokerAdapter> imple } @Override - public Collection<String> getSupportedVirtualHostStoreTypes() - { - return _supportedVirtualHostStoreTypes; - } - - @Override public Collection<String> getSupportedVirtualHostTypes() { return getObjectFactory().getSupportedTypes(VirtualHost.class); diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/plugin/DurableConfigurationStoreFactory.java b/java/broker-core/src/main/java/org/apache/qpid/server/plugin/DurableConfigurationStoreFactory.java deleted file mode 100644 index ba398f129d..0000000000 --- a/java/broker-core/src/main/java/org/apache/qpid/server/plugin/DurableConfigurationStoreFactory.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.server.plugin; - -import java.util.Map; - -import org.apache.qpid.server.store.DurableConfigurationStore; - -public interface DurableConfigurationStoreFactory extends Pluggable -{ - PluggableFactoryLoader<DurableConfigurationStoreFactory> FACTORY_LOADER = new PluggableFactoryLoader<DurableConfigurationStoreFactory>(DurableConfigurationStoreFactory.class); - - String getType(); - - DurableConfigurationStore createDurableConfigurationStore(); - - void validateConfigurationStoreSettings(Map<String, Object> attributes); -} diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/plugin/MessageStoreFactory.java b/java/broker-core/src/main/java/org/apache/qpid/server/plugin/MessageStoreFactory.java deleted file mode 100644 index bae6738f23..0000000000 --- a/java/broker-core/src/main/java/org/apache/qpid/server/plugin/MessageStoreFactory.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.server.plugin; - -import java.util.Map; - -import org.apache.qpid.server.store.MessageStore; - -public interface MessageStoreFactory extends Pluggable -{ - PluggableFactoryLoader<MessageStoreFactory> FACTORY_LOADER = new PluggableFactoryLoader<MessageStoreFactory>(MessageStoreFactory.class); - - String getType(); - - MessageStore createMessageStore(); - - void validateAttributes(Map<String, Object> attributes); -} diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStoreFactory.java b/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStoreFactory.java deleted file mode 100644 index ea1f41d7ab..0000000000 --- a/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStoreFactory.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.store; - -import java.util.Map; - -import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory; -import org.apache.qpid.server.plugin.PluggableService; - -@PluggableService -public class JsonFileConfigStoreFactory implements DurableConfigurationStoreFactory -{ - @Override - public String getType() - { - return JsonFileConfigStore.TYPE; - } - - @Override - public DurableConfigurationStore createDurableConfigurationStore() - { - return new JsonFileConfigStore(); - } - - @Override - public void validateConfigurationStoreSettings(Map<String, Object> attributes) - { - Object storePath = attributes.get(DurableConfigurationStore.STORE_PATH); - if(!(storePath instanceof String)) - { - throw new IllegalArgumentException("Setting '"+ DurableConfigurationStore.STORE_PATH - +"' is required and must be of type String."); - - } - } - -} diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNode.java b/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNode.java index 7f460aae4f..e37eeb17bf 100644 --- a/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNode.java +++ b/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNode.java @@ -38,9 +38,7 @@ import org.apache.qpid.server.model.ConfiguredObject; import org.apache.qpid.server.model.RemoteReplicationNode; import org.apache.qpid.server.model.VirtualHost; import org.apache.qpid.server.model.VirtualHostNode; -import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory; import org.apache.qpid.server.security.SecurityManager; -import org.apache.qpid.server.store.DurableConfigurationStore; import org.apache.qpid.server.store.MessageStore; import org.apache.qpid.server.store.MessageStoreProvider; import org.apache.qpid.server.store.VirtualHostStoreUpgraderAndRecoverer; @@ -57,16 +55,6 @@ public abstract class AbstractStandardVirtualHostNode<X extends AbstractStandard super(parent, attributes); } - @Override - public void onValidate() - { - super.onValidate(); - DurableConfigurationStoreFactory durableConfigurationStoreFactory = getDurableConfigurationStoreFactory(); - Map<String, Object> storeSettings = new HashMap<String, Object>(getActualAttributes()); - storeSettings.put(DurableConfigurationStore.STORE_TYPE, durableConfigurationStoreFactory.getType()); - durableConfigurationStoreFactory.validateConfigurationStoreSettings(storeSettings); - } - @SuppressWarnings({ "rawtypes", "unchecked" }) @Override protected <C extends ConfiguredObject> C addChild(Class<C> childClass, Map<String, Object> attributes, @@ -80,16 +68,6 @@ public abstract class AbstractStandardVirtualHostNode<X extends AbstractStandard } @Override - protected DurableConfigurationStore createConfigurationStore() - { - DurableConfigurationStoreFactory durableConfigurationStoreFactory = getDurableConfigurationStoreFactory(); - DurableConfigurationStore store = durableConfigurationStoreFactory.createDurableConfigurationStore(); - return store; - } - - protected abstract DurableConfigurationStoreFactory getDurableConfigurationStoreFactory(); - - @Override protected void activate() { if (LOGGER.isDebugEnabled()) diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/JsonVirtualHostNodeImpl.java b/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/JsonVirtualHostNodeImpl.java index f41b794953..67f690a2b9 100644 --- a/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/JsonVirtualHostNodeImpl.java +++ b/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/JsonVirtualHostNodeImpl.java @@ -26,8 +26,8 @@ import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.ManagedAttributeField; import org.apache.qpid.server.model.ManagedObject; import org.apache.qpid.server.model.ManagedObjectFactoryConstructor; -import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory; -import org.apache.qpid.server.store.JsonFileConfigStoreFactory; +import org.apache.qpid.server.store.DurableConfigurationStore; +import org.apache.qpid.server.store.JsonFileConfigStore; @ManagedObject(category=false, type="JSON") public class JsonVirtualHostNodeImpl extends AbstractStandardVirtualHostNode<JsonVirtualHostNodeImpl> implements FileBasedVirtualHostNode<JsonVirtualHostNodeImpl> @@ -42,9 +42,9 @@ public class JsonVirtualHostNodeImpl extends AbstractStandardVirtualHostNode<Jso } @Override - protected DurableConfigurationStoreFactory getDurableConfigurationStoreFactory() + protected DurableConfigurationStore createConfigurationStore() { - return new JsonFileConfigStoreFactory(); + return new JsonFileConfigStore(); } @Override @@ -58,5 +58,4 @@ public class JsonVirtualHostNodeImpl extends AbstractStandardVirtualHostNode<Jso { return getClass().getSimpleName() + " [id=" + getId() + ", name=" + getName() + ", storePath=" + getStorePath() + "]"; } - } diff --git a/java/broker-core/src/test/java/org/apache/qpid/server/store/TestMemoryMessageStoreFactory.java b/java/broker-core/src/test/java/org/apache/qpid/server/store/TestMemoryMessageStoreFactory.java deleted file mode 100644 index df17884495..0000000000 --- a/java/broker-core/src/test/java/org/apache/qpid/server/store/TestMemoryMessageStoreFactory.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.server.store; - -import java.util.Map; - -import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory; -import org.apache.qpid.server.plugin.MessageStoreFactory; - -public class TestMemoryMessageStoreFactory implements MessageStoreFactory, DurableConfigurationStoreFactory -{ - - @Override - public String getType() - { - return TestMemoryMessageStore.TYPE; - } - - @Override - public MessageStore createMessageStore() - { - return new TestMemoryMessageStore(); - } - - @Override - public void validateAttributes(Map<String, Object> attributes) - { - } - - @Override - public DurableConfigurationStore createDurableConfigurationStore() - { - return new AbstractMemoryStore() - { - }; - } - - @Override - public void validateConfigurationStoreSettings(Map<String, Object> attributes) - { - } -} diff --git a/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNodeTest.java b/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNodeTest.java index 220e9e94de..e0a56bc39c 100644 --- a/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNodeTest.java +++ b/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNodeTest.java @@ -37,13 +37,10 @@ import org.apache.qpid.server.model.State; import org.apache.qpid.server.model.SystemContext; import org.apache.qpid.server.model.VirtualHost; import org.apache.qpid.server.model.VirtualHostNode; -import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory; import org.apache.qpid.server.store.ConfiguredObjectRecord; import org.apache.qpid.server.store.DurableConfigurationStore; -import org.apache.qpid.server.store.MessageStore; import org.apache.qpid.server.store.NullMessageStore; import org.apache.qpid.server.store.StoreException; -import org.apache.qpid.server.store.TestMemoryMessageStore; import org.apache.qpid.server.store.handler.ConfiguredObjectRecordHandler; import org.apache.qpid.server.util.BrokerTestHelper; import org.apache.qpid.server.virtualhost.TestMemoryVirtualHost; @@ -54,7 +51,6 @@ public class AbstractStandardVirtualHostNodeTest extends QpidTestCase private static final String TEST_VIRTUAL_HOST_NODE_NAME = "testNode"; private static final String TEST_VIRTUAL_HOST_NAME = "testVirtualHost"; - private DurableConfigurationStoreFactory _configStoreFactory = mock(DurableConfigurationStoreFactory.class); private UUID _nodeId = UUID.randomUUID(); private Broker<?> _broker; private DurableConfigurationStore _configStore; @@ -102,7 +98,6 @@ public class AbstractStandardVirtualHostNodeTest extends QpidTestCase handler.end(); } }; - when(_configStoreFactory.createDurableConfigurationStore()).thenReturn(_configStore); Map<String, Object> nodeAttributes = new HashMap<String, Object>(); nodeAttributes.put(VirtualHostNode.NAME, TEST_VIRTUAL_HOST_NODE_NAME); @@ -131,7 +126,6 @@ public class AbstractStandardVirtualHostNodeTest extends QpidTestCase handler.end(); } }; - when(_configStoreFactory.createDurableConfigurationStore()).thenReturn(_configStore); Map<String, Object> nodeAttributes = new HashMap<String, Object>(); nodeAttributes.put(VirtualHostNode.NAME, TEST_VIRTUAL_HOST_NODE_NAME); @@ -156,9 +150,6 @@ public class AbstractStandardVirtualHostNodeTest extends QpidTestCase virtualHostAttributes.put(VirtualHost.NAME, TEST_VIRTUAL_HOST_NAME); virtualHostAttributes.put(VirtualHost.TYPE, TestMemoryVirtualHost.VIRTUAL_HOST_TYPE); virtualHostAttributes.put(VirtualHost.MODEL_VERSION, BrokerModel.MODEL_VERSION); - Map<String,Object> messageStoreSettings = new HashMap<String, Object>(); - virtualHostAttributes.put(VirtualHost.MESSAGE_STORE_SETTINGS, messageStoreSettings); - messageStoreSettings.put(MessageStore.STORE_TYPE, TestMemoryMessageStore.TYPE); ConfiguredObjectRecord record = mock(ConfiguredObjectRecord.class); when(record.getId()).thenReturn(virtualHostId); diff --git a/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/TestVirtualHostNode.java b/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/TestVirtualHostNode.java index eda07bd846..16a9aa5550 100644 --- a/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/TestVirtualHostNode.java +++ b/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/TestVirtualHostNode.java @@ -25,11 +25,10 @@ import java.util.Map; import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.ManagedObject; -import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory; import org.apache.qpid.server.store.DurableConfigurationStore; import org.apache.qpid.server.store.MessageStore; import org.apache.qpid.server.store.TestMemoryMessageStore; -import org.apache.qpid.server.store.TestMemoryMessageStoreFactory; + @ManagedObject(type="TestMemory", category=false) public class TestVirtualHostNode extends AbstractStandardVirtualHostNode<TestVirtualHostNode> { @@ -49,33 +48,9 @@ public class TestVirtualHostNode extends AbstractStandardVirtualHostNode<TestVir } @Override - protected DurableConfigurationStoreFactory getDurableConfigurationStoreFactory() + protected DurableConfigurationStore createConfigurationStore() { - if (_store != null) - { - return new DurableConfigurationStoreFactory() - { - - @Override - public void validateConfigurationStoreSettings(Map<String, Object> attributes) - { - } - - @Override - public String getType() - { - return null; - } - - @Override - public DurableConfigurationStore createDurableConfigurationStore() - { - return _store; - } - }; - } - - return new TestMemoryMessageStoreFactory(); + return _store; } @Override diff --git a/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.DurableConfigurationStoreFactory b/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.DurableConfigurationStoreFactory deleted file mode 100644 index 9512fb8117..0000000000 --- a/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.DurableConfigurationStoreFactory +++ /dev/null @@ -1,19 +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. -# -org.apache.qpid.server.store.TestMemoryMessageStoreFactory diff --git a/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.MessageStoreFactory b/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.MessageStoreFactory deleted file mode 100644 index 9512fb8117..0000000000 --- a/java/broker-core/src/test/resources/META-INF/services/org.apache.qpid.server.plugin.MessageStoreFactory +++ /dev/null @@ -1,19 +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. -# -org.apache.qpid.server.store.TestMemoryMessageStoreFactory |