Bug 488: Removed requirement for DOM providers to supply BundleContext.
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / sal / dom / broker / osgi / SchemaServiceActivator.java
index 617b13bc2bcad46df2fdf92544531589ba130646..113a9c08dbe064f2d8d2066ee94dd8a1e0952505 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 package org.opendaylight.controller.sal.dom.broker.osgi;
 
 import java.util.Hashtable;
@@ -10,20 +17,19 @@ 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);
+    public void start(final BundleContext context) {
+        schemaService = GlobalBundleScanningSchemaServiceImpl.createInstance(context);
         schemaService.start();
         schemaServiceReg = context.registerService(SchemaService.class, schemaService, new Hashtable<String,String>());
     }
-    
+
     @Override
-    public void stop(BundleContext context) throws Exception {
+    public void stop(final BundleContext context) throws Exception {
         schemaServiceReg.unregister();
         schemaService.close();
     }