You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2014/04/10 16:16:12 UTC

[50/59] [abbrv] git commit: [KARAF-2833] Make obr independent of blueprint

[KARAF-2833] Make obr independent of blueprint


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/04afd902
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/04afd902
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/04afd902

Branch: refs/heads/master
Commit: 04afd9029a156a66d9ad5a241bf69d41cff72939
Parents: 4182735
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Thu Apr 10 09:54:47 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Thu Apr 10 16:02:54 2014 +0200

----------------------------------------------------------------------
 .../standard/src/main/feature/feature.xml       |  1 -
 obr/pom.xml                                     | 11 ++++++
 .../karaf/obr/core/internal/osgi/Activator.java | 36 ++++++++++++++++++++
 .../resources/OSGI-INF/blueprint/blueprint.xml  | 34 ------------------
 4 files changed, 47 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/04afd902/assemblies/features/standard/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/assemblies/features/standard/src/main/feature/feature.xml b/assemblies/features/standard/src/main/feature/feature.xml
index 6813d27..b6f8dea 100644
--- a/assemblies/features/standard/src/main/feature/feature.xml
+++ b/assemblies/features/standard/src/main/feature/feature.xml
@@ -109,7 +109,6 @@
     </feature>
 
     <feature name="obr" description="Provide OSGi Bundle Repository (OBR) support" version="${project.version}">
-        <feature>aries-blueprint</feature>
         <bundle start-level="30">mvn:org.apache.felix/org.osgi.service.obr/${felix.obr.version}</bundle>
         <bundle start-level="30">mvn:org.apache.felix/org.apache.felix.bundlerepository/${felix.bundlerepository.version}</bundle>
         <bundle start-level="30">mvn:org.apache.karaf.obr/org.apache.karaf.obr.core/${project.version}</bundle>

http://git-wip-us.apache.org/repos/asf/karaf/blob/04afd902/obr/pom.xml
----------------------------------------------------------------------
diff --git a/obr/pom.xml b/obr/pom.xml
index e0498c7..1e9b381 100644
--- a/obr/pom.xml
+++ b/obr/pom.xml
@@ -50,6 +50,11 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.karaf</groupId>
+            <artifactId>org.apache.karaf.util</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.karaf.shell</groupId>
             <artifactId>org.apache.karaf.shell.core</artifactId>
             <optional>true</optional>
@@ -83,8 +88,14 @@
                         </Export-Package>
                         <Private-Package>
                             org.apache.karaf.obr.command,
+                            org.apache.karaf.obr.command.util,
                             org.apache.karaf.obr.core.internal,
+                            org.apache.karaf.obr.core.internal.osgi,
+                            org.apache.karaf.util.tracker
                         </Private-Package>
+                        <Bundle-Activator>
+                            org.apache.karaf.obr.core.internal.osgi.Activator
+                        </Bundle-Activator>
                         <Karaf-Commands>*</Karaf-Commands>
                     </instructions>
                 </configuration>

http://git-wip-us.apache.org/repos/asf/karaf/blob/04afd902/obr/src/main/java/org/apache/karaf/obr/core/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/obr/src/main/java/org/apache/karaf/obr/core/internal/osgi/Activator.java b/obr/src/main/java/org/apache/karaf/obr/core/internal/osgi/Activator.java
new file mode 100644
index 0000000..183508e
--- /dev/null
+++ b/obr/src/main/java/org/apache/karaf/obr/core/internal/osgi/Activator.java
@@ -0,0 +1,36 @@
+/*
+ * 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.karaf.obr.core.internal.osgi;
+
+import org.apache.felix.bundlerepository.RepositoryAdmin;
+import org.apache.karaf.obr.core.internal.ObrMBeanImpl;
+import org.apache.karaf.util.tracker.BaseActivator;
+
+public class Activator extends BaseActivator {
+
+    @Override
+    protected void doOpen() throws Exception {
+        trackService(RepositoryAdmin.class);
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        RepositoryAdmin admin = getTrackedService(RepositoryAdmin.class);
+        ObrMBeanImpl mbean = new ObrMBeanImpl(bundleContext, admin);
+        registerMBean(mbean, "type=obr");
+    }
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/04afd902/obr/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/obr/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/obr/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index 4fbe9fb..0000000
--- a/obr/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-   Licensed 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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-    xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
-    xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
-
-    <ext:property-placeholder />
-
-    <reference id="repositoryAdmin" interface="org.apache.felix.bundlerepository.RepositoryAdmin"/>
-
-    <bean id="obrMBean" class="org.apache.karaf.obr.core.internal.ObrMBeanImpl">
-        <argument ref="blueprintBundleContext"/>
-        <argument ref="repositoryAdmin"/>
-    </bean>
-
-    <service ref="obrMBean" auto-export="interfaces">
-        <service-properties>
-            <entry key="jmx.objectname" value="org.apache.karaf:type=obr,name=${karaf.name}"/>
-        </service-properties>
-    </service>
-
-</blueprint>
\ No newline at end of file