geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r918677 - in /geronimo/server/trunk/framework: ./ buildsupport/car-maven-plugin/ buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ buildsupport/geronimo-osgi-plugin/ modules/geronimo-deployment/src/main/java/...
Date Wed, 03 Mar 2010 20:47:11 GMT
Author: gawor
Date: Wed Mar  3 20:47:11 2010
New Revision: 918677

URL: http://svn.apache.org/viewvc?rev=918677&view=rev
Log:
GERONIMO-5166: Enable car-maven-plugin to use Equinox or Felix as the OSGi framework

Modified:
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/pom.xml
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java
    geronimo/server/trunk/framework/buildsupport/geronimo-osgi-plugin/pom.xml
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
    geronimo/server/trunk/framework/pom.xml

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/pom.xml?rev=918677&r1=918676&r2=918677&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/pom.xml (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/pom.xml Wed Mar  3 20:47:11
2010
@@ -217,11 +217,6 @@
 
         <dependency>
             <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.framework</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.felix</groupId>
             <artifactId>org.osgi.compendium</artifactId>
         </dependency>
 
@@ -239,5 +234,46 @@
 
     </dependencies>
 
+    <profiles>
+        <profile>
+            <id>felix</id>
+
+            <activation>
+                <property>
+                    <name>framework</name>
+                    <value>felix</value>
+                </property>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+
+            <dependencies>
+                 <dependency>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>org.apache.felix.framework</artifactId>
+                </dependency>
+            </dependencies>
+
+        </profile>
+
+        <profile>
+            <id>equinox</id>
+
+            <activation>
+                <property>
+                    <name>framework</name>
+                    <value>equinox</value>
+                </property>
+            </activation>
+
+            <dependencies>
+                <dependency>
+                    <groupId>org.eclipse</groupId>
+                    <artifactId>osgi</artifactId>
+                </dependency>
+            </dependencies>
+
+        </profile>
+    </profiles>
+
 </project>
 

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java?rev=918677&r1=918676&r2=918677&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java
(original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java
Wed Mar  3 20:47:11 2010
@@ -23,6 +23,7 @@
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.lang.reflect.Field;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -826,11 +827,11 @@
                         "org.apache.geronimo.kernel.basic," +
                         "org.apache.geronimo.kernel.classloader," +
                         "org.apache.geronimo.kernel.config," +
-                        "org.apache.geronimo.kernel.config.classloading," +
                         "org.apache.geronimo.kernel.config.xstream," +
                         "org.apache.geronimo.kernel.lifecycle," +
                         "org.apache.geronimo.kernel.management," +
                         "org.apache.geronimo.kernel.osgi," +
+                        "org.apache.geronimo.kernel.osgi.jar," +
                         "org.apache.geronimo.kernel.proxy," +
                         "org.apache.geronimo.kernel.repository," +
                         "org.apache.geronimo.kernel.rmi," +
@@ -853,7 +854,7 @@
                         "org.apache.geronimo.system.sharedlib," +
                         "org.apache.geronimo.system.threads," +
                         "org.apache.geronimo.system.util," +
-                        "org.apache.geronimo.mavenplugins.car," +
+                        "org.apache.geronimo.mavenplugins.car" +
                        "");
                         /*
 
@@ -941,12 +942,33 @@
                         "javax.enterprise.deploy.shared," +
                         "javax.enterprise.deploy.spi");
 */
+                        
         File storageDir = new File(basedir, "target/bundle-cache");
         properties.put(Constants.FRAMEWORK_STORAGE, storageDir.getAbsolutePath());
+        
+        /* 
+         * A hack for Equinox to restore FrameworkProperties to the initial state.
+         * If the FrameworkProperties is not restored to the initial state, Equinox
+         * will create a separate classloader and load the Geronimo kernel classes
+         * from deployed geronimo-kernel bundle instead of the system bundle. 
+         * That will result in ClassCastException. 
+         */
+        resetFrameworkProperties();
+        
         ServiceLoader<FrameworkFactory> loader = ServiceLoader.load(FrameworkFactory.class);
         Framework framework = loader.iterator().next().newFramework(properties);
         framework.start();
         return framework;
     }
 
+    private static void resetFrameworkProperties() {
+        try {
+            Class clazz = Class.forName("org.eclipse.osgi.framework.internal.core.FrameworkProperties");
+            Field f = clazz.getDeclaredField("properties");
+            f.setAccessible(true);
+            f.set(null, null);
+        } catch (Throwable e) {
+            e.printStackTrace();
+        }
+    }
 }

Modified: geronimo/server/trunk/framework/buildsupport/geronimo-osgi-plugin/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/geronimo-osgi-plugin/pom.xml?rev=918677&r1=918676&r2=918677&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/geronimo-osgi-plugin/pom.xml (original)
+++ geronimo/server/trunk/framework/buildsupport/geronimo-osgi-plugin/pom.xml Wed Mar  3 20:47:11
2010
@@ -31,21 +31,6 @@
     <name>Geronimo Build Support :: OSGi Plugin</name>
     <packaging>maven-plugin</packaging>
 
-    <repositories>
-        <!-- Tuscany repository to hold artifacts that are not published in the public
maven repos -->
-        <repository>
-            <id>tuscany.repo</id>
-            <name>Tuscany Maven 2.x Repository</name>
-            <url>http://svn.apache.org/repos/asf/tuscany/maven</url>
-            <releases>
-                <enabled>true</enabled>
-            </releases>
-            <snapshots>
-                <enabled>false</enabled>
-            </snapshots>
-        </repository>
-    </repositories>
-
     <dependencies>
 
         <dependency>
@@ -78,7 +63,6 @@
         <dependency>
             <groupId>org.eclipse</groupId>
             <artifactId>osgi</artifactId>
-            <version>3.5.0-v20090520</version>
             <scope>compile</scope>
         </dependency>
 

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=918677&r1=918676&r2=918677&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
Wed Mar  3 20:47:11 2010
@@ -25,7 +25,6 @@
 import java.io.PrintWriter;
 import java.net.URI;
 import java.net.URL;
-import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -197,7 +196,7 @@
             createTempManifest();
             createPluginMetadata();
             JarUtils.jarDirectory(baseDir, tempBundleFile);
-            String location = "reference:file:" + URLEncoder.encode(tempBundleFile.getAbsolutePath(),
"UTF-8");
+            String location = "reference:" + tempBundleFile.toURI().toURL();
             tempBundle = bundleContext.installBundle(location);
             if (BundleUtils.canStart(tempBundle)) {
                 tempBundle.start(Bundle.START_TRANSIENT);

Modified: geronimo/server/trunk/framework/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/pom.xml?rev=918677&r1=918676&r2=918677&view=diff
==============================================================================
--- geronimo/server/trunk/framework/pom.xml (original)
+++ geronimo/server/trunk/framework/pom.xml Wed Mar  3 20:47:11 2010
@@ -37,6 +37,11 @@
     <dependencyManagement>
         <dependencies>
             <dependency>
+                <groupId>org.eclipse</groupId>
+                <artifactId>osgi</artifactId>
+                <version>3.5.0.v20090520</version>
+            </dependency>
+            <dependency>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>org.apache.felix.framework</artifactId>
                 <version>2.1.0-SNAPSHOT</version>



Mime
View raw message