2 * Copyright (c) 2013 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(String instanceName,
36 DependencyResolver dependencyResolver, BundleContext bundleContext) {
37 return new TestingParallelAPSPModule(new ModuleIdentifier(NAME,
38 instanceName), dependencyResolver, null, null);
42 public TestingParallelAPSPModule createModule(String instanceName,
43 DependencyResolver dependencyResolver, DynamicMBeanWithInstance old, BundleContext context)
45 TestingParallelAPSPImpl oldInstance;
47 oldInstance = (TestingParallelAPSPImpl) old.getInstance();
48 } catch (ClassCastException e) {
51 TestingParallelAPSPModule result = new TestingParallelAPSPModule(
52 new ModuleIdentifier(NAME, instanceName), dependencyResolver,
53 old.getInstance(), oldInstance);
55 String someParam = (String) old.getAttribute("SomeParam");
56 result.setSomeParam(someParam);
57 ObjectName threadPool = (ObjectName) old.getAttribute("ThreadPool");
58 result.setThreadPool(threadPool);
63 public boolean isModuleImplementingServiceInterface(
64 Class<? extends AbstractServiceInterface> serviceInterface) {
69 public Set<Module> getDefaultModules(DependencyResolverFactory dependencyResolverFactory, BundleContext context) {
70 return new HashSet<Module>();
74 public Set<Class<? extends AbstractServiceInterface>> getImplementedServiceIntefaces() {
75 return Collections.emptySet();