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 javax.annotation.concurrent.ThreadSafe;
11 import javax.management.ObjectName;
13 import org.opendaylight.controller.config.api.DependencyResolver;
14 import org.opendaylight.controller.config.api.DependencyResolverFactory;
15 import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
16 import org.opendaylight.controller.config.api.ModuleIdentifier;
17 import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface;
18 import org.opendaylight.controller.config.spi.Module;
19 import org.opendaylight.controller.config.spi.ModuleFactory;
21 import java.util.HashSet;
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) {
37 return new TestingParallelAPSPModule(new ModuleIdentifier(NAME,
38 instanceName), dependencyResolver, null, null);
42 public TestingParallelAPSPModule createModule(String instanceName,
43 DependencyResolver dependencyResolver, DynamicMBeanWithInstance old)
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) {
70 return new HashSet<Module>();