Search in sources :

Example 6 with ServiceInterfaceAnnotation

use of org.opendaylight.controller.config.api.annotations.ServiceInterfaceAnnotation in project controller by opendaylight.

the class InterfacesHelper method getOsgiRegistrationTypes.

/**
 * Get OSGi registration types under which config bean instance should be
 * registered. This is specified in
 * {@link org.opendaylight.controller.config.api.annotations.ServiceInterfaceAnnotation#osgiRegistrationType()}
 *
 * @param configBeanClass config bean class
 * @return set of classes
 */
public static Set<Class<?>> getOsgiRegistrationTypes(final Class<? extends Module> configBeanClass) {
    Set<Class<?>> serviceInterfaces = getServiceInterfaces(configBeanClass);
    Set<Class<?>> result = new HashSet<>();
    for (Class<?> clazz : serviceInterfaces) {
        ServiceInterfaceAnnotation annotation = clazz.getAnnotation(ServiceInterfaceAnnotation.class);
        result.add(annotation.osgiRegistrationType());
    }
    return result;
}
Also used : ServiceInterfaceAnnotation(org.opendaylight.controller.config.api.annotations.ServiceInterfaceAnnotation) HashSet(java.util.HashSet)

Example 7 with ServiceInterfaceAnnotation

use of org.opendaylight.controller.config.api.annotations.ServiceInterfaceAnnotation in project controller by opendaylight.

the class InterfacesHelper method getServiceInterfaceAnnotations.

private static Set<ServiceInterfaceAnnotation> getServiceInterfaceAnnotations(final Set<Class<? extends AbstractServiceInterface>> implementedServiceIntefaces) {
    Set<Class<? extends AbstractServiceInterface>> inspected = getAllAbstractServiceInterfaceClasses(implementedServiceIntefaces);
    Set<ServiceInterfaceAnnotation> result = new HashSet<>();
    // AbstractSI
    for (Class<?> clazz : inspected) {
        ServiceInterfaceAnnotation annotation = clazz.getAnnotation(ServiceInterfaceAnnotation.class);
        if (annotation != null) {
            result.add(annotation);
        }
    }
    return Collections.unmodifiableSet(result);
}
Also used : ServiceInterfaceAnnotation(org.opendaylight.controller.config.api.annotations.ServiceInterfaceAnnotation) AbstractServiceInterface(org.opendaylight.controller.config.api.annotations.AbstractServiceInterface) HashSet(java.util.HashSet)

Aggregations

ServiceInterfaceAnnotation (org.opendaylight.controller.config.api.annotations.ServiceInterfaceAnnotation)7 HashSet (java.util.HashSet)4 InstanceAlreadyExistsException (javax.management.InstanceAlreadyExistsException)3 ObjectName (javax.management.ObjectName)3 ModuleIdentifier (org.opendaylight.controller.config.api.ModuleIdentifier)3 Module (org.opendaylight.controller.config.spi.Module)2 BundleContext (org.osgi.framework.BundleContext)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 GuardedBy (javax.annotation.concurrent.GuardedBy)1 InstanceNotFoundException (javax.management.InstanceNotFoundException)1 DependencyResolver (org.opendaylight.controller.config.api.DependencyResolver)1 RuntimeBeanRegistratorAwareModule (org.opendaylight.controller.config.api.RuntimeBeanRegistratorAwareModule)1 AbstractServiceInterface (org.opendaylight.controller.config.api.annotations.AbstractServiceInterface)1 CommitStatus (org.opendaylight.controller.config.api.jmx.CommitStatus)1 DestroyedModule (org.opendaylight.controller.config.manager.impl.dependencyresolver.DestroyedModule)1 ModuleInternalTransactionalInfo (org.opendaylight.controller.config.manager.impl.dependencyresolver.ModuleInternalTransactionalInfo)1 DynamicReadableWrapper (org.opendaylight.controller.config.manager.impl.dynamicmbean.DynamicReadableWrapper)1