Convert yang-data-jaxen to OSGi DS
[yangtools.git] / attic / yang-data-jaxen / src / main / java / org / opendaylight / yangtools / yang / data / jaxen / JaxenSchemaContextFactory.java
index 22117dfe56ada0a3018e6c604b34d2627c320114..e66810fbdfbd2a42d9f8331dacc21d60b4b311fc 100644 (file)
@@ -7,17 +7,45 @@
  */
 package org.opendaylight.yangtools.yang.data.jaxen;
 
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.kohsuke.MetaInfServices;
 import org.opendaylight.yangtools.yang.data.jaxen.api.XPathSchemaContext;
 import org.opendaylight.yangtools.yang.data.jaxen.api.XPathSchemaContextFactory;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @MetaInfServices
+@Singleton
+@Component
 @NonNullByDefault
 public final class JaxenSchemaContextFactory implements XPathSchemaContextFactory {
+    private static final Logger LOG = LoggerFactory.getLogger(JaxenSchemaContextFactory.class);
+
+    @Inject
+    public JaxenSchemaContextFactory() {
+        // For DI
+    }
+
     @Override
     public XPathSchemaContext createContext(final EffectiveModelContext context) {
         return new JaxenSchemaContext(context);
     }
+
+    @Activate
+    @SuppressWarnings("static-method")
+    void activate() {
+        LOG.info("Jaxen XPathSchemaContextFactory enabled");
+    }
+
+    @Deactivate
+    @SuppressWarnings("static-method")
+    void deactivate() {
+        LOG.info("Jaxen XPathSchemaContextFactory disabled");
+    }
 }