tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [2/5] incubator-tamaya git commit: TAMAYA-238: OSGI improvements and service loading.
Date Sun, 26 Feb 2017 23:05:06 GMT
TAMAYA-238: OSGI improvements and service loading.


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

Branch: refs/heads/master
Commit: edaee8e8d66fdb3a43d75136e8857bc54b2f3eba
Parents: dd66dff
Author: anatole <anatole@apache.org>
Authored: Thu Feb 23 01:08:12 2017 +0100
Committer: anatole <anatole@apache.org>
Committed: Mon Feb 27 00:05:00 2017 +0100

----------------------------------------------------------------------
 code/core/bnd.bnd                               | 15 +++--
 code/core/pom.xml                               |  4 --
 .../org/apache/tamaya/core/OSGIActivator.java   | 67 ++++++++++++++++++++
 .../tamaya/core/internal/OSGIActivator.java     | 66 -------------------
 pom.xml                                         |  3 +-
 5 files changed, 79 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/edaee8e8/code/core/bnd.bnd
----------------------------------------------------------------------
diff --git a/code/core/bnd.bnd b/code/core/bnd.bnd
index eec2853..5d14d8c 100644
--- a/code/core/bnd.bnd
+++ b/code/core/bnd.bnd
@@ -1,7 +1,12 @@
 Export-Package: \
 	org.apache.tamaya.core,\
-	org.apache.tamaya.core.propertysource,\
-	org.apache.tamaya.core.provider,\
-    org.apache.tamaya.core.internal,\
-    org.apache.tamaya.core.internal.converters
-Bundle-Activator: org.apache.tamaya.core.internal.OSGIActivator
\ No newline at end of file
+	org.apache.tamaya.core.internal,\
+	org.apache.tamaya.core.propertysource
+Import-Package: \
+	org.apache.tamaya,\
+	org.apache.tamaya.spi,\
+	org.osgi.framework,\
+	javax.annotation
+Bundle-Activator: org.apache.tamaya.core.OSGIActivator
+Bundle-SymbolicName: org.apache.tamaya.core
+Bundle-Version: 0.3-INCUBATING-SNAPSHOT
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/edaee8e8/code/core/pom.xml
----------------------------------------------------------------------
diff --git a/code/core/pom.xml b/code/core/pom.xml
index 2cc76b5..f9566c7 100644
--- a/code/core/pom.xml
+++ b/code/core/pom.xml
@@ -29,10 +29,6 @@ under the License.
     <name>Apache Tamaya Core Implementation</name>
     <packaging>jar</packaging>
 
-    <properties>
-        <osgi.compendium.version>5.0.0</osgi.compendium.version>
-     </properties>
-
     <dependencies>
         <dependency>
             <groupId>org.apache.tamaya</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/edaee8e8/code/core/src/main/java/org/apache/tamaya/core/OSGIActivator.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/OSGIActivator.java b/code/core/src/main/java/org/apache/tamaya/core/OSGIActivator.java
new file mode 100644
index 0000000..8798531
--- /dev/null
+++ b/code/core/src/main/java/org/apache/tamaya/core/OSGIActivator.java
@@ -0,0 +1,67 @@
+/*
+ * 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.core;
+
+
+
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.core.internal.*;
+import org.apache.tamaya.spi.ServiceContextManager;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+import java.util.logging.Logger;
+
+/**
+ * A bundle activator that registers the {@link OSGIServiceLoader}.
+ */
+public class OSGIActivator implements BundleActivator {
+
+    private static final Logger LOG = Logger.getLogger(OSGIActivator.class.getName());
+
+    private OSGIServiceLoader serviceLoader;
+
+    @Override
+    public void start(BundleContext context) {
+        // Register marker service
+        serviceLoader = new OSGIServiceLoader(context);
+        context.addBundleListener(serviceLoader);
+        ServiceContextManager.set(new OSGIServiceContext(serviceLoader));
+        LOG.info("Registered OSGI enabled ServiceContext...");
+        ConfigurationProvider.setConfiguration(
+                new DefaultConfiguration(
+                       new DefaultConfigurationContextBuilder()
+                        .addDefaultPropertyConverters()
+                        .addDefaultPropertyFilters()
+                        .addDefaultPropertySources()
+                        .sortPropertyFilter(PropertyFilterComparator.getInstance())
+                        .sortPropertySources(PropertySourceComparator.getInstance())
+                        .build()
+                )
+        );
+        LOG.info("Loaded default configuration from OSGI.");
+    }
+
+    @Override
+    public void stop(BundleContext context) {
+        if(serviceLoader!=null) {
+            context.removeBundleListener(serviceLoader);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/edaee8e8/code/core/src/main/java/org/apache/tamaya/core/internal/OSGIActivator.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/OSGIActivator.java b/code/core/src/main/java/org/apache/tamaya/core/internal/OSGIActivator.java
deleted file mode 100644
index 6e18f0f..0000000
--- a/code/core/src/main/java/org/apache/tamaya/core/internal/OSGIActivator.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.core.internal;
-
-
-
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.spi.ServiceContextManager;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-import java.util.logging.Logger;
-
-/**
- * A bundle activator that registers the {@link OSGIServiceLoader}.
- */
-public class OSGIActivator implements BundleActivator {
-
-    private static final Logger LOG = Logger.getLogger(OSGIActivator.class.getName());
-
-    private OSGIServiceLoader serviceLoader;
-
-    @Override
-    public void start(BundleContext context) {
-        // Register marker service
-        serviceLoader = new OSGIServiceLoader(context);
-        context.addBundleListener(serviceLoader);
-        ServiceContextManager.set(new OSGIServiceContext(serviceLoader));
-        LOG.info("Registered OSGI enabled ServiceContext...");
-        ConfigurationProvider.setConfiguration(
-                new DefaultConfiguration(
-                       new DefaultConfigurationContextBuilder()
-                        .addDefaultPropertyConverters()
-                        .addDefaultPropertyFilters()
-                        .addDefaultPropertySources()
-                        .sortPropertyFilter(PropertyFilterComparator.getInstance())
-                        .sortPropertySources(PropertySourceComparator.getInstance())
-                        .build()
-                )
-        );
-        LOG.info("Loaded default configuration from OSGI.");
-    }
-
-    @Override
-    public void stop(BundleContext context) {
-        if(serviceLoader!=null) {
-            context.removeBundleListener(serviceLoader);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/edaee8e8/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index fbbaa49..a8f7a1f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,7 +40,8 @@
         <commons-io.version>2.5</commons-io.version>
         <findbugs.skip>false</findbugs.skip>
         <jdkVersion>1.7</jdkVersion>
-        <osgi.version>6.0.0</osgi.version>
+        <osgi.version>5.0.0</osgi.version>
+        <osgi.compendium.version>${osgi.version}</osgi.compendium.version>
         <maven.compile.targetLevel>${jdkVersion}</maven.compile.targetLevel>
         <maven.compile.sourceLevel>${jdkVersion}</maven.compile.sourceLevel>
         <maven.compile.optimize>false</maven.compile.optimize>


Mime
View raw message