Convert yang-data-jaxen to OSGi DS
[yangtools.git] / attic / yang-data-jaxen / src / main / java / org / opendaylight / yangtools / yang / data / jaxen / JaxenSchemaContextFactory.java
1 /*
2  * Copyright (c) 2015 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.yangtools.yang.data.jaxen;
9
10 import javax.inject.Inject;
11 import javax.inject.Singleton;
12 import org.eclipse.jdt.annotation.NonNullByDefault;
13 import org.kohsuke.MetaInfServices;
14 import org.opendaylight.yangtools.yang.data.jaxen.api.XPathSchemaContext;
15 import org.opendaylight.yangtools.yang.data.jaxen.api.XPathSchemaContextFactory;
16 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
17 import org.osgi.service.component.annotations.Activate;
18 import org.osgi.service.component.annotations.Component;
19 import org.osgi.service.component.annotations.Deactivate;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
22
23 @MetaInfServices
24 @Singleton
25 @Component
26 @NonNullByDefault
27 public final class JaxenSchemaContextFactory implements XPathSchemaContextFactory {
28     private static final Logger LOG = LoggerFactory.getLogger(JaxenSchemaContextFactory.class);
29
30     @Inject
31     public JaxenSchemaContextFactory() {
32         // For DI
33     }
34
35     @Override
36     public XPathSchemaContext createContext(final EffectiveModelContext context) {
37         return new JaxenSchemaContext(context);
38     }
39
40     @Activate
41     @SuppressWarnings("static-method")
42     void activate() {
43         LOG.info("Jaxen XPathSchemaContextFactory enabled");
44     }
45
46     @Deactivate
47     @SuppressWarnings("static-method")
48     void deactivate() {
49         LOG.info("Jaxen XPathSchemaContextFactory disabled");
50     }
51 }