4 * Generated from: yang module name: opendaylight-sal-dom-broker-impl yang module local name: schema-service-singleton
5 * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
6 * Generated at: Wed Nov 20 17:01:31 CET 2013
8 * Do not modify this file unless it is present under src/main directory
10 package org.opendaylight.controller.config.yang.md.sal.dom.impl;
12 import org.opendaylight.controller.sal.core.api.model.SchemaService;
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.SchemaServiceListener;
19 import org.osgi.framework.BundleContext;
20 import org.osgi.framework.ServiceReference;
25 public final class SchemaServiceImplSingletonModule extends
26 org.opendaylight.controller.config.yang.md.sal.dom.impl.AbstractSchemaServiceImplSingletonModule {
28 BundleContext bundleContext;
30 public SchemaServiceImplSingletonModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
31 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
32 super(identifier, dependencyResolver);
35 public SchemaServiceImplSingletonModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
36 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
37 SchemaServiceImplSingletonModule oldModule, java.lang.AutoCloseable oldInstance) {
38 super(identifier, dependencyResolver, oldModule, oldInstance);
42 public boolean canReuseInstance(AbstractSchemaServiceImplSingletonModule oldModule) {
46 public BundleContext getBundleContext() {
50 public void setBundleContext(BundleContext bundleContext) {
51 this.bundleContext = bundleContext;
55 public void validate() {
60 public java.lang.AutoCloseable createInstance() {
61 ServiceReference<SchemaService> ref = getBundleContext().getServiceReference(SchemaService.class);
63 return new GlobalSchemaServiceProxy(getBundleContext(), ref);
66 GlobalBundleScanningSchemaServiceImpl newInstance = new GlobalBundleScanningSchemaServiceImpl();
67 newInstance.setContext(getBundleContext());
72 public class GlobalSchemaServiceProxy implements AutoCloseable, SchemaService, Delegator<SchemaService> {
74 private BundleContext bundleContext;
75 private ServiceReference<SchemaService> reference;
76 private SchemaService delegate;
78 public GlobalSchemaServiceProxy(BundleContext bundleContext, ServiceReference<SchemaService> ref) {
79 this.bundleContext = bundleContext;
81 this.delegate = bundleContext.getService(reference);
85 public void close() throws Exception {
86 if (delegate != null) {
88 bundleContext.ungetService(reference);
94 public void addModule(Module arg0) {
95 delegate.addModule(arg0);
98 public SchemaContext getGlobalContext() {
99 return delegate.getGlobalContext();
102 public SchemaContext getSessionContext() {
103 return delegate.getSessionContext();
106 public ListenerRegistration<SchemaServiceListener> registerSchemaServiceListener(SchemaServiceListener arg0) {
107 return delegate.registerSchemaServiceListener(arg0);
110 public void removeModule(Module arg0) {
111 delegate.removeModule(arg0);
115 public SchemaService getDelegate() {