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.sal.schema.service.impl;
10 import java.util.Hashtable;
11 import org.opendaylight.controller.sal.core.api.model.SchemaService;
12 import org.opendaylight.controller.sal.core.api.model.YangTextSourceProvider;
13 import org.osgi.framework.BundleActivator;
14 import org.osgi.framework.BundleContext;
15 import org.osgi.framework.ServiceRegistration;
17 public class SchemaServiceActivator implements BundleActivator {
18 private ServiceRegistration<SchemaService> schemaServiceReg;
19 private ServiceRegistration<YangTextSourceProvider> schemaSourceReg;
20 private GlobalBundleScanningSchemaServiceImpl schemaService;
23 public void start(final BundleContext context) {
24 schemaService = GlobalBundleScanningSchemaServiceImpl.createInstance(context);
25 schemaServiceReg = context.registerService(SchemaService.class, schemaService, new Hashtable<String,String>());
26 schemaSourceReg = context.registerService(YangTextSourceProvider.class, schemaService, new Hashtable<String,String>());
30 public void stop(final BundleContext context) {
31 schemaServiceReg.unregister();
32 schemaSourceReg.unregister();
33 schemaService.close();