本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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());
}
}
示例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);
}
示例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();
}
示例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);
}
}
示例11: isModuleImplementingServiceInterface
import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
@Override
public boolean isModuleImplementingServiceInterface(
final Class<? extends AbstractServiceInterface> serviceInterface) {
return ifc.contains(serviceInterface);
}
示例12: getImplementedServiceIntefaces
import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
@Override
public Set<Class<? extends AbstractServiceInterface>> getImplementedServiceIntefaces() {
return ifc;
}
示例13: isModuleImplementingServiceInterface
import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
@Override
public boolean isModuleImplementingServiceInterface(
final Class<? extends AbstractServiceInterface> serviceInterface) {
return IFC.contains(serviceInterface);
}
示例14: getImplementedServiceIntefaces
import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
@Override
public Set<Class<? extends AbstractServiceInterface>> getImplementedServiceIntefaces() {
return IFC;
}
示例15: isModuleImplementingServiceInterface
import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface; //导入依赖的package包/类
@Override
public boolean isModuleImplementingServiceInterface(
final Class<? extends AbstractServiceInterface> serviceInterface) {
return false;
}