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
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.sal.dom.broker.osgi;
9
10 import java.util.Hashtable;
11
12 import org.opendaylight.controller.sal.core.api.model.SchemaService;
13 import org.opendaylight.controller.sal.dom.broker.GlobalBundleScanningSchemaServiceImpl;
14 import org.osgi.framework.BundleActivator;
15 import org.osgi.framework.BundleContext;
16 import org.osgi.framework.ServiceRegistration;
17
18 public class SchemaServiceActivator implements BundleActivator {
19
20
21     private ServiceRegistration<SchemaService> schemaServiceReg;
22     private GlobalBundleScanningSchemaServiceImpl schemaService;
23
24     @Override
25     public void start(final BundleContext context) {
26         schemaService = GlobalBundleScanningSchemaServiceImpl.createInstance(context);
27         schemaService.start();
28         schemaServiceReg = context.registerService(SchemaService.class, schemaService, new Hashtable<String,String>());
29     }
30
31     @Override
32     public void stop(final BundleContext context) throws Exception {
33         schemaServiceReg.unregister();
34         schemaService.close();
35     }
36 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.