summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorAlex Rudyy <orudyy@apache.org>2014-11-26 16:29:26 +0000
committerAlex Rudyy <orudyy@apache.org>2014-11-26 16:29:26 +0000
commit40f6a09a123d8288f7794b0de2b1525b384aa65e (patch)
treedb845182512a4c6c79bfe8f20c80fe931b3cbea2 /qpid/java
parent1074a4b5941858309c85e18cb42f7df5c0370045 (diff)
downloadqpid-python-40f6a09a123d8288f7794b0de2b1525b384aa65e.tar.gz
QPID-6246: Introduce ManagedInterface and ManagedAnnotation and expose the implemented ManagedInterfaces via meta data servlet
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1641849 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java64
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAnnotation.java34
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedInterface.java25
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PasswordCredentialManagingAuthenticationProvider.java3
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/ConfigureObjectTypeRegistryTest.java72
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass0.java40
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass1.java39
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass2.java40
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass3.java40
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass4.java39
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass5.java37
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedInterface1.java33
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedInterface2.java31
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java13
14 files changed, 508 insertions, 2 deletions
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 ac980568b6..70a64e8130 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
@@ -20,6 +20,7 @@
*/
package org.apache.qpid.server.model;
+import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@@ -172,6 +173,9 @@ public class ConfiguredObjectTypeRegistry
private final Map<Class<? extends ConfiguredObject>, Map<State, Map<State, Method>>> _stateChangeMethods =
Collections.synchronizedMap(new HashMap<Class<? extends ConfiguredObject>, Map<State, Map<State, Method>>>());
+ private final Map<Class<? extends ConfiguredObject>,Set<Class<? extends ManagedInterface>>> _allManagedInterfaces =
+ Collections.synchronizedMap(new HashMap<Class<? extends ConfiguredObject>, Set<Class<? extends ManagedInterface>>>());
+
public ConfiguredObjectTypeRegistry(Iterable<ConfiguredObjectRegistration> configuredObjectRegistrations, Collection<Class<? extends ConfiguredObject>> categoriesRestriction)
{
@@ -258,8 +262,8 @@ public class ConfiguredObjectTypeRegistry
}
_typeSpecificAttributes.put(typeClass, attributes);
}
-
}
+
}
}
@@ -545,6 +549,8 @@ public class ConfiguredObjectTypeRegistry
processDefaultContext(clazz);
processStateChangeMethods(clazz);
+
+ processManagedInterfaces(clazz);
}
}
@@ -859,4 +865,60 @@ public class ConfiguredObjectTypeRegistry
return Collections.unmodifiableMap(_defaultContext);
}
+
+ public Set<Class<? extends ManagedInterface>> getManagedInterfaces(final Class<? extends ConfiguredObject> classObject)
+ {
+ if (!_allManagedInterfaces.containsKey(classObject))
+ {
+ process(classObject);
+ }
+ Set<Class<? extends ManagedInterface>> interfaces = _allManagedInterfaces.get(classObject);
+ return interfaces == null ? Collections.<Class<? extends ManagedInterface>>emptySet() : interfaces;
+ }
+
+
+ private <X extends ConfiguredObject> void processManagedInterfaces(Class<X> clazz)
+ {
+ Set<Class<? extends ManagedInterface>> managedInterfaces = new HashSet<>();
+ if (checkManagedAnnotationAndFindManagedInterfaces(clazz, managedInterfaces, false))
+ {
+ _allManagedInterfaces.put(clazz, Collections.unmodifiableSet(managedInterfaces));
+ }
+ else
+ {
+ _allManagedInterfaces.put(clazz, Collections.<Class<? extends ManagedInterface>>emptySet());
+ }
+ }
+
+ private boolean checkManagedAnnotationAndFindManagedInterfaces(Class<?> type, Set<Class<? extends ManagedInterface>> managedInterfaces, boolean hasManagedAnnotation)
+ {
+ while(type != null && ManagedInterface.class.isAssignableFrom(type))
+ {
+ Annotation[] annotations = type.getAnnotations();
+ for (Annotation annotation : annotations)
+ {
+ if (annotation instanceof ManagedAnnotation)
+ {
+ hasManagedAnnotation = true;
+ }
+ }
+
+ if (hasManagedAnnotation && type.isInterface() && ManagedInterface.class.isAssignableFrom(type) && type != ManagedInterface.class)
+ {
+ managedInterfaces.add((Class<? extends ManagedInterface>)type);
+ }
+
+ Class<?>[] interfaceClasses = type.getInterfaces();
+ for (Class<?> interfaceClass : interfaceClasses)
+ {
+ if (checkManagedAnnotationAndFindManagedInterfaces(interfaceClass, managedInterfaces, hasManagedAnnotation))
+ {
+ hasManagedAnnotation = true;
+ }
+ }
+ type = type.getSuperclass();
+ }
+ return hasManagedAnnotation;
+ }
+
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAnnotation.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAnnotation.java
new file mode 100644
index 0000000000..80b25fd7f8
--- /dev/null
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedAnnotation.java
@@ -0,0 +1,34 @@
+/*
+ *
+ * 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.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface ManagedAnnotation
+{
+}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedInterface.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedInterface.java
new file mode 100644
index 0000000000..9a65db60af
--- /dev/null
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ManagedInterface.java
@@ -0,0 +1,25 @@
+/*
+ *
+ * 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;
+
+public interface ManagedInterface
+{
+}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PasswordCredentialManagingAuthenticationProvider.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PasswordCredentialManagingAuthenticationProvider.java
index 235cedf198..fd64b89a33 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PasswordCredentialManagingAuthenticationProvider.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PasswordCredentialManagingAuthenticationProvider.java
@@ -25,7 +25,8 @@ import java.util.Map;
import javax.security.auth.login.AccountNotFoundException;
-public interface PasswordCredentialManagingAuthenticationProvider<X extends PasswordCredentialManagingAuthenticationProvider<X>> extends AuthenticationProvider<X>
+@ManagedAnnotation
+public interface PasswordCredentialManagingAuthenticationProvider<X extends PasswordCredentialManagingAuthenticationProvider<X>> extends AuthenticationProvider<X>, ManagedInterface
{
boolean createUser(String username, String password, Map<String, String> attributes);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/ConfigureObjectTypeRegistryTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/ConfigureObjectTypeRegistryTest.java
index 3301c046a8..68186cc534 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/ConfigureObjectTypeRegistryTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/ConfigureObjectTypeRegistryTest.java
@@ -22,15 +22,27 @@ package org.apache.qpid.server.model;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
import junit.framework.TestCase;
+import org.apache.qpid.server.model.testmodel.TestManagedClass0;
+import org.apache.qpid.server.model.testmodel.TestManagedClass1;
+import org.apache.qpid.server.model.testmodel.TestManagedClass2;
+import org.apache.qpid.server.model.testmodel.TestManagedClass3;
+import org.apache.qpid.server.model.testmodel.TestManagedClass4;
+import org.apache.qpid.server.model.testmodel.TestManagedClass5;
+import org.apache.qpid.server.model.testmodel.TestManagedInterface1;
+import org.apache.qpid.server.model.testmodel.TestManagedInterface2;
import org.apache.qpid.server.model.testmodel.Test2RootCategory;
import org.apache.qpid.server.model.testmodel.Test2RootCategoryImpl;
import org.apache.qpid.server.model.testmodel.TestChildCategory;
import org.apache.qpid.server.model.testmodel.TestModel;
import org.apache.qpid.server.model.testmodel.TestRootCategory;
import org.apache.qpid.server.model.testmodel.TestRootCategoryImpl;
+import org.apache.qpid.server.plugin.ConfiguredObjectRegistration;
public class ConfigureObjectTypeRegistryTest extends TestCase
{
@@ -93,6 +105,66 @@ public class ConfigureObjectTypeRegistryTest extends TestCase
}
+ public void testGetManagedInterfacesForTypeNotImplementingManagedInterfaceAndNotHavingManagedAnnotation()
+ {
+ ConfiguredObjectTypeRegistry typeRegistry = createConfiguredObjectTypeRegistry(TestRootCategoryImpl.class);
+ assertEquals("Unexpected interfaces from object not implementing Managed interfaces",
+ Collections.emptySet(), typeRegistry.getManagedInterfaces(TestRootCategory.class));
+ }
+
+ public void testGetManagedInterfacesForTypeImplementingManagedInterfaceButNotHavingManagedAnnotation()
+ {
+ ConfiguredObjectTypeRegistry typeRegistry = createConfiguredObjectTypeRegistry(TestRootCategoryImpl.class, TestManagedClass5.class);
+ assertEquals("Unexpected interfaces from object not implementing Managed interfaces",
+ Collections.emptySet(), typeRegistry.getManagedInterfaces(TestManagedClass5.class));
+ }
+
+ public void testGetManagedInterfacesForTypesImplementingManagedInterfacesWithManagedAnnotation()
+ {
+ ConfiguredObjectTypeRegistry typeRegistry = createConfiguredObjectTypeRegistry(TestRootCategoryImpl.class, TestManagedClass0.class, TestManagedClass1.class, TestManagedClass4.class);
+ Set<Class<?>> expected = Collections.<Class<?>>singleton(TestManagedInterface1.class);
+ assertEquals("Unexpected interfaces on child class", expected, typeRegistry.getManagedInterfaces(TestManagedClass1.class));
+ assertEquals("Unexpected interfaces on super class", expected, typeRegistry.getManagedInterfaces(TestManagedClass0.class));
+ assertEquals("Unexpected interfaces on class implementing interface with annotation twice",
+ expected, typeRegistry.getManagedInterfaces(TestManagedClass4.class));
+ }
+
+ public void testGetManagedInterfacesForTypeHavingDirectManagedAnnotation()
+ {
+ ConfiguredObjectTypeRegistry typeRegistry = createConfiguredObjectTypeRegistry(TestRootCategoryImpl.class, TestManagedClass2.class, TestManagedClass3.class);
+
+ assertEquals("Unexpected interfaces on class implementing 2 interfaces with annotation",
+ new HashSet<>(Arrays.asList(TestManagedInterface2.class, TestManagedInterface1.class)), typeRegistry.getManagedInterfaces(TestManagedClass2.class));
+ assertEquals("Unexpected interfaces on class implementing 2 direct interfaces with annotation",
+ new HashSet<>(Arrays.asList(TestManagedInterface2.class, TestManagedInterface1.class)), typeRegistry.getManagedInterfaces(TestManagedClass3.class));
+
+ }
+
+ private ConfiguredObjectTypeRegistry createConfiguredObjectTypeRegistry(Class<? extends ConfiguredObject>... supportedTypes)
+ {
+ ConfiguredObjectRegistration configuredObjectRegistration = createConfiguredObjectRegistration(supportedTypes);
+
+ return new ConfiguredObjectTypeRegistry(Arrays.asList(configuredObjectRegistration), Arrays.asList(TestRootCategory.class, TestChildCategory.class));
+ }
+
+ private ConfiguredObjectRegistration createConfiguredObjectRegistration(final Class<? extends ConfiguredObject>... supportedTypes)
+ {
+ return new ConfiguredObjectRegistration()
+ {
+ @Override
+ public Collection<Class<? extends ConfiguredObject>> getConfiguredObjectClasses()
+ {
+ return Arrays.asList(supportedTypes);
+ }
+
+ @Override
+ public String getType()
+ {
+ return "test";
+ }
+ };
+ }
+
private void checkDefaultedValue(final Collection<ConfiguredObjectAttribute<?, ?>> attrs,
final String defaultedValueDefault)
{
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass0.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass0.java
new file mode 100644
index 0000000000..1e53f2ecd5
--- /dev/null
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass0.java
@@ -0,0 +1,40 @@
+/*
+ *
+ * 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.testmodel;
+
+import java.util.Map;
+
+import org.apache.qpid.server.model.ManagedInterface;
+import org.apache.qpid.server.model.ManagedObject;
+
+/**
+ * This is a test managed type implementing TestManagedInterface1 which extends ManagedInterface.
+ * Because TestManagedInterface1 already has ManagedAnnotation set, the instances of this class will be managed entities
+ * of type TestManagedInterface1.
+ */
+@ManagedObject( category = false , type = "SuperClass" )
+public class TestManagedClass0 extends TestChildCategoryImpl implements TestManagedInterface1
+{
+ public TestManagedClass0(final Map<String, Object> attributes, TestRootCategory<?> parent)
+ {
+ super(attributes, parent);
+ }
+}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass1.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass1.java
new file mode 100644
index 0000000000..c7aa648223
--- /dev/null
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass1.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * 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.testmodel;
+
+import java.util.Map;
+
+import org.apache.qpid.server.model.ManagedObject;
+
+/**
+ * This is a test managed type extending TestManagedClass0.
+ * Because TestManagedClass0 implements managed interface TestManagedInterface1 with ManagedAnnotation set,
+ * the instances of this class will be managed entities of type TestManagedInterface1.
+ */
+@ManagedObject( category = false , type = "ChildClass" )
+public class TestManagedClass1 extends TestManagedClass0
+{
+ public TestManagedClass1(final Map<String, Object> attributes, TestRootCategory<?> parent)
+ {
+ super(attributes, parent);
+ }
+}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass2.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass2.java
new file mode 100644
index 0000000000..bd1bc6b24c
--- /dev/null
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass2.java
@@ -0,0 +1,40 @@
+/*
+ *
+ * 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.testmodel;
+
+import java.util.Map;
+
+import org.apache.qpid.server.model.ManagedAnnotation;
+import org.apache.qpid.server.model.ManagedObject;
+
+/**
+ * This is a test managed type implementing managed interface TestManagedInterface2 and having ManagedAnnotation set.
+ * The instances of this class will be managed entities of types TestManagedInterface1 and TestManagedInterface2
+ */
+@ManagedObject( category = false , type = "ChildClass2" )
+@ManagedAnnotation
+public class TestManagedClass2 extends TestManagedClass0 implements TestManagedInterface2
+{
+ public TestManagedClass2(final Map<String, Object> attributes, TestRootCategory<?> parent)
+ {
+ super(attributes, parent);
+ }
+}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass3.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass3.java
new file mode 100644
index 0000000000..fbd3c60045
--- /dev/null
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass3.java
@@ -0,0 +1,40 @@
+/*
+ *
+ * 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.testmodel;
+
+import java.util.Map;
+
+import org.apache.qpid.server.model.ManagedAnnotation;
+import org.apache.qpid.server.model.ManagedObject;
+
+/**
+ * This is a test managed type implementing managed interface TestManagedInterface1 and TestManagedInterface2.
+ * The instances of this class will be managed entities of types TestManagedInterface1 and TestManagedInterface2.
+ */
+@ManagedObject( category = false , type = "ChildClass3" )
+@ManagedAnnotation
+public class TestManagedClass3 extends TestChildCategoryImpl implements TestManagedInterface1,TestManagedInterface2
+{
+ public TestManagedClass3(final Map<String, Object> attributes, TestRootCategory<?> parent)
+ {
+ super(attributes, parent);
+ }
+}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass4.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass4.java
new file mode 100644
index 0000000000..ff8f4b058c
--- /dev/null
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass4.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * 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.testmodel;
+
+import java.util.Map;
+
+import org.apache.qpid.server.model.ManagedObject;
+
+/**
+ * This is a test managed type extending managed type TestManagedClass0 and implementing TestManagedInterface2
+ * The instances of this class will be managed entities of types TestManagedInterface1 only
+ * as it has no direct ManagedAnnotation set and no ManagedAnnotation declared in TestManagedInterface2.
+ */
+@ManagedObject( category = false , type = "ChildClass4" )
+public class TestManagedClass4 extends TestManagedClass0 implements TestManagedInterface2
+{
+ public TestManagedClass4(final Map<String, Object> attributes, TestRootCategory<?> parent)
+ {
+ super(attributes, parent);
+ }
+}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass5.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass5.java
new file mode 100644
index 0000000000..5894363204
--- /dev/null
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedClass5.java
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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.testmodel;
+
+import java.util.Map;
+
+import org.apache.qpid.server.model.ManagedObject;
+
+/**
+ * This is a test type which has no ManagedAnnotation set and thus it should not expose any ManagedInterface
+ */
+@ManagedObject( category = false , type = "ChildClass3" )
+public class TestManagedClass5 extends TestChildCategoryImpl implements TestManagedInterface2
+{
+ public TestManagedClass5(final Map<String, Object> attributes, TestRootCategory<?> parent)
+ {
+ super(attributes, parent);
+ }
+}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedInterface1.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedInterface1.java
new file mode 100644
index 0000000000..aac5adad18
--- /dev/null
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedInterface1.java
@@ -0,0 +1,33 @@
+/*
+ *
+ * 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.testmodel;
+
+import org.apache.qpid.server.model.ManagedAnnotation;
+import org.apache.qpid.server.model.ManagedInterface;
+
+/**
+ * This is a test managed interface which has ManagedAnnotation.
+ * All types implementing this interface will inherit the annotation and will be managed entities of type TestManagedInterface1
+ */
+@ManagedAnnotation
+public interface TestManagedInterface1 extends ManagedInterface
+{
+}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedInterface2.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedInterface2.java
new file mode 100644
index 0000000000..7ecb2d63ac
--- /dev/null
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestManagedInterface2.java
@@ -0,0 +1,31 @@
+/*
+ *
+ * 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.testmodel;
+
+import org.apache.qpid.server.model.ManagedInterface;
+
+/**
+ * This is a test managed interface which has no ManagedAnnotation.
+ * All types implementing this interface would need to have ManagedAnnotation declared in order to became managed entity.
+ */
+public interface TestManagedInterface2 extends ManagedInterface
+{
+}
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java
index 35eff5c0b7..2947cfb85b 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java
+++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java
@@ -24,8 +24,10 @@ import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.Set;
import java.util.TreeMap;
import javax.servlet.ServletException;
@@ -98,9 +100,20 @@ public class MetaDataServlet extends AbstractServlet
{
Map<String,Object> typeDetails = new LinkedHashMap<>();
typeDetails.put("attributes", processAttributes(type));
+ typeDetails.put("managedInterfaces", getManagedInterfaces(type));
return typeDetails;
}
+ private Set<String> getManagedInterfaces(Class<? extends ConfiguredObject> type)
+ {
+ Set<String> interfaces = new HashSet<>();
+ for(Class<?> classObject: _instance.getTypeRegistry().getManagedInterfaces(type))
+ {
+ interfaces.add(classObject.getSimpleName());
+ }
+ return interfaces;
+ }
+
private Map<String,Map> processAttributes(final Class<? extends ConfiguredObject> type)
{
Collection<ConfiguredObjectAttribute<?, ?>> attributes =