2 * Copyright (c) 2014 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.yang.md.sal.dom.impl;
10 import java.util.Collections;
13 import org.opendaylight.controller.config.api.DependencyResolver;
14 import org.opendaylight.controller.config.api.DependencyResolverFactory;
15 import org.opendaylight.controller.config.api.ModuleIdentifier;
16 import org.opendaylight.controller.config.spi.Module;
17 import org.osgi.framework.BundleContext;
22 public class SchemaServiceImplSingletonModuleFactory extends
23 org.opendaylight.controller.config.yang.md.sal.dom.impl.AbstractSchemaServiceImplSingletonModuleFactory {
25 private static final ModuleIdentifier IDENTIFIER = new ModuleIdentifier(NAME, "yang-schema-service");
26 public static SchemaServiceImplSingletonModule SINGLETON;
29 public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
30 throw new UnsupportedOperationException("Only default instance supported.");
34 public Set<SchemaServiceImplSingletonModule> getDefaultModules(DependencyResolverFactory dependencyResolverFactory,
35 BundleContext bundleContext) {
36 DependencyResolver dependencyResolver = dependencyResolverFactory.createDependencyResolver(IDENTIFIER);
38 if (SINGLETON == null) {
39 SINGLETON = new SchemaServiceImplSingletonModule(IDENTIFIER, dependencyResolver);
40 SINGLETON.setBundleContext(bundleContext);
42 return Collections.singleton(SINGLETON);