44039b820c2f284d80e482c5a3e536c602acb477
[controller.git] / opendaylight / md-sal / sal-dom-broker-config / src / main / java / org / opendaylight / controller / config / yang / md / sal / dom / impl / SchemaServiceImplSingletonModuleFactory.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.config.yang.md.sal.dom.impl;
9
10 import static com.google.common.base.Preconditions.checkArgument;
11
12 import org.opendaylight.controller.config.api.DependencyResolver;
13 import org.osgi.framework.BundleContext;
14
15 /**
16  * Deprecated.
17  *
18  * @deprecated Replaced by blueprint wiring
19  */
20 @Deprecated
21 public class SchemaServiceImplSingletonModuleFactory extends
22         org.opendaylight.controller.config.yang.md.sal.dom.impl.AbstractSchemaServiceImplSingletonModuleFactory {
23
24     public static final String SINGLETON_NAME = "yang-schema-service";
25
26     @Override
27     public SchemaServiceImplSingletonModule instantiateModule(String instanceName,
28             DependencyResolver dependencyResolver, SchemaServiceImplSingletonModule oldModule,
29             AutoCloseable oldInstance, BundleContext bundleContext) {
30         checkArgument(SINGLETON_NAME.equals(instanceName),
31                 "Illegal instance name '" + instanceName + "', only allowed name is " + SINGLETON_NAME);
32         SchemaServiceImplSingletonModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
33                 oldInstance, bundleContext);
34         // FIXME bundle context should not be passed around
35         module.setBundleContext(bundleContext);
36         return module;
37     }
38
39     @Override
40     public SchemaServiceImplSingletonModule instantiateModule(String instanceName,
41             DependencyResolver dependencyResolver, BundleContext bundleContext) {
42         checkArgument(SINGLETON_NAME.equals(instanceName),
43                 "Illegal instance name '" + instanceName + "', only allowed name is " + SINGLETON_NAME);
44         SchemaServiceImplSingletonModule module = super.instantiateModule(instanceName, dependencyResolver,
45                 bundleContext);
46         // FIXME bundle context should not be passed around
47         module.setBundleContext(bundleContext);
48         return module;
49     }
50 }