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 org.opendaylight.controller.config.api.DependencyResolver;
11 import org.opendaylight.controller.config.api.DependencyResolverFactory;
12 import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
13 import org.opendaylight.controller.config.api.ModuleIdentifier;
14 import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface;
15 import org.opendaylight.controller.config.spi.Module;
16 import org.opendaylight.controller.config.spi.ModuleFactory;
17 import org.osgi.framework.BundleContext;
19 import javax.annotation.concurrent.ThreadSafe;
20 import javax.management.ObjectName;
21 import java.util.Collections;
22 import java.util.HashSet;
26 public class TestingParallelAPSPModuleFactory implements ModuleFactory {
28 public static final String NAME = "parallel";
31 public String getImplementationName() {
36 public TestingParallelAPSPModule createModule(String instanceName,
37 DependencyResolver dependencyResolver, BundleContext bundleContext) {
38 return new TestingParallelAPSPModule(new ModuleIdentifier(NAME,
39 instanceName), dependencyResolver, null, null);
43 public TestingParallelAPSPModule createModule(String instanceName,
44 DependencyResolver dependencyResolver, DynamicMBeanWithInstance old, BundleContext context)
46 TestingParallelAPSPImpl oldInstance;
48 oldInstance = (TestingParallelAPSPImpl) old.getInstance();
49 } catch (ClassCastException e) {
52 TestingParallelAPSPModule result = new TestingParallelAPSPModule(
53 new ModuleIdentifier(NAME, instanceName), dependencyResolver,
54 old.getInstance(), oldInstance);
56 String someParam = (String) old.getAttribute("SomeParam");
57 result.setSomeParam(someParam);
58 ObjectName threadPool = (ObjectName) old.getAttribute("ThreadPool");
59 result.setThreadPool(threadPool);
64 public boolean isModuleImplementingServiceInterface(
65 Class<? extends AbstractServiceInterface> serviceInterface) {
70 public Set<Module> getDefaultModules(DependencyResolverFactory dependencyResolverFactory, BundleContext context) {
71 return new HashSet<Module>();
75 public Set<Class<? extends AbstractServiceInterface>> getImplementedServiceIntefaces() {
76 return Collections.emptySet();