當前位置: 首頁>>代碼示例>>Java>>正文


Java HierarchicalRuntimeBeanRegistration類代碼示例

本文整理匯總了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());
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:10,代碼來源:TestingScheduledThreadPoolImpl.java

示例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;
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:13,代碼來源:RuntimeBeanRegistratorImplTest.java

示例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());
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:9,代碼來源:RuntimeBeanRegistratorImplTest.java

示例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;
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:61,代碼來源:RuntimeRegistratorFtlTemplate.java


注:本文中的org.opendaylight.controller.config.api.runtime.HierarchicalRuntimeBeanRegistration類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。