Extract dom-serializer-api|impl from binding-broker-impl
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / sal / dom / broker / osgi / SchemaServiceActivator.java
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/SchemaServiceActivator.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/SchemaServiceActivator.java
new file mode 100644 (file)
index 0000000..617b13b
--- /dev/null
@@ -0,0 +1,30 @@
+package org.opendaylight.controller.sal.dom.broker.osgi;
+
+import java.util.Hashtable;
+
+import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.controller.sal.dom.broker.GlobalBundleScanningSchemaServiceImpl;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+public class SchemaServiceActivator implements BundleActivator {
+
+    
+    private ServiceRegistration<SchemaService> schemaServiceReg;
+    private GlobalBundleScanningSchemaServiceImpl schemaService;
+
+    @Override
+    public void start(BundleContext context) throws Exception {
+        schemaService = new GlobalBundleScanningSchemaServiceImpl();
+        schemaService.setContext(context);
+        schemaService.start();
+        schemaServiceReg = context.registerService(SchemaService.class, schemaService, new Hashtable<String,String>());
+    }
+    
+    @Override
+    public void stop(BundleContext context) throws Exception {
+        schemaServiceReg.unregister();
+        schemaService.close();
+    }
+}