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 com.google.common.util.concurrent.CheckedFuture;
11 import org.opendaylight.controller.sal.core.api.model.SchemaService;
12 import org.opendaylight.controller.sal.core.api.model.YangTextSourceProvider;
13 import org.opendaylight.controller.sal.dom.broker.GlobalBundleScanningSchemaServiceImpl;
14 import org.opendaylight.yangtools.concepts.Delegator;
15 import org.opendaylight.yangtools.concepts.ListenerRegistration;
16 import org.opendaylight.yangtools.yang.model.api.Module;
17 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
18 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
19 import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException;
20 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
21 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
22 import org.osgi.framework.BundleContext;
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
27 * @deprecated Replaced by blueprint wiring
30 public final class SchemaServiceImplSingletonModule extends
31 org.opendaylight.controller.config.yang.md.sal.dom.impl.AbstractSchemaServiceImplSingletonModule {
33 private static final Logger LOG = LoggerFactory.getLogger(SchemaServiceImplSingletonModule.class);
35 BundleContext bundleContext;
37 public SchemaServiceImplSingletonModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
38 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
39 super(identifier, dependencyResolver);
42 public SchemaServiceImplSingletonModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
43 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
44 final SchemaServiceImplSingletonModule oldModule, final java.lang.AutoCloseable oldInstance) {
45 super(identifier, dependencyResolver, oldModule, oldInstance);
49 public boolean canReuseInstance(final AbstractSchemaServiceImplSingletonModule oldModule) {
53 public BundleContext getBundleContext() {
57 public void setBundleContext(final BundleContext bundleContext) {
58 this.bundleContext = bundleContext;
62 public void validate() {
67 public java.lang.AutoCloseable createInstance() {
68 return new GlobalSchemaServiceProxy(GlobalBundleScanningSchemaServiceImpl.getInstance());
71 private static class GlobalSchemaServiceProxy implements AutoCloseable, SchemaService, YangTextSourceProvider,
72 Delegator<SchemaService> {
73 private final GlobalBundleScanningSchemaServiceImpl delegate;
75 public GlobalSchemaServiceProxy(GlobalBundleScanningSchemaServiceImpl service) {
76 this.delegate = service;
81 // Intentional noop as the life-cycle is controlled via blueprint.
85 public void addModule(final Module arg0) {
86 delegate.addModule(arg0);
90 public SchemaContext getGlobalContext() {
91 return delegate.getGlobalContext();
95 public SchemaContext getSessionContext() {
96 return delegate.getSessionContext();
100 public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(final SchemaContextListener arg0) {
101 return delegate.registerSchemaContextListener(arg0);
105 public void removeModule(final Module arg0) {
106 delegate.removeModule(arg0);
110 public SchemaService getDelegate() {
115 public CheckedFuture<? extends YangTextSchemaSource, SchemaSourceException> getSource(
116 SourceIdentifier sourceIdentifier) {
117 return delegate.getSource(sourceIdentifier);