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