本文整理汇总了Java中org.opendaylight.controller.config.api.runtime.RootRuntimeBeanRegistrator类的典型用法代码示例。如果您正苦于以下问题:Java RootRuntimeBeanRegistrator类的具体用法?Java RootRuntimeBeanRegistrator怎么用?Java RootRuntimeBeanRegistrator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RootRuntimeBeanRegistrator类属于org.opendaylight.controller.config.api.runtime包,在下文中一共展示了RootRuntimeBeanRegistrator类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRuntimeRegistratorCode
import org.opendaylight.controller.config.api.runtime.RootRuntimeBeanRegistrator; //导入依赖的package包/类
private static String getRuntimeRegistratorCode(Optional<FullyQualifiedName> maybeRegistratorType) {
if (maybeRegistratorType.isPresent()) {
String registratorType = maybeRegistratorType.get().toString();
return "\n"+
format("private %s rootRuntimeBeanRegistratorWrapper;\n", registratorType)+
"\n"+
format("public %s getRootRuntimeBeanRegistratorWrapper(){\n", registratorType)+
"return rootRuntimeBeanRegistratorWrapper;\n"+
"}\n"+
"\n"+
"@Override\n"+
format("public void setRuntimeBeanRegistrator(%s rootRuntimeRegistrator){\n", RootRuntimeBeanRegistrator.class.getCanonicalName())+
format("this.rootRuntimeBeanRegistratorWrapper = new %s(rootRuntimeRegistrator);\n", registratorType)+
"}\n";
} else {
return "";
}
}
示例2: TestingScheduledThreadPoolImpl
import org.opendaylight.controller.config.api.runtime.RootRuntimeBeanRegistrator; //导入依赖的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());
}
示例3: setRuntimeBeanRegistrator
import org.opendaylight.controller.config.api.runtime.RootRuntimeBeanRegistrator; //导入依赖的package包/类
@Override
public void setRuntimeBeanRegistrator(final RootRuntimeBeanRegistrator runtimeBeanRegistrator) {
this.runtimeBeanRegistrator = runtimeBeanRegistrator;
}
示例4: create
import org.opendaylight.controller.config.api.runtime.RootRuntimeBeanRegistrator; //导入依赖的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;
}
示例5: setRuntimeBeanRegistrator
import org.opendaylight.controller.config.api.runtime.RootRuntimeBeanRegistrator; //导入依赖的package包/类
/**
* Configuration framework will call this setter on all modules implementing
* this interface. It is responsibility of modules or rather their instances
* to close registrator in their {@link java.io.Closeable#close()} method. Same
* module will get the same registrator during reconfiguration.
*
* @param rootRuntimeBeanRegistrator root bean
*/
void setRuntimeBeanRegistrator(
RootRuntimeBeanRegistrator rootRuntimeBeanRegistrator);