Search in sources :

Example 1 with ConfiguredObjectRegistration

use of org.apache.qpid.server.plugin.ConfiguredObjectRegistration in project qpid-broker-j by apache.

the class AbstractLogger method getSupportedLogInclusionRules.

private static Collection<String> getSupportedLogInclusionRules(Class<? extends ConfiguredObject> clazz) {
    final Iterable<ConfiguredObjectRegistration> registrations = (new QpidServiceLoader()).instancesOf(ConfiguredObjectRegistration.class);
    Set<String> supportedTypes = new HashSet<>();
    for (ConfiguredObjectRegistration registration : registrations) {
        for (Class<? extends ConfiguredObject> typeClass : registration.getConfiguredObjectClasses()) {
            if (clazz.isAssignableFrom(typeClass)) {
                ManagedObject annotation = typeClass.getAnnotation(ManagedObject.class);
                if (annotation.creatable() && annotation.defaultType().equals("") && LogBackLogInclusionRule.class.isAssignableFrom(typeClass)) {
                    supportedTypes.add(ConfiguredObjectTypeRegistry.getType(typeClass));
                }
            }
        }
    }
    return Collections.unmodifiableCollection(supportedTypes);
}
Also used : QpidServiceLoader(org.apache.qpid.server.plugin.QpidServiceLoader) ConfiguredObjectRegistration(org.apache.qpid.server.plugin.ConfiguredObjectRegistration) ManagedObject(org.apache.qpid.server.model.ManagedObject) HashSet(java.util.HashSet)

Example 2 with ConfiguredObjectRegistration

use of org.apache.qpid.server.plugin.ConfiguredObjectRegistration in project qpid-broker-j by apache.

the class AbstractVirtualHostNode method getSupportedVirtualHostTypes.

protected static Collection<String> getSupportedVirtualHostTypes(boolean includeProvided) {
    final Iterable<ConfiguredObjectRegistration> registrations = (new QpidServiceLoader()).instancesOf(ConfiguredObjectRegistration.class);
    Set<String> supportedTypes = new HashSet<>();
    for (ConfiguredObjectRegistration registration : registrations) {
        for (Class<? extends ConfiguredObject> typeClass : registration.getConfiguredObjectClasses()) {
            if (VirtualHost.class.isAssignableFrom(typeClass)) {
                ManagedObject annotation = typeClass.getAnnotation(ManagedObject.class);
                if (annotation.creatable() && annotation.defaultType().equals("") && !NonStandardVirtualHost.class.isAssignableFrom(typeClass)) {
                    supportedTypes.add(ConfiguredObjectTypeRegistry.getType(typeClass));
                }
            }
        }
    }
    if (includeProvided) {
        supportedTypes.add(ProvidedStoreVirtualHostImpl.VIRTUAL_HOST_TYPE);
    }
    return Collections.unmodifiableCollection(supportedTypes);
}
Also used : QpidServiceLoader(org.apache.qpid.server.plugin.QpidServiceLoader) ConfiguredObjectRegistration(org.apache.qpid.server.plugin.ConfiguredObjectRegistration) ManagedObject(org.apache.qpid.server.model.ManagedObject) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)2 ManagedObject (org.apache.qpid.server.model.ManagedObject)2 ConfiguredObjectRegistration (org.apache.qpid.server.plugin.ConfiguredObjectRegistration)2 QpidServiceLoader (org.apache.qpid.server.plugin.QpidServiceLoader)2