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 org.opendaylight.controller.sal.core.api.model.SchemaService;
11 import org.opendaylight.controller.sal.dom.broker.GlobalBundleScanningSchemaServiceImpl;
12 import org.opendaylight.yangtools.concepts.Delegator;
13 import org.opendaylight.yangtools.concepts.ListenerRegistration;
14 import org.opendaylight.yangtools.yang.model.api.Module;
15 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
16 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
17 import org.osgi.framework.BundleContext;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
21 public final class SchemaServiceImplSingletonModule extends
22 org.opendaylight.controller.config.yang.md.sal.dom.impl.AbstractSchemaServiceImplSingletonModule {
24 private static final Logger LOG = LoggerFactory.getLogger(SchemaServiceImplSingletonModule.class);
26 BundleContext bundleContext;
28 public SchemaServiceImplSingletonModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
29 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
30 super(identifier, dependencyResolver);
33 public SchemaServiceImplSingletonModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
34 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
35 final SchemaServiceImplSingletonModule oldModule, final java.lang.AutoCloseable oldInstance) {
36 super(identifier, dependencyResolver, oldModule, oldInstance);
40 public boolean canReuseInstance(final AbstractSchemaServiceImplSingletonModule oldModule) {
44 public BundleContext getBundleContext() {
48 public void setBundleContext(final BundleContext bundleContext) {
49 this.bundleContext = bundleContext;
53 public void validate() {
58 public java.lang.AutoCloseable createInstance() {
59 return GlobalBundleScanningSchemaServiceImpl.getInstance();
62 public class GlobalSchemaServiceProxy implements AutoCloseable, SchemaService, Delegator<SchemaService> {
64 private SchemaService delegate;
66 public GlobalSchemaServiceProxy() {
67 this.delegate = GlobalBundleScanningSchemaServiceImpl.getInstance();
71 public void close() throws Exception {
72 if (delegate != null) {
78 public void addModule(final Module arg0) {
79 delegate.addModule(arg0);
83 public SchemaContext getGlobalContext() {
84 return delegate.getGlobalContext();
88 public SchemaContext getSessionContext() {
89 return delegate.getSessionContext();
93 public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(final SchemaContextListener arg0) {
94 return delegate.registerSchemaContextListener(arg0);
98 public void removeModule(final Module arg0) {
99 delegate.removeModule(arg0);
103 public SchemaService getDelegate() {