Fix somar complaints in equals methods
[yangtools.git] / attic / yang-data-jaxen / src / main / java / org / opendaylight / yangtools / yang / data / jaxen / osgi / Activator.java
1 /*
2  * Copyright (c) 2018 Pantheon Technologies, s.r.o. 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.yangtools.yang.data.jaxen.osgi;
9
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.opendaylight.yangtools.yang.data.jaxen.JaxenSchemaContextFactory;
12 import org.opendaylight.yangtools.yang.data.jaxen.api.XPathSchemaContextFactory;
13 import org.osgi.framework.BundleActivator;
14 import org.osgi.framework.BundleContext;
15 import org.osgi.framework.ServiceRegistration;
16
17 /**
18  * YANG Jaxen XPath implementation activator. Publishes a {@link XPathSchemaContextFactory} implementation on bundle
19  * start.
20  *
21  * @author Robert Varga
22  */
23 public final class Activator implements BundleActivator {
24     private ServiceRegistration<@NonNull XPathSchemaContextFactory> registration;
25
26     @Override
27     public void start(final BundleContext context) throws Exception {
28         registration = context.registerService(XPathSchemaContextFactory.class, new JaxenSchemaContextFactory(), null);
29     }
30
31     @Override
32     public void stop(final BundleContext context) throws Exception {
33         if (registration != null) {
34             registration.unregister();
35             registration = null;
36         }
37     }
38 }