本文整理匯總了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;
}