本文整理汇总了Java中org.opendaylight.controller.config.api.runtime.HierarchicalRuntimeBeanRegistration类的典型用法代码示例。如果您正苦于以下问题:Java HierarchicalRuntimeBeanRegistration类的具体用法?Java HierarchicalRuntimeBeanRegistration怎么用?Java HierarchicalRuntimeBeanRegistration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HierarchicalRuntimeBeanRegistration类属于org.opendaylight.controller.config.api.runtime包,在下文中一共展示了HierarchicalRuntimeBeanRegistration类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TestingScheduledThreadPoolImpl
import org.opendaylight.controller.config.api.runtime.HierarchicalRuntimeBeanRegistration; //导入依赖的package包/类
public TestingScheduledThreadPoolImpl(final RootRuntimeBeanRegistrator runtimeBeanRegistrator,
final int corePoolSize) {
this.runtimeBeanRegistrator = runtimeBeanRegistrator;
executor = new ScheduledThreadPoolExecutor(corePoolSize);
ALLEXECUTORS.add(executor);
HierarchicalRuntimeBeanRegistration hierarchicalRuntimeBeanRegistration = runtimeBeanRegistrator
.registerRoot(new TestingScheduledRuntimeBean());
hierarchicalRuntimeBeanRegistration.register("a", "b", new TestingScheduledRuntimeBean());
}
示例2: createAdditional
import org.opendaylight.controller.config.api.runtime.HierarchicalRuntimeBeanRegistration; //导入依赖的package包/类
private HierarchicalRuntimeBeanRegistration createAdditional(
final HierarchicalRuntimeBeanRegistrationImpl rootRegistration) throws Exception {
HierarchicalRuntimeBeanRegistrationImpl registration = rootRegistration.register(additionalKey, additionalValue,
new TestingRuntimeBean());
ObjectName expectedON1 = ObjectNameUtil.createRuntimeBeanName(MODULE1, INSTANCE_NAME, additionalProperties);
assertEquals(expectedON1, registration.getObjectName());
checkExists(registration.getObjectName());
return registration;
}
示例3: testCloseRegistrator
import org.opendaylight.controller.config.api.runtime.HierarchicalRuntimeBeanRegistration; //导入依赖的package包/类
@Test
public void testCloseRegistrator() throws Exception {
HierarchicalRuntimeBeanRegistrationImpl rootRegistration = createRoot();
HierarchicalRuntimeBeanRegistration childRegistration = createAdditional(rootRegistration);
tested.close();
checkNotExists(rootRegistration.getObjectName());
checkNotExists(childRegistration.getObjectName());
}
示例4: create
import org.opendaylight.controller.config.api.runtime.HierarchicalRuntimeBeanRegistration; //导入依赖的package包/类
/**
* Get registrator and n registration ftls where n is equal to total number
* of runtime beans in hierarchy.
*/
public static Map<String, FtlTemplate> create(RuntimeBeanEntry rootRB) {
checkArgument(rootRB.isRoot(), "RuntimeBeanEntry must be root");
String registratorName = getJavaNameOfRuntimeRegistrator(rootRB);
List<MethodDefinition> methods = new ArrayList<>();
Field rootRuntimeBeanRegistratorField = new Field(
Collections.singletonList(Modifier.FINAL),
RootRuntimeBeanRegistrator.class.getName(),
"rootRuntimeBeanRegistrator");
List<Field> constructorParameters = Lists
.newArrayList(rootRuntimeBeanRegistratorField);
String constructorBody = constructConstructorBody(constructorParameters);
MethodDefinition constructor = MethodDefinition.createConstructor(
registratorName, constructorParameters, constructorBody);
methods.add(constructor);
LinkedHashMap<String, RuntimeRegistratorFtlTemplate> RuntimeRegistratorFtlTemplates =
createRegistrationHierarchy(rootRB, Collections.emptySet());
RuntimeRegistratorFtlTemplate rootFtlFile = RuntimeRegistratorFtlTemplates
.values().iterator().next();
{// add register(rootruntimemxbean)
String fullyQualifiedNameOfMXBean = FullyQualifiedNameHelper
.getFullyQualifiedName(rootRB.getPackageName(), rootRB.getJavaNameOfRuntimeMXBean());
String childRegistratorFQN = rootFtlFile.getFullyQualifiedName();
Field rbParameter = new Field(fullyQualifiedNameOfMXBean, "rb");
String registerBody = format("%s %s = this.%s.registerRoot(%s);\n"
+ "return new %s(%2$s);\n",
HierarchicalRuntimeBeanRegistration.class.getCanonicalName(),
hierachicalRegistration.getName(),
rootRuntimeBeanRegistratorField.getName(),
rbParameter.getName(),
rootFtlFile.getFullyQualifiedName());
MethodDefinition registerMethod = new MethodDefinition(
childRegistratorFQN, "register",
Collections.singletonList(rbParameter), registerBody);
methods.add(registerMethod);
}
MethodDefinition closeRegistrator = createCloseMethodToCloseField(rootRuntimeBeanRegistratorField);
methods.add(closeRegistrator);
// TODO add header
GeneralClassTemplate registrator = new GeneralClassTemplate(null,
rootRB.getPackageName(), registratorName,
Collections.emptyList(), Collections.singletonList(Closeable.class
.getCanonicalName()), constructorParameters, methods);
checkState(!RuntimeRegistratorFtlTemplates.containsKey(registrator
.getTypeDeclaration().getName()), "Name conflict: "
+ registrator.getTypeDeclaration().getName());
Map<String, FtlTemplate> result = new HashMap<>();
result.putAll(RuntimeRegistratorFtlTemplates);
result.put(registrator.getTypeDeclaration().getName(), registrator);
return result;
}