2 * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.config.manager.testingservices.parallelapsp;
10 import java.util.Collections;
11 import java.util.HashSet;
13 import javax.annotation.concurrent.ThreadSafe;
14 import javax.management.ObjectName;
15 import org.opendaylight.controller.config.api.DependencyResolver;
16 import org.opendaylight.controller.config.api.DependencyResolverFactory;
17 import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
18 import org.opendaylight.controller.config.api.ModuleIdentifier;
19 import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface;
20 import org.opendaylight.controller.config.spi.Module;
21 import org.opendaylight.controller.config.spi.ModuleFactory;
22 import org.osgi.framework.BundleContext;
25 public class TestingParallelAPSPModuleFactory implements ModuleFactory {
27 public static final String NAME = "parallel";
30 public String getImplementationName() {
35 public TestingParallelAPSPModule createModule(final String instanceName,
36 final DependencyResolver dependencyResolver, final BundleContext bundleContext) {
37 return new TestingParallelAPSPModule(new ModuleIdentifier(NAME, instanceName), dependencyResolver, null, null);
41 public TestingParallelAPSPModule createModule(final String instanceName,
42 final DependencyResolver dependencyResolver, final DynamicMBeanWithInstance old,
43 final BundleContext context) throws Exception {
44 TestingParallelAPSPImpl oldInstance;
46 oldInstance = (TestingParallelAPSPImpl) old.getInstance();
47 } catch (final ClassCastException e) {
50 TestingParallelAPSPModule result = new TestingParallelAPSPModule(new ModuleIdentifier(NAME, instanceName),
51 dependencyResolver, old.getInstance(), oldInstance);
53 String someParam = (String) old.getAttribute("SomeParam");
54 result.setSomeParam(someParam);
55 ObjectName threadPool = (ObjectName) old.getAttribute("ThreadPool");
56 result.setThreadPool(threadPool);
61 public boolean isModuleImplementingServiceInterface(
62 final Class<? extends AbstractServiceInterface> serviceInterface) {
67 public Set<Module> getDefaultModules(final DependencyResolverFactory dependencyResolverFactory,
68 final BundleContext context) {
69 return new HashSet<>();
73 public Set<Class<? extends AbstractServiceInterface>> getImplementedServiceIntefaces() {
74 return Collections.emptySet();