geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1360229 - in /geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries: ApplicationInstaller.java ApplicationUpdateHelper.java GeronimoApplication.java
Date Wed, 11 Jul 2012 15:28:07 GMT
Author: gawor
Date: Wed Jul 11 15:28:06 2012
New Revision: 1360229

URL: http://svn.apache.org/viewvc?rev=1360229&view=rev
Log:
GERONIMO-6370: Add a switch so that unpacked and packed bundles in ebas are supported

Modified:
    geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationInstaller.java
    geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationUpdateHelper.java
    geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/GeronimoApplication.java

Modified: geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationInstaller.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationInstaller.java?rev=1360229&r1=1360228&r2=1360229&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationInstaller.java
(original)
+++ geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationInstaller.java
Wed Jul 11 15:28:06 2012
@@ -150,7 +150,7 @@ public class ApplicationInstaller implem
             context.flush();
             context.initializeConfiguration();
 
-            storeApplication(app, tempDirectory, true);
+            storeApplication(app, tempDirectory, getUnpackApplicationBundles());
             
             AbstractName name = naming.createChildName(moduleName, "AriesApplication", "GBean");
             GBeanData data = new GBeanData(name, ApplicationGBean.class);
@@ -167,6 +167,11 @@ public class ApplicationInstaller implem
         }
     }
     
+    private static boolean getUnpackApplicationBundles() {
+        String property = System.getProperty("org.apache.geronimo.aries.unpackApplicationBundles",
"true");
+        return Boolean.parseBoolean(property);
+    }
+    
     private void storeApplication(AriesApplication app, File directory, boolean unpack) throws
IOException {
         ApplicationMetadata appMetadata = app.getApplicationMetadata();
         appMetadata.store(new File(directory, AppConstants.APPLICATION_MF));

Modified: geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationUpdateHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationUpdateHelper.java?rev=1360229&r1=1360228&r2=1360229&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationUpdateHelper.java
(original)
+++ geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationUpdateHelper.java
Wed Jul 11 15:28:06 2012
@@ -557,8 +557,8 @@ public class ApplicationUpdateHelper {
     }
     
     private String getBundleNameInArchive(Bundle bundle) {
-        String baseLocation = applicationGBean.getBundle().getLocation();
-        String location = bundle.getLocation();
+        String baseLocation = normalizeLocation(applicationGBean.getBundle().getLocation());
+        String location = normalizeLocation(bundle.getLocation());
         if (location.startsWith(baseLocation)) {
             return location.substring(baseLocation.length());
         } else {
@@ -571,6 +571,14 @@ public class ApplicationUpdateHelper {
         }
     }
     
+    private static String normalizeLocation(String bundleLocation) {
+        if (bundleLocation.startsWith(BundleUtils.REFERENCE_SCHEME)) {
+            return bundleLocation.substring(BundleUtils.REFERENCE_SCHEME.length());
+        } else {
+            return bundleLocation;
+        }
+    }
+    
     private static void deleteFile(File file) {
         if (file != null) {
             file.delete();

Modified: geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/GeronimoApplication.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/GeronimoApplication.java?rev=1360229&r1=1360228&r2=1360229&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/GeronimoApplication.java
(original)
+++ geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/GeronimoApplication.java
Wed Jul 11 15:28:06 2012
@@ -109,21 +109,27 @@ public class GeronimoApplication impleme
    
     private void collectFileSystemBasedBundleInfos(File baseDir, ApplicationMetadataFactory
applicationFactory) throws IOException {
         for (File file : baseDir.listFiles()) {
-            if (file.isDirectory() && !file.getCanonicalPath().endsWith(".jar"))
{
-                collectFileSystemBasedBundleInfos(file, applicationFactory);
-                continue;
-            }
-            BundleManifest bm = BundleManifest.fromBundle(file);
-            
-            if (bm != null && bm.isValid()) {
-                /*
-                 * Pass file:// url instead of reference:file:// as bundle location to make
sure
-                 * Equinox has its own copy of the jar. That is, to prevent strange ZipErrors
when
-                 * application bundles are updated at runtime, specifically, when 
-                 * ApplicationGBean.hotSwapApplicationContent() is called.
-                 */
-                bundleInfo.add(new SimpleBundleInfo(applicationFactory, bm, "reference:"
+ file.toURI().toString()));       
-                
+            if (file.isDirectory()) {
+                if (file.getName().endsWith(".jar")) {
+                    BundleManifest bm = BundleManifest.fromBundle(file);
+                    if (bm != null && bm.isValid()) {
+                        bundleInfo.add(new SimpleBundleInfo(applicationFactory, bm, "reference:"
+ file.toURI().toString()));                
+                    }
+                } else {
+                    collectFileSystemBasedBundleInfos(file, applicationFactory);
+                    continue;
+                }
+            } else {
+                BundleManifest bm = BundleManifest.fromBundle(file);
+                if (bm != null && bm.isValid()) {
+                    /*
+                     * Pass file:// url instead of reference:file:// as bundle location to
make sure
+                     * Equinox has its own copy of the jar. That is, to prevent strange ZipErrors
when
+                     * application bundles are updated at runtime, specifically, when 
+                     * ApplicationGBean.hotSwapApplicationContent() is called.
+                     */
+                    bundleInfo.add(new SimpleBundleInfo(applicationFactory, bm, file.toURI().toString()));
               
+                }
             }
         }
     }



Mime
View raw message