You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2017/10/03 12:54:04 UTC

incubator-tamaya-sandbox git commit: TAMAYA-274 Added missing Activator class.

Repository: incubator-tamaya-sandbox
Updated Branches:
  refs/heads/master 3e5225120 -> 9788f0028


TAMAYA-274 Added missing Activator class.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/9788f002
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/9788f002
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/9788f002

Branch: refs/heads/master
Commit: 9788f0028d0cd6d29a6f5cf4d6577fc64ea6580b
Parents: 3e52251
Author: Anatole Tresch <an...@apache.org>
Authored: Tue Oct 3 14:53:56 2017 +0200
Committer: Anatole Tresch <an...@apache.org>
Committed: Tue Oct 3 14:53:56 2017 +0200

----------------------------------------------------------------------
 .../apache/tamaya/osgi/injection/Activator.java | 61 ++++++++++++++++++++
 1 file changed, 61 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9788f002/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/Activator.java
----------------------------------------------------------------------
diff --git a/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/Activator.java b/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/Activator.java
new file mode 100644
index 0000000..d11d223
--- /dev/null
+++ b/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/Activator.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.osgi.injection;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.logging.Logger;
+
+/**
+ * Activator that registers the Tamaya commands for the Felix Gogo console used
+ * in Apache Felix and Equinox.
+ */
+public class Activator implements BundleActivator {
+
+    private static final Logger LOG = Logger.getLogger(Activator.class.getName());
+
+    private TamayaOSGIInjector injector;
+    private ServiceRegistration<TamayaOSGIInjector> injectorReg;
+
+    @Override
+    public void start(BundleContext context) throws Exception {
+        LOG.finest("Registering Tamaya OSGI Config injector...");
+        injector = new TamayaOSGIInjector(context);
+        Dictionary<String, Object> props = new Hashtable<>();
+        injectorReg = context.registerService(
+                TamayaOSGIInjector.class,
+                injector, props);
+        injector.start();
+        LOG.finest("Registered Tamaya OSGI Config injector.");
+    }
+
+    @Override
+    public void stop(BundleContext context) throws Exception {
+        LOG.finest("Unregistering Tamaya Config injector...");
+        if (injectorReg != null) {
+            injector.stop();
+            injectorReg.unregister();
+        }
+    }
+
+}