diff options
| author | Robert Godfrey <rgodfrey@apache.org> | 2014-04-28 02:25:27 +0000 |
|---|---|---|
| committer | Robert Godfrey <rgodfrey@apache.org> | 2014-04-28 02:25:27 +0000 |
| commit | e93df1d676c748f942daaf5fb0c4d4dd4ea867a2 (patch) | |
| tree | 334bdee0947d54ee5e9f366331e222db2e749d38 /qpid/java/broker-plugins/management-http | |
| parent | 206d461b36995e741ca5a1edcdb2b28f8835832a (diff) | |
| download | qpid-python-e93df1d676c748f942daaf5fb0c4d4dd4ea867a2.tar.gz | |
QPID-5726 : [Java Broker] Use annotation processing to generate object factories and service definitions
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1590547 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins/management-http')
7 files changed, 9 insertions, 147 deletions
diff --git a/qpid/java/broker-plugins/management-http/build.xml b/qpid/java/broker-plugins/management-http/build.xml index d921b91580..e4ad1d9e4b 100644 --- a/qpid/java/broker-plugins/management-http/build.xml +++ b/qpid/java/broker-plugins/management-http/build.xml @@ -18,7 +18,7 @@ --> <project name="Qpid Broker-Plugins Management HTTP" default="build"> - <property name="module.depends" value="common broker-core" /> + <property name="module.depends" value="common broker-core broker-codegen" /> <property name="module.test.depends" value="broker-core/tests qpid-test-utils management/common client" /> <property name="module.genpom" value="true" /> diff --git a/qpid/java/broker-plugins/management-http/pom.xml b/qpid/java/broker-plugins/management-http/pom.xml index c66bda224f..de6089dc1d 100644 --- a/qpid/java/broker-plugins/management-http/pom.xml +++ b/qpid/java/broker-plugins/management-http/pom.xml @@ -38,6 +38,13 @@ </dependency> <dependency> + <groupId>org.apache.qpid</groupId> + <artifactId>qpid-broker-codegen</artifactId> + <version>${project.version}</version> + <optional>true</optional> + </dependency> + + <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>${log4j-version}</version> 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 5c5f53f676..5b7c23ef2e 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 @@ -106,6 +106,7 @@ public class HttpManagement extends AbstractPluginAdapter<HttpManagement> implem @ManagedAttributeField private int _sessionTimeout; + @ManagedObjectFactoryConstructor public HttpManagement(Map<String, Object> attributes, Broker broker) { super(attributes, broker); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementFactory.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementFactory.java deleted file mode 100644 index 518788a3d3..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementFactory.java +++ /dev/null @@ -1,43 +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.management.plugin; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.qpid.server.model.AbstractConfiguredObjectTypeFactory; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.ConfiguredObject; - -public class HttpManagementFactory extends AbstractConfiguredObjectTypeFactory<HttpManagement> -{ - - public HttpManagementFactory() - { - super(HttpManagement.class); - } - - @Override - public HttpManagement createInstance(final Map<String, Object> attributes, final ConfiguredObject<?>... parents) - { - Map<String,Object> attributesWithoutId = new HashMap<String, Object>(attributes); - return new HttpManagement(attributes, getParent(Broker.class,parents)); - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/resources/META-INF/services/org.apache.qpid.server.plugin.ConfiguredObjectTypeFactory b/qpid/java/broker-plugins/management-http/src/main/resources/META-INF/services/org.apache.qpid.server.plugin.ConfiguredObjectTypeFactory deleted file mode 100644 index 316698a10e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/resources/META-INF/services/org.apache.qpid.server.plugin.ConfiguredObjectTypeFactory +++ /dev/null @@ -1,21 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -org.apache.qpid.server.management.plugin.HttpManagementFactory - - diff --git a/qpid/java/broker-plugins/management-http/src/main/resources/META-INF/services/org.apache.qpid.server.plugin.PluginFactory b/qpid/java/broker-plugins/management-http/src/main/resources/META-INF/services/org.apache.qpid.server.plugin.PluginFactory deleted file mode 100644 index 7ffb9a9013..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/resources/META-INF/services/org.apache.qpid.server.plugin.PluginFactory +++ /dev/null @@ -1,19 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -org.apache.qpid.server.management.plugin.HttpManagementFactory diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementFactoryTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementFactoryTest.java deleted file mode 100644 index 809b2405b1..0000000000 --- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementFactoryTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.qpid.server.management.plugin; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.BrokerModel; -import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectFactory; -import org.apache.qpid.server.model.ConfiguredObjectFactoryImpl; -import org.apache.qpid.test.utils.QpidTestCase; - -public class HttpManagementFactoryTest extends QpidTestCase -{ - private static final int SESSION_TIMEOUT = 3600; - - private HttpManagementFactory _pluginFactory = new HttpManagementFactory(); - private Map<String, Object> _attributes = new HashMap<String, Object>(); - private Broker _broker = mock(Broker.class); - private UUID _id = UUID.randomUUID(); - - - public void testCreateInstance() throws Exception - { - _attributes.put(ConfiguredObject.NAME, getName()); - _attributes.put(ConfiguredObject.TYPE, HttpManagement.PLUGIN_TYPE); - _attributes.put(HttpManagement.TIME_OUT, SESSION_TIMEOUT); - _attributes.put(ConfiguredObject.ID, _id); - when(_broker.getCategoryClass()).thenReturn(Broker.class); - ConfiguredObjectFactory objectFactory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance()); - when(_broker.getObjectFactory()).thenReturn(objectFactory); - when(_broker.getModel()).thenReturn(objectFactory.getModel()); - - HttpManagement management = _pluginFactory.createInstance(_attributes, _broker); - management.open(); - - assertEquals(_broker, management.getParent(Broker.class)); - assertEquals(SESSION_TIMEOUT, management.getSessionTimeout()); - } - -} |
