• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DependencyResolver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.opendaylight.controller.config.api.DependencyResolver的典型用法代码示例。如果您正苦于以下问题:Java DependencyResolver类的具体用法?Java DependencyResolver怎么用?Java DependencyResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DependencyResolver类属于org.opendaylight.controller.config.api包,在下文中一共展示了DependencyResolver类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testCreateInstance

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
@Test
public void testCreateInstance() throws Exception {
    // configure mocks
    DependencyResolver dependencyResolver = mock(DependencyResolver.class);
    BindingAwareBroker broker = mock(BindingAwareBroker.class);
    when(dependencyResolver.resolveInstance(eq(BindingAwareBroker.class), any(ObjectName.class), any(JmxAttribute.class))).thenReturn(broker);

    // create instance of module with injected mocks
    HelloModule module = new HelloModule(mock(ModuleIdentifier.class), dependencyResolver);

    // getInstance calls resolveInstance to get the broker dependency and then calls createInstance
    AutoCloseable closeable = module.getInstance();

    // verify that the module registered the returned provider with the broker
    verify(broker).registerProvider((HelloProvider)closeable);

    // ensure no exceptions on close
    closeable.close();
}
 
开发者ID:lrodrin,项目名称:opendaylight,代码行数:20,代码来源:HelloModuleTest.java


示例2: testCreateInstance

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
@Test
public void testCreateInstance() throws Exception {
    // configure mocks
    DependencyResolver dependencyResolver = mock(DependencyResolver.class);
    BindingAwareBroker broker = mock(BindingAwareBroker.class);
    when(dependencyResolver.resolveInstance(eq(BindingAwareBroker.class), any(ObjectName.class), any(JmxAttribute.class))).thenReturn(broker);

    // create instance of module with injected mocks
    SdnaModule module = new SdnaModule(mock(ModuleIdentifier.class), dependencyResolver);

    // getInstance calls resolveInstance to get the broker dependency and then calls createInstance
    AutoCloseable closeable = module.getInstance();

    // verify that the module registered the returned provider with the broker
    verify(broker).registerProvider((SdnaProvider)closeable);

    // ensure no exceptions on close
    closeable.close();
}
 
开发者ID:hashcms,项目名称:sdna,代码行数:20,代码来源:SdnaModuleTest.java


