当前位置: 首页>>代码示例>>Java>>正文


Java AbstractServiceInterface类代码示例

本文整理汇总了Java中org.opendaylight.controller.config.api.annotations.AbstractServiceInterface的典型用法代码示例。如果您正苦于以下问题:Java AbstractServiceInterface类的具体用法?Java AbstractServiceInterface怎么用?Java AbstractServiceInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AbstractServiceInterface类属于org.opendaylight.controller.config.api.annotations包,在下文中一共展示了AbstractServiceInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isModuleImplementingServiceInterface

import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
@Override
public boolean isModuleImplementingServiceInterface(
        final Class<? extends AbstractServiceInterface> serviceInterface) {
    Class<?>[] classes = configBeanClass.getInterfaces();
    List<Class<?>> ifc = Arrays.asList(classes);
    if (ifc.contains(serviceInterface)) {
        return true;
    }
    for (Class<?> c : classes) {
        ifc = Arrays.asList(c.getInterfaces());
        if (ifc.contains(serviceInterface)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:ClassBasedModuleFactory.java

示例2: serviceInterfaceFromSie

import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
public static GeneralInterfaceTemplate serviceInterfaceFromSie(
        final ServiceInterfaceEntry sie) {

    final List<String> extendedInterfaces = Lists
            .newArrayList(AbstractServiceInterface.class.getCanonicalName());
    if (sie.getBase().isPresent()) {
        extendedInterfaces.add(sie.getBase().get().getFullyQualifiedName());
    }

    // FIXME header
    final GeneralInterfaceTemplate sieTemplate = new GeneralInterfaceTemplate(
            getHeaderFromEntry(sie), sie.getPackageName(),
            sie.getTypeName(), extendedInterfaces,
            Lists.<MethodDeclaration> newArrayList());
    sieTemplate.setJavadoc(sie.getNullableDescription());

    if (sie.getNullableDescription() != null) {
        sieTemplate.getAnnotations().add(
                Annotation.createDescriptionAnnotation(sie
                        .getNullableDescription()));
    }
    sieTemplate.getAnnotations().addAll(Annotation.createSieAnnotations(sie));

    return sieTemplate;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:26,代码来源:TemplateFactory.java

示例3: getServiceInterfaces

import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
/**
 * Get all implemented interfaces that have
 * {@link org.opendaylight.controller.config.api.annotations.ServiceInterfaceAnnotation}
 * annotation.
 *
 * @param configBeanClass
 *            config bean class
 * @return set containing classes
 */
public static Set<Class<?>> getServiceInterfaces(final Class<? extends Module> configBeanClass) {
    Set<Class<?>> allInterfaces = getAllInterfaces(configBeanClass);
    Set<Class<?>> result = new HashSet<>();
    for (Class<?> clazz : allInterfaces) {
        if (AbstractServiceInterface.class.isAssignableFrom(clazz)) {
            ServiceInterfaceAnnotation annotation = clazz.getAnnotation(ServiceInterfaceAnnotation.class);
            if (annotation != null) {
                result.add(clazz);
            }
        }
    }
    return result;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:23,代码来源:InterfacesHelper.java

示例4: getAllAbstractServiceClasses

import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
public static Set<Class<? extends AbstractServiceInterface>> getAllAbstractServiceClasses(
        final Class<? extends Module> configBeanClass) {

    Set<Class<? extends AbstractServiceInterface>> foundGeneratedSIClasses = new HashSet<>();
    for (Class<?> clazz : getAllInterfaces(configBeanClass)) {
        if (AbstractServiceInterface.class.isAssignableFrom(clazz)
                && !AbstractServiceInterface.class.equals(clazz)) {
            foundGeneratedSIClasses.add((Class<? extends AbstractServiceInterface>) clazz);
        }
    }
    return getAllAbstractServiceInterfaceClasses(foundGeneratedSIClasses);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:13,代码来源:InterfacesHelper.java

示例5: getServiceInterfaceAnnotations

import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
private static Set<ServiceInterfaceAnnotation> getServiceInterfaceAnnotations(
        final Set<Class<? extends AbstractServiceInterface>> implementedServiceIntefaces) {
    Set<Class<? extends AbstractServiceInterface>> inspected = getAllAbstractServiceInterfaceClasses(
            implementedServiceIntefaces);
    Set<ServiceInterfaceAnnotation> result = new HashSet<>();
    // SIs can form hierarchies, inspect superclass until it does not extend
    // AbstractSI
    for (Class<?> clazz : inspected) {
        ServiceInterfaceAnnotation annotation = clazz.getAnnotation(ServiceInterfaceAnnotation.class);
        if (annotation != null) {
            result.add(annotation);
        }
    }
    return Collections.unmodifiableSet(result);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:16,代码来源:InterfacesHelper.java

示例6: getAllAbstractServiceInterfaceClasses

import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
static Set<Class<? extends AbstractServiceInterface>> getAllAbstractServiceInterfaceClasses(
        final Set<Class<? extends AbstractServiceInterface>> directlyImplementedAbstractSIs) {

    Set<Class<?>> allInterfaces = getAllSuperInterfaces(directlyImplementedAbstractSIs);
    Set<Class<? extends AbstractServiceInterface>> result = new HashSet<>();
    for (Class<?> ifc : allInterfaces) {
        if (AbstractServiceInterface.class.isAssignableFrom(ifc) && !ifc.equals(AbstractServiceInterface.class)) {
            result.add((Class<? extends AbstractServiceInterface>) ifc);
        }
    }
    return result;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:13,代码来源:InterfacesHelper.java

示例7: assertRequireInterfaceAnnotationHasCorrectValue

import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
private static void assertRequireInterfaceAnnotationHasCorrectValue(final Class<?> clazz, final String methodName,
        final Set<Class<?>> inspectedInterfaces, final Class<? extends AbstractServiceInterface> expectedValue) {
    Method setter = findMethod(clazz, methodName);
    RequireInterface found = AttributeHolder.findRequireInterfaceAnnotation(setter, inspectedInterfaces);
    if (expectedValue == null) {
        assertNull(found);
    } else {
        assertNotNull(found);
        assertEquals(expectedValue, found.value());
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:12,代码来源:AnnotationsTest.java

示例8: testGetAllAbstractServiceInterfaceClasses

import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
@Test
public void testGetAllAbstractServiceInterfaceClasses() {
    Class<? extends AbstractServiceInterface> clazz = TestingScheduledThreadPoolServiceInterface.class;
    Set<Class<? extends AbstractServiceInterface>> input = new HashSet<>();
    input.add(clazz);
    Set<Class<? extends AbstractServiceInterface>> result = InterfacesHelper
            .getAllAbstractServiceInterfaceClasses(input);

    Set<Class<?>> expected = ImmutableSet.of((Class<?>) TestingScheduledThreadPoolServiceInterface.class,
            TestingThreadPoolServiceInterface.class);
    assertEquals(expected, result);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:13,代码来源:InterfacesHelperTest.java

示例9: getServiceIfcsInitialization

import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
private static String getServiceIfcsInitialization(List<FullyQualifiedName> providedServices) {
    String generic = format("Class<? extends %s>", AbstractServiceInterface.class.getCanonicalName());

    StringBuilder result = new StringBuilder("static {\n");
    if (!providedServices.isEmpty()) {
        result.append(format("java.util.Set<%1$s> serviceIfcs2 = new java.util.HashSet<>();\n", generic));

        for (FullyQualifiedName fqn : providedServices) {
            result.append(format("serviceIfcs2.add(%s.class);\n", fqn));
        }

        result.append("serviceIfcs = java.util.Collections.unmodifiableSet(serviceIfcs2);\n");
    } else {
        result.append("serviceIfcs = java.util.Collections.emptySet();\n");
    }
    result.append("}\n");

    // add isModuleImplementingServiceInterface and getImplementedServiceIntefaces methods

    result.append(format("\n"
            + "@Override\n"
            + "public final boolean isModuleImplementingServiceInterface(Class<? extends %1$s> serviceInterface) "
            + "{\n"
            + "for (Class<?> ifc: serviceIfcs) {\n"
            + "if (serviceInterface.isAssignableFrom(ifc)){\n"
            + "return true;\n"
            + "}\n"
            + "}\n"
            + "return false;\n"
            + "}\n"
            + "\n"
            + "@Override\n"
            + "public java.util.Set<Class<? extends %1$s>> getImplementedServiceIntefaces() {\n"
            + "return serviceIfcs;\n"
            + "}\n", AbstractServiceInterface.class.getCanonicalName()));

    return result.toString();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:39,代码来源:AbsFactoryGeneratedObjectFactory.java

示例10: validateDependency

import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
// TODO: check for cycles
@Override
public void validateDependency(final Class<? extends AbstractServiceInterface> expectedServiceInterface,
        final ObjectName dependentReadOnlyON, final JmxAttribute jmxAttribute) {

    this.transactionStatus.checkNotCommitted();
    if (expectedServiceInterface == null) {
        throw new NullPointerException("Parameter 'expectedServiceInterface' is null");
    }
    if (jmxAttribute == null) {
        throw new NullPointerException("Parameter 'jmxAttribute' is null");
    }

    JmxAttributeValidationException.checkNotNull(dependentReadOnlyON,
            "is null, expected dependency implementing " + expectedServiceInterface, jmxAttribute);

    // check that objectName belongs to this transaction - this should be
    // stripped
    // in DynamicWritableWrapper
    final boolean hasTransaction = ObjectNameUtil.getTransactionName(dependentReadOnlyON) != null;
    JmxAttributeValidationException.checkCondition(!hasTransaction,
            String.format("ObjectName should not contain " + "transaction name. %s set to %s. ", jmxAttribute,
                    dependentReadOnlyON),
            jmxAttribute);

    final ObjectName newDependentReadOnlyON = translateServiceRefIfPossible(dependentReadOnlyON);

    final ModuleIdentifier moduleIdentifier = ObjectNameUtil.fromON(newDependentReadOnlyON,
            ObjectNameUtil.TYPE_MODULE);

    final ModuleFactory foundFactory = this.modulesHolder.findModuleFactory(moduleIdentifier, jmxAttribute);

    final boolean implementsSI = foundFactory.isModuleImplementingServiceInterface(expectedServiceInterface);
    if (!implementsSI) {
        final String message = String.format(
                "Found module factory does not expose expected service interface. "
                        + "Module name is %s : %s, expected service interface %s, dependent module ON %s , "
                        + "attribute %s",
                foundFactory.getImplementationName(), foundFactory, expectedServiceInterface,
                newDependentReadOnlyON, jmxAttribute);
        throw new JmxAttributeValidationException(message, jmxAttribute);
    }
    synchronized (this) {
        this.dependencies.add(moduleIdentifier);
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:50,代码来源:DependencyResolverImpl.java

示例11: isModuleImplementingServiceInterface

import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
@Override
public boolean isModuleImplementingServiceInterface(
        final Class<? extends AbstractServiceInterface> serviceInterface) {
    return ifc.contains(serviceInterface);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:6,代码来源:TestingScheduledThreadPoolModuleFactory.java

示例12: getImplementedServiceIntefaces

import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
@Override
public Set<Class<? extends AbstractServiceInterface>> getImplementedServiceIntefaces() {
    return ifc;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:5,代码来源:TestingScheduledThreadPoolModuleFactory.java

示例13: isModuleImplementingServiceInterface

import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
@Override
public boolean isModuleImplementingServiceInterface(
        final Class<? extends AbstractServiceInterface> serviceInterface) {
    return IFC.contains(serviceInterface);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:6,代码来源:TestingFixedThreadPoolModuleFactory.java

示例14: getImplementedServiceIntefaces

import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
@Override
public Set<Class<? extends AbstractServiceInterface>> getImplementedServiceIntefaces() {
    return IFC;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:5,代码来源:TestingFixedThreadPoolModuleFactory.java

示例15: isModuleImplementingServiceInterface

import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
@Override
public boolean isModuleImplementingServiceInterface(
        final Class<? extends AbstractServiceInterface> serviceInterface) {
    return false;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:6,代码来源:TestingParallelAPSPModuleFactory.java


注:本文中的org.opendaylight.controller.config.api.annotations.AbstractServiceInterface类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。