aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject aries-containers git commit: Register the docker local ContainerFactory as a service.
Date Fri, 26 May 2017 09:22:07 GMT
Repository: aries-containers
Updated Branches:
  refs/heads/master d6d8175cc -> 8d1fcb5e0


Register the docker local ContainerFactory as a service.


Project: http://git-wip-us.apache.org/repos/asf/aries-containers/repo
Commit: http://git-wip-us.apache.org/repos/asf/aries-containers/commit/8d1fcb5e
Tree: http://git-wip-us.apache.org/repos/asf/aries-containers/tree/8d1fcb5e
Diff: http://git-wip-us.apache.org/repos/asf/aries-containers/diff/8d1fcb5e

Branch: refs/heads/master
Commit: 8d1fcb5e0f4f27d3589c842745a2ad9ed1427f4a
Parents: d6d8175
Author: David Bosschaert <davidb@apache.org>
Authored: Fri May 26 10:21:40 2017 +0100
Committer: David Bosschaert <davidb@apache.org>
Committed: Fri May 26 10:21:40 2017 +0100

----------------------------------------------------------------------
 .../org/apache/aries/containers/Container.java  |  3 +++
 .../aries/containers/ContainerFactory.java      |  2 ++
 containers-docker-local/pom.xml                 |  7 ++++++
 .../containers/docker/local/impl/Activator.java | 23 ++++++++++++++++++++
 4 files changed, 35 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aries-containers/blob/8d1fcb5e/containers-api/src/main/java/org/apache/aries/containers/Container.java
----------------------------------------------------------------------
diff --git a/containers-api/src/main/java/org/apache/aries/containers/Container.java b/containers-api/src/main/java/org/apache/aries/containers/Container.java
index 9c4d569..6ec8148 100644
--- a/containers-api/src/main/java/org/apache/aries/containers/Container.java
+++ b/containers-api/src/main/java/org/apache/aries/containers/Container.java
@@ -20,6 +20,9 @@ package org.apache.aries.containers;
 
 import java.util.Map;
 
+import org.osgi.annotation.versioning.ProviderType;
+
+@ProviderType
 public interface Container extends Comparable<Container> {
     @Override
     default int compareTo(Container other) {

http://git-wip-us.apache.org/repos/asf/aries-containers/blob/8d1fcb5e/containers-api/src/main/java/org/apache/aries/containers/ContainerFactory.java
----------------------------------------------------------------------
diff --git a/containers-api/src/main/java/org/apache/aries/containers/ContainerFactory.java
b/containers-api/src/main/java/org/apache/aries/containers/ContainerFactory.java
index d6d91d9..6f47cc8 100644
--- a/containers-api/src/main/java/org/apache/aries/containers/ContainerFactory.java
+++ b/containers-api/src/main/java/org/apache/aries/containers/ContainerFactory.java
@@ -6,6 +6,8 @@ import org.osgi.annotation.versioning.ProviderType;
 
 @ProviderType
 public interface ContainerFactory {
+    public static final String BINDING = "container.factory.binding";
+
     Service getService(ServiceConfig config) throws Exception;
 
     Set<String> listServices() throws Exception;

http://git-wip-us.apache.org/repos/asf/aries-containers/blob/8d1fcb5e/containers-docker-local/pom.xml
----------------------------------------------------------------------
diff --git a/containers-docker-local/pom.xml b/containers-docker-local/pom.xml
index b74d85a..6c78d4f 100644
--- a/containers-docker-local/pom.xml
+++ b/containers-docker-local/pom.xml
@@ -34,6 +34,12 @@
 
     <dependencies>
         <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        
+        <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>org.apache.aries.containers.api</artifactId>
             <version>${project.version}</version>
@@ -62,6 +68,7 @@
                 </executions>
                 <configuration>
                     <bnd><![CDATA[
+                        Bundle-Activator: org.apache.aries.containers.docker.local.impl.Activator
                         Conditional-Package: org.apache.felix.utils.json.*
                     ]]></bnd>
                 </configuration>

http://git-wip-us.apache.org/repos/asf/aries-containers/blob/8d1fcb5e/containers-docker-local/src/main/java/org/apache/aries/containers/docker/local/impl/Activator.java
----------------------------------------------------------------------
diff --git a/containers-docker-local/src/main/java/org/apache/aries/containers/docker/local/impl/Activator.java
b/containers-docker-local/src/main/java/org/apache/aries/containers/docker/local/impl/Activator.java
new file mode 100644
index 0000000..561c55b
--- /dev/null
+++ b/containers-docker-local/src/main/java/org/apache/aries/containers/docker/local/impl/Activator.java
@@ -0,0 +1,23 @@
+package org.apache.aries.containers.docker.local.impl;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.aries.containers.ContainerFactory;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+    @Override
+    public void start(BundleContext context) throws Exception {
+        Dictionary<String, Object> props = new Hashtable<>();
+        props.put(ContainerFactory.BINDING, "docker.local");
+        context.registerService(ContainerFactory.class,
+                new LocalDockerContainerFactory(), props);
+    }
+
+    @Override
+    public void stop(BundleContext context) throws Exception {
+        // Nothing to do
+    }
+}


Mime
View raw message