示例3: createModule

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
@Override
public synchronized ObjectName createModule(final String factoryName, final String instanceName)
        throws InstanceAlreadyExistsException {

    transactionStatus.checkNotCommitStarted();
    transactionStatus.checkNotAborted();
    ModuleIdentifier moduleIdentifier = new ModuleIdentifier(factoryName, instanceName);
    dependencyResolverManager.assertNotExists(moduleIdentifier);

    // find factory
    ModuleFactory moduleFactory = factoriesHolder.findByModuleName(factoryName);

    DependencyResolver dependencyResolver = dependencyResolverManager.getOrCreate(moduleIdentifier);
    BundleContext bundleContext = getModuleFactoryBundleContext(moduleFactory.getImplementationName());
    Module module = moduleFactory.createModule(instanceName, dependencyResolver, bundleContext);
    boolean defaultBean = false;
    return putConfigBeanToJMXAndInternalMaps(moduleIdentifier, module, moduleFactory, null, dependencyResolver,
            defaultBean, bundleContext);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:ConfigTransactionControllerImpl.java


示例4: createModule

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
@Override
public Module createModule(final String instanceName, final DependencyResolver dependencyResolver,
        final DynamicMBeanWithInstance old, final BundleContext bundleContext) throws Exception {
    TestingScheduledThreadPoolImpl oldInstance;
    try {
        oldInstance = (TestingScheduledThreadPoolImpl) old.getInstance();
    } catch (final ClassCastException e) {
        // happens after OSGi update
        oldInstance = null;
    }

    TestingScheduledThreadPoolModule configBean = new TestingScheduledThreadPoolModule(
            new ModuleIdentifier(NAME, instanceName), old.getInstance(), oldInstance);
    // copy attributes
    configBean.setRecreate((Boolean) old.getAttribute("Recreate"));
    return configBean;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:TestingScheduledThreadPoolModuleFactory.java


示例5: createModule

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
@Override
public Module createModule(final String instanceName, final DependencyResolver dependencyResolver,
        final DynamicMBeanWithInstance old, final BundleContext bundleContext) throws Exception {
    int threadCount = (Integer) old.getAttribute("ThreadCount");
    // is the instance compatible?
    TestingFixedThreadPool oldInstance;
    try {
        // reconfigure existing instance
        oldInstance = (TestingFixedThreadPool) old.getInstance();
    } catch (final ClassCastException e) {
        // old instance will be closed, new needs to be created
        oldInstance = null;
    }
    TestingFixedThreadPoolModule result = new TestingFixedThreadPoolModule(new ModuleIdentifier(NAME, instanceName),
            old.getInstance(), oldInstance);
    result.setThreadCount(threadCount);
    return result;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:TestingFixedThreadPoolModuleFactory.java


示例6: createModule

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
@Override
public TestingParallelAPSPModule createModule(final String instanceName,
        final DependencyResolver dependencyResolver, final DynamicMBeanWithInstance old,
        final BundleContext context) throws Exception {
    TestingParallelAPSPImpl oldInstance;
    try {
        oldInstance = (TestingParallelAPSPImpl) old.getInstance();
    } catch (final ClassCastException e) {
        oldInstance = null;
    }
    TestingParallelAPSPModule result = new TestingParallelAPSPModule(new ModuleIdentifier(NAME, instanceName),
            dependencyResolver, old.getInstance(), oldInstance);
    // copy attributes
    String someParam = (String) old.getAttribute("SomeParam");
    result.setSomeParam(someParam);
    ObjectName threadPool = (ObjectName) old.getAttribute("ThreadPool");
    result.setThreadPool(threadPool);
    return result;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:TestingParallelAPSPModuleFactory.java


示例7: constructModule

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
private Module constructModule(final String instanceName, final DependencyResolver dependencyResolver,
        final DynamicMBeanWithInstance old)
        throws InstantiationException, IllegalAccessException, InvocationTargetException {
    Preconditions.checkNotNull(dependencyResolver);
    ModuleIdentifier moduleIdentifier = new ModuleIdentifier(implementationName, instanceName);
    Constructor<? extends Module> declaredConstructor;
    try {
        declaredConstructor = configBeanClass.getDeclaredConstructor(DynamicMBeanWithInstance.class,
                ModuleIdentifier.class);
    } catch (final NoSuchMethodException e) {
        throw new IllegalStateException(
                "Did not find constructor with parameters (DynamicMBeanWithInstance) in " + configBeanClass, e);
    }
    Preconditions.checkState(declaredConstructor != null);
    return declaredConstructor.newInstance(old, moduleIdentifier);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:ClassBasedModuleFactory.java


示例8: createModule

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
@Override
public Module createModule(String instanceName,
                           DependencyResolver dependencyResolver,
                           DynamicMBeanWithInstance old,
                           BundleContext bundleContext)
        throws Exception {

    MessageBusAppImplModule module =
            (MessageBusAppImplModule) super.createModule(instanceName,
                    dependencyResolver,
                    old,
                    bundleContext);

    module.setBundleContext(bundleContext);

    return module;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:MessageBusAppImplModuleFactory.java


示例9: testCreateInstance

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
@Test
public void testCreateInstance() throws Exception {
    // configure mocks
    DependencyResolver dependencyResolver = mock(DependencyResolver.class);
    BindingAwareBroker broker = mock(BindingAwareBroker.class);
    when(dependencyResolver.resolveInstance(eq(BindingAwareBroker.class), any(ObjectName.class), any(JmxAttribute.class))).thenReturn(broker);

    // create instance of module with injected mocks
    ExampleModule module = new ExampleModule(mock(ModuleIdentifier.class), dependencyResolver);

    // getInstance calls resolveInstance to get the broker dependency and then calls createInstance
    AutoCloseable closeable = module.getInstance();

    // verify that the module registered the returned provider with the broker
    verify(broker).registerProvider((ExampleProvider)closeable);

    // ensure no exceptions on close
    closeable.close();
}
 
开发者ID:geopet85,项目名称:odlexample,代码行数:20,代码来源:ExampleModuleTest.java


示例10: testCustomValidation

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
@Test
public void testCustomValidation() {
    HelloModule module = new HelloModule(mock(ModuleIdentifier.class), mock(DependencyResolver.class));

    // ensure no exceptions on validation
    // currently this method is empty
    module.customValidation();
}
 
开发者ID:lrodrin,项目名称:opendaylight,代码行数:9,代码来源:HelloModuleTest.java


示例11: testCustomValidation

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
@Test
public void testCustomValidation() {
    SdnaModule module = new SdnaModule(mock(ModuleIdentifier.class), mock(DependencyResolver.class));

    // ensure no exceptions on validation
    // currently this method is empty
    module.customValidation();
}
 
开发者ID:hashcms,项目名称:sdna,代码行数:9,代码来源:SdnaModuleTest.java


示例12: putConfigBeanToJMXAndInternalMaps

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
private synchronized ObjectName putConfigBeanToJMXAndInternalMaps(final ModuleIdentifier moduleIdentifier,
        final Module module, final ModuleFactory moduleFactory,
        @Nullable final ModuleInternalInfo maybeOldConfigBeanInfo, final DependencyResolver dependencyResolver,
        final boolean isDefaultBean, final BundleContext bundleContext) throws InstanceAlreadyExistsException {

    LOG.debug("Adding module {} to transaction {}", moduleIdentifier, this);
    if (!moduleIdentifier.equals(module.getIdentifier())) {
        throw new IllegalStateException("Incorrect name reported by module. Expected " + moduleIdentifier + ", got "
                + module.getIdentifier());
    }
    if (!dependencyResolver.getIdentifier().equals(moduleIdentifier)) {
        throw new IllegalStateException("Incorrect name reported by dependency resolver. Expected "
                + moduleIdentifier + ", got " + dependencyResolver.getIdentifier());
    }
    DynamicMBean writableDynamicWrapper = new DynamicWritableWrapper(module, moduleIdentifier,
            getTransactionIdentifier().getName(), readOnlyAtomicBoolean, transactionsMBeanServer,
            configMBeanServer);

    ObjectName writableON = ObjectNameUtil.createTransactionModuleON(getTransactionIdentifier().getName(),
            moduleIdentifier);
    // put wrapper to jmx
    TransactionModuleJMXRegistration transactionModuleJMXRegistration = getTxModuleJMXRegistrator()
            .registerMBean(writableDynamicWrapper, writableON);

    dependencyResolverManager.put(moduleIdentifier, module, moduleFactory, maybeOldConfigBeanInfo,
            transactionModuleJMXRegistration, isDefaultBean, bundleContext);
    return writableON;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:29,代码来源:ConfigTransactionControllerImpl.java


示例13: TestingParallelAPSPModule

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
public TestingParallelAPSPModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver,
        @Nullable final AutoCloseable oldCloseable, @Nullable final TestingParallelAPSPImpl oldInstance) {
    this.identifier = identifier;
    this.dependencyResolver = dependencyResolver;
    this.oldCloseable = oldCloseable;
    this.oldInstance = oldInstance;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:TestingParallelAPSPModule.java


示例14: createModule

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
@Override
public Module createModule(final String instanceName, final DependencyResolver dependencyResolver,
        final BundleContext bundleContext) {
    try {
        return constructModule(instanceName, dependencyResolver, null);
    } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:ClassBasedModuleFactory.java


示例15: instantiateModule

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
@Override
public GlobalEventExecutorModule instantiateModule(final String instanceName, final DependencyResolver dependencyResolver, final GlobalEventExecutorModule oldModule, final AutoCloseable oldInstance, final BundleContext bundleContext) {
    checkArgument(SINGLETON_NAME.equals(instanceName),"Illegal instance name '" + instanceName + "', only allowed name is " + SINGLETON_NAME);
    GlobalEventExecutorModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
            oldInstance, bundleContext);
    module.setBundleContext(bundleContext);
    return module;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:GlobalEventExecutorModuleFactory.java


示例16: instantiateModule

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
@Override
public HashedWheelTimerModule instantiateModule(final String instanceName, final DependencyResolver dependencyResolver,
        final HashedWheelTimerModule oldModule, final AutoCloseable oldInstance, final BundleContext bundleContext) {
    HashedWheelTimerModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
            oldInstance, bundleContext);
    module.setBundleContext(bundleContext);
    return module;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:HashedWheelTimerModuleFactory.java


示例17: instantiateModule

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
@Override
public NettyThreadgroupModule instantiateModule(final String instanceName, final DependencyResolver dependencyResolver,
        final NettyThreadgroupModule oldModule, final AutoCloseable oldInstance, final BundleContext bundleContext) {
    NettyThreadgroupModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule, oldInstance, bundleContext);
    module.setBundleContext(bundleContext);
    return module;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:NettyThreadgroupModuleFactory.java


示例18: getDefaultModules

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
@Override
public Set<ShutdownModule> getDefaultModules(final DependencyResolverFactory dependencyResolverFactory, final BundleContext bundleContext) {
    ModuleIdentifier id = new ModuleIdentifier(NAME, NAME);
    DependencyResolver dependencyResolver = dependencyResolverFactory.createDependencyResolver(id);
    ShutdownModule shutdownModule = instantiateModule(NAME, dependencyResolver, bundleContext);
    return new java.util.HashSet<>(Arrays.asList(shutdownModule));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:ShutdownModuleFactory.java


示例19: getNewConstructor

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
private static String getNewConstructor(FullyQualifiedName abstractFQN) {
    LinkedHashMap<String, String> parameters = new LinkedHashMap<>();
    parameters.put(ModuleIdentifier.class.getCanonicalName(), "identifier");
    parameters.put(DependencyResolver.class.getCanonicalName(), "dependencyResolver");
    String init = "super(identifier, dependencyResolver);\n";
    return getConstructorStart(abstractFQN, parameters, init);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:AbsModuleGeneratedObjectFactory.java


示例20: getCopyFromOldConstructor

import org.opendaylight.controller.config.api.DependencyResolver; //导入依赖的package包/类
private static String getCopyFromOldConstructor(FullyQualifiedName abstractFQN) {
    LinkedHashMap<String, String> parameters = new LinkedHashMap<>();
    parameters.put(ModuleIdentifier.class.getCanonicalName(), "identifier");
    parameters.put(DependencyResolver.class.getCanonicalName(), "dependencyResolver");
    parameters.put(abstractFQN.getTypeName(), "oldModule");
    parameters.put(AutoCloseable.class.getCanonicalName(), "oldInstance");
    String init = "super(identifier, dependencyResolver, oldModule, oldInstance);\n";
    return getConstructorStart(abstractFQN, parameters, init);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:AbsModuleGeneratedObjectFactory.java



注:本文中的org.opendaylight.controller.config.api.DependencyResolver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TagInfo类代码示例发布时间:2022-05-23
下一篇:
Java EditableWSDLInput类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap