diff options
| author | Robert Godfrey <rgodfrey@apache.org> | 2014-05-02 20:32:16 +0000 |
|---|---|---|
| committer | Robert Godfrey <rgodfrey@apache.org> | 2014-05-02 20:32:16 +0000 |
| commit | db543bd85497285b1911c7250a9a1f76522f318b (patch) | |
| tree | 0a88c2e19a1a8e3e4bedf49ab0a4ef7248d25603 /qpid/java | |
| parent | 1af82f62bbf94323e61a415c182adf2d66ac99f0 (diff) | |
| download | qpid-python-db543bd85497285b1911c7250a9a1f76522f318b.tar.gz | |
QPID-5746 : [Java Broker] Split attribute annotations into separate annotations for derived and automated, and allow derived attributes to be persisted
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1592030 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
115 files changed, 765 insertions, 557 deletions
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNode.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNode.java index e18c76b986..691096f59f 100644 --- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNode.java +++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNode.java @@ -20,6 +20,7 @@ */ package org.apache.qpid.server.virtualhostnode.berkeleydb; +import org.apache.qpid.server.model.DerivedAttribute; import org.apache.qpid.server.model.ManagedAttribute; import org.apache.qpid.server.model.ManagedObject; import org.apache.qpid.server.model.RemoteReplicationNode; @@ -33,19 +34,19 @@ public interface BDBHARemoteReplicationNode<X extends BDBHARemoteReplicationNode String LAST_KNOWN_REPLICATION_TRANSACTION_ID = "lastKnownReplicationTransactionId"; String JOIN_TIME = "joinTime"; - @ManagedAttribute(derived = true) + @DerivedAttribute String getGroupName(); - @ManagedAttribute(derived = true) + @DerivedAttribute String getAddress(); - @ManagedAttribute(automate = true) + @ManagedAttribute(persist = false) String getRole(); - @ManagedAttribute(derived = true) + @DerivedAttribute long getJoinTime(); - @ManagedAttribute(derived = true) + @DerivedAttribute long getLastKnownReplicationTransactionId(); } diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeImpl.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeImpl.java index 8e94649a1a..23dd2ee5c0 100644 --- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeImpl.java +++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeImpl.java @@ -25,7 +25,10 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicReference; +import com.sleepycat.je.rep.MasterStateException; +import com.sleepycat.je.rep.ReplicatedEnvironment; import org.apache.log4j.Logger; + import org.apache.qpid.server.configuration.IllegalConfigurationException; import org.apache.qpid.server.model.AbstractConfiguredObject; import org.apache.qpid.server.model.ConfiguredObject; @@ -34,9 +37,6 @@ import org.apache.qpid.server.model.ManagedAttributeField; import org.apache.qpid.server.model.State; import org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade; -import com.sleepycat.je.rep.MasterStateException; -import com.sleepycat.je.rep.ReplicatedEnvironment; - public class BDBHARemoteReplicationNodeImpl extends AbstractConfiguredObject<BDBHARemoteReplicationNodeImpl> implements BDBHARemoteReplicationNode<BDBHARemoteReplicationNodeImpl> { private static final Logger LOGGER = Logger.getLogger(BDBHARemoteReplicationNodeImpl.class); @@ -125,7 +125,7 @@ public class BDBHARemoteReplicationNodeImpl extends AbstractConfiguredObject<BDB } @Override - protected boolean setState(State currentState, State desiredState) + protected boolean setState(State desiredState) { if (desiredState == State.DELETED) { diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNode.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNode.java index c135803717..0d0292ce58 100644 --- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNode.java +++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNode.java @@ -22,6 +22,7 @@ package org.apache.qpid.server.virtualhostnode.berkeleydb; import java.util.Map; +import org.apache.qpid.server.model.DerivedAttribute; import org.apache.qpid.server.model.ManagedAttribute; public interface BDBHAVirtualHostNode<X extends BDBHAVirtualHostNode<X>> extends BDBVirtualHostNode<X> @@ -39,39 +40,39 @@ public interface BDBHAVirtualHostNode<X extends BDBHAVirtualHostNode<X>> extends public static final String LAST_KNOWN_REPLICATION_TRANSACTION_ID = "lastKnownReplicationTransactionId"; public static final String JOIN_TIME = "joinTime"; - @ManagedAttribute(automate = true, mandatory=true) + @ManagedAttribute(mandatory=true) String getGroupName(); - @ManagedAttribute(automate = true, mandatory=true) + @ManagedAttribute(mandatory=true) String getAddress(); - @ManagedAttribute(automate = true, mandatory=true) + @ManagedAttribute(mandatory=true) String getHelperAddress(); - @ManagedAttribute(automate = true, defaultValue = "NO_SYNC,NO_SYNC,SIMPLE_MAJORITY") + @ManagedAttribute(defaultValue = "NO_SYNC,NO_SYNC,SIMPLE_MAJORITY") String getDurability(); - @ManagedAttribute(automate = true, defaultValue = "true") + @ManagedAttribute(defaultValue = "true") boolean isCoalescingSync(); - @ManagedAttribute(automate = true, defaultValue = "false") + @ManagedAttribute(defaultValue = "false") boolean isDesignatedPrimary(); - @ManagedAttribute(automate = true, defaultValue = "1") + @ManagedAttribute(defaultValue = "1") int getPriority(); - @ManagedAttribute(automate = true, defaultValue = "0") + @ManagedAttribute(defaultValue = "0") int getQuorumOverride(); - @ManagedAttribute(automate = true, persist = false) + @ManagedAttribute(persist = false) String getRole(); - @ManagedAttribute(automate = true) + @ManagedAttribute Map<String, String> getReplicatedEnvironmentConfiguration(); - @ManagedAttribute(derived = true) + @DerivedAttribute Long getLastKnownReplicationTransactionId(); - @ManagedAttribute(derived = true) + @DerivedAttribute Long getJoinTime(); } diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java index 95f542585c..a6ce1c47df 100644 --- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java +++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java @@ -37,9 +37,8 @@ import com.sleepycat.je.rep.ReplicatedEnvironment; import com.sleepycat.je.rep.ReplicationNode; import com.sleepycat.je.rep.StateChangeEvent; import com.sleepycat.je.rep.StateChangeListener; - import org.apache.log4j.Logger; -import org.apache.qpid.server.configuration.IllegalConfigurationException; + import org.apache.qpid.server.logging.messages.ConfigStoreMessages; import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.BrokerModel; @@ -385,7 +384,7 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode<BDBHAVirtu } }); } - host.setDesiredState(host.getState(), State.ACTIVE); + host.setDesiredState(State.ACTIVE); } catch (Exception e) @@ -422,7 +421,7 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode<BDBHAVirtu VirtualHost<?,?,?> virtualHost = getVirtualHost(); if (virtualHost!= null) { - virtualHost.setDesiredState(virtualHost.getState(), State.STOPPED); + virtualHost.setDesiredState(State.STOPPED); } } @@ -655,13 +654,13 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode<BDBHAVirtu } @Override - public boolean setState(State currentState, State desiredState) + public boolean setState(State desiredState) { if (desiredState != State.STOPPED) { throw new IllegalArgumentException("Unsupported state " + desiredState); } - return super.setState(currentState, desiredState); + return super.setState(desiredState); } } diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNode.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNode.java index 4785d47447..91b2d7ae63 100644 --- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNode.java +++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBVirtualHostNode.java @@ -29,6 +29,6 @@ public interface BDBVirtualHostNode<X extends BDBVirtualHostNode<X>> extends Fil { public static final String ENVIRONMENT_CONFIGURATION = "environmentConfiguration"; - @ManagedAttribute(mandatory=false, automate=true) + @ManagedAttribute(mandatory=false) Map<String, String> getEnvironmentConfiguration(); -}
\ No newline at end of file +} diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeTest.java index 5e5458b382..49205930ea 100644 --- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeTest.java +++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeTest.java @@ -33,6 +33,9 @@ import java.util.UUID; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import com.sleepycat.je.rep.ReplicatedEnvironment; +import com.sleepycat.je.rep.ReplicationConfig; + import org.apache.qpid.server.configuration.updater.TaskExecutor; import org.apache.qpid.server.configuration.updater.TaskExecutorImpl; import org.apache.qpid.server.model.Broker; @@ -52,9 +55,6 @@ import org.apache.qpid.server.virtualhostnode.berkeleydb.BDBHAVirtualHostNode; import org.apache.qpid.test.utils.QpidTestCase; import org.apache.qpid.util.FileUtils; -import com.sleepycat.je.rep.ReplicatedEnvironment; -import com.sleepycat.je.rep.ReplicationConfig; - public class BDBHAVirtualHostNodeTest extends QpidTestCase { @@ -89,7 +89,7 @@ public class BDBHAVirtualHostNodeTest extends QpidTestCase { try { - node.setDesiredState(node.getState(), State.DELETED); + node.setDesiredState(State.DELETED); } catch(Exception e) { @@ -175,7 +175,7 @@ public class BDBHAVirtualHostNodeTest extends QpidTestCase { } }); - assertEquals(State.ACTIVE, node.setDesiredState(node.getState(), State.ACTIVE)); + assertEquals(State.ACTIVE, node.setDesiredState(State.ACTIVE)); DurableConfigurationStore store = node.getConfigurationStore(); assertNotNull(store); @@ -200,13 +200,13 @@ public class BDBHAVirtualHostNodeTest extends QpidTestCase assertEquals("Unexpected virtual host store", store, virtualHost.getMessageStore()); assertEquals("Unexpected virtual host state", State.ACTIVE, virtualHost.getState()); - State currentState = node.setDesiredState(State.ACTIVE, State.STOPPED); + State currentState = node.setDesiredState(State.STOPPED); assertEquals("Unexpected state returned after stop", State.STOPPED, currentState); assertEquals("Unexpected state", State.STOPPED, node.getState()); assertNull("Virtual host is not destroyed", node.getVirtualHost()); - currentState = node.setDesiredState(State.STOPPED, State.DELETED); + currentState = node.setDesiredState(State.DELETED); assertEquals("Unexpected state returned after delete", State.DELETED, currentState); assertEquals("Unexpected state", State.DELETED, node.getState()); assertFalse("Store still exists", _bdbStorePath.exists()); @@ -228,7 +228,7 @@ public class BDBHAVirtualHostNodeTest extends QpidTestCase BDBHAVirtualHostNode<?> node = createHaVHN(attributes); - assertEquals("Failed to activate node", State.ACTIVE, node.setDesiredState(node.getState(), State.ACTIVE)); + assertEquals("Failed to activate node", State.ACTIVE, node.setDesiredState(State.ACTIVE)); BDBMessageStore bdbMessageStore = (BDBMessageStore) node.getConfigurationStore(); ReplicatedEnvironment environment = (ReplicatedEnvironment) bdbMessageStore.getEnvironmentFacade().getEnvironment(); @@ -265,7 +265,7 @@ public class BDBHAVirtualHostNodeTest extends QpidTestCase node1Attributes.put(BDBHAVirtualHostNode.STORE_PATH, _bdbStorePath + File.separator + "1"); BDBHAVirtualHostNode<?> node1 = createHaVHN(node1Attributes); - assertEquals("Failed to activate node", State.ACTIVE, node1.setDesiredState(node1.getState(), State.ACTIVE)); + assertEquals("Failed to activate node", State.ACTIVE, node1.setDesiredState(State.ACTIVE)); int node2PortNumber = getNextAvailable(node1PortNumber+1); @@ -279,7 +279,7 @@ public class BDBHAVirtualHostNodeTest extends QpidTestCase node2Attributes.put(BDBHAVirtualHostNode.STORE_PATH, _bdbStorePath + File.separator + "2"); BDBHAVirtualHostNode<?> node2 = createHaVHN(node2Attributes); - assertEquals("Failed to activate node2", State.ACTIVE, node2.setDesiredState(node2.getState(), State.ACTIVE)); + assertEquals("Failed to activate node2", State.ACTIVE, node2.setDesiredState(State.ACTIVE)); int node3PortNumber = getNextAvailable(node2PortNumber+1); Map<String, Object> node3Attributes = new HashMap<String, Object>(); @@ -291,7 +291,7 @@ public class BDBHAVirtualHostNodeTest extends QpidTestCase node3Attributes.put(BDBHAVirtualHostNode.HELPER_ADDRESS, helperAddress); node3Attributes.put(BDBHAVirtualHostNode.STORE_PATH, _bdbStorePath + File.separator + "3"); BDBHAVirtualHostNode<?> node3 = createHaVHN(node3Attributes); - assertEquals("Failed to activate node3", State.ACTIVE, node3.setDesiredState(node3.getState(), State.ACTIVE)); + assertEquals("Failed to activate node3", State.ACTIVE, node3.setDesiredState(State.ACTIVE)); BDBHAVirtualHostNode<?> replica = null; int findReplicaCount = 0; @@ -335,7 +335,7 @@ public class BDBHAVirtualHostNodeTest extends QpidTestCase node1Attributes.put(BDBHAVirtualHostNode.STORE_PATH, _bdbStorePath + File.separator + "1"); BDBHAVirtualHostNode<?> node1 = createHaVHN(node1Attributes); - assertEquals("Failed to activate node", State.ACTIVE, node1.setDesiredState(node1.getState(), State.ACTIVE)); + assertEquals("Failed to activate node", State.ACTIVE, node1.setDesiredState(State.ACTIVE)); final CountDownLatch remoteNodeLatch = new CountDownLatch(2); node1.addChangeListener(new ConfigurationChangeListener() @@ -378,7 +378,7 @@ public class BDBHAVirtualHostNodeTest extends QpidTestCase node2Attributes.put(BDBHAVirtualHostNode.STORE_PATH, _bdbStorePath + File.separator + "2"); BDBHAVirtualHostNode<?> node2 = createHaVHN(node2Attributes); - assertEquals("Failed to activate node2", State.ACTIVE, node2.setDesiredState(node2.getState(), State.ACTIVE)); + assertEquals("Failed to activate node2", State.ACTIVE, node2.setDesiredState(State.ACTIVE)); int node3PortNumber = getNextAvailable(node2PortNumber+1); Map<String, Object> node3Attributes = new HashMap<String, Object>(); @@ -390,7 +390,7 @@ public class BDBHAVirtualHostNodeTest extends QpidTestCase node3Attributes.put(BDBHAVirtualHostNode.HELPER_ADDRESS, helperAddress); node3Attributes.put(BDBHAVirtualHostNode.STORE_PATH, _bdbStorePath + File.separator + "3"); BDBHAVirtualHostNode<?> node3 = createHaVHN(node3Attributes); - assertEquals("Failed to activate node3", State.ACTIVE, node3.setDesiredState(node3.getState(), State.ACTIVE)); + assertEquals("Failed to activate node3", State.ACTIVE, node3.setDesiredState(State.ACTIVE)); assertTrue("Replication nodes have not been seen during 5s", remoteNodeLatch.await(5, TimeUnit.SECONDS)); @@ -429,7 +429,7 @@ public class BDBHAVirtualHostNodeTest extends QpidTestCase node1Attributes.put(BDBHAVirtualHostNode.STORE_PATH, _bdbStorePath + File.separator + "1"); BDBHAVirtualHostNode<?> node = createHaVHN(node1Attributes); - assertEquals("Failed to activate node", State.ACTIVE, node.setDesiredState(node.getState(), State.ACTIVE)); + assertEquals("Failed to activate node", State.ACTIVE, node.setDesiredState(State.ACTIVE)); assertNodeRole(node, "MASTER"); diff --git a/qpid/java/broker-codegen/src/main/java/org/apache/qpid/server/model/ConfiguredObjectRegistrationGenerator.java b/qpid/java/broker-codegen/src/main/java/org/apache/qpid/server/model/ConfiguredObjectRegistrationGenerator.java index 48e9c960b2..67ae9fbce5 100644 --- a/qpid/java/broker-codegen/src/main/java/org/apache/qpid/server/model/ConfiguredObjectRegistrationGenerator.java +++ b/qpid/java/broker-codegen/src/main/java/org/apache/qpid/server/model/ConfiguredObjectRegistrationGenerator.java @@ -87,7 +87,6 @@ public class ConfiguredObjectRegistrationGenerator extends AbstractProcessor } classNames.add(e.getSimpleName().toString()); } - processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, e.getSimpleName()); } for (Map.Entry<String, Set<String>> entry : _managedObjectClasses.entrySet()) { diff --git a/qpid/java/broker-codegen/src/main/java/org/apache/qpid/server/model/ManagedObjectFactoryConstructor.java b/qpid/java/broker-codegen/src/main/java/org/apache/qpid/server/model/ManagedObjectFactoryConstructor.java index 285f96db12..0e5022a66f 100644 --- a/qpid/java/broker-codegen/src/main/java/org/apache/qpid/server/model/ManagedObjectFactoryConstructor.java +++ b/qpid/java/broker-codegen/src/main/java/org/apache/qpid/server/model/ManagedObjectFactoryConstructor.java @@ -20,11 +20,13 @@ */ package org.apache.qpid.server.model; +import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; @Retention(RetentionPolicy.SOURCE) - +@Target(ElementType.CONSTRUCTOR) public @interface ManagedObjectFactoryConstructor { } diff --git a/qpid/java/broker-codegen/src/main/java/org/apache/qpid/server/plugin/PluggableProcessor.java b/qpid/java/broker-codegen/src/main/java/org/apache/qpid/server/plugin/PluggableProcessor.java index 8cf5692dd5..ba55f6cf20 100644 --- a/qpid/java/broker-codegen/src/main/java/org/apache/qpid/server/plugin/PluggableProcessor.java +++ b/qpid/java/broker-codegen/src/main/java/org/apache/qpid/server/plugin/PluggableProcessor.java @@ -142,7 +142,7 @@ public class PluggableProcessor extends AbstractProcessor .printMessage(Diagnostic.Kind.NOTE, "Generating service file for " + serviceName); String relativeName = "META-INF/services/" + serviceName; - + loadExistingServicesFile(filer, serviceName); try { FileObject serviceFile = filer.createResource(StandardLocation.CLASS_OUTPUT, "", relativeName); diff --git a/qpid/java/broker-codegen/src/main/java/org/apache/qpid/server/plugin/PluggableService.java b/qpid/java/broker-codegen/src/main/java/org/apache/qpid/server/plugin/PluggableService.java index 07799ca71a..59fe72e377 100644 --- a/qpid/java/broker-codegen/src/main/java/org/apache/qpid/server/plugin/PluggableService.java +++ b/qpid/java/broker-codegen/src/main/java/org/apache/qpid/server/plugin/PluggableService.java @@ -19,10 +19,13 @@ package org.apache.qpid.server.plugin;/* * */ +import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; @Retention(RetentionPolicy.SOURCE) +@Target(ElementType.TYPE) public @interface PluggableService { } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/binding/BindingImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/binding/BindingImpl.java index 8b6cb1c387..593fb3c6a1 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/binding/BindingImpl.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/binding/BindingImpl.java @@ -190,7 +190,7 @@ public class BindingImpl return result; } - protected boolean setState(final State currentState, final State desiredState) + protected boolean setState(final State desiredState) { if(desiredState == State.DELETED) { diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java index 97d1c17f31..c1e2f59bd8 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java @@ -22,11 +22,9 @@ package org.apache.qpid.server.configuration.updater; import java.util.concurrent.CancellationException; -import org.apache.qpid.server.model.State; - public interface TaskExecutor { - State getState(); + boolean isRunning(); void start(); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutorImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutorImpl.java index 5eb149b4ec..b140fc4a61 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutorImpl.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutorImpl.java @@ -32,12 +32,12 @@ import java.util.concurrent.Future; import java.util.concurrent.RunnableFuture; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.atomic.AtomicBoolean; import javax.security.auth.Subject; import org.apache.log4j.Logger; -import org.apache.qpid.server.model.State; + import org.apache.qpid.server.util.ServerScopedRuntimeException; public class TaskExecutorImpl implements TaskExecutor @@ -46,25 +46,20 @@ public class TaskExecutorImpl implements TaskExecutor private static final Logger LOGGER = Logger.getLogger(TaskExecutorImpl.class); private volatile Thread _taskThread; - private final AtomicReference<State> _state; + private final AtomicBoolean _running = new AtomicBoolean(); private volatile ExecutorService _executor; - public TaskExecutorImpl() - { - _state = new AtomicReference<State>(State.INITIALISING); - } - @Override - public State getState() + public boolean isRunning() { - return _state.get(); + return _running.get(); } @Override public void start() { - if (_state.compareAndSet(State.INITIALISING, State.ACTIVE)) + if (_running.compareAndSet(false, true)) { LOGGER.debug("Starting task executor"); _executor = Executors.newFixedThreadPool(1, new ThreadFactory() @@ -83,7 +78,7 @@ public class TaskExecutorImpl implements TaskExecutor @Override public void stopImmediately() { - if (_state.compareAndSet(State.ACTIVE, State.STOPPED)) + if (_running.compareAndSet(true,false)) { ExecutorService executor = _executor; if (executor != null) @@ -108,7 +103,7 @@ public class TaskExecutorImpl implements TaskExecutor @Override public void stop() { - if (_state.compareAndSet(State.ACTIVE, State.STOPPED)) + if (_running.compareAndSet(true,false)) { ExecutorService executor = _executor; if (executor != null) @@ -288,7 +283,7 @@ public class TaskExecutorImpl implements TaskExecutor private void checkState() { - if (_state.get() != State.ACTIVE) + if (!_running.get()) { throw new IllegalStateException("Task executor is not in ACTIVE state"); } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java index 72f0365240..88ed0bf573 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java @@ -136,9 +136,9 @@ public abstract class AbstractExchange<T extends AbstractExchange<T>> } @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); if(!_virtualHost.getSecurityManager().isSystemProcess()) { @@ -732,7 +732,7 @@ public abstract class AbstractExchange<T extends AbstractExchange<T>> final Map<String, Object> oldArguments); @Override - protected boolean setState(final State currentState, final State desiredState) + protected boolean setState(final State desiredState) { if(desiredState == State.DELETED) { diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java index 0199693bda..48e2619427 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java @@ -148,6 +148,9 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im private final OwnAttributeResolver _attributeResolver = new OwnAttributeResolver(this); + @ManagedAttributeField + private State _desiredState; + protected static Map<Class<? extends ConfiguredObject>, ConfiguredObject<?>> parentsMap(ConfiguredObject<?>... parents) { final Map<Class<? extends ConfiguredObject>, ConfiguredObject<?>> parentsMap = @@ -237,7 +240,10 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im } Object durableObj = attributes.get(DURABLE); - _durable = AttributeValueConverter.BOOLEAN_CONVERTER.convert(durableObj == null ? _attributeTypes.get(DURABLE).getAnnotation().defaultValue() : durableObj, this); + _durable = AttributeValueConverter.BOOLEAN_CONVERTER.convert(durableObj == null + ? ((ConfiguredAutomatedAttribute) (_attributeTypes + .get(DURABLE))).defaultValue() + : durableObj, this); for (String name : getAttributeNames()) { @@ -265,11 +271,18 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im } for(ConfiguredObjectAttribute<?,?> attr : _attributeTypes.values()) { - if(attr.getAnnotation().mandatory() && !(_attributes.containsKey(attr.getName()) - || !"".equals(attr.getAnnotation().defaultValue()))) + if(attr.isAutomated()) { - deleted(); - throw new IllegalArgumentException("Mandatory attribute " + attr.getName() + " not supplied for instance of " + getClass().getName()); + ConfiguredAutomatedAttribute<?,?> autoAttr = (ConfiguredAutomatedAttribute<?,?>)attr; + if (autoAttr.isMandatory() && !(_attributes.containsKey(attr.getName()) + || !"".equals(autoAttr.defaultValue()))) + { + deleted(); + throw new IllegalArgumentException("Mandatory attribute " + + attr.getName() + + " not supplied for instance of " + + getClass().getName()); + } } } } @@ -333,10 +346,10 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im { try { - final ConfiguredObjectAttribute attribute = _attributeTypes.get(name); - if(value == null && !"".equals(attribute.getAnnotation().defaultValue())) + final ConfiguredAutomatedAttribute attribute = (ConfiguredAutomatedAttribute) _attributeTypes.get(name); + if(value == null && !"".equals(attribute.defaultValue())) { - value = attribute.getAnnotation().defaultValue(); + value = attribute.defaultValue(); } ConfiguredObjectTypeRegistry.AutomatedField field = _automatedFields.get(name); @@ -436,7 +449,7 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im } } }); - validate(); + onValidate(); } } @@ -444,7 +457,7 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im { if(skipCheck || !_open.get()) { - resolve(); + onResolve(); applyToChildren(new Action<ConfiguredObject<?>>() { @Override @@ -493,25 +506,25 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im } } - public void validate() + public void onValidate() { } - protected void resolve() + protected void onResolve() { for (ConfiguredObjectAttribute<?, ?> attr : _attributeTypes.values()) { String attrName = attr.getName(); - ManagedAttribute attrAnnotation = attr.getAnnotation(); - if (attrAnnotation.automate()) + if (attr.isAutomated()) { + ConfiguredAutomatedAttribute<?,?> autoAttr = (ConfiguredAutomatedAttribute<?,?>)attr; if (_attributes.containsKey(attrName)) { automatedSetValue(attrName, _attributes.get(attrName)); } - else if (!"".equals(attrAnnotation.defaultValue())) + else if (!"".equals(autoAttr.defaultValue())) { - automatedSetValue(attrName, attrAnnotation.defaultValue()); + automatedSetValue(attrName, autoAttr.defaultValue()); } } @@ -566,11 +579,11 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im public State getDesiredState() { - return null; //TODO + return _desiredState; } @Override - public final State setDesiredState(final State currentState, final State desiredState) + public final State setDesiredState(final State desiredState) throws IllegalStateTransitionException, AccessControlException { @@ -580,10 +593,11 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im @Override public State execute() { - authoriseSetDesiredState(currentState, desiredState); - if (setState(currentState, desiredState)) + State state = getState(); + authoriseSetDesiredState(desiredState); + if (setState(desiredState)) { - notifyStateChanged(currentState, desiredState); + notifyStateChanged(state, desiredState); return desiredState; } else @@ -597,7 +611,7 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im /** * @return true when the state has been successfully updated to desiredState or false otherwise */ - protected abstract boolean setState(State currentState, State desiredState); + protected abstract boolean setState(State desiredState); protected void notifyStateChanged(final State currentState, final State desiredState) { @@ -689,10 +703,10 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im public Object getAttribute(String name) { ConfiguredObjectAttribute<X,?> attr = (ConfiguredObjectAttribute<X, ?>) _attributeTypes.get(name); - if(attr != null && (attr.getAnnotation().automate() || attr.getAnnotation().derived())) + if(attr != null && (attr.isAutomated() || attr.isDerived())) { Object value = attr.getValue((X)this); - if(value != null && attr.getAnnotation().secure() && + if(value != null && attr.isSecure() && !SecurityManager.isSystemProcess()) { return SECURE_VALUES.get(value.getClass()); @@ -702,11 +716,15 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im return value; } } - else + else if(attr != null) { Object value = getActualAttribute(name); return value; } + else + { + throw new IllegalArgumentException("Unknown attribute: '" + name + "'"); + } } @Override @@ -732,20 +750,9 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im private Object getActualAttribute(final String name) { - if(CREATED_BY.equals(name)) - { - return getCreatedBy(); - } - else if(CREATED_TIME.equals(name)) - { - return getCreatedTime(); - } - else + synchronized (_attributes) { - synchronized (_attributes) - { - return _attributes.get(name); - } + return _attributes.get(name); } } @@ -784,7 +791,7 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im //TODO: don't put nulls _attributes.put(name, desired); ConfiguredObjectAttribute<?,?> attr = _attributeTypes.get(name); - if(attr != null && attr.getAnnotation().automate()) + if(attr != null && attr.isAutomated()) { automatedSetValue(name, desired); } @@ -846,25 +853,29 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im @Override public Map<String, Object> run() { - Map<String,Object> actualAttributes = new HashMap<String, Object>(getActualAttributes()); - Iterator<Map.Entry<String,Object>> attributeIterator = actualAttributes.entrySet().iterator(); - - while(attributeIterator.hasNext()) + Map<String,Object> attributes = new HashMap<String, Object>(); + Map<String,Object> actualAttributes = getActualAttributes(); + for(ConfiguredObjectAttribute<?,?> attr : _attributeTypes.values()) { - Map.Entry<String, Object> entry = attributeIterator.next(); - ConfiguredObjectAttribute<?, ?> attributeDefinition = - _attributeTypes.get(entry.getKey()); - if(attributeDefinition != null && !attributeDefinition.getAnnotation().persist()) + if(attr.isPersisted()) { - attributeIterator.remove(); - } - else if(entry.getValue() instanceof ConfiguredObject) - { - entry.setValue(((ConfiguredObject)entry.getValue()).getId()); + if(attr.isDerived()) + { + attributes.put(attr.getName(), getAttribute(attr.getName())); + } + else if(actualAttributes.containsKey(attr.getName())) + { + Object value = actualAttributes.get(attr.getName()); + if(value instanceof ConfiguredObject) + { + value = ((ConfiguredObject)value).getId(); + } + attributes.put(attr.getName(), value); + } } } - actualAttributes.remove(ID); - return actualAttributes; + attributes.remove(ID); + return attributes; } }); } @@ -1070,7 +1081,7 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im new AttributeGettingHandler(attributes)); } - protected void authoriseSetDesiredState(State currentState, State desiredState) throws AccessControlException + protected void authoriseSetDesiredState(State desiredState) throws AccessControlException { // allowed by default } @@ -1337,11 +1348,11 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im protected Object getValue(final ConfiguredObjectAttribute attribute) { - ManagedAttribute annotation = attribute.getAnnotation(); - if(annotation.automate()) + if(attribute.isAutomated()) { + ConfiguredAutomatedAttribute autoAttr = (ConfiguredAutomatedAttribute)attribute; Object value = _attributes.get(attribute.getName()); - return attribute.convert(value == null && !"".equals(annotation.defaultValue()) ? annotation.defaultValue() : value , AbstractConfiguredObject.this); + return attribute.convert(value == null && !"".equals(autoAttr.defaultValue()) ? autoAttr.defaultValue() : value , AbstractConfiguredObject.this); } else { diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractUnresolvedObject.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractUnresolvedObject.java index b9dc1f4071..e7e8bdd5e9 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractUnresolvedObject.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractUnresolvedObject.java @@ -53,42 +53,47 @@ public abstract class AbstractUnresolvedObject<C extends ConfiguredObject<C>> im ConfiguredObjectTypeRegistry.getAttributes(clazz); for(ConfiguredObjectAttribute<? super C, ?> attribute : attributes) { - final Class<?> attributeType = attribute.getType(); - if(ConfiguredObject.class.isAssignableFrom(attributeType)) + if(attribute.isPersisted()) { - addUnresolvedObject((Class<? extends ConfiguredObject>) attributeType, attribute.getName(), attribute.getAnnotation().mandatory()); - } - else if(Collection.class.isAssignableFrom(attributeType)) - { - Type returnType = attribute.getGetter().getGenericReturnType(); - Class<? extends ConfiguredObject> attrClass = getMemberType(returnType); - if(attrClass != null) + final Class<?> attributeType = attribute.getType(); + if (ConfiguredObject.class.isAssignableFrom(attributeType)) + { + addUnresolvedObject((Class<? extends ConfiguredObject>) attributeType, + attribute.getName(), + attribute.isAutomated() && ((ConfiguredAutomatedAttribute<? super C,?>)attribute).isMandatory()); + } + else if (Collection.class.isAssignableFrom(attributeType)) { - Object attrValue = _record.getAttributes().get(attribute.getName()); - if(attrValue != null) + Type returnType = attribute.getGetter().getGenericReturnType(); + Class<? extends ConfiguredObject> attrClass = getMemberType(returnType); + if (attrClass != null) { - if (attrValue instanceof Collection) + Object attrValue = _record.getAttributes().get(attribute.getName()); + if (attrValue != null) { - for (Object val : (Collection) attrValue) + if (attrValue instanceof Collection) { - addUnresolvedObject(attrClass, attribute.getName(), val); + for (Object val : (Collection) attrValue) + { + addUnresolvedObject(attrClass, attribute.getName(), val); + } } - } - else if(attrValue instanceof Object[]) - { - for (Object val : (Object[]) attrValue) + else if (attrValue instanceof Object[]) { - addUnresolvedObject(attrClass, attribute.getName(), val); + for (Object val : (Object[]) attrValue) + { + addUnresolvedObject(attrClass, attribute.getName(), val); + } + } + else + { + addUnresolvedObject(attrClass, attribute.getName(), attrValue); } - } - else - { - addUnresolvedObject(attrClass, attribute.getName(), attrValue); } } - } + } } } } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java index a4e1f47160..944ed97ccc 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java @@ -32,14 +32,14 @@ public interface Binding<X extends Binding<X>> extends ConfiguredObject<X> public String EXCHANGE = "exchange"; // TODO - this is a hack - @ManagedAttribute( derived = true ) + @DerivedAttribute Queue<?> getQueue(); // TODO - this is a hack - @ManagedAttribute( derived = true ) + @DerivedAttribute Exchange<?> getExchange(); - @ManagedAttribute( automate = true ) + @ManagedAttribute Map<String,Object> getArguments(); @ManagedStatistic diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java index 024a7b0bfb..be61094196 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java @@ -74,52 +74,52 @@ public interface Broker<X extends Broker<X>> extends ConfiguredObject<X>, EventL @ManagedContextDefault(name = QPID_JMX_PORT) public static final String DEFAULT_JMX_PORT_NUMBER = "9099"; - @ManagedAttribute( derived = true ) + @DerivedAttribute String getBuildVersion(); - @ManagedAttribute( derived = true ) + @DerivedAttribute String getOperatingSystem(); - @ManagedAttribute( derived = true ) + @DerivedAttribute String getPlatform(); - @ManagedAttribute( derived = true ) + @DerivedAttribute String getProcessPid(); - @ManagedAttribute( derived = true ) + @DerivedAttribute String getProductVersion(); - @ManagedAttribute( derived = true ) + @DerivedAttribute Collection<String> getSupportedVirtualHostStoreTypes(); - @ManagedAttribute( derived = true ) + @DerivedAttribute Collection<String> getSupportedAuthenticationProviders(); - @ManagedAttribute( derived = true ) + @DerivedAttribute Collection<String> getSupportedPreferencesProviderTypes(); - @ManagedAttribute( derived = true ) + @DerivedAttribute Collection<String> getSupportedVirtualHostTypes(); - @ManagedAttribute( automate = true ) + @ManagedAttribute String getDefaultVirtualHost(); - @ManagedAttribute( automate = true, defaultValue = "256" ) + @ManagedAttribute( defaultValue = "256" ) int getConnection_sessionCountLimit(); - @ManagedAttribute( automate = true, defaultValue = "0") + @ManagedAttribute( defaultValue = "0") int getConnection_heartBeatDelay(); - @ManagedAttribute( automate = true, defaultValue = "true" ) + @ManagedAttribute( defaultValue = "true" ) boolean getConnection_closeWhenNoRoute(); - @ManagedAttribute( automate = true, defaultValue = "0" ) + @ManagedAttribute( defaultValue = "0" ) int getStatisticsReportingPeriod(); - @ManagedAttribute( automate = true, defaultValue = "false") + @ManagedAttribute( defaultValue = "false") boolean getStatisticsReportingResetEnabled(); - @ManagedAttribute( derived = true ) + @DerivedAttribute( persist = true ) String getModelVersion(); @ManagedStatistic diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredAutomatedAttribute.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredAutomatedAttribute.java new file mode 100644 index 0000000000..236e7fdccc --- /dev/null +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredAutomatedAttribute.java @@ -0,0 +1,72 @@ +/* + * + * 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.model; + +import java.lang.reflect.Method; + +public class ConfiguredAutomatedAttribute<C extends ConfiguredObject, T> extends ConfiguredObjectAttribute<C,T> +{ + private final ManagedAttribute _annotation; + + ConfiguredAutomatedAttribute(final Class<C> clazz, + final Method getter, + final ManagedAttribute annotation) + { + super(clazz, getter); + _annotation = annotation; + } + + public boolean isAutomated() + { + return true; + } + + public boolean isDerived() + { + return false; + } + + public String defaultValue() + { + return _annotation.defaultValue(); + } + + public boolean isSecure() + { + return _annotation.secure(); + } + + public boolean isMandatory() + { + return _annotation.mandatory(); + } + + public boolean isPersisted() + { + return _annotation.persist(); + } + + public String getDescription() + { + return _annotation.description(); + } + +} diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredDerivedAttribute.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredDerivedAttribute.java new file mode 100644 index 0000000000..9495c1ff84 --- /dev/null +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredDerivedAttribute.java @@ -0,0 +1,62 @@ +/* + * + * 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.model; + +import java.lang.reflect.Method; + +public class ConfiguredDerivedAttribute<C extends ConfiguredObject, T> extends ConfiguredObjectAttribute<C,T> +{ + private final DerivedAttribute _annotation; + + ConfiguredDerivedAttribute(final Class<C> clazz, + final Method getter, + final DerivedAttribute annotation) + { + super(clazz, getter); + _annotation = annotation; + } + + public boolean isAutomated() + { + return false; + } + + public boolean isDerived() + { + return true; + } + + public boolean isSecure() + { + return _annotation.secure(); + } + + public boolean isPersisted() + { + return _annotation.persist(); + } + + public String getDescription() + { + return _annotation.description(); + } + +} diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObject.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObject.java index 206196b99e..3a2e27d29b 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObject.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObject.java @@ -45,6 +45,7 @@ public interface ConfiguredObject<X extends ConfiguredObject<X>> String LAST_UPDATED_BY = "lastUpdatedBy"; String LAST_UPDATED_TIME = "lastUpdatedTime"; String STATE = "state"; + String DESIRED_STATE = "desiredState"; String CREATED_BY = "createdBy"; String CREATED_TIME = "createdTime"; @@ -54,7 +55,7 @@ public interface ConfiguredObject<X extends ConfiguredObject<X>> * * @return the objects id */ - @ManagedAttribute( automate = true, mandatory = true ) + @ManagedAttribute( mandatory = true ) UUID getId(); /** @@ -62,31 +63,31 @@ public interface ConfiguredObject<X extends ConfiguredObject<X>> * * @return the name of the object */ - @ManagedAttribute( automate = true, mandatory = true) + @ManagedAttribute( mandatory = true) String getName(); - @ManagedAttribute( automate = true ) + @ManagedAttribute String getDescription(); - @ManagedAttribute( automate = true ) + @ManagedAttribute String getType(); - @ManagedAttribute(automate = true) + @ManagedAttribute Map<String, String> getContext(); <T> T getContextValue(Class<T> clazz, String propertyName); - @ManagedAttribute( derived = true ) + @DerivedAttribute( persist = true ) String getLastUpdatedBy(); - @ManagedAttribute( derived = true ) + @DerivedAttribute( persist = true ) long getLastUpdatedTime(); - @ManagedAttribute( derived = true ) + @DerivedAttribute( persist = true ) String getCreatedBy(); - @ManagedAttribute( derived = true ) + @DerivedAttribute( persist = true ) long getCreatedTime(); @@ -99,6 +100,7 @@ public interface ConfiguredObject<X extends ConfiguredObject<X>> * * @return the desired state of the object */ + @ManagedAttribute State getDesiredState(); /** @@ -107,13 +109,12 @@ public interface ConfiguredObject<X extends ConfiguredObject<X>> * Request a change to the current state. The caller must pass in the state it believe the object to be in, if * this differs from the current desired state when the object evaluates the request, then no state change will occur. * - * @param currentState the state the caller believes the object to be in * @param desiredState the state the caller wishes the object to attain * @return the new current state * @throws IllegalStateTransitionException the requested state transition is invalid * @throws AccessControlException the current context does not have sufficient permissions to change the state */ - State setDesiredState(State currentState, State desiredState) throws IllegalStateTransitionException, + State setDesiredState(State desiredState) throws IllegalStateTransitionException, AccessControlException; /** @@ -125,7 +126,7 @@ public interface ConfiguredObject<X extends ConfiguredObject<X>> * * @return the actual state of the object */ - @ManagedAttribute( state = true ) + @DerivedAttribute State getState(); @@ -159,7 +160,7 @@ public interface ConfiguredObject<X extends ConfiguredObject<X>> * * @return the durability */ - @ManagedAttribute( automate = true, defaultValue = "true" ) + @ManagedAttribute( defaultValue = "true" ) boolean isDurable(); /** @@ -167,7 +168,7 @@ public interface ConfiguredObject<X extends ConfiguredObject<X>> * * @return the lifetime policy */ - @ManagedAttribute( automate = true, defaultValue = "PERMANENT" ) + @ManagedAttribute( defaultValue = "PERMANENT" ) LifetimePolicy getLifetimePolicy(); /** @@ -254,8 +255,6 @@ public interface ConfiguredObject<X extends ConfiguredObject<X>> void open(); - void validate(); - TaskExecutor getTaskExecutor(); ConfiguredObjectFactory getObjectFactory(); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectAttribute.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectAttribute.java index e7fb50be87..6f6ef7f6e1 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectAttribute.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectAttribute.java @@ -22,27 +22,29 @@ package org.apache.qpid.server.model; import java.lang.reflect.Method; -public final class ConfiguredObjectAttribute<C extends ConfiguredObject, T> extends ConfiguredObjectAttributeOrStatistic<C,T> +public abstract class ConfiguredObjectAttribute<C extends ConfiguredObject, T> extends ConfiguredObjectAttributeOrStatistic<C,T> { - private final ManagedAttribute _annotation; ConfiguredObjectAttribute(Class<C> clazz, - final Method getter, - final ManagedAttribute annotation) + final Method getter) { super(getter); if(getter.getParameterTypes().length != 0) { throw new IllegalArgumentException("ManagedAttribute annotation should only be added to no-arg getters"); } - _annotation = annotation; } - public ManagedAttribute getAnnotation() - { - return _annotation; - } + public abstract boolean isAutomated(); + + public abstract boolean isDerived(); + + public abstract boolean isSecure(); + + public abstract boolean isPersisted(); + + public abstract String getDescription(); public T convert(final Object value, C object) { diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java index 0a99912df1..e08d720729 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java @@ -390,41 +390,53 @@ public class ConfiguredObjectTypeRegistry for(Method m : clazz.getDeclaredMethods()) { - ManagedAttribute annotation = m.getAnnotation(ManagedAttribute.class); - if(annotation != null) + + if(m.isAnnotationPresent(ManagedAttribute.class)) { - if(!(annotation.automate() || annotation.derived() || annotation.state())) + ManagedAttribute annotation = m.getAnnotation(ManagedAttribute.class); + + if(!clazz.isInterface() || !ConfiguredObject.class.isAssignableFrom(clazz)) + { + throw new ServerScopedRuntimeException("Can only define ManagedAttributes on interfaces which extend " + ConfiguredObject.class.getSimpleName() + ". " + clazz.getSimpleName() + " does not meet these criteria."); + } + + ConfiguredObjectAttribute<?,?> attribute = new ConfiguredAutomatedAttribute<>(clazz, m, annotation); + if(attributeSet.contains(attribute)) { - throw new ServerScopedRuntimeException("ManagedAttributes must be either automated or derived. " + m.getName() + " on " + clazz.getSimpleName() + " does not meet this criterion."); + attributeSet.remove(attribute); } + attributeSet.add(attribute); + } + else if(m.isAnnotationPresent(DerivedAttribute.class)) + { + DerivedAttribute annotation = m.getAnnotation(DerivedAttribute.class); + if(!clazz.isInterface() || !ConfiguredObject.class.isAssignableFrom(clazz)) { throw new ServerScopedRuntimeException("Can only define ManagedAttributes on interfaces which extend " + ConfiguredObject.class.getSimpleName() + ". " + clazz.getSimpleName() + " does not meet these criteria."); } - ConfiguredObjectAttribute<?,?> attribute = new ConfiguredObjectAttribute(clazz, m, annotation); + ConfiguredObjectAttribute<?,?> attribute = new ConfiguredDerivedAttribute<>(clazz, m, annotation); if(attributeSet.contains(attribute)) { attributeSet.remove(attribute); } attributeSet.add(attribute); + } - else + else if(m.isAnnotationPresent(ManagedStatistic.class)) { ManagedStatistic statAnnotation = m.getAnnotation(ManagedStatistic.class); - if(statAnnotation != null) + if(!clazz.isInterface() || !ConfiguredObject.class.isAssignableFrom(clazz)) { - if(!clazz.isInterface() || !ConfiguredObject.class.isAssignableFrom(clazz)) - { - throw new ServerScopedRuntimeException("Can only define ManagedStatistics on interfaces which extend " + ConfiguredObject.class.getSimpleName() + ". " + clazz.getSimpleName() + " does not meet these criteria."); - } - ConfiguredObjectStatistic statistic = new ConfiguredObjectStatistic(clazz, m); - if(statisticSet.contains(statistic)) - { - statisticSet.remove(statistic); - } - statisticSet.add(statistic); + throw new ServerScopedRuntimeException("Can only define ManagedStatistics on interfaces which extend " + ConfiguredObject.class.getSimpleName() + ". " + clazz.getSimpleName() + " does not meet these criteria."); } + ConfiguredObjectStatistic statistic = new ConfiguredObjectStatistic(clazz, m); + if(statisticSet.contains(statistic)) + { + statisticSet.remove(statistic); + } + statisticSet.add(statistic); } } @@ -436,7 +448,7 @@ public class ConfiguredObjectTypeRegistry for(ConfiguredObjectAttribute<?,?> attr : attrCol) { attrMap.put(attr.getName(), attr); - if(attr.getAnnotation().automate()) + if(attr.isAutomated()) { fieldMap.put(attr.getName(), findField(attr, clazz)); } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Connection.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Connection.java index cfae6f0400..7a965c19d7 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Connection.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Connection.java @@ -43,37 +43,37 @@ public interface Connection<X extends Connection<X>> extends ConfiguredObject<X> String TRANSPORT = "transport"; String PORT = "port"; - @ManagedAttribute( derived = true ) + @DerivedAttribute String getClientId(); - @ManagedAttribute( derived = true ) + @DerivedAttribute String getClientVersion(); - @ManagedAttribute( derived = true ) + @DerivedAttribute boolean isIncoming(); - @ManagedAttribute( derived = true ) + @DerivedAttribute String getLocalAddress(); - @ManagedAttribute( derived = true ) + @DerivedAttribute String getPrincipal(); - @ManagedAttribute( derived = true ) + @DerivedAttribute String getRemoteAddress(); - @ManagedAttribute( derived = true ) + @DerivedAttribute String getRemoteProcessName(); - @ManagedAttribute( derived = true ) + @DerivedAttribute String getRemoteProcessPid(); - @ManagedAttribute( derived = true ) + @DerivedAttribute long getSessionCountLimit(); - @ManagedAttribute( derived = true ) + @DerivedAttribute Transport getTransport(); - @ManagedAttribute( derived = true ) + @DerivedAttribute Port getPort(); @ManagedStatistic diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Consumer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Consumer.java index 578b648b4d..82dea4ff9f 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Consumer.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Consumer.java @@ -29,19 +29,19 @@ public interface Consumer<X extends Consumer<X>> extends ConfiguredObject<X> public String SELECTOR = "selector"; public String SETTLEMENT_MODE = "settlementMode"; - @ManagedAttribute( automate = true ) + @ManagedAttribute String getDistributionMode(); - @ManagedAttribute( automate = true ) + @ManagedAttribute String getSettlementMode(); - @ManagedAttribute( automate = true ) + @ManagedAttribute boolean isExclusive(); - @ManagedAttribute( automate = true ) + @ManagedAttribute boolean isNoLocal(); - @ManagedAttribute( automate = true ) + @ManagedAttribute String getSelector(); @ManagedStatistic diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/DerivedAttribute.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/DerivedAttribute.java new file mode 100644 index 0000000000..57fc5b365e --- /dev/null +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/DerivedAttribute.java @@ -0,0 +1,35 @@ +package org.apache.qpid.server.model;/* + * + * 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. + * + */ + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface DerivedAttribute +{ + boolean secure() default false; + boolean persist() default false; + String description() default ""; + +} diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Exchange.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Exchange.java index 1c572a1877..0c656bc739 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Exchange.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Exchange.java @@ -32,7 +32,7 @@ public interface Exchange<X extends Exchange<X>> extends ConfiguredObject<X>, Me // Attributes - @ManagedAttribute(automate = true) + @ManagedAttribute Exchange<?> getAlternateExchange(); //children diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ExternalFileBasedAuthenticationManager.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ExternalFileBasedAuthenticationManager.java index 57b06817f7..055890e73c 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ExternalFileBasedAuthenticationManager.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ExternalFileBasedAuthenticationManager.java @@ -24,6 +24,6 @@ public interface ExternalFileBasedAuthenticationManager<X extends ExternalFileBa { String PATH = "path"; - @ManagedAttribute( automate = true , mandatory = true, description = "File location") + @ManagedAttribute( mandatory = true, description = "File location") public String getPath(); } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttribute.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttribute.java index bf42335620..2a72c5c5ac 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttribute.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttribute.java @@ -20,17 +20,16 @@ */ package org.apache.qpid.server.model; +import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) - +@Target(ElementType.METHOD) public @interface ManagedAttribute { boolean secure() default false; - boolean derived() default false; - boolean automate() default false; - boolean state() default false; boolean mandatory() default false; boolean persist() default true; String defaultValue() default ""; diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttributeField.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttributeField.java index 89cf32f252..a73213ab54 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttributeField.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAttributeField.java @@ -21,10 +21,13 @@ package org.apache.qpid.server.model; +import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) public @interface ManagedAttributeField { String beforeSet() default ""; diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedContextDefault.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedContextDefault.java index 46b2ea0750..a30c87e287 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedContextDefault.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedContextDefault.java @@ -19,10 +19,13 @@ package org.apache.qpid.server.model;/* * */ +import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) public @interface ManagedContextDefault { String name(); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedObject.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedObject.java index bb821d057e..8cfb84135e 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedObject.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedObject.java @@ -20,11 +20,13 @@ */ package org.apache.qpid.server.model; +import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) - +@Target(ElementType.TYPE) public @interface ManagedObject { boolean category() default true; diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedStatistic.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedStatistic.java index ad6e39dd40..7633986c1c 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedStatistic.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedStatistic.java @@ -20,11 +20,13 @@ */ package org.apache.qpid.server.model; +import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) - +@Target(ElementType.METHOD) public @interface ManagedStatistic { } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Port.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Port.java index 766cde7ed8..a5b9629d08 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Port.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Port.java @@ -32,8 +32,6 @@ public interface Port<X extends Port<X>> extends ConfiguredObject<X> String PROTOCOLS = "protocols"; String TRANSPORTS = "transports"; String TCP_NO_DELAY = "tcpNoDelay"; - String SEND_BUFFER_SIZE = "sendBufferSize"; - String RECEIVE_BUFFER_SIZE = "receiveBufferSize"; String NEED_CLIENT_AUTH = "needClientAuth"; String WANT_CLIENT_AUTH = "wantClientAuth"; String AUTHENTICATION_PROVIDER = "authenticationProvider"; @@ -42,22 +40,22 @@ public interface Port<X extends Port<X>> extends ConfiguredObject<X> // Attributes - @ManagedAttribute(automate = true, defaultValue = "*") + @ManagedAttribute(defaultValue = "*") String getBindingAddress(); - @ManagedAttribute(mandatory = true, automate = true) + @ManagedAttribute( mandatory = true ) int getPort(); - @ManagedAttribute( automate = true ) + @ManagedAttribute Set<Protocol> getProtocols(); - @ManagedAttribute( automate = true, defaultValue = "TCP" ) + @ManagedAttribute( defaultValue = "TCP" ) Set<Transport> getTransports(); - @ManagedAttribute( automate = true ) + @ManagedAttribute KeyStore getKeyStore(); - @ManagedAttribute( automate = true ) + @ManagedAttribute Collection<TrustStore> getTrustStores(); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java index fb9548c429..78e05dca5e 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java @@ -45,89 +45,89 @@ public interface Queue<X extends Queue<X>> extends ConfiguredObject<X> String QUEUE_FLOW_RESUME_SIZE_BYTES = "queueFlowResumeSizeBytes"; String QUEUE_FLOW_STOPPED = "queueFlowStopped"; - @ManagedAttribute( automate = true ) + @ManagedAttribute Exchange getAlternateExchange(); - @ManagedAttribute( automate = true, defaultValue = "NONE" ) + @ManagedAttribute( defaultValue = "NONE" ) ExclusivityPolicy getExclusive(); - @ManagedAttribute( derived = true ) + @DerivedAttribute( persist = true ) String getOwner(); - @ManagedAttribute( automate = true ) + @ManagedAttribute boolean isNoLocal(); - @ManagedAttribute( automate = true ) + @ManagedAttribute String getMessageGroupKey(); @ManagedContextDefault( name = "qpid.broker_default-shared-message-group") String DEFAULT_SHARED_MESSAGE_GROUP = "qpid.no-group"; - @ManagedAttribute( automate = true, defaultValue = "${qpid.broker_default-shared-message-group}") + @ManagedAttribute( defaultValue = "${qpid.broker_default-shared-message-group}") String getMessageGroupDefaultGroup(); @ManagedContextDefault( name = "queue.maximumDistinctGroups") int DEFAULT_MAXIMUM_DISTINCT_GROUPS = 255; - @ManagedAttribute( automate = true, defaultValue = "${queue.maximumDistinctGroups}") + @ManagedAttribute( defaultValue = "${queue.maximumDistinctGroups}") int getMaximumDistinctGroups(); - @ManagedAttribute( automate = true ) + @ManagedAttribute boolean isMessageGroupSharedGroups(); @ManagedContextDefault( name = "queue.maximumDeliveryAttempts") int DEFAULT_MAXIMUM_DELIVERY_ATTEMPTS = 0; - @ManagedAttribute( automate = true, defaultValue = "${queue.maximumDeliveryAttempts}") + @ManagedAttribute( defaultValue = "${queue.maximumDeliveryAttempts}") int getMaximumDeliveryAttempts(); @ManagedContextDefault( name = "queue.queueFlowControlSizeBytes") long DEFAULT_FLOW_CONTROL_SIZE_BYTES = 0l; - @ManagedAttribute( automate = true, defaultValue = "${queue.queueFlowControlSizeBytes}") + @ManagedAttribute( defaultValue = "${queue.queueFlowControlSizeBytes}") long getQueueFlowControlSizeBytes(); @ManagedContextDefault( name = "queue.queueFlowResumeSizeBytes") long DEFAULT_FLOW_CONTROL_RESUME_SIZE_BYTES = 0l; - @ManagedAttribute( automate = true, defaultValue = "${queue.queueFlowResumeSizeBytes}") + @ManagedAttribute( defaultValue = "${queue.queueFlowResumeSizeBytes}") long getQueueFlowResumeSizeBytes(); // TODO - this is not an attribute - @ManagedAttribute( derived = true ) + @DerivedAttribute boolean isQueueFlowStopped(); @ManagedContextDefault( name = "queue.alertThresholdMessageAge") long DEFAULT_ALERT_THRESHOLD_MESSAGE_AGE = 0l; - @ManagedAttribute( automate = true, defaultValue = "${queue.alertThresholdMessageAge}") + @ManagedAttribute( defaultValue = "${queue.alertThresholdMessageAge}") long getAlertThresholdMessageAge(); @ManagedContextDefault( name = "queue.alertThresholdMessageSize") long DEFAULT_ALERT_THRESHOLD_MESSAGE_SIZE = 0l; - @ManagedAttribute( automate = true, defaultValue = "${queue.alertThresholdMessageSize}") + @ManagedAttribute( defaultValue = "${queue.alertThresholdMessageSize}") long getAlertThresholdMessageSize(); @ManagedContextDefault( name = "queue.alertThresholdQueueDepthBytes") long DEFAULT_ALERT_THRESHOLD_QUEUE_DEPTH = 0l; - @ManagedAttribute( automate = true, defaultValue = "${queue.alertThresholdQueueDepthBytes}") + @ManagedAttribute( defaultValue = "${queue.alertThresholdQueueDepthBytes}") long getAlertThresholdQueueDepthBytes(); @ManagedContextDefault( name = "queue.alertThresholdQueueDepthMessages") long DEFAULT_ALERT_THRESHOLD_MESSAGE_COUNT = 0l; - @ManagedAttribute( automate = true, defaultValue = "${queue.alertThresholdQueueDepthMessages}") + @ManagedAttribute( defaultValue = "${queue.alertThresholdQueueDepthMessages}") long getAlertThresholdQueueDepthMessages(); @ManagedContextDefault( name = "queue.alertRepeatGap") long DEFAULT_ALERT_REPEAT_GAP = 30000l; - @ManagedAttribute( automate = true, defaultValue = "${queue.alertRepeatGap}") + @ManagedAttribute( defaultValue = "${queue.alertRepeatGap}") long getAlertRepeatGap(); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Session.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Session.java index ee6fa9b8ab..686ded9774 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Session.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Session.java @@ -30,10 +30,10 @@ public interface Session<X extends Session<X>> extends ConfiguredObject<X> // available credit of both producer and consumer sides. String PRODUCER_FLOW_BLOCKED = "producerFlowBlocked"; - @ManagedAttribute( derived = true ) + @DerivedAttribute int getChannelId(); - @ManagedAttribute( derived = true ) + @DerivedAttribute boolean isProducerFlowBlocked(); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/State.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/State.java index a4287e09b1..0085d325b9 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/State.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/State.java @@ -27,6 +27,5 @@ public enum State STOPPED, ACTIVE, DELETED, - REPLICA, ERRORED } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/SystemContext.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/SystemContext.java index 04634ea2a6..8b9cb6c48d 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/SystemContext.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/SystemContext.java @@ -31,10 +31,10 @@ public interface SystemContext<X extends SystemContext<X>> extends ConfiguredObj BrokerOptions getBrokerOptions(); - @ManagedAttribute( automate = true ) + @ManagedAttribute String getStorePath(); - @ManagedAttribute( automate = true ) + @ManagedAttribute String getStoreType(); void close(); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/SystemContextImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/SystemContextImpl.java index 76a7de82b3..4f681eb8df 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/SystemContextImpl.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/SystemContextImpl.java @@ -72,7 +72,7 @@ public class SystemContextImpl extends AbstractConfiguredObject<SystemContextImp } @Override - protected boolean setState(final State currentState, final State desiredState) + protected boolean setState(final State desiredState) { throw new IllegalArgumentException("Cannot change the state of the SystemContext object"); } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/TrustStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/TrustStore.java index 3f61cc61cf..07fee06849 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/TrustStore.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/TrustStore.java @@ -26,7 +26,7 @@ import javax.net.ssl.TrustManager; @ManagedObject( defaultType = "FileTrustStore" ) public interface TrustStore<X extends TrustStore<X>> extends ConfiguredObject<X> { - @ManagedAttribute( secure = true, automate = true, mandatory = true) + @ManagedAttribute( secure = true, mandatory = true) public String getPassword(); public void setPassword(String password); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/User.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/User.java index d739de69ae..22df4969c9 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/User.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/User.java @@ -31,7 +31,7 @@ public interface User<X extends User<X>> extends ConfiguredObject<X> // Attributes - @ManagedAttribute( secure = true , automate = true ) + @ManagedAttribute( secure = true ) String getPassword(); public void setPassword(String password); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java index 0da3ceea87..9f741b0a44 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java @@ -47,47 +47,47 @@ public interface VirtualHost<X extends VirtualHost<X, Q, E>, Q extends Queue<?>, String MODEL_VERSION = "modelVersion"; // TODO - this isn't really an attribute - @ManagedAttribute( derived = true ) + @DerivedAttribute Collection<String> getSupportedExchangeTypes(); // TODO - this isn't really an attribute - @ManagedAttribute( derived = true ) + @DerivedAttribute Collection<String> getSupportedQueueTypes(); @ManagedContextDefault( name = "queue.deadLetterQueueEnabled") public static final boolean DEFAULT_DEAD_LETTER_QUEUE_ENABLED = false; - @ManagedAttribute( automate = true, defaultValue = "${queue.deadLetterQueueEnabled}") + @ManagedAttribute( defaultValue = "${queue.deadLetterQueueEnabled}") boolean isQueue_deadLetterQueueEnabled(); @ManagedContextDefault( name = "virtualhost.housekeepingCheckPeriod") public static final long DEFAULT_HOUSEKEEPING_CHECK_PERIOD = 30000l; - @ManagedAttribute( automate = true, defaultValue = "${virtualhost.housekeepingCheckPeriod}") + @ManagedAttribute( defaultValue = "${virtualhost.housekeepingCheckPeriod}") long getHousekeepingCheckPeriod(); @ManagedContextDefault( name = "virtualhost.storeTransactionIdleTimeoutClose") public static final long DEFAULT_STORE_TRANSACTION_IDLE_TIMEOUT_CLOSE = 0l; - @ManagedAttribute( automate = true, defaultValue = "${virtualhost.storeTransactionIdleTimeoutClose}") + @ManagedAttribute( defaultValue = "${virtualhost.storeTransactionIdleTimeoutClose}") long getStoreTransactionIdleTimeoutClose(); @ManagedContextDefault( name = "virtualhost.storeTransactionIdleTimeoutWarn") public static final long DEFAULT_STORE_TRANSACTION_IDLE_TIMEOUT_WARN = 0l; - @ManagedAttribute( automate = true, defaultValue = "${virtualhost.storeTransactionIdleTimeoutWarn}") + @ManagedAttribute( defaultValue = "${virtualhost.storeTransactionIdleTimeoutWarn}") long getStoreTransactionIdleTimeoutWarn(); @ManagedContextDefault( name = "virtualhost.storeTransactionOpenTimeoutClose") public static final long DEFAULT_STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE = 0l; - @ManagedAttribute( automate = true, defaultValue = "${virtualhost.storeTransactionOpenTimeoutClose}") + @ManagedAttribute( defaultValue = "${virtualhost.storeTransactionOpenTimeoutClose}") long getStoreTransactionOpenTimeoutClose(); @ManagedContextDefault( name = "virtualhost.storeTransactionOpenTimeoutWarn") public static final long DEFAULT_STORE_TRANSACTION_OPEN_TIMEOUT_WARN = 0l; - @ManagedAttribute( automate = true, defaultValue = "${virtualhost.storeTransactionOpenTimeoutWarn}") + @ManagedAttribute( defaultValue = "${virtualhost.storeTransactionOpenTimeoutWarn}") long getStoreTransactionOpenTimeoutWarn(); @ManagedContextDefault( name = "virtualhost.housekeepingThreadCount") @@ -101,13 +101,13 @@ public interface VirtualHost<X extends VirtualHost<X, Q, E>, Q extends Queue<?>, } }; - @ManagedAttribute( automate = true, defaultValue = "${virtualhost.housekeepingThreadCount}") + @ManagedAttribute( defaultValue = "${virtualhost.housekeepingThreadCount}") int getHousekeepingThreadCount(); - @ManagedAttribute( automate = true ) + @ManagedAttribute Map<String, Object> getMessageStoreSettings(); - @ManagedAttribute( derived = true ) + @DerivedAttribute( persist = true ) String getModelVersion(); @ManagedStatistic diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHostNode.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHostNode.java index 5f536b0467..1a2180b640 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHostNode.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHostNode.java @@ -29,7 +29,7 @@ public interface VirtualHostNode<X extends VirtualHostNode<X>> extends Configure { public static final String IS_MESSAGE_STORE_PROVIDER = "messageStoreProvider"; - @ManagedAttribute (automate = true, defaultValue = "false") + @ManagedAttribute (defaultValue = "false") boolean isMessageStoreProvider(); VirtualHost<?,?,?> getVirtualHost(); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractPluginAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractPluginAdapter.java index 03e564a28d..1f7767ca75 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractPluginAdapter.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractPluginAdapter.java @@ -45,9 +45,9 @@ public abstract class AbstractPluginAdapter<X extends Plugin<X>> extends Abstrac @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); if(!isDurable()) { throw new IllegalArgumentException(getClass().getSimpleName() + " must be durable"); @@ -87,7 +87,7 @@ public abstract class AbstractPluginAdapter<X extends Plugin<X>> extends Abstrac } @Override - protected void authoriseSetDesiredState(State currentState, State desiredState) throws AccessControlException + protected void authoriseSetDesiredState(State desiredState) throws AccessControlException { if(desiredState == State.DELETED) { diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java index d729259236..59aa4856cf 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java @@ -123,9 +123,9 @@ public class BrokerAdapter extends AbstractConfiguredObject<BrokerAdapter> imple initialiseStatistics(); } - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); String modelVersion = (String) getActualAttributes().get(Broker.MODEL_VERSION); if (modelVersion == null) { @@ -412,7 +412,7 @@ public class BrokerAdapter extends AbstractConfiguredObject<BrokerAdapter> imple @Override public Object run() { - virtualHostNode.setDesiredState(State.INITIALISING, State.ACTIVE); + virtualHostNode.setDesiredState(State.ACTIVE); return null; } }); @@ -508,7 +508,7 @@ public class BrokerAdapter extends AbstractConfiguredObject<BrokerAdapter> imple // restarted for it to take effect so we can't reuse port numbers until it is. boolean quiesce = isManagementMode() || !(port instanceof AmqpPort) || isPreviouslyUsedPortNumber(port); - port.setDesiredState(State.INITIALISING, quiesce ? State.QUIESCED : State.ACTIVE); + port.setDesiredState(quiesce ? State.QUIESCED : State.ACTIVE); return port; } @@ -544,7 +544,7 @@ public class BrokerAdapter extends AbstractConfiguredObject<BrokerAdapter> imple addAccessControlProvider(accessControlProvider); boolean quiesce = isManagementMode(); - accessControlProvider.setDesiredState(State.INITIALISING, quiesce ? State.QUIESCED : State.ACTIVE); + accessControlProvider.setDesiredState(quiesce ? State.QUIESCED : State.ACTIVE); return accessControlProvider; @@ -574,7 +574,7 @@ public class BrokerAdapter extends AbstractConfiguredObject<BrokerAdapter> imple { AuthenticationProvider<?> authenticationProvider = createChild(AuthenticationProvider.class, attributes); addAuthenticationProvider(authenticationProvider); - authenticationProvider.setDesiredState(State.INITIALISING, State.ACTIVE); + authenticationProvider.setDesiredState(State.ACTIVE); return authenticationProvider; } }); @@ -609,7 +609,7 @@ public class BrokerAdapter extends AbstractConfiguredObject<BrokerAdapter> imple { GroupProvider<?> groupProvider = createChild(GroupProvider.class, attributes); addGroupProvider(groupProvider); - groupProvider.setDesiredState(State.INITIALISING, State.ACTIVE); + groupProvider.setDesiredState(State.ACTIVE); return groupProvider; } }); @@ -715,12 +715,12 @@ public class BrokerAdapter extends AbstractConfiguredObject<BrokerAdapter> imple } @Override - public boolean setState(State currentState, State desiredState) + public boolean setState(State desiredState) { if (desiredState == State.ACTIVE) { initialiseStatisticsReporting(); - changeChildState(currentState, State.ACTIVE, false); + changeChildState(State.ACTIVE, false); if (isManagementMode()) { _eventLogger.message(BrokerMessages.MANAGEMENT_MODE(BrokerOptions.MANAGEMENT_MODE_USER_NAME, @@ -736,14 +736,13 @@ public class BrokerAdapter extends AbstractConfiguredObject<BrokerAdapter> imple _reportingTimer.cancel(); } - changeChildState(currentState, State.STOPPED, true); + changeChildState(State.STOPPED, true); return true; } return false; } - private void changeChildState(final State currentState, - final State desiredState, + private void changeChildState(final State desiredState, final boolean swallowException) { runTask(new VoidTask() @@ -765,7 +764,7 @@ public class BrokerAdapter extends AbstractConfiguredObject<BrokerAdapter> imple } try { - configuredObject.setDesiredState(currentState, desiredState); + configuredObject.setDesiredState(desiredState); } catch (RuntimeException e) { diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java index 7a4523035d..87c96f7602 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java @@ -193,7 +193,7 @@ public final class ConnectionAdapter extends AbstractConfiguredObject<Connection } @Override - protected boolean setState(State currentState, State desiredState) + protected boolean setState(State desiredState) { // TODO: add state management return false; diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileBasedGroupProvider.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileBasedGroupProvider.java index 7ca27f25ea..d338dad300 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileBasedGroupProvider.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileBasedGroupProvider.java @@ -29,6 +29,6 @@ public interface FileBasedGroupProvider<X extends FileBasedGroupProvider<X>> ext { String PATH="path"; - @ManagedAttribute( automate = true, mandatory = true, description = "File location" ) + @ManagedAttribute( mandatory = true, description = "File location" ) String getPath(); } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileBasedGroupProviderImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileBasedGroupProviderImpl.java index 26886c176e..57604b01fa 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileBasedGroupProviderImpl.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileBasedGroupProviderImpl.java @@ -81,7 +81,7 @@ public class FileBasedGroupProviderImpl _state = new AtomicReference<State>(state); } - public void validate() + public void onValidate() { Collection<GroupProvider<?>> groupProviders = _broker.getGroupProviders(); for(GroupProvider<?> provider : groupProviders) @@ -128,7 +128,7 @@ public class FileBasedGroupProviderImpl } catch (IOException e) { - setState(getState(), State.ERRORED); + setState(State.ERRORED); LOGGER.warn(("Unable to open preferences file at " + _path)); } } @@ -182,7 +182,7 @@ public class FileBasedGroupProviderImpl } catch (IOException e) { - setState(getState(), State.ERRORED); + setState(State.ERRORED); LOGGER.warn(("Unable to open preferences file at " + _path)); } @@ -266,7 +266,7 @@ public class FileBasedGroupProviderImpl } @Override - protected boolean setState(State currentState, State desiredState) + protected boolean setState(State desiredState) { State state = _state.get(); if (desiredState == State.ACTIVE) @@ -379,7 +379,7 @@ public class FileBasedGroupProviderImpl } @Override - protected void authoriseSetDesiredState(State currentState, State desiredState) throws AccessControlException + protected void authoriseSetDesiredState(State desiredState) throws AccessControlException { if(desiredState == State.DELETED) { @@ -423,9 +423,9 @@ public class FileBasedGroupProviderImpl @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); if(!isDurable()) { throw new IllegalArgumentException(getClass().getSimpleName() + " must be durable"); @@ -507,7 +507,7 @@ public class FileBasedGroupProviderImpl } @Override - protected boolean setState(State currentState, State desiredState) + protected boolean setState(State desiredState) throws IllegalStateTransitionException, AccessControlException { if (desiredState == State.DELETED) @@ -547,9 +547,9 @@ public class FileBasedGroupProviderImpl @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); if(!isDurable()) { throw new IllegalArgumentException(getClass().getSimpleName() + " must be durable"); @@ -580,7 +580,7 @@ public class FileBasedGroupProviderImpl } @Override - protected boolean setState(State currentState, State desiredState) + protected boolean setState(State desiredState) throws IllegalStateTransitionException, AccessControlException { diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java index 6d65f1507a..42b93db3e7 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java @@ -30,6 +30,6 @@ public interface FileSystemPreferencesProvider<X extends FileSystemPreferencesPr String PATH = "path"; String PROVIDER_TYPE = "FileSystemPreferences"; - @ManagedAttribute( automate = true ) + @ManagedAttribute String getPath(); } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProviderImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProviderImpl.java index 013aa5ed98..6427e5b658 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProviderImpl.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProviderImpl.java @@ -93,9 +93,9 @@ public class FileSystemPreferencesProviderImpl } @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); if(!isDurable()) { throw new IllegalArgumentException(getClass().getSimpleName() + " must be durable"); @@ -132,11 +132,11 @@ public class FileSystemPreferencesProviderImpl public void close() { - setDesiredState(getState(), State.STOPPED); + setDesiredState(State.STOPPED); } @Override - public boolean setState(State currentState, State desiredState) throws IllegalStateTransitionException, AccessControlException + public boolean setState(State desiredState) throws IllegalStateTransitionException, AccessControlException { State state = _state.get(); if (desiredState == State.DELETED) diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/SessionAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/SessionAdapter.java index c32bfac88c..ebb20df377 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/SessionAdapter.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/SessionAdapter.java @@ -172,7 +172,7 @@ final class SessionAdapter extends AbstractConfiguredObject<SessionAdapter> impl @Override - protected boolean setState(State currentState, State desiredState) + protected boolean setState(State desiredState) { // TODO : add state management return false; diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAliasAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAliasAdapter.java index c16e17acf3..fba1e26734 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAliasAdapter.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAliasAdapter.java @@ -86,7 +86,7 @@ public class VirtualHostAliasAdapter extends AbstractConfiguredObject<VirtualHos } @Override - protected boolean setState(State currentState, State desiredState) + protected boolean setState(State desiredState) { // TODO: state is not supported at the moment return false; diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPort.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPort.java index 13c35f97cc..21a619547d 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPort.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPort.java @@ -86,9 +86,9 @@ abstract public class AbstractPort<X extends AbstractPort<X>> extends AbstractCo @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); boolean useTLSTransport = getTransports().contains(Transport.SSL) || getTransports().contains(Transport.WSS); @@ -282,7 +282,7 @@ abstract public class AbstractPort<X extends AbstractPort<X>> extends AbstractCo } @Override - public boolean setState(State currentState, State desiredState) + public boolean setState(State desiredState) { State state = _state.get(); if (desiredState == State.DELETED) @@ -355,7 +355,7 @@ abstract public class AbstractPort<X extends AbstractPort<X>> extends AbstractCo @Override - protected void authoriseSetDesiredState(State currentState, State desiredState) throws AccessControlException + protected void authoriseSetDesiredState(State desiredState) throws AccessControlException { if(desiredState == State.DELETED) { diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPortWithAuthProvider.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPortWithAuthProvider.java index 3c1b649b51..a959709657 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPortWithAuthProvider.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPortWithAuthProvider.java @@ -72,9 +72,9 @@ abstract public class AbstractPortWithAuthProvider<X extends AbstractPortWithAut } @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); boolean useClientAuth = getNeedClientAuth() || getWantClientAuth(); if(useClientAuth && (getTrustStores() == null || getTrustStores().isEmpty())) diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java index d694db264d..0d3ec6d3bb 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/AmqpPort.java @@ -35,24 +35,26 @@ public interface AmqpPort<X extends AmqpPort<X>> extends Port<X> String DEFAULT_AMQP_NEED_CLIENT_AUTH = "false"; String DEFAULT_AMQP_WANT_CLIENT_AUTH = "false"; + String SEND_BUFFER_SIZE = "sendBufferSize"; + String RECEIVE_BUFFER_SIZE = "receiveBufferSize"; - @ManagedAttribute( automate = true , defaultValue = AmqpPort.DEFAULT_AMQP_TCP_NO_DELAY ) + @ManagedAttribute( defaultValue = AmqpPort.DEFAULT_AMQP_TCP_NO_DELAY ) boolean isTcpNoDelay(); - @ManagedAttribute( automate = true , defaultValue = AmqpPort.DEFAULT_AMQP_SEND_BUFFER_SIZE ) + @ManagedAttribute( defaultValue = AmqpPort.DEFAULT_AMQP_SEND_BUFFER_SIZE ) int getSendBufferSize(); - @ManagedAttribute( automate = true , defaultValue = AmqpPort.DEFAULT_AMQP_RECEIVE_BUFFER_SIZE ) + @ManagedAttribute( defaultValue = AmqpPort.DEFAULT_AMQP_RECEIVE_BUFFER_SIZE ) int getReceiveBufferSize(); - @ManagedAttribute( automate = true, defaultValue = DEFAULT_AMQP_NEED_CLIENT_AUTH ) + @ManagedAttribute( defaultValue = DEFAULT_AMQP_NEED_CLIENT_AUTH ) boolean getNeedClientAuth(); - @ManagedAttribute( automate = true, defaultValue = DEFAULT_AMQP_WANT_CLIENT_AUTH ) + @ManagedAttribute( defaultValue = DEFAULT_AMQP_WANT_CLIENT_AUTH ) boolean getWantClientAuth(); - @ManagedAttribute( automate = true, mandatory = true ) + @ManagedAttribute( mandatory = true ) AuthenticationProvider getAuthenticationProvider(); VirtualHostImpl getVirtualHost(String name); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/HttpPort.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/HttpPort.java index b2a7306284..39f7d3bd4d 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/HttpPort.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/HttpPort.java @@ -33,12 +33,12 @@ public interface HttpPort<X extends HttpPort<X>> extends Port<X> String DEFAULT_AMQP_WANT_CLIENT_AUTH = "false"; - @ManagedAttribute( automate = true, defaultValue = DEFAULT_AMQP_NEED_CLIENT_AUTH ) + @ManagedAttribute( defaultValue = DEFAULT_AMQP_NEED_CLIENT_AUTH ) boolean getNeedClientAuth(); - @ManagedAttribute( automate = true, defaultValue = DEFAULT_AMQP_WANT_CLIENT_AUTH ) + @ManagedAttribute( defaultValue = DEFAULT_AMQP_WANT_CLIENT_AUTH ) boolean getWantClientAuth(); - @ManagedAttribute( automate = true, mandatory = true ) + @ManagedAttribute( mandatory = true ) AuthenticationProvider getAuthenticationProvider(); } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPort.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPort.java index ca72fe962b..4e9696fbbe 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPort.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPort.java @@ -33,12 +33,12 @@ public interface JmxPort<X extends JmxPort<X>> extends Port<X> String DEFAULT_AMQP_WANT_CLIENT_AUTH = "false"; - @ManagedAttribute( automate = true, defaultValue = DEFAULT_AMQP_NEED_CLIENT_AUTH ) + @ManagedAttribute( defaultValue = DEFAULT_AMQP_NEED_CLIENT_AUTH ) boolean getNeedClientAuth(); - @ManagedAttribute( automate = true, defaultValue = DEFAULT_AMQP_WANT_CLIENT_AUTH ) + @ManagedAttribute( defaultValue = DEFAULT_AMQP_WANT_CLIENT_AUTH ) boolean getWantClientAuth(); - @ManagedAttribute( automate = true, mandatory = true ) + @ManagedAttribute( mandatory = true ) AuthenticationProvider getAuthenticationProvider(); } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPortImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPortImpl.java index a71298e0e1..4f4fbd1c47 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPortImpl.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPortImpl.java @@ -38,9 +38,9 @@ public class JmxPortImpl extends AbstractPortWithAuthProvider<JmxPortImpl> imple } @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); validateOnlyOneInstance(); } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/RmiPort.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/RmiPort.java index b6beedd05d..1326a96870 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/RmiPort.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/port/RmiPort.java @@ -42,9 +42,9 @@ public class RmiPort extends AbstractPort<RmiPort> } @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); validateOnlyOneInstance(); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/PluginFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/PluginFactory.java deleted file mode 100644 index 2ef13345b4..0000000000 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/PluginFactory.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.plugin; - -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.Plugin; - -import java.util.Map; -import java.util.UUID; - -public interface PluginFactory extends Pluggable -{ - Plugin createInstance(UUID id, Map<String, Object> attributes, Broker broker); -} diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java index d36f3df37e..2bdef40801 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java @@ -171,7 +171,7 @@ public abstract class AbstractQueue<X extends AbstractQueue<X>> @ManagedAttributeField private ExclusivityPolicy _exclusive; - private Object _exclusiveOwner; // could be connection, session, Principal or a String forset the container name + private Object _exclusiveOwner; // could be connection, session, Principal or a String for the container name private final Set<NotificationCheck> _notificationChecks = Collections.synchronizedSet(EnumSet.noneOf(NotificationCheck.class)); @@ -246,9 +246,9 @@ public abstract class AbstractQueue<X extends AbstractQueue<X>> } @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); if (_queueFlowResumeSizeBytes > _queueFlowControlSizeBytes) { throw new IllegalConfigurationException("Flow resume size can't be greater than flow control size"); @@ -302,9 +302,17 @@ public abstract class AbstractQueue<X extends AbstractQueue<X>> case PRINCIPAL: _exclusiveOwner = sessionModel.getConnectionModel().getAuthorizedPrincipal(); + if(isDurable()) + { + _virtualHost.getDurableConfigurationStore().update(false,asObjectRecord()); + } break; case CONTAINER: _exclusiveOwner = sessionModel.getConnectionModel().getRemoteContainerName(); + if(isDurable()) + { + _virtualHost.getDurableConfigurationStore().update(false,asObjectRecord()); + } break; case CONNECTION: _exclusiveOwner = sessionModel.getConnectionModel(); @@ -2510,7 +2518,7 @@ public abstract class AbstractQueue<X extends AbstractQueue<X>> @Override - protected boolean setState(final State currentState, final State desiredState) + protected boolean setState(final State desiredState) { if(desiredState == State.DELETED) { diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/LastValueQueue.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/LastValueQueue.java index a9c1fec246..7ee454ff04 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/LastValueQueue.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/LastValueQueue.java @@ -32,6 +32,6 @@ public interface LastValueQueue<X extends LastValueQueue<X>> extends AMQQueue<X> @ManagedContextDefault( name = "queue.lvqKey" ) String DEFAULT_LVQ_KEY = "qpid.LVQ_key"; - @ManagedAttribute(automate = true, defaultValue = "${queue.lvqKey}") + @ManagedAttribute(defaultValue = "${queue.lvqKey}") String getLvqKey(); } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/PriorityQueue.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/PriorityQueue.java index 87693b793d..280fb8c7b0 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/PriorityQueue.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/PriorityQueue.java @@ -32,6 +32,6 @@ public interface PriorityQueue<X extends PriorityQueue<X>> extends AMQQueue<X> @ManagedContextDefault( name = "queue.priorities") int DEFAULT_PRIORITY_LEVELS = 10; - @ManagedAttribute( automate = true, defaultValue = "${queue.priorities}") + @ManagedAttribute( defaultValue = "${queue.priorities}") int getPriorities(); } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumerImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumerImpl.java index 1d7bf7f2a9..22c74f8a4b 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumerImpl.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumerImpl.java @@ -477,7 +477,7 @@ class QueueConsumerImpl } @Override - protected boolean setState(final State currentState, final State desiredState) + protected boolean setState(final State desiredState) { return false; } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java index a91e1e8d58..56fe0bc8e0 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java @@ -28,7 +28,7 @@ public interface SortedQueue<X extends SortedQueue<X>> extends AMQQueue<X> { String SORT_KEY = "sortKey"; - @ManagedAttribute( automate = true, mandatory = true ) + @ManagedAttribute( mandatory = true ) String getSortKey(); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java index d3e80ecee7..4bb5f2496a 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java @@ -83,7 +83,7 @@ public class ApplicationRegistry implements IApplicationRegistry _broker.open(); // starting the broker - _broker.setDesiredState(State.INITIALISING, State.ACTIVE); + _broker.setDesiredState(State.ACTIVE); startupLogger.message(BrokerMessages.READY()); _broker.setEventLogger(eventLogger); @@ -101,7 +101,7 @@ public class ApplicationRegistry implements IApplicationRegistry { if (_broker != null) { - _broker.setDesiredState(_broker.getState(), State.STOPPED); + _broker.setDesiredState(State.STOPPED); } } finally diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStore.java index cd73bec3b2..d8a8c3f5cf 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStore.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStore.java @@ -57,18 +57,18 @@ public interface FileKeyStore<X extends FileKeyStore<X>> extends KeyStore<X> } }; - @ManagedAttribute( automate = true, mandatory = true) + @ManagedAttribute( mandatory = true) String getPath(); - @ManagedAttribute( automate = true ) + @ManagedAttribute String getCertificateAlias(); - @ManagedAttribute( automate = true, defaultValue = "${keyStoreFile.keyManagerFactoryAlgorithm}" ) + @ManagedAttribute( defaultValue = "${keyStoreFile.keyManagerFactoryAlgorithm}" ) String getKeyManagerFactoryAlgorithm(); - @ManagedAttribute( automate = true, defaultValue = "${keyStoreFile.keyStoreType}" ) + @ManagedAttribute( defaultValue = "${keyStoreFile.keyStoreType}" ) String getKeyStoreType(); - @ManagedAttribute( secure = true, automate = true, mandatory = true ) + @ManagedAttribute( secure = true, mandatory = true ) String getPassword(); } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStoreImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStoreImpl.java index adfce94dc8..d755380210 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStoreImpl.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileKeyStoreImpl.java @@ -92,9 +92,9 @@ public class FileKeyStoreImpl extends AbstractConfiguredObject<FileKeyStoreImpl> } @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); validateKeyStoreAttributes(this); } @@ -116,7 +116,7 @@ public class FileKeyStoreImpl extends AbstractConfiguredObject<FileKeyStoreImpl> } @Override - protected boolean setState(State currentState, State desiredState) + protected boolean setState(State desiredState) { if(desiredState == State.DELETED) { @@ -139,7 +139,7 @@ public class FileKeyStoreImpl extends AbstractConfiguredObject<FileKeyStoreImpl> } @Override - protected void authoriseSetDesiredState(State currentState, State desiredState) throws AccessControlException + protected void authoriseSetDesiredState(State desiredState) throws AccessControlException { if(desiredState == State.DELETED) { diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStore.java index 78de8b770f..ccff8a6d6c 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStore.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStore.java @@ -57,18 +57,18 @@ public interface FileTrustStore<X extends FileTrustStore<X>> extends TrustStore< } }; - @ManagedAttribute( automate = true, mandatory = true ) + @ManagedAttribute( mandatory = true ) String getPath(); - @ManagedAttribute( automate = true, defaultValue = "${trustStoreFile.trustManagerFactoryAlgorithm}") + @ManagedAttribute( defaultValue = "${trustStoreFile.trustManagerFactoryAlgorithm}") String getTrustManagerFactoryAlgorithm(); - @ManagedAttribute( automate = true, defaultValue = "${trustStoreFile.trustStoreType}") + @ManagedAttribute( defaultValue = "${trustStoreFile.trustStoreType}") String getTrustStoreType(); - @ManagedAttribute( automate = true, defaultValue = "false" ) + @ManagedAttribute( defaultValue = "false" ) boolean isPeersOnly(); - @ManagedAttribute( secure = true, automate = true, mandatory = true ) + @ManagedAttribute( secure = true, mandatory = true ) String getPassword(); } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStoreImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStoreImpl.java index 823f24922e..d71670fbe0 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStoreImpl.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/FileTrustStoreImpl.java @@ -75,9 +75,9 @@ public class FileTrustStoreImpl extends AbstractConfiguredObject<FileTrustStoreI } @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); validateTrustStore(this); if(!isDurable()) { @@ -92,7 +92,7 @@ public class FileTrustStoreImpl extends AbstractConfiguredObject<FileTrustStoreI } @Override - protected boolean setState(State currentState, State desiredState) + protected boolean setState(State desiredState) { if(desiredState == State.DELETED) { @@ -107,7 +107,7 @@ public class FileTrustStoreImpl extends AbstractConfiguredObject<FileTrustStoreI { for (TrustStore store : trustStores) { - if (storeName.equals(store.getAttribute(TrustStore.NAME))) + if(storeName.equals(store.getAttribute(TrustStore.NAME))) { throw new IntegrityViolationException("Trust store '" + storeName @@ -121,12 +121,18 @@ public class FileTrustStoreImpl extends AbstractConfiguredObject<FileTrustStoreI Collection<AuthenticationProvider> authenticationProviders = new ArrayList<AuthenticationProvider>(_broker.getAuthenticationProviders()); for (AuthenticationProvider authProvider : authenticationProviders) { - Object attributeType = authProvider.getAttribute(AuthenticationProvider.TYPE); - Object attributeValue = authProvider.getAttribute(SimpleLDAPAuthenticationManager.TRUST_STORE); - if (SimpleLDAPAuthenticationManager.PROVIDER_TYPE.equals(attributeType) - && storeName.equals(attributeValue)) + if(authProvider.getAttributeNames().contains(SimpleLDAPAuthenticationManager.TRUST_STORE)) { - throw new IntegrityViolationException("Trust store '" + storeName + "' can't be deleted as it is in use by an authentication manager: " + authProvider.getName()); + Object attributeType = authProvider.getAttribute(AuthenticationProvider.TYPE); + Object attributeValue = authProvider.getAttribute(SimpleLDAPAuthenticationManager.TRUST_STORE); + if (SimpleLDAPAuthenticationManager.PROVIDER_TYPE.equals(attributeType) + && storeName.equals(attributeValue)) + { + throw new IntegrityViolationException("Trust store '" + + storeName + + "' can't be deleted as it is in use by an authentication manager: " + + authProvider.getName()); + } } } deleted(); @@ -136,7 +142,7 @@ public class FileTrustStoreImpl extends AbstractConfiguredObject<FileTrustStoreI } @Override - protected void authoriseSetDesiredState(State currentState, State desiredState) throws AccessControlException + protected void authoriseSetDesiredState(State desiredState) throws AccessControlException { if(desiredState == State.DELETED) { diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java index 7424d32b54..7855f7f192 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java @@ -64,9 +64,9 @@ public abstract class AbstractAuthenticationManager<T extends AbstractAuthentica } @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); Collection<PreferencesProvider> prefsProviders = getChildren(PreferencesProvider.class); if(prefsProviders != null && prefsProviders.size() > 1) { @@ -151,7 +151,7 @@ public abstract class AbstractAuthenticationManager<T extends AbstractAuthentica attributes.put(ConfiguredObject.ID, UUID.randomUUID()); PreferencesProvider pp = getObjectFactory().create(PreferencesProvider.class, attributes, this); - pp.setDesiredState(State.INITIALISING, State.ACTIVE); + pp.setDesiredState(State.ACTIVE); _preferencesProvider = pp; return (C)pp; } @@ -160,7 +160,7 @@ public abstract class AbstractAuthenticationManager<T extends AbstractAuthentica @Override - protected void authoriseSetDesiredState(State currentState, State desiredState) throws AccessControlException + protected void authoriseSetDesiredState(State desiredState) throws AccessControlException { if(desiredState == State.DELETED) { @@ -181,7 +181,7 @@ public abstract class AbstractAuthenticationManager<T extends AbstractAuthentica } @Override - public boolean setState(State currentState, State desiredState) + public boolean setState(State desiredState) throws IllegalStateTransitionException, AccessControlException { State state = _state.get(); @@ -207,7 +207,7 @@ public abstract class AbstractAuthenticationManager<T extends AbstractAuthentica delete(); if (_preferencesProvider != null) { - _preferencesProvider.setDesiredState(_preferencesProvider.getState(), State.DELETED); + _preferencesProvider.setDesiredState(State.DELETED); } deleted(); return true; @@ -225,7 +225,7 @@ public abstract class AbstractAuthenticationManager<T extends AbstractAuthentica { if (_preferencesProvider != null) { - _preferencesProvider.setDesiredState(_preferencesProvider.getState(), State.ACTIVE); + _preferencesProvider.setDesiredState(State.ACTIVE); } return true; } @@ -265,7 +265,7 @@ public abstract class AbstractAuthenticationManager<T extends AbstractAuthentica close(); if (_preferencesProvider != null) { - _preferencesProvider.setDesiredState(_preferencesProvider.getState(), State.STOPPED); + _preferencesProvider.setDesiredState(State.STOPPED); } return true; } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManager.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManager.java index 28293b5814..19206d0f07 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManager.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManager.java @@ -30,6 +30,6 @@ public interface ExternalAuthenticationManager<T extends ExternalAuthenticationM String PROVIDER_TYPE = "External"; String ATTRIBUTE_USE_FULL_DN = "useFullDN"; - @ManagedAttribute( automate = true , description = "Use the full DN as the Username") + @ManagedAttribute( description = "Use the full DN as the Username") boolean getUseFullDN(); } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java index be49623249..a59bdc0e4e 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java @@ -256,7 +256,7 @@ public abstract class PrincipalDatabaseAuthenticationManager<T extends Principal PrincipalAdapter user = _userMap.get(principal); if(user != null) { - user.setState(user.getState(), State.DELETED); + user.setState(State.DELETED); } else { @@ -391,9 +391,9 @@ public abstract class PrincipalDatabaseAuthenticationManager<T extends Principal } @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); if(!isDurable()) { throw new IllegalArgumentException(getClass().getSimpleName() + " must be durable"); @@ -449,7 +449,7 @@ public abstract class PrincipalDatabaseAuthenticationManager<T extends Principal } @Override - protected boolean setState(State currentState, State desiredState) + protected boolean setState(State desiredState) throws IllegalStateTransitionException, AccessControlException { if(desiredState == State.DELETED) diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ScramAuthUser.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ScramAuthUser.java index e9d4e00254..15cd1d82a6 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ScramAuthUser.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ScramAuthUser.java @@ -68,9 +68,9 @@ class ScramAuthUser extends AbstractConfiguredObject<ScramAuthUser> implements U } @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); if(!isDurable()) { throw new IllegalArgumentException(getClass().getSimpleName() + " must be durable"); @@ -87,7 +87,7 @@ class ScramAuthUser extends AbstractConfiguredObject<ScramAuthUser> implements U } } @Override - protected boolean setState(final State currentState, final State desiredState) + protected boolean setState(final State desiredState) { if(desiredState == State.DELETED) { diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManager.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManager.java index 43a4932022..b28fb010a4 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManager.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManager.java @@ -295,7 +295,7 @@ public class ScramSHA1AuthenticationManager final ScramAuthUser authUser = getUser(user); if(authUser != null) { - authUser.setState(State.ACTIVE, State.DELETED); + authUser.setState(State.DELETED); } else { diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java index 883dcd025e..dde1e690ac 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java @@ -31,21 +31,21 @@ public interface SimpleLDAPAuthenticationManager<X extends SimpleLDAPAuthenticat String PROVIDER_TYPE = "SimpleLDAP"; String TRUST_STORE = "trustStore"; - @ManagedAttribute( automate = true, description = "LDAP server URL" ) + @ManagedAttribute( description = "LDAP server URL" ) String getProviderUrl(); - @ManagedAttribute( automate = true, description = "LDAP authentication URL") + @ManagedAttribute( description = "LDAP authentication URL") String getProviderAuthUrl(); - @ManagedAttribute( automate = true, description = "Search context") + @ManagedAttribute( description = "Search context") String getSearchContext(); - @ManagedAttribute( automate = true, description = "Search filter") + @ManagedAttribute( description = "Search filter") String getSearchFilter(); - @ManagedAttribute( automate = true, description = "LDAP context factory") + @ManagedAttribute( description = "LDAP context factory") String getLdapContextFactory(); - @ManagedAttribute( automate = true, description = "Trust store name") + @ManagedAttribute( description = "Trust store name") TrustStore getTrustStore(); } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/transport/TCPandSSLTransport.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/transport/TCPandSSLTransport.java index 1ed461300b..e6bf0c1f89 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/transport/TCPandSSLTransport.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/transport/TCPandSSLTransport.java @@ -31,6 +31,7 @@ import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.Port; import org.apache.qpid.server.model.Protocol; import org.apache.qpid.server.model.Transport; +import org.apache.qpid.server.model.port.AmqpPort; import org.apache.qpid.server.protocol.MultiVersionProtocolEngineFactory; import org.apache.qpid.transport.NetworkTransportConfiguration; import org.apache.qpid.transport.network.IncomingNetworkTransport; @@ -123,13 +124,13 @@ class TCPandSSLTransport implements AcceptingTransport @Override public Integer getSendBufferSize() { - return (Integer)_port.getAttribute(Port.SEND_BUFFER_SIZE); + return (Integer)_port.getAttribute(AmqpPort.SEND_BUFFER_SIZE); } @Override public Integer getReceiveBufferSize() { - return (Integer)_port.getAttribute(Port.RECEIVE_BUFFER_SIZE); + return (Integer)_port.getAttribute(AmqpPort.RECEIVE_BUFFER_SIZE); } @Override diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java index 93006823d9..958c65d589 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java @@ -175,9 +175,9 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte } - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); String name = getName(); if (name == null || "".equals(name.trim())) { @@ -347,7 +347,7 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte } @Override - protected void authoriseSetDesiredState(State currentState, State desiredState) throws AccessControlException + protected void authoriseSetDesiredState(State desiredState) throws AccessControlException { if(desiredState == State.DELETED) { @@ -404,7 +404,8 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte case ACTIVE: return State.ACTIVE; case PASSIVE: - return State.REPLICA; + // TODO + return State.ACTIVE; case STOPPED: return State.STOPPED; case ERRORED: @@ -1248,7 +1249,7 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte @Override - protected boolean setState(State currentState, State desiredState) + protected boolean setState(State desiredState) { if (desiredState == State.ACTIVE) { @@ -1273,7 +1274,7 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte if (getVirtualHostState() == VirtualHostState.ACTIVE || getVirtualHostState() == VirtualHostState.INITIALISING) { - setDesiredState(currentState, State.STOPPED); + setDesiredState(State.STOPPED); } MessageStore ms = getMessageStore(); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java index 2568d7be97..62e545659b 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java @@ -46,9 +46,9 @@ public class StandardVirtualHost extends AbstractVirtualHost<StandardVirtualHost } @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); VirtualHostNode<?> virtualHostNode = getParent(VirtualHostNode.class); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNode.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNode.java index 12a379f9ca..3304adbed4 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNode.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNode.java @@ -57,9 +57,9 @@ public abstract class AbstractStandardVirtualHostNode<X extends AbstractStandard } @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); DurableConfigurationStoreFactory durableConfigurationStoreFactory = getDurableConfigurationStoreFactory(); Map<String, Object> storeSettings = new HashMap<String, Object>(getActualAttributes()); storeSettings.put(DurableConfigurationStore.STORE_TYPE, durableConfigurationStoreFactory.getType()); @@ -148,7 +148,7 @@ public abstract class AbstractStandardVirtualHostNode<X extends AbstractStandard }); } - host.setDesiredState(host.getState(), State.ACTIVE); + host.setDesiredState(State.ACTIVE); } @Override diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java index 0a67169e4b..6655ec1e4b 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java @@ -98,14 +98,14 @@ public abstract class AbstractVirtualHostNode<X extends AbstractVirtualHostNode< } @Override - protected boolean setState(State currentState, State desiredState) + protected boolean setState(State desiredState) { State state = _state.get(); if (desiredState == State.DELETED) { if (state == State.ACTIVE || state == State.INITIALISING) { - state = setDesiredState(currentState, State.STOPPED); + state = setDesiredState(State.STOPPED); } if (state == State.STOPPED || state == State.ERRORED) @@ -238,7 +238,7 @@ public abstract class AbstractVirtualHostNode<X extends AbstractVirtualHostNode< VirtualHost<?, ?, ?> virtualHost = getVirtualHost(); if (virtualHost != null) { - virtualHost.setDesiredState(virtualHost.getState(), State.DELETED); + virtualHost.setDesiredState(State.DELETED); } deleted(); @@ -254,7 +254,7 @@ public abstract class AbstractVirtualHostNode<X extends AbstractVirtualHostNode< VirtualHost<?, ?, ?> virtualHost = getVirtualHost(); if (virtualHost != null) { - virtualHost.setDesiredState(virtualHost.getState(), State.STOPPED); + virtualHost.setDesiredState(State.STOPPED); } getConfigurationStore().closeConfigurationStore(); @@ -262,7 +262,7 @@ public abstract class AbstractVirtualHostNode<X extends AbstractVirtualHostNode< } @Override - protected void authoriseSetDesiredState(State currentState, State desiredState) throws AccessControlException + protected void authoriseSetDesiredState(State desiredState) throws AccessControlException { if(desiredState == State.DELETED) { diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/FileBasedVirtualHostNode.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/FileBasedVirtualHostNode.java index 52c8825e76..6274ee6c21 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/FileBasedVirtualHostNode.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/FileBasedVirtualHostNode.java @@ -27,7 +27,7 @@ public interface FileBasedVirtualHostNode<X extends FileBasedVirtualHostNode<X>> { public static final String STORE_PATH = "storePath"; - @ManagedAttribute(automate = true, mandatory = true) + @ManagedAttribute(mandatory = true) public String getStorePath(); } diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java index 85e2e08129..6619b76214 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java @@ -48,6 +48,7 @@ import org.apache.qpid.server.model.TrustStore; import org.apache.qpid.server.model.VirtualHost; import org.apache.qpid.server.model.VirtualHostNode; import org.apache.qpid.server.model.adapter.FileSystemPreferencesProvider; +import org.apache.qpid.server.model.port.AmqpPort; import org.apache.qpid.server.security.FileKeyStore; import org.apache.qpid.server.security.FileTrustStore; import org.apache.qpid.server.security.auth.manager.AnonymousAuthenticationManager; @@ -411,8 +412,8 @@ public abstract class ConfigurationEntryStoreTestCase extends QpidTestCase attributes.put(Port.PORT, 9999); attributes.put(Port.TRANSPORTS, tcpTransportSet); attributes.put(Port.TCP_NO_DELAY, true); - attributes.put(Port.RECEIVE_BUFFER_SIZE, 1); - attributes.put(Port.SEND_BUFFER_SIZE, 2); + attributes.put(AmqpPort.RECEIVE_BUFFER_SIZE, 1); + attributes.put(AmqpPort.SEND_BUFFER_SIZE, 2); attributes.put(Port.NEED_CLIENT_AUTH, true); attributes.put(Port.WANT_CLIENT_AUTH, true); diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/CurrentThreadTaskExecutor.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/CurrentThreadTaskExecutor.java index 001a14e11e..5a0d77da89 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/CurrentThreadTaskExecutor.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/CurrentThreadTaskExecutor.java @@ -23,17 +23,15 @@ package org.apache.qpid.server.configuration.updater; import java.util.concurrent.CancellationException; import java.util.concurrent.atomic.AtomicReference; -import org.apache.qpid.server.model.State; - public class CurrentThreadTaskExecutor implements TaskExecutor { private final AtomicReference<Thread> _thread = new AtomicReference<>(); - private State _state; + private boolean _running; @Override - public State getState() + public boolean isRunning() { - return null; + return _running; } @Override @@ -43,14 +41,14 @@ public class CurrentThreadTaskExecutor implements TaskExecutor { checkThread(); } - _state = State.ACTIVE; + _running = true; } @Override public void stopImmediately() { checkThread(); - _state = State.STOPPED; + _running = false; } diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java index 04016d91bc..6b53776bb6 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java @@ -35,7 +35,6 @@ import javax.security.auth.Subject; import junit.framework.TestCase; -import org.apache.qpid.server.model.State; import org.apache.qpid.server.util.ServerScopedRuntimeException; public class TaskExecutorTest extends TestCase @@ -62,13 +61,13 @@ public class TaskExecutorTest extends TestCase public void testGetState() { - assertEquals("Unexpected initial state", State.INITIALISING, _executor.getState()); + assertFalse("Unexpected initial state", _executor.isRunning()); } public void testStart() { _executor.start(); - assertEquals("Unexpected started state", State.ACTIVE, _executor.getState()); + assertTrue("Unexpected started state", _executor.isRunning()); } public void testStopImmediately() throws Exception @@ -112,7 +111,7 @@ public class TaskExecutorTest extends TestCase assertTrue("The first task has not been triggered", waitForCallLatch.await(1000, TimeUnit.MILLISECONDS)); _executor.stopImmediately(); - assertEquals("Unexpected stopped state", State.STOPPED, _executor.getState()); + assertFalse("Unexpected stopped state", _executor.isRunning()); Exception e = submitExceptions.poll(1000l, TimeUnit.MILLISECONDS); assertNotNull("The task execution was not interrupted or cancelled", e); @@ -129,7 +128,7 @@ public class TaskExecutorTest extends TestCase { _executor.start(); _executor.stop(); - assertEquals("Unexpected stopped state", State.STOPPED, _executor.getState()); + assertFalse("Unexpected stopped state", _executor.isRunning()); } public void testSubmitAndWait() throws Exception diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/VirtualHostTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/VirtualHostTest.java index c6195d2efb..8c1c83b7c8 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/VirtualHostTest.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/VirtualHostTest.java @@ -84,7 +84,7 @@ public class VirtualHostTest extends QpidTestCase VirtualHost<?,?,?> host = createHost(); - host.setDesiredState(State.INITIALISING, State.ACTIVE); + host.setDesiredState(State.ACTIVE); assertEquals("Unexpected state", State.ACTIVE, host.getAttribute(VirtualHost.STATE)); } @@ -94,10 +94,10 @@ public class VirtualHostTest extends QpidTestCase assertEquals("Unexpected state", State.INITIALISING, host.getAttribute(VirtualHost.STATE)); - host.setDesiredState(State.INITIALISING, State.ACTIVE); + host.setDesiredState(State.ACTIVE); assertEquals("Unexpected state", State.ACTIVE, host.getAttribute(VirtualHost.STATE)); - host.setDesiredState(State.ACTIVE, State.STOPPED); + host.setDesiredState(State.STOPPED); assertEquals("Unexpected state", State.STOPPED, host.getAttribute(VirtualHost.STATE)); } @@ -107,7 +107,7 @@ public class VirtualHostTest extends QpidTestCase assertEquals("Unexpected state", State.INITIALISING, host.getAttribute(VirtualHost.STATE)); - host.setDesiredState(State.INITIALISING, State.DELETED); + host.setDesiredState(State.DELETED); assertEquals("Unexpected state", State.DELETED, host.getAttribute(VirtualHost.STATE)); } @@ -115,7 +115,7 @@ public class VirtualHostTest extends QpidTestCase { VirtualHost<?,?,?> host = createHost(); - host.setDesiredState(State.INITIALISING, State.ACTIVE); + host.setDesiredState(State.ACTIVE); String queueName = getTestName(); Map<String, Object> arguments = new HashMap<String, Object>(); diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProviderTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProviderTest.java index 8c1766d188..f5c631df68 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProviderTest.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProviderTest.java @@ -80,7 +80,7 @@ public class FileSystemPreferencesProviderTest extends QpidTestCase { if (_preferencesProvider != null) { - _preferencesProvider.setDesiredState(_preferencesProvider.getState(), State.DELETED); + _preferencesProvider.setDesiredState(State.DELETED); } BrokerTestHelper.tearDown(); _preferencesFile.delete(); @@ -144,7 +144,7 @@ public class FileSystemPreferencesProviderTest extends QpidTestCase public void testActivate() { _preferencesProvider = createPreferencesProvider(); - _preferencesProvider.setDesiredState(State.INITIALISING, State.ACTIVE); + _preferencesProvider.setDesiredState(State.ACTIVE); assertEquals("Unexpected state", State.ACTIVE, _preferencesProvider.getState()); } @@ -152,7 +152,7 @@ public class FileSystemPreferencesProviderTest extends QpidTestCase public void testChangeAttributes() { _preferencesProvider = createPreferencesProvider(); - _preferencesProvider.setDesiredState(State.INITIALISING, State.ACTIVE); + _preferencesProvider.setDesiredState(State.ACTIVE); File newPrefsFile = TestFileUtils.createTempFile(this, ".prefs.json", "{\"user3\":{\"pref1\":\"pref1User3Value\", \"pref3\": 2.0}}"); try @@ -181,7 +181,7 @@ public class FileSystemPreferencesProviderTest extends QpidTestCase public void testGetPreferences() { _preferencesProvider = createPreferencesProvider(); - _preferencesProvider.setDesiredState(State.INITIALISING, State.ACTIVE); + _preferencesProvider.setDesiredState(State.ACTIVE); Map<String, Object> preferences1 = _preferencesProvider.getPreferences(_user1); assertUser1Preferences(preferences1); @@ -197,7 +197,7 @@ public class FileSystemPreferencesProviderTest extends QpidTestCase public void testSetPreferences() { _preferencesProvider = createPreferencesProvider(); - _preferencesProvider.setDesiredState(State.INITIALISING, State.ACTIVE); + _preferencesProvider.setDesiredState(State.ACTIVE); Map<String, Object> newPreferences = new HashMap<String, Object>(); newPreferences.put("pref2", false); @@ -208,10 +208,10 @@ public class FileSystemPreferencesProviderTest extends QpidTestCase newPreferences.put("pref5", pref5); _preferencesProvider.setPreferences(_user1, newPreferences); - _preferencesProvider.setDesiredState(State.ACTIVE, State.STOPPED); + _preferencesProvider.setDesiredState(State.STOPPED); _preferencesProvider = createPreferencesProvider(); - _preferencesProvider.setDesiredState(State.INITIALISING, State.ACTIVE); + _preferencesProvider.setDesiredState(State.ACTIVE); Map<String, Object> preferences1 = _preferencesProvider.getPreferences(_user1); assertNotNull("Preferences should not be null for user 1", preferences1); assertEquals("Unexpected preference 1 for user 1", "pref1User1Value", preferences1.get("pref1")); @@ -232,16 +232,16 @@ public class FileSystemPreferencesProviderTest extends QpidTestCase public void testDeletePreferences() { _preferencesProvider = createPreferencesProvider(); - _preferencesProvider.setDesiredState(State.INITIALISING, State.ACTIVE); + _preferencesProvider.setDesiredState(State.ACTIVE); assertUser1Preferences(_preferencesProvider.getPreferences(_user1)); assertUser2Preferences(_preferencesProvider.getPreferences(_user2)); _preferencesProvider.deletePreferences(_user1); - _preferencesProvider.setDesiredState(State.ACTIVE, State.STOPPED); + _preferencesProvider.setDesiredState(State.STOPPED); _preferencesProvider = createPreferencesProvider(); - _preferencesProvider.setDesiredState(State.INITIALISING, State.ACTIVE); + _preferencesProvider.setDesiredState(State.ACTIVE); Map<String, Object> preferences1 = _preferencesProvider.getPreferences(_user1); assertTrue("Preferences should not be set for user 1", preferences1.isEmpty()); @@ -256,16 +256,16 @@ public class FileSystemPreferencesProviderTest extends QpidTestCase public void testDeleteMultipleUsersPreferences() { _preferencesProvider = createPreferencesProvider(); - _preferencesProvider.setDesiredState(State.INITIALISING, State.ACTIVE); + _preferencesProvider.setDesiredState(State.ACTIVE); assertUser1Preferences(_preferencesProvider.getPreferences(_user1)); assertUser2Preferences(_preferencesProvider.getPreferences(_user2)); _preferencesProvider.deletePreferences(_user1, _user2); - _preferencesProvider.setDesiredState(State.ACTIVE, State.STOPPED); + _preferencesProvider.setDesiredState(State.STOPPED); _preferencesProvider = createPreferencesProvider(); - _preferencesProvider.setDesiredState(State.INITIALISING, State.ACTIVE); + _preferencesProvider.setDesiredState(State.ACTIVE); Map<String, Object> preferences1 = _preferencesProvider.getPreferences(_user1); assertTrue("Preferences should not be set for user 1", preferences1.isEmpty()); @@ -280,7 +280,7 @@ public class FileSystemPreferencesProviderTest extends QpidTestCase public void testListUserNames() { _preferencesProvider = createPreferencesProvider(); - _preferencesProvider.setDesiredState(State.INITIALISING, State.ACTIVE); + _preferencesProvider.setDesiredState(State.ACTIVE); Set<String> userNames = _preferencesProvider.listUserIDs(); diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java index 73a655bfea..676f455533 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java @@ -99,8 +99,8 @@ public class PortFactoryTest extends QpidTestCase _attributes.put(Port.TRANSPORTS, _tcpStringSet); _attributes.put(Port.AUTHENTICATION_PROVIDER, _authProviderName); _attributes.put(Port.TCP_NO_DELAY, "true"); - _attributes.put(Port.RECEIVE_BUFFER_SIZE, "1"); - _attributes.put(Port.SEND_BUFFER_SIZE, "2"); + _attributes.put(AmqpPort.RECEIVE_BUFFER_SIZE, "1"); + _attributes.put(AmqpPort.SEND_BUFFER_SIZE, "2"); _attributes.put(Port.BINDING_ADDRESS, "127.0.0.1"); } @@ -172,9 +172,9 @@ public class PortFactoryTest extends QpidTestCase assertEquals("Unexpected protocols", EnumSet.of(Protocol.AMQP_0_8, Protocol.AMQP_0_9, Protocol.AMQP_0_9_1, Protocol.AMQP_0_10, Protocol.AMQP_1_0), port.getAvailableProtocols()); assertEquals("Unexpected send buffer size", PortFactory.DEFAULT_AMQP_SEND_BUFFER_SIZE, - port.getAttribute(Port.SEND_BUFFER_SIZE)); + port.getAttribute(AmqpPort.SEND_BUFFER_SIZE)); assertEquals("Unexpected receive buffer size", PortFactory.DEFAULT_AMQP_RECEIVE_BUFFER_SIZE, - port.getAttribute(Port.RECEIVE_BUFFER_SIZE)); + port.getAttribute(AmqpPort.RECEIVE_BUFFER_SIZE)); assertEquals("Unexpected need client auth", PortFactory.DEFAULT_AMQP_NEED_CLIENT_AUTH, port.getAttribute(Port.NEED_CLIENT_AUTH)); assertEquals("Unexpected want client auth", PortFactory.DEFAULT_AMQP_WANT_CLIENT_AUTH, @@ -317,8 +317,8 @@ public class PortFactoryTest extends QpidTestCase assertEquals(_tcpTransports, port.getTransports()); } assertEquals(amqp010ProtocolSet, port.getAvailableProtocols()); - assertEquals("Unexpected send buffer size", 2, port.getAttribute(Port.SEND_BUFFER_SIZE)); - assertEquals("Unexpected receive buffer size", 1, port.getAttribute(Port.RECEIVE_BUFFER_SIZE)); + assertEquals("Unexpected send buffer size", 2, port.getAttribute(AmqpPort.SEND_BUFFER_SIZE)); + assertEquals("Unexpected receive buffer size", 1, port.getAttribute(AmqpPort.RECEIVE_BUFFER_SIZE)); assertEquals("Unexpected need client auth", needClientAuth, port.getAttribute(Port.NEED_CLIENT_AUTH)); assertEquals("Unexpected want client auth", wantClientAuth, port.getAttribute(Port.WANT_CLIENT_AUTH)); assertEquals("Unexpected tcp no delay", true, port.getAttribute(Port.TCP_NO_DELAY)); @@ -345,11 +345,6 @@ public class PortFactoryTest extends QpidTestCase assertEquals(_portNumber, port.getPort()); assertEquals(_tcpTransports, port.getTransports()); assertEquals(nonAmqpProtocolSet, port.getAvailableProtocols()); - assertNull("Unexpected send buffer size", port.getAttribute(Port.SEND_BUFFER_SIZE)); - assertNull("Unexpected receive buffer size", port.getAttribute(Port.RECEIVE_BUFFER_SIZE)); - assertNull("Unexpected need client auth", port.getAttribute(Port.NEED_CLIENT_AUTH)); - assertNull("Unexpected want client auth", port.getAttribute(Port.WANT_CLIENT_AUTH)); - assertNull("Unexpected tcp no delay", port.getAttribute(Port.TCP_NO_DELAY)); } public void testCreateNonAmqpPortWithPartiallySetAttributes() @@ -371,11 +366,7 @@ public class PortFactoryTest extends QpidTestCase assertEquals(_portNumber, port.getPort()); assertEquals(Collections.singleton(PortFactory.DEFAULT_TRANSPORT), port.getTransports()); assertEquals(nonAmqpProtocolSet, port.getAvailableProtocols()); - assertNull("Unexpected send buffer size", port.getAttribute(Port.SEND_BUFFER_SIZE)); - assertNull("Unexpected receive buffer size", port.getAttribute(Port.RECEIVE_BUFFER_SIZE)); - assertNull("Unexpected need client auth", port.getAttribute(Port.NEED_CLIENT_AUTH)); - assertNull("Unexpected want client auth", port.getAttribute(Port.WANT_CLIENT_AUTH)); - assertNull("Unexpected tcp no delay", port.getAttribute(Port.TCP_NO_DELAY)); + } public void testCreateMixedAmqpAndNonAmqpThrowsException() diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java index c4cf787d56..3fce26823e 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java @@ -30,9 +30,9 @@ public interface TestRootCategory<X extends TestRootCategory<X>> extends Configu String AUTOMATED_PERSISTED_VALUE = "automatedPersistedValue"; String AUTOMATED_NONPERSISTED_VALUE = "automatedNonPersistedValue"; - @ManagedAttribute( automate = true ) + @ManagedAttribute String getAutomatedPersistedValue(); - @ManagedAttribute( automate = true, persist = false ) + @ManagedAttribute( persist = false ) String getAutomatedNonPersistedValue(); } diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategoryImpl.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategoryImpl.java index 9dccae9646..91bc00c33c 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategoryImpl.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategoryImpl.java @@ -60,7 +60,7 @@ public class TestRootCategoryImpl extends AbstractConfiguredObject<TestRootCateg } @Override - protected boolean setState(final State currentState, final State desiredState) + protected boolean setState(final State desiredState) { return false; } diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManagerTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManagerTest.java index 2ef294b31d..9578174819 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManagerTest.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManagerTest.java @@ -96,7 +96,7 @@ public class ScramSHA1AuthenticationManagerTest extends QpidTestCase assertEquals("Manager should have exactly one user child",1, _authManager.getUsers().size()); - user.setDesiredState(State.ACTIVE, State.DELETED); + user.setDesiredState(State.DELETED); assertEquals("No users should be present after child deletion", 0, _authManager.getChildren(User.class).size()); diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java index 1e10053d90..3cef51bac8 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java @@ -248,6 +248,8 @@ public abstract class AbstractDurableConfigurationStoreTestCase extends QpidTest Map<String,Object> arg = new HashMap<String, Object>(binding.getAttributes()); arg.remove("createdBy"); arg.remove("createdTime"); + arg.remove("lastUpdatedTime"); + arg.remove("lastUpdatedBy"); return (_id == ANY_UUID || _id.equals(binding.getId())) && _name.equals(binding.getType()) && (_matchingMap == ANY_MAP || arg.equals(_matchingMap)) diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java index a3855ab481..8a071707e9 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java @@ -127,7 +127,7 @@ public class BrokerTestHelper when(virtualHostNode.getObjectFactory()).thenReturn(objectFactory); when(virtualHostNode.getCategoryClass()).thenReturn(VirtualHostNode.class); AbstractVirtualHost host = (AbstractVirtualHost) objectFactory.create(VirtualHost.class, attributes, virtualHostNode ); - host.setDesiredState(host.getState(), State.ACTIVE); + host.setDesiredState(State.ACTIVE); return host; } diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java index f7bb58c736..6e4f344c48 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java @@ -155,7 +155,7 @@ public class MockVirtualHost implements VirtualHostImpl<MockVirtualHost, AMQQueu } @Override - public State setDesiredState(final State currentState, final State desiredState) + public State setDesiredState(final State desiredState) throws IllegalStateTransitionException, AccessControlException { return null; @@ -545,12 +545,6 @@ public class MockVirtualHost implements VirtualHostImpl<MockVirtualHost, AMQQueu } - @Override - public void validate() - { - - } - public StatisticsCounter getDataDeliveryStatistics() { return null; diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/VirtualHostQueueCreationTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/VirtualHostQueueCreationTest.java index 2d0403370b..a8fab5bb4b 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/VirtualHostQueueCreationTest.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/VirtualHostQueueCreationTest.java @@ -119,7 +119,7 @@ public class VirtualHostQueueCreationTest extends QpidTestCase attributes.put(VirtualHost.ID, UUID.randomUUID()); StandardVirtualHost host = new StandardVirtualHost(attributes, _virtualHostNode); host.create(); - host.setDesiredState(host.getState(), State.ACTIVE); + host.setDesiredState(State.ACTIVE); return host; } diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNodeTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNodeTest.java index 68fcf3b868..6a9dcd9405 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNodeTest.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNodeTest.java @@ -110,7 +110,7 @@ public class AbstractStandardVirtualHostNodeTest extends QpidTestCase VirtualHostNode<?> node = new TestVirtualHostNode(_broker, nodeAttributes, _configStore); node.open(); - node.setDesiredState(node.getState(), State.ACTIVE); + node.setDesiredState(State.ACTIVE); VirtualHost<?, ?, ?> virtualHost = node.getVirtualHost(); assertNotNull("Virtual host was not recovered", virtualHost); @@ -140,7 +140,7 @@ public class AbstractStandardVirtualHostNodeTest extends QpidTestCase VirtualHostNode<?> node = new TestVirtualHostNode(_broker, nodeAttributes, _configStore); node.open(); - node.setDesiredState(node.getState(), State.ACTIVE); + node.setDesiredState(State.ACTIVE); VirtualHost<?, ?, ?> virtualHost = node.getVirtualHost(); assertNotNull("Virtual host was not recovered", virtualHost); diff --git a/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProvider.java b/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProvider.java index d54f226a00..b8509ebd39 100644 --- a/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProvider.java +++ b/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProvider.java @@ -27,6 +27,6 @@ import org.apache.qpid.server.model.ManagedObject; @ManagedObject( category = false, type="AclFile" ) public interface ACLFileAccessControlProvider<X extends ACLFileAccessControlProvider<X>> extends AccessControlProvider<X> { - @ManagedAttribute( automate = true, mandatory = true, description = "File location" ) + @ManagedAttribute( mandatory = true, description = "File location" ) String getPath(); } diff --git a/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProviderImpl.java b/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProviderImpl.java index 554f2f46c5..91e64e5334 100644 --- a/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProviderImpl.java +++ b/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProviderImpl.java @@ -69,9 +69,9 @@ public class ACLFileAccessControlProviderImpl } @Override - public void validate() + public void onValidate() { - super.validate(); + super.onValidate(); if(!isDurable()) { throw new IllegalArgumentException(getClass().getSimpleName() + " must be durable"); @@ -124,7 +124,7 @@ public class ACLFileAccessControlProviderImpl } @Override - public boolean setState(State currentState, State desiredState) + public boolean setState(State desiredState) throws IllegalStateTransitionException, AccessControlException { State state = _state.get(); @@ -186,7 +186,7 @@ public class ACLFileAccessControlProviderImpl } @Override - protected void authoriseSetDesiredState(State currentState, State desiredState) throws AccessControlException + protected void authoriseSetDesiredState(State desiredState) throws AccessControlException { if(desiredState == State.DELETED) { diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNode.java b/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNode.java index e6e4f960d8..f66cb74529 100644 --- a/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNode.java +++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNode.java @@ -27,22 +27,22 @@ import org.apache.qpid.server.store.jdbc.DefaultConnectionProviderFactory; public interface JDBCVirtualHostNode { //TODO: Split this attribute into connectionUrl, username and password. Make the password attribute secure. - @ManagedAttribute(automate=true, mandatory=true) + @ManagedAttribute(mandatory=true) String getConnectionUrl(); - @ManagedAttribute(automate=true, defaultValue=DefaultConnectionProviderFactory.TYPE) + @ManagedAttribute(defaultValue=DefaultConnectionProviderFactory.TYPE) String getConnectionPoolType(); - @ManagedAttribute(automate=true) + @ManagedAttribute String getBigIntType(); - @ManagedAttribute(automate=true) + @ManagedAttribute boolean isBytesForBlob(); - @ManagedAttribute(automate=true) + @ManagedAttribute String getVarBinaryType(); - @ManagedAttribute(automate=true) + @ManagedAttribute String getBlobType(); -}
\ No newline at end of file +} diff --git a/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java b/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java index 8f43cdf9ef..ab58b80ac4 100644 --- a/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java +++ b/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java @@ -496,7 +496,7 @@ class ManagementNode implements MessageSource, MessageDestination responseHeader.setHeader(TYPE_ATTRIBUTE, type); try { - entity.setDesiredState(entity.getState(),State.DELETED); + entity.setDesiredState(State.DELETED); responseHeader.setHeader(STATUS_CODE_HEADER, STATUS_CODE_NO_CONTENT); } catch(AccessControlException e) diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java index 54c66647c0..c1b2fc4bd6 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java +++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java @@ -113,7 +113,7 @@ public class HttpManagement extends AbstractPluginAdapter<HttpManagement> implem } @Override - protected boolean setState(State currentState, State desiredState) + protected boolean setState(State desiredState) { if(desiredState == State.ACTIVE) { diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementConfiguration.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementConfiguration.java index aebe76b9bd..c054ffe405 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementConfiguration.java +++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementConfiguration.java @@ -28,19 +28,19 @@ import org.apache.qpid.server.model.Plugin; public interface HttpManagementConfiguration<X extends HttpManagementConfiguration<X>> extends Plugin<X> { - @ManagedAttribute( automate = true, defaultValue = "true" ) + @ManagedAttribute( defaultValue = "true" ) boolean isHttpsSaslAuthenticationEnabled(); - @ManagedAttribute( automate = true, defaultValue = "true" ) + @ManagedAttribute( defaultValue = "true" ) boolean isHttpSaslAuthenticationEnabled(); - @ManagedAttribute( automate = true, defaultValue = "true" ) + @ManagedAttribute( defaultValue = "true" ) boolean isHttpsBasicAuthenticationEnabled(); - @ManagedAttribute( automate = true, defaultValue = "false" ) + @ManagedAttribute( defaultValue = "false" ) boolean isHttpBasicAuthenticationEnabled(); - @ManagedAttribute( automate = true, defaultValue = "600" ) + @ManagedAttribute( defaultValue = "600" ) public int getSessionTimeout(); AuthenticationProvider getAuthenticationProvider(SocketAddress localAddress); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java index 0309ecc838..4bd28accb0 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java +++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java @@ -541,7 +541,7 @@ public class RestServlet extends AbstractServlet Collection<ConfiguredObject<?>> allObjects = getObjects(request); for(ConfiguredObject o : allObjects) { - o.setDesiredState(o.getState(), State.DELETED); + o.setDesiredState(State.DELETED); } response.setStatus(HttpServletResponse.SC_OK); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/AbstractSpecialisedAttributeLister.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/AbstractSpecialisedAttributeLister.java index 173e4fce66..5d1e7cba21 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/AbstractSpecialisedAttributeLister.java +++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/AbstractSpecialisedAttributeLister.java @@ -59,9 +59,9 @@ abstract class AbstractSpecialisedAttributeLister<T extends ConfiguredObject> i for(ConfiguredObjectAttribute<?, ?> attr : typeSpecificAttributes) { attributeNames.add(attr.getName()); - if(!"".equals(attr.getAnnotation().description())) + if(!"".equals(attr.getDescription())) { - descriptions.put(attr.getName(), attr.getAnnotation().description()); + descriptions.put(attr.getName(), attr.getDescription()); } } data.put(ATTRIBUTES, attributeNames); diff --git a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPlugin.java b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPlugin.java index 472be5a1a1..36efd4cb4c 100644 --- a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPlugin.java +++ b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPlugin.java @@ -30,6 +30,6 @@ public interface JMXManagementPlugin<X extends JMXManagementPlugin<X>> extends P String USE_PLATFORM_MBEAN_SERVER = "usePlatformMBeanServer"; String DEFAULT_USE_PLATFORM_MBEAN_SERVER = "true"; - @ManagedAttribute( automate = true, defaultValue = DEFAULT_USE_PLATFORM_MBEAN_SERVER ) + @ManagedAttribute( defaultValue = DEFAULT_USE_PLATFORM_MBEAN_SERVER ) boolean getUsePlatformMBeanServer(); } diff --git a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPluginImpl.java b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPluginImpl.java index aa823d7f6a..850c14cf20 100644 --- a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPluginImpl.java +++ b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPluginImpl.java @@ -88,7 +88,7 @@ public class JMXManagementPluginImpl } @Override - protected boolean setState(State currentState, State desiredState) + protected boolean setState(State desiredState) { if(desiredState == State.ACTIVE) { diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/VirtualHostMessageStoreTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/VirtualHostMessageStoreTest.java index 32f936983f..cfb331fd0f 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/VirtualHostMessageStoreTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/VirtualHostMessageStoreTest.java @@ -20,15 +20,20 @@ */ package org.apache.qpid.server.store; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.io.File; +import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import javax.security.auth.Subject; + import org.apache.qpid.common.AMQPFilterTypes; import org.apache.qpid.exchange.ExchangeDefaults; import org.apache.qpid.framing.AMQShortString; @@ -39,6 +44,7 @@ import org.apache.qpid.framing.abstraction.MessagePublishInfo; import org.apache.qpid.framing.amqp_8_0.BasicConsumeBodyImpl; import org.apache.qpid.server.configuration.updater.TaskExecutor; import org.apache.qpid.server.configuration.updater.TaskExecutorImpl; +import org.apache.qpid.server.connection.SessionPrincipal; import org.apache.qpid.server.exchange.ExchangeImpl; import org.apache.qpid.server.message.InstanceProperties; import org.apache.qpid.server.message.MessageSource; @@ -52,6 +58,8 @@ import org.apache.qpid.server.model.Queue; import org.apache.qpid.server.model.State; import org.apache.qpid.server.model.UUIDGenerator; import org.apache.qpid.server.model.VirtualHostNode; +import org.apache.qpid.server.protocol.AMQConnectionModel; +import org.apache.qpid.server.protocol.AMQSessionModel; import org.apache.qpid.server.protocol.v0_8.AMQMessage; import org.apache.qpid.server.protocol.v0_8.MessageMetaData; import org.apache.qpid.server.queue.AMQQueue; @@ -130,7 +138,7 @@ public class VirtualHostMessageStoreTest extends QpidTestCase nodeAttributes.put(VirtualHostNode.NAME, hostName); nodeAttributes.put(VirtualHostNode.ID, UUID.randomUUID()); _node = factory.create(VirtualHostNode.class, nodeAttributes, broker); - _node.setDesiredState(_node.getState(), State.ACTIVE); + _node.setDesiredState(State.ACTIVE); _virtualHost = (VirtualHostImpl<?,?,?>)_node.getVirtualHost(); @@ -144,7 +152,7 @@ public class VirtualHostMessageStoreTest extends QpidTestCase if (_virtualHost != null) { VirtualHostNode<?> node = _virtualHost.getParent(VirtualHostNode.class); - node.setDesiredState(node.getState(), State.STOPPED); + node.setDesiredState(State.STOPPED); } } finally @@ -157,10 +165,10 @@ public class VirtualHostMessageStoreTest extends QpidTestCase protected void reloadVirtualHost() { assertEquals("Virtual host node is not active", State.ACTIVE, _virtualHost.getState()); - State currentState = _node.setDesiredState(State.ACTIVE, State.STOPPED); + State currentState = _node.setDesiredState(State.STOPPED); assertEquals("Virtual host node is not stopped", State.STOPPED, currentState); - currentState = _node.setDesiredState(State.STOPPED, State.ACTIVE); + currentState = _node.setDesiredState(State.ACTIVE); assertEquals("Virtual host node is not active", State.ACTIVE, currentState); _virtualHost = (VirtualHostImpl<?, ?, ?>) _node.getVirtualHost(); } @@ -628,7 +636,7 @@ public class VirtualHostMessageStoreTest extends QpidTestCase throws Exception { - Map<String,Object> queueArguments = new HashMap<String, Object>(); + final Map<String,Object> queueArguments = new HashMap<String, Object>(); if(usePriority || lastValueQueue) { @@ -650,14 +658,25 @@ public class VirtualHostMessageStoreTest extends QpidTestCase queueArguments.put(Queue.DURABLE, durable); queueArguments.put(Queue.LIFETIME_POLICY, LifetimePolicy.PERMANENT); queueArguments.put(Queue.EXCLUSIVE, exclusive ? ExclusivityPolicy.CONTAINER : ExclusivityPolicy.NONE); - if(exclusive && queueOwner != null) - { - queueArguments.put(Queue.OWNER, queueOwner); - } - AMQQueue<?> queue = null; + AMQSessionModel sessionModel = mock(AMQSessionModel.class); + AMQConnectionModel connectionModel = mock(AMQConnectionModel.class); + when(sessionModel.getConnectionModel()).thenReturn(connectionModel); + when(connectionModel.getRemoteContainerName()).thenReturn(queueOwner); + SessionPrincipal principal = new SessionPrincipal(sessionModel); + AMQQueue<?> queue = Subject.doAs(new Subject(true, + Collections.singleton(principal), + Collections.emptySet(), + Collections.emptySet()), + new PrivilegedAction<AMQQueue<?>>() + { + @Override + public AMQQueue<?> run() + { + return _virtualHost.createQueue(queueArguments); + + } + }); - //Ideally we would be able to use the QueueDeclareHandler here. - queue = _virtualHost.createQueue(queueArguments); validateQueueProperties(queue, usePriority, durable, exclusive, lastValueQueue); } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/Asserts.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/Asserts.java index cccf94c739..aa4d94ba98 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/Asserts.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/Asserts.java @@ -43,6 +43,7 @@ import org.apache.qpid.server.model.Port; import org.apache.qpid.server.model.Queue; import org.apache.qpid.server.model.State; import org.apache.qpid.server.model.VirtualHost; +import org.apache.qpid.server.model.port.AmqpPort; import org.apache.qpid.server.queue.LastValueQueue; import org.apache.qpid.server.queue.PriorityQueue; import org.apache.qpid.server.queue.SortedQueue; @@ -63,6 +64,7 @@ public class Asserts ConfiguredObject.LAST_UPDATED_TIME, ConfiguredObject.DESCRIPTION, ConfiguredObject.CONTEXT, + ConfiguredObject.DESIRED_STATE, VirtualHost.SUPPORTED_QUEUE_TYPES, VirtualHost.TYPE, VirtualHost.MESSAGE_STORE_SETTINGS); @@ -120,7 +122,8 @@ public class Asserts Queue.MESSAGE_GROUP_KEY, Queue.MESSAGE_GROUP_SHARED_GROUPS, PriorityQueue.PRIORITIES, - ConfiguredObject.CONTEXT); + ConfiguredObject.CONTEXT, + ConfiguredObject.DESIRED_STATE); assertEquals("Unexpected value of queue attribute " + Queue.NAME, queueName, queueData.get(Queue.NAME)); assertNotNull("Unexpected value of queue attribute " + Queue.ID, queueData.get(Queue.ID)); @@ -226,7 +229,8 @@ public class Asserts ConfiguredObject.LAST_UPDATED_BY, ConfiguredObject.LAST_UPDATED_TIME, ConfiguredObject.DESCRIPTION, - ConfiguredObject.CONTEXT); + ConfiguredObject.CONTEXT, + ConfiguredObject.DESIRED_STATE); assertEquals("Unexpected value for connection attribute " + Connection.PORT, TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT, connectionData.get(Connection.PORT)); @@ -279,6 +283,7 @@ public class Asserts ConfiguredObject.LAST_UPDATED_TIME, ConfiguredObject.DESCRIPTION, ConfiguredObject.CONTEXT, + ConfiguredObject.DESIRED_STATE, Port.AUTHENTICATION_PROVIDER, Port.KEY_STORE, Port.TRUST_STORES, @@ -296,11 +301,12 @@ public class Asserts ConfiguredObject.LAST_UPDATED_TIME, ConfiguredObject.DESCRIPTION, ConfiguredObject.CONTEXT, + ConfiguredObject.DESIRED_STATE, Port.AUTHENTICATION_PROVIDER, Port.BINDING_ADDRESS, Port.TCP_NO_DELAY, - Port.SEND_BUFFER_SIZE, - Port.RECEIVE_BUFFER_SIZE, + AmqpPort.SEND_BUFFER_SIZE, + AmqpPort.RECEIVE_BUFFER_SIZE, Port.NEED_CLIENT_AUTH, Port.WANT_CLIENT_AUTH, Port.KEY_STORE, @@ -332,7 +338,8 @@ public class Asserts ConfiguredObject.LAST_UPDATED_BY, ConfiguredObject.LAST_UPDATED_TIME, ConfiguredObject.DESCRIPTION, - ConfiguredObject.CONTEXT); + ConfiguredObject.CONTEXT, + ConfiguredObject.DESIRED_STATE); assertEquals("Unexpected value of exchange attribute " + Exchange.NAME, exchangeName, exchangeData.get(Exchange.NAME)); @@ -368,7 +375,8 @@ public class Asserts ConfiguredObject.LAST_UPDATED_BY, ConfiguredObject.LAST_UPDATED_TIME, ConfiguredObject.DESCRIPTION, - ConfiguredObject.CONTEXT); + ConfiguredObject.CONTEXT, + ConfiguredObject.DESIRED_STATE); assertEquals("Unexpected binding attribute " + Binding.NAME, bindingName, binding.get(Binding.NAME)); assertEquals("Unexpected binding attribute " + Binding.QUEUE, queueName, binding.get(Binding.QUEUE)); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AuthenticationProviderRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AuthenticationProviderRestTest.java index cb57d6e5dc..57d75ecbae 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AuthenticationProviderRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AuthenticationProviderRestTest.java @@ -309,7 +309,8 @@ public class AuthenticationProviderRestTest extends QpidRestTestCase { Asserts.assertAttributesPresent(provider, ConfiguredObjectTypeRegistry.getAttributeNames( AuthenticationProvider.class), - AuthenticationProvider.DESCRIPTION, ConfiguredObject.CONTEXT, ConfiguredObject.CREATED_BY, + AuthenticationProvider.DESCRIPTION, ConfiguredObject.CONTEXT, + ConfiguredObject.DESIRED_STATE, ConfiguredObject.CREATED_BY, ConfiguredObject.CREATED_TIME, ConfiguredObject.LAST_UPDATED_BY, ConfiguredObject.LAST_UPDATED_TIME); assertEquals("Unexpected value of provider attribute " + AuthenticationProvider.STATE, State.ACTIVE.name(), provider.get(AuthenticationProvider.STATE)); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java index a4d0f40590..7ddf119ebc 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java @@ -71,6 +71,7 @@ public class BrokerRestHttpsTest extends QpidRestTestCase ConfiguredObject.LAST_UPDATED_BY, ConfiguredObject.LAST_UPDATED_TIME, ConfiguredObject.DESCRIPTION, - ConfiguredObject.CONTEXT); + ConfiguredObject.CONTEXT, + ConfiguredObject.DESIRED_STATE); } } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java index e9745f68e5..e312293c33 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java @@ -210,7 +210,8 @@ public class BrokerRestTest extends QpidRestTestCase ConfiguredObject.LAST_UPDATED_BY, ConfiguredObject.LAST_UPDATED_TIME, ConfiguredObject.DESCRIPTION, - ConfiguredObject.CONTEXT); + ConfiguredObject.CONTEXT, + ConfiguredObject.DESIRED_STATE); assertEquals("Unexpected value of attribute " + Broker.BUILD_VERSION, QpidProperties.getBuildVersion(), brokerDetails.get(Broker.BUILD_VERSION)); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/ConnectionRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/ConnectionRestTest.java index e07fd5ccaf..cbdd4ff35c 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/ConnectionRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/ConnectionRestTest.java @@ -182,6 +182,7 @@ public class ConnectionRestTest extends QpidRestTestCase ConfiguredObject.LAST_UPDATED_TIME, ConfiguredObject.DESCRIPTION, ConfiguredObject.CONTEXT, + ConfiguredObject.DESIRED_STATE, Session.STATE, Session.DURABLE, Session.LIFETIME_POLICY); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java index 47424919c0..7bc2429942 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java @@ -329,7 +329,8 @@ public class GroupProviderRestTest extends QpidRestTestCase ConfiguredObject.LAST_UPDATED_BY, ConfiguredObject.LAST_UPDATED_TIME, ConfiguredObject.DESCRIPTION, - ConfiguredObject.CONTEXT); + ConfiguredObject.CONTEXT, + ConfiguredObject.DESIRED_STATE); assertEquals("Unexpected value of provider attribute " + GroupProvider.STATE, State.ACTIVE.name(), provider.get(GroupProvider.STATE)); assertEquals("Unexpected value of provider attribute " + GroupProvider.LIFETIME_POLICY, diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java index b7a85a1ffe..1d2b5d8bb5 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java @@ -169,7 +169,8 @@ public class PreferencesProviderRestTest extends QpidRestTestCase ConfiguredObject.LAST_UPDATED_BY, ConfiguredObject.LAST_UPDATED_TIME, ConfiguredObject.DESCRIPTION, - ConfiguredObject.CONTEXT); + ConfiguredObject.CONTEXT, + ConfiguredObject.DESIRED_STATE); assertEquals("Unexpected value of provider attribute " + PreferencesProvider.STATE, State.ACTIVE.name(), provider.get(PreferencesProvider.STATE)); assertEquals("Unexpected value of provider attribute " + PreferencesProvider.LIFETIME_POLICY, diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QueueRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QueueRestTest.java index b091fd876b..db25b91236 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QueueRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QueueRestTest.java @@ -215,7 +215,8 @@ public class QueueRestTest extends QpidRestTestCase ConfiguredObject.LAST_UPDATED_BY, ConfiguredObject.LAST_UPDATED_TIME, ConfiguredObject.DESCRIPTION, - ConfiguredObject.CONTEXT); + ConfiguredObject.CONTEXT, + ConfiguredObject.DESIRED_STATE); assertEquals("Unexpected binding attribute " + Consumer.NAME, "1", consumer.get(Consumer.NAME)); assertEquals("Unexpected binding attribute " + Consumer.DURABLE, Boolean.FALSE, consumer.get(Consumer.DURABLE)); |
