2 * Copyright (c) 2017 Pantheon Technologies, s.r.o. 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.yangtools.yang.parser.impl.osgi;
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory;
12 import org.opendaylight.yangtools.yang.parser.impl.YangParserFactoryImpl;
13 import org.osgi.framework.BundleActivator;
14 import org.osgi.framework.BundleContext;
15 import org.osgi.framework.ServiceRegistration;
18 * YANG parser implementation activator. Publishes a {@link YangParserFactory} implementation on bundle start.
20 * @author Robert Varga
22 public final class Activator implements BundleActivator {
23 private ServiceRegistration<@NonNull YangParserFactory> registration;
26 public void start(final BundleContext context) throws Exception {
27 registration = context.registerService(YangParserFactory.class, new YangParserFactoryImpl(), null);
31 public void stop(final BundleContext context) throws Exception {
32 if (registration != null) {
33 registration.unregister();