geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1307840 [1/2] - in /geronimo/server/branches/3.0-beta: framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ framework/configs/karaf-framework/src/main/history/ framework/modules/geronimo-crypto/src/ma...
Date Sat, 31 Mar 2012 16:13:06 GMT
Author: xuhaihong
Date: Sat Mar 31 16:13:05 2012
New Revision: 1307840

URL: http://svn.apache.org/viewvc?rev=1307840&view=rev
Log:
GERONIMO-6313 Use reference:file protocol for server-side bundle installation

Modified:
    geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java
    geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java
    geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java
    geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginBootstrap2.java
    geronimo/server/branches/3.0-beta/framework/configs/karaf-framework/src/main/history/dependencies.xml
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/SimpleEncryption.java
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/TargetImpl.java
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java   (contents, props changed)
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Maven2Repository.java   (contents, props changed)
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/BundleUtil.java
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/InputUtils.java
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/JarUtils.java
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/Bootstrapper.java
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/FrameworkLauncher.java
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/util/ConfiguredEncryption.java
    geronimo/server/branches/3.0-beta/plugins/aries/aries-deployer/src/main/history/dependencies.xml
    geronimo/server/branches/3.0-beta/plugins/aries/aries/src/main/history/dependencies.xml
    geronimo/server/branches/3.0-beta/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/GeronimoApplication.java
    geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
    geronimo/server/branches/3.0-beta/plugins/wab/web-extender/src/main/history/dependencies.xml

Modified: geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java (original)
+++ geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java Sat Mar 31 16:13:05 2012
@@ -24,18 +24,19 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Field;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.ServiceLoader;
 import java.util.Set;
-import java.util.LinkedHashMap;
-import java.util.ArrayList;
 
+import org.apache.geronimo.kernel.util.IOUtils;
 import org.apache.geronimo.system.plugin.model.ArtifactType;
 import org.apache.geronimo.system.plugin.model.DependencyType;
 import org.apache.geronimo.system.plugin.model.ImportType;
@@ -53,8 +54,8 @@ import org.apache.maven.plugin.MojoFailu
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.plugin.logging.SystemStreamLog;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.ProjectBuildingException;
 import org.apache.maven.project.MavenProjectHelper;
+import org.apache.maven.project.ProjectBuildingException;
 import org.apache.maven.project.artifact.InvalidDependencyVersionException;
 import org.apache.maven.shared.dependency.tree.DependencyNode;
 import org.apache.maven.shared.dependency.tree.DependencyTreeResolutionListener;
@@ -64,10 +65,10 @@ import org.apache.maven.shared.filtering
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.StringUtils;
-import org.osgi.framework.launch.Framework;
-import org.osgi.framework.launch.FrameworkFactory;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
+import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
 
 /**
  * Support for <em>packaging</em> Mojos.
@@ -233,10 +234,13 @@ public abstract class AbstractCarMojo
             }
             props.setProperty(name, value);
         }
-        BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(outputFile));
-        props.store(output, null);
-        output.flush();
-        output.close();
+        BufferedOutputStream output = null;
+        try {
+            output = new BufferedOutputStream(new FileOutputStream(outputFile));
+            props.store(output, null);
+        } finally {
+            IOUtils.close(output);
+        }
     }
 
     protected static File getArchiveFile(final File basedir, final String finalName, String classifier) {

Modified: geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java (original)
+++ geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java Sat Mar 31 16:13:05 2012
@@ -20,14 +20,13 @@
 package org.apache.geronimo.mavenplugins.car;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
 
 import org.apache.geronimo.kernel.osgi.ConfigurationActivator;
 import org.apache.geronimo.system.osgi.BootActivator;
@@ -241,9 +240,9 @@ public class ArchiveCarMojo
         try {
             // Incldue the generated artifact contents
             File artifactDirectory = this.getArtifactInRepositoryDir();
-
+            
             if (artifactDirectory.exists()) {
-                archiver.addArchivedFileSet(artifactDirectory);
+                archiver.getArchiver().addDirectory(artifactDirectory);
             }
 
             // Include the optional classes.resources
@@ -276,17 +275,16 @@ public class ArchiveCarMojo
 
             //For no plan car, do nothing
             if (artifactDirectory.exists()) {
-                
-                JarFile includedJarFile = new JarFile(artifactDirectory) ;
-                
-                if (includedJarFile.getEntry("META-INF/MANIFEST.MF") != null) {
+
+                File mfFile = new File(artifactDirectory, "META-INF/MANIFEST.MF");
+                if (mfFile.exists()) {
                     FilesetManifestConfig mergeFilesetManifestConfig = new FilesetManifestConfig();
                     mergeFilesetManifestConfig.setValue("merge");
                     archiver.getArchiver().setFilesetmanifest(mergeFilesetManifestConfig);
                 } else {
                     //File configFile = new File(new File(getArtifactInRepositoryDir(), "META-INF"), "imports.txt");
-                    ZipEntry importTxtEntry = includedJarFile.getEntry("META-INF/imports.txt");
-                    if (importTxtEntry != null) {
+                    File importsTxtFile = new File(artifactDirectory, "META-INF/imports.txt");
+                    if (importsTxtFile.exists()) {
                         StringBuilder imports = new StringBuilder("org.apache.geronimo.kernel.osgi,");
                         if (boot) {
                             archive.addManifestEntry(Constants.BUNDLE_ACTIVATOR, BootActivator.class.getName());
@@ -308,7 +306,7 @@ public class ArchiveCarMojo
                         archive.addManifestEntry("Bundle-License", ((License) project.getLicenses().get(0)).getUrl());
                         archive.addManifestEntry(Constants.BUNDLE_DOCURL, project.getUrl());
                         archive.addManifestEntry(Constants.BUNDLE_SYMBOLICNAME, project.getGroupId() + "." + project.getArtifactId());
-                        Reader in = new InputStreamReader(includedJarFile.getInputStream(importTxtEntry));
+                        Reader in = new InputStreamReader(new FileInputStream(importsTxtFile));
                         char[] buf = new char[1024];
                         try {
                             int i;

Modified: geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java (original)
+++ geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java Sat Mar 31 16:13:05 2012
@@ -22,16 +22,12 @@ package org.apache.geronimo.mavenplugins
 import java.io.File;
 import java.net.URI;
 import java.util.Arrays;
-import java.util.HashMap;
+import java.util.Dictionary;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
-import java.util.Collections;
-import java.util.Dictionary;
 
-import org.apache.geronimo.mavenplugins.car.PluginBootstrap2;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
@@ -39,7 +35,6 @@ import org.apache.geronimo.gbean.GBeanIn
 import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelFactory;
-import org.apache.geronimo.kernel.KernelRegistry;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
@@ -47,10 +42,9 @@ import org.apache.geronimo.kernel.config
 import org.apache.geronimo.kernel.config.KernelConfigurationManager;
 import org.apache.geronimo.kernel.config.LifecycleException;
 import org.apache.geronimo.kernel.config.RecordingLifecycleMonitor;
-import org.apache.geronimo.system.configuration.DependencyManager;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
-import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.system.configuration.DependencyManager;
 import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
 import org.apache.geronimo.system.repository.Maven2Repository;
 import org.apache.geronimo.system.resolver.ExplicitDefaultArtifactResolver;
@@ -267,8 +261,8 @@ public class PackageMojo extends Abstrac
         BundleContext bundleContext = framework.getBundleContext();
         boot.setBundleContext(bundleContext);
 
-        // Keep the same behavior with RepositoryConfigurationStore
-        boot.setExpanded(false);
+        // Generate expanded so we can use Maven to generate the archive
+        boot.setExpanded(true);
 
         boot.bootstrap();
 

Modified: geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginBootstrap2.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginBootstrap2.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginBootstrap2.java (original)
+++ geronimo/server/branches/3.0-beta/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginBootstrap2.java Sat Mar 31 16:13:05 2012
@@ -39,6 +39,7 @@ import org.apache.geronimo.kernel.reposi
 import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.util.IOUtils;
 import org.apache.geronimo.system.configuration.DependencyManager;
 import org.apache.geronimo.system.configuration.ExecutableConfigurationUtil;
 import org.apache.geronimo.system.repository.Maven2Repository;
@@ -119,8 +120,7 @@ public class PluginBootstrap2 {
 
         try {
             writeConfiguration(configurationData);
-        }
-        finally {
+        } finally {
             context.close();
         }
     }
@@ -134,16 +134,8 @@ public class PluginBootstrap2 {
                 out = new JarOutputStream(new FileOutputStream(carFile));
                 ExecutableConfigurationUtil.writeConfiguration(configurationData, out);
                 out.flush();
-            }
-            finally {
-                if (out != null) {
-                    try {
-                        out.close();
-                    }
-                    catch (IOException ignored) {
-                        // ignored
-                    }
-                }
+            } finally {
+                IOUtils.close(out);
             }
         }
     }

Modified: geronimo/server/branches/3.0-beta/framework/configs/karaf-framework/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/configs/karaf-framework/src/main/history/dependencies.xml?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/configs/karaf-framework/src/main/history/dependencies.xml (original)
+++ geronimo/server/branches/3.0-beta/framework/configs/karaf-framework/src/main/history/dependencies.xml Sat Mar 31 16:13:05 2012
@@ -3,7 +3,7 @@
     <module-id>
         <groupId>org.apache.geronimo.framework</groupId>
         <artifactId>karaf-framework</artifactId>
-        <version>3.0-beta-1-SNAPSHOT</version>
+        <version>3.0-beta-2-SNAPSHOT</version>
         <type>car</type>
     </module-id>
     <dependency>

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/SimpleEncryption.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/SimpleEncryption.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/SimpleEncryption.java (original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/SimpleEncryption.java Sat Mar 31 16:13:05 2012
@@ -16,15 +16,7 @@
  */
 package org.apache.geronimo.crypto;
 
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.io.ObjectInputStream;
-import java.io.ByteArrayInputStream;
 import javax.crypto.spec.SecretKeySpec;
-import javax.crypto.Cipher;
-import javax.crypto.SealedObject;
-import org.apache.geronimo.crypto.encoders.Base64;
 
 /**
  * This class protects some value BY ENCRYPTING WITH A KNOWN KEY.  That is

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/TargetImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/TargetImpl.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/TargetImpl.java (original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/TargetImpl.java Sat Mar 31 16:13:05 2012
@@ -17,9 +17,10 @@
 
 package org.apache.geronimo.deployment.plugin;
 
-import javax.enterprise.deploy.spi.Target;
-import javax.management.ObjectName;
 import java.io.Serializable;
+
+import javax.enterprise.deploy.spi.Target;
+
 import org.apache.geronimo.gbean.AbstractName;
 
 /**

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java (original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java Sat Mar 31 16:13:05 2012
@@ -26,7 +26,7 @@ import java.util.Map;
 import java.util.jar.JarFile;
 
 import junit.framework.TestCase;
-import org.apache.geronimo.common.DeploymentException;
+
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.config.ConfigurationData;

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java (original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java Sat Mar 31 16:13:05 2012
@@ -41,14 +41,14 @@ import org.apache.geronimo.gbean.annotat
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Naming;
-import org.apache.xbean.osgi.bundle.util.DelegatingBundle;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.MissingDependencyException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.xbean.osgi.bundle.util.DelegatingBundle;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * A Configuration represents a collection of runnable services that can be
@@ -269,9 +269,6 @@ public class Configuration implements GB
     }
     
     private static String getBundleLocation(ConfigurationResolver configurationResolver, Artifact configurationId) {
-        if (System.getProperty("geronimo.build.car") == null) {
-            return "mvn:" + configurationId.getGroupId() + "/" + configurationId.getArtifactId() + "/" + configurationId.getVersion() + ("jar".equals(configurationId.getType())?  "": "/" + configurationId.getType());
-        }
         if (configurationResolver == null) {
             throw new NullPointerException("ConfigurationResolver is null");
         }

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java (original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java Sat Mar 31 16:13:05 2012
@@ -35,7 +35,6 @@ import org.apache.geronimo.gbean.annotat
 import org.apache.geronimo.gbean.annotation.ParamSpecial;
 import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.apache.geronimo.kernel.management.State;
-import org.apache.xbean.osgi.bundle.util.BundleUtils;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
 import org.apache.geronimo.kernel.repository.Dependency;
@@ -43,6 +42,7 @@ import org.apache.geronimo.kernel.reposi
 import org.apache.geronimo.kernel.repository.MissingDependencyException;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.repository.Version;
+import org.apache.xbean.osgi.bundle.util.BundleUtils;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
@@ -619,10 +619,7 @@ public class SimpleConfigurationManager 
         throw exception;
     }
 
-    private String locateBundle(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, IOException, InvalidConfigException {
-        if (System.getProperty("geronimo.build.car") == null) {
-            return "mvn:" + configurationId.getGroupId() + "/" + configurationId.getArtifactId() + "/" + configurationId.getVersion() + "/" + configurationId.getType();
-        }
+    private String locateBundle(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, IOException, InvalidConfigException {        
         monitor.addConfiguration(configurationId);
         monitor.reading(configurationId);
         for (Repository repo : repositories) {

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java (original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java Sat Mar 31 16:13:05 2012
@@ -20,27 +20,26 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.regex.Pattern;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipException;
 import java.util.zip.ZipFile;
 
+import org.apache.geronimo.kernel.util.IOUtils;
 import org.apache.geronimo.kernel.util.InputUtils;
+import org.apache.geronimo.kernel.util.JarUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * @version $Rev: 506425 $ $Date: 2007-02-12 22:49:46 +1100 (Mon, 12 Feb 2007) $
+ * @version $Rev$ $Date$
  */
 public abstract class AbstractRepository implements WriteableRepository {
     protected final Logger log = LoggerFactory.getLogger(getClass());
     private final static ArtifactTypeHandler DEFAULT_TYPE_HANDLER = new CopyArtifactTypeHandler();
-    private final static Pattern ILLEGAL_CHARS = Pattern.compile("[\\.]{2}|[()<>,;:\\\\/\"\']");
     protected final File rootFile;
     private final Map<String, ArtifactTypeHandler> typeHandlers = new HashMap<String, ArtifactTypeHandler>();
 
@@ -54,7 +53,7 @@ public abstract class AbstractRepository
         this.rootFile = rootFile;
         log.debug("Repository root is {}", rootFile.getAbsolutePath());
 
-//        typeHandlers.put("car", new UnpackArtifactTypeHandler());
+        typeHandlers.put("car", new UnpackArtifactTypeHandler());
     }
 
     public boolean contains(Artifact artifact) {
@@ -70,7 +69,7 @@ public abstract class AbstractRepository
     public void copyToRepository(File source, Artifact destination, FileWriteMonitor monitor) throws IOException {
 
         // ensure there are no illegal chars in destination elements
-        InputUtils.validateSafeInput(new ArrayList(Arrays.asList(destination.getGroupId(), destination.getArtifactId(), destination.getVersion().toString(), destination.getType())));
+        InputUtils.validateSafeInput(Arrays.asList(destination.getGroupId(), destination.getArtifactId(), destination.getVersion().toString(), destination.getType()));
 
         if(!destination.isResolved()) {
             throw new IllegalArgumentException("Artifact "+destination+" is not fully resolved");
@@ -82,26 +81,20 @@ public abstract class AbstractRepository
         ZipFile zip = null;
         try {
             zip = new ZipFile(source);
-            for (Enumeration entries=zip.entries(); entries.hasMoreElements();) {
-            	ZipEntry entry = (ZipEntry)entries.nextElement();
+            for (Enumeration<? extends ZipEntry> entries=zip.entries(); entries.hasMoreElements();) {
+            	ZipEntry entry = entries.nextElement();
             	size += entry.getSize();
             }
         } catch (ZipException ze) {
             size = (int)source.length();
         } finally {
-            if (zip != null) {
-                zip.close();
-            }
+            JarUtils.close(zip);
         }
         FileInputStream is = new FileInputStream(source);
         try {
             copyToRepository(is, size, destination, monitor);
         } finally {
-            try {
-                is.close();
-            } catch (IOException ignored) {
-                // ignored
-            }
+            IOUtils.close(is);
         }
     }
 

Propchange: geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Maven2Repository.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Maven2Repository.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Maven2Repository.java (original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Maven2Repository.java Sat Mar 31 16:13:05 2012
@@ -24,7 +24,7 @@ import java.util.SortedSet;
 import java.util.TreeSet;
 
 /**
- * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $
+ * @version $Rev$ $Date$
  */
 public class Maven2Repository extends AbstractRepository implements WritableListableRepository {
 
@@ -44,19 +44,19 @@ public class Maven2Repository extends Ab
         return path;
     }
 
-    public SortedSet list() {
+    public SortedSet<Artifact> list() {
         return listInternal(null, null, null);
     }
 
-    public SortedSet list(Artifact query) {
+    public SortedSet<Artifact> list(Artifact query) {
         if(query.getGroupId() != null) { // todo: see if more logic can be shared with the other case
             File path = new File(rootFile, query.getGroupId().replace('.', File.separatorChar));
             path = new File(path, query.getArtifactId());
             if(!path.canRead() || !path.isDirectory()) {
-                return new TreeSet();
+                return new TreeSet<Artifact>();
             }
 
-            SortedSet artifacts = new TreeSet();
+            SortedSet<Artifact> artifacts = new TreeSet<Artifact>();
 
             File[] versionDirs = path.listFiles();
             for (int i = 0; i < versionDirs.length; i++) {
@@ -91,8 +91,8 @@ public class Maven2Repository extends Ab
         }
     }
 
-    private SortedSet listInternal(String artifactMatch, String typeMatch, String versionMatch) {
-        SortedSet artifacts = new TreeSet();
+    private SortedSet<Artifact> listInternal(String artifactMatch, String typeMatch, String versionMatch) {
+        SortedSet<Artifact> artifacts = new TreeSet<Artifact>();
         File[] groupIds = rootFile.listFiles();
         for (int i = 0; i < groupIds.length; i++) {
             File groupId = groupIds[i];
@@ -109,9 +109,9 @@ public class Maven2Repository extends Ab
         return artifacts;
     }
 
-    private List getArtifacts(String groupId, File versionDir, String artifactMatch, String typeMatch, String versionMatch) {
+    private List<Artifact> getArtifacts(String groupId, File versionDir, String artifactMatch, String typeMatch, String versionMatch) {
         // org/apache/xbean/xbean-classpath/2.2-SNAPSHOT/xbean-classpath-2.2-SNAPSHOT.jar
-        List artifacts = new ArrayList();
+        List<Artifact> artifacts = new ArrayList<Artifact>();
         String artifactId = versionDir.getParentFile().getName();
 
         File[] files = versionDir.listFiles();

Propchange: geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Maven2Repository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Maven2Repository.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Maven2Repository.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/BundleUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/BundleUtil.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/BundleUtil.java (original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/BundleUtil.java Sat Mar 31 16:13:05 2012
@@ -17,19 +17,26 @@
 
 package org.apache.geronimo.kernel.util;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.osgi.framework.Bundle;
 import org.osgi.framework.Version;
 
 /**
  * @version $Rev$ $Date$
  */
 public class BundleUtil {
-    
+
     // the header that identifies a bundle as being a WAB
     public final static String WEB_CONTEXT_PATH_HEADER = "Web-ContextPath";
-    
+
     public final static String EBA_GROUP_ID = "application";
 
+    public final static String REFERENCE_FILE_PREFIX = "reference:file://";
+
     public static String getVersion(org.osgi.framework.Version version) {
         String str = version.getMajor() + "." + version.getMinor() + "." + version.getMicro();
         String qualifier = version.getQualifier();
@@ -38,9 +45,35 @@ public class BundleUtil {
         }
         return str;
     }
-    
+
     public static Artifact createArtifact(String group, String symbolicName, Version version) {
         return new Artifact(group, symbolicName, getVersion(version), "eba");
     }
+
+    public static File toFile(Bundle bundle) {
+        return toFile(bundle.getLocation());
+    }
+
+    public static File toFile(URL url) {
+        return toFile(url.toExternalForm());
+    }
+
+    /**
+     * Translate the reference:file:// style URL  to the underlying file instance
+     * @param url
+     * @return
+     */
+    public static File toFile(String url) {
+        if (url.startsWith(REFERENCE_FILE_PREFIX)) {
+            File file = new File(url.substring(REFERENCE_FILE_PREFIX.length()));
+            if (file.exists()) {
+                return file;
+            }
+        }
+        return null;
+    }
     
+    public static String toReferenceFileLocation(File file) throws IOException {
+        return REFERENCE_FILE_PREFIX + file.getCanonicalPath();
+    }
 }

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/InputUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/InputUtils.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/InputUtils.java (original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/InputUtils.java Sat Mar 31 16:13:05 2012
@@ -17,7 +17,7 @@
 package org.apache.geronimo.kernel.util;
 
 // import java.io.IOException;
-import java.util.ArrayList;
+import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -46,7 +46,7 @@ public class InputUtils {
         }
     }
 
-    public final static void validateSafeInput(ArrayList<String> inputs) {
+    public final static void validateSafeInput(List<String> inputs) {
         for (String input : inputs) {
             validateSafeInput(input);
         }

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/JarUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/JarUtils.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/JarUtils.java (original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/JarUtils.java Sat Mar 31 16:13:05 2012
@@ -40,6 +40,7 @@ import java.util.jar.JarOutputStream;
 import java.util.jar.Manifest;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -323,34 +324,111 @@ public final class JarUtils {
         }
     }
 
-    public static void unzipToDirectory(ZipFile zipFile, File destDir) throws IOException {
-        Enumeration entries = zipFile.entries();
+    public static void unzipToDirectory(ZipInputStream zipIn, File destDir, String prefix, boolean stripPrefix) throws IOException {
+        ZipEntry entry = null;
+        while ((entry = zipIn.getNextEntry()) != null) {
+            if (!entry.getName().startsWith(prefix)) {
+                continue;
+            }
+            String subBasePath = null;
+            if (stripPrefix) {
+                subBasePath = prefix.equals(entry.getName()) ? "" : entry.getName().substring(prefix.length());
+            } else {
+                subBasePath = entry.getName();
+            }
+            unzipToDirectory(zipIn, entry, destDir, subBasePath);
+        }
+    }
+
+    public static void unzipToDirectory(ZipInputStream zipIn, File destDir) throws IOException {
+        ZipEntry entry = null;
+        while ((entry = zipIn.getNextEntry()) != null) {
+            unzipToDirectory(zipIn, entry, destDir);
+        }
+    }
+
+    public static void unzipToDirectory(ZipFile zipFile, File destDir, String prefix, boolean stripPrefix) throws IOException {
+        Enumeration<? extends ZipEntry> entries = zipFile.entries();
         try {
             while (entries.hasMoreElements()) {
-                ZipEntry entry = (ZipEntry) entries.nextElement();
-                if (entry.isDirectory()) {
-                    File dir = new File(destDir, entry.getName());
-                    createDirectory(dir);
+                ZipEntry entry = entries.nextElement();
+                if (!entry.getName().startsWith(prefix)) {
+                    continue;
+                }
+                String subBasePath = null;
+                if (stripPrefix) {
+                    subBasePath = prefix.equals(entry.getName()) ? "" : entry.getName().substring(prefix.length());
                 } else {
-                    File file = new File(destDir, entry.getName());
-                    createDirectory(file.getParentFile());
-                    OutputStream out = null;
-                    InputStream in = null;
-                    try {
-                        out = new BufferedOutputStream(new FileOutputStream(file));
-                        in = zipFile.getInputStream(entry);
-                        IOUtils.copy(in, out);
-                    } finally {
-                        IOUtils.close(in);
-                        IOUtils.close(out);
-                    }
+                    subBasePath = entry.getName();
                 }
+                unzipToDirectory(zipFile, entry, destDir, subBasePath);
+            }
+        } finally {
+            zipFile.close();
+        }
+    }
+
+    public static void unzipToDirectory(ZipFile zipFile, File destDir, String prefix) throws IOException {
+        unzipToDirectory(zipFile, destDir, prefix, false);
+    }
+
+    public static void unzipToDirectory(ZipFile zipFile, File destDir) throws IOException {
+        Enumeration<? extends ZipEntry> entries = zipFile.entries();
+        try {
+            while (entries.hasMoreElements()) {
+                ZipEntry entry = entries.nextElement();
+                unzipToDirectory(zipFile, entry, destDir);
             }
         } finally {
             zipFile.close();
         }
     }
 
+    private static void unzipToDirectory(ZipInputStream zipIn, ZipEntry entry, File destDir) throws IOException {
+        unzipToDirectory(zipIn, entry, destDir, entry.getName());
+    }
+
+    private static void unzipToDirectory(ZipInputStream zipIn, ZipEntry entry, File destDir, String subBasePath) throws IOException {
+        if (entry.isDirectory()) {
+            File dir = new File(destDir, subBasePath);
+            createDirectory(dir);
+        } else {
+            File file = new File(destDir, subBasePath);
+            createDirectory(file.getParentFile());
+            OutputStream out = null;
+            try {
+                out = new BufferedOutputStream(new FileOutputStream(file));
+                IOUtils.copy(zipIn, out);
+            } finally {
+                IOUtils.close(out);
+            }
+        }
+    }
+
+    private static void unzipToDirectory(ZipFile zipFile, ZipEntry entry, File destDir) throws IOException {
+        unzipToDirectory(zipFile, entry, destDir, entry.getName());
+    }
+
+    private static void unzipToDirectory(ZipFile zipFile, ZipEntry entry, File destDir, String subBasePath) throws IOException {
+        if (entry.isDirectory()) {
+            File dir = new File(destDir, subBasePath);
+            createDirectory(dir);
+        } else {
+            File file = new File(destDir, subBasePath);
+            createDirectory(file.getParentFile());
+            OutputStream out = null;
+            InputStream in = null;
+            try {
+                out = new BufferedOutputStream(new FileOutputStream(file));
+                in = zipFile.getInputStream(entry);
+                IOUtils.copy(in, out);
+            } finally {
+                IOUtils.close(in);
+                IOUtils.close(out);
+            }
+        }
+    }
+
     public static void close(JarFile thing) {
         if (thing != null) {
             try {
@@ -360,6 +438,15 @@ public final class JarUtils {
         }
     }
 
+    public static void close(ZipFile thing) {
+        if (thing != null) {
+            try {
+                thing.close();
+            } catch (Exception ignored) {
+            }
+        }
+    }
+
     /**
      * Determine whether a file is a JAR File.
      *

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/Bootstrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/Bootstrapper.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/Bootstrapper.java (original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/Bootstrapper.java Sat Mar 31 16:13:05 2012
@@ -17,6 +17,7 @@
 package org.apache.geronimo.main;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.List;
 import java.util.Properties;
 
@@ -108,11 +109,14 @@ public class Bootstrapper extends Framew
             parts[2] = file.getParentFile().getName();
             parts[3] = file.getName().substring(file.getName().lastIndexOf('.') + 1);
             
-            String mvnLocation = getMvnLocation(parts);
-            
             BundleInfo info = new BundleInfo();
             info.location = file;
-            info.mvnLocation = mvnLocation;
+            try {
+                info.bundleLocation = toReferenceFileLocation(file);
+            } catch (IOException e) {
+                System.err.println("Ignoring Artifact " + location + " (" + e.getMessage() + ")");
+                continue;
+            }
             info.startLevel = 60;
             
             startList.add(info);            
@@ -121,8 +125,8 @@ public class Bootstrapper extends Framew
         return startList;
     }
     
-    private String getMvnLocation(String[] parts) {
-        return "mvn:" + parts[0] + "/" + parts[1] + "/" + parts[2] + "/" + parts[3]; 
+    private String toReferenceFileLocation(File file) throws IOException {
+        return "reference:file://" + file.getCanonicalPath();
     }
     
     private static File getBundleLocation(List<File> bundleDirs, String[] parts) {

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/FrameworkLauncher.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/FrameworkLauncher.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/FrameworkLauncher.java (original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/FrameworkLauncher.java Sat Mar 31 16:13:05 2012
@@ -19,10 +19,8 @@
 package org.apache.geronimo.main;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.io.InputStream;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.net.URLClassLoader;
@@ -30,12 +28,10 @@ import java.security.Provider;
 import java.security.Security;
 import java.util.ArrayList;
 import java.util.Enumeration;
-import java.util.Iterator;
 import java.util.List;
+import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.ServiceLoader;
-import java.util.Map.Entry;
-import java.util.logging.Logger;
 
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -80,8 +76,6 @@ public class FrameworkLauncher {
 
     private static final String KARAF_FRAMEWORK = "karaf.framework";
 
-    private static final Logger LOG = Logger.getLogger(FrameworkLauncher.class.getName());
-
     private boolean uniqueInstance = false;
     private String log4jFile;
     private String startupFile = STARTUP_PROPERTIES_FILE_NAME;
@@ -291,7 +285,7 @@ public class FrameworkLauncher {
         Properties props = Utils.loadPropertiesFile(file, false);
 
         // Perform variable substitution on specified properties.
-        for (Enumeration e = props.propertyNames(); e.hasMoreElements();) {
+        for (Enumeration<?> e = props.propertyNames(); e.hasMoreElements();) {
             String name = (String) e.nextElement();
             String value = System.getProperty(name, props.getProperty(name));
             System.setProperty(name, Utils.substVars(value, name, null, null));
@@ -306,13 +300,13 @@ public class FrameworkLauncher {
         if (additionalConfigFile != null){
             File additionalConfig = new File(new File(baseDir, "etc"), additionalConfigFile);
             Properties additionalProps = Utils.loadPropertiesFile(additionalConfig, false);
-            for (Entry entry : additionalProps.entrySet()) {
+            for (Entry<Object, Object> entry : additionalProps.entrySet()) {
                 configProps.setProperty((String)entry.getKey(), (String)entry.getValue());
             }
         }
 
         // Perform variable substitution for system properties.
-        for (Enumeration e = configProps.propertyNames(); e.hasMoreElements();) {
+        for (Enumeration<?> e = configProps.propertyNames(); e.hasMoreElements();) {
             String name = (String) e.nextElement();
             configProps.setProperty(name, Utils.substVars(configProps.getProperty(name), name, null, configProps));
         }
@@ -321,7 +315,7 @@ public class FrameworkLauncher {
     }
 
     protected static void copySystemProperties(Properties configProps) {
-        for (Enumeration e = System.getProperties().propertyNames(); e.hasMoreElements();) {
+        for (Enumeration<?> e = System.getProperties().propertyNames(); e.hasMoreElements();) {
             String key = (String) e.nextElement();
             if (key.startsWith("felix.") ||
                     key.startsWith("karaf.") ||
@@ -351,7 +345,7 @@ public class FrameworkLauncher {
         URLClassLoader classLoader = (URLClassLoader) FrameworkLauncher.class.getClassLoader();
         Method mth = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
         mth.setAccessible(true);
-        mth.invoke(classLoader, bundleFile.toURL());
+        mth.invoke(classLoader, bundleFile.toURI().toURL());
     }
 
     private void startBundles(BundleContext context, List<BundleInfo> startList) throws Exception {
@@ -365,17 +359,10 @@ public class FrameworkLauncher {
         sl.setInitialBundleStartLevel(ibsl);
 
         for (BundleInfo info : startList) {
-            InputStream in = new FileInputStream(info.location);
-            Bundle bundle = null;
-            try {
-                bundle = context.installBundle(info.mvnLocation, in);
-            } finally {
-                try { in.close(); } catch (Exception e) {}
-            }
+            Bundle bundle = context.installBundle(info.bundleLocation);           
             if (info.startLevel > 0) {
                 sl.setBundleStartLevel(bundle, info.startLevel);
             }
-
             info.bundle = bundle;
         }
 
@@ -414,8 +401,8 @@ public class FrameworkLauncher {
     protected List<BundleInfo> loadStartupProperties(Properties startupProps, List<File> bundleDirs) {
         List<BundleInfo> startList = new ArrayList<BundleInfo>();
 
-        for (Iterator iterator = startupProps.keySet().iterator(); iterator.hasNext();) {
-            String location = (String) iterator.next();
+        for (Entry<Object, Object> entry : startupProps.entrySet()) {
+            String location = (String) entry.getKey();
 
             File file = findFile(bundleDirs, location);
 
@@ -426,17 +413,20 @@ public class FrameworkLauncher {
 
             int level;
             try {
-                level = Integer.parseInt(startupProps.getProperty(location).trim());
+                level = Integer.parseInt(((String) entry.getValue()).trim());
             } catch (NumberFormatException e1) {
                 System.err.print("Ignoring " + location + " (run level must be an integer)");
                 continue;
             }
 
-            String mvnLocation = toMvnUrl(location);
-
             BundleInfo info = new BundleInfo();
             info.location = file;
-            info.mvnLocation = mvnLocation;
+            try {
+                info.bundleLocation = toReferenceFileLocation(file);
+            } catch (IOException e) {
+                System.err.println("Ignoring Artifact " + location + " (" + e.getMessage() + ")");
+                continue;
+            }
             info.startLevel = level;
 
             startList.add(info);
@@ -445,6 +435,10 @@ public class FrameworkLauncher {
         return startList;
     }
 
+    private String toReferenceFileLocation(File file) throws IOException {
+        return "reference:file://" + file.getCanonicalPath();
+    }
+
     private static File findFile(List<File> bundleDirs, String name) {
         for (File bundleDir : bundleDirs) {
             File file = findFile(bundleDir, name);
@@ -477,48 +471,9 @@ public class FrameworkLauncher {
         return null;
     }
 
-    private static String toMvnUrl(String location) {
-        String[] p = location.split("/");
-        if (p.length >= 4 && p[p.length-1].startsWith(p[p.length-3] + "-" + p[p.length-2])) {
-            String groupId = null;
-            String artifactId = p[p.length-3];
-            String version = p[p.length-2];
-            String classifier;
-            String type;
-            String artifactIdVersion = artifactId + "-" + version;
-            StringBuilder sb = new StringBuilder();
-            if (p[p.length-1].charAt(artifactIdVersion.length()) == '-') {
-                classifier = p[p.length-1].substring(artifactIdVersion.length() + 1, p[p.length-1].lastIndexOf('.'));
-            } else {
-                classifier = null;
-            }
-            type = p[p.length-1].substring(p[p.length-1].lastIndexOf('.') + 1);
-            sb.append("mvn:");
-            for (int j = 0; j < p.length - 3; j++) {
-                if (j > 0) {
-                    sb.append('.');
-                }
-                sb.append(p[j]);
-            }
-            sb.append('/').append(artifactId).append('/').append(version);
-            if (!"jar".equals(type) || classifier != null) {
-                sb.append('/');
-                if (!"jar".equals(type)) {
-                    sb.append(type);
-                }
-                if (classifier != null) {
-                    sb.append('/').append(classifier);
-                }
-            }
-            return sb.toString();
-        } else {
-            return location;
-        }
-    }
-
     static class BundleInfo {
         File location;
-        String mvnLocation;
+        String bundleLocation;
         int startLevel;
         Bundle bundle;
     }

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java (original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java Sat Mar 31 16:13:05 2012
@@ -49,6 +49,7 @@ import org.apache.geronimo.kernel.reposi
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
 import org.apache.geronimo.kernel.repository.MissingDependencyException;
 import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.util.BundleUtil;
 import org.apache.geronimo.kernel.util.IOUtils;
 import org.apache.geronimo.system.plugin.model.DependencyType;
 import org.apache.geronimo.system.plugin.model.PluginArtifactType;
@@ -324,7 +325,7 @@ public class DependencyManager implement
                 log.warn("No PackageAdmin service is found, fail to get export packages of " + bundle.getLocation());
                 return Collections.<ExportPackage> emptySet();
             }
-            String exportPackageHeader = (String)bundle.getHeaders().get(Constants.EXPORT_PACKAGE);
+            String exportPackageHeader = bundle.getHeaders().get(Constants.EXPORT_PACKAGE);
             Map<String, HeaderElement> nameVersionExportPackageMap = new HashMap<String, HeaderElement>();
             if (exportPackageHeader != null) {
                 List<HeaderElement> headerElements = HeaderParser.parseHeader(exportPackageHeader);
@@ -383,7 +384,7 @@ public class DependencyManager implement
                 }
             }
         } catch (Throwable e) {
-            log.warn("Could not read geronimo metadata for bundle: " + bundle, e);
+            log.warn("Could not read Geronimo metadata for bundle: " + bundle, e);
         } finally {
             IOUtils.close(in);
         }
@@ -530,14 +531,10 @@ public class DependencyManager implement
         }
     }
 
-    private String locateBundle(Artifact configurationId) throws NoSuchConfigException, IOException, InvalidConfigException {
-        if (System.getProperty("geronimo.build.car") == null) {
-            return "mvn:" + configurationId.getGroupId() + "/" + configurationId.getArtifactId() + "/" + configurationId.getVersion()
-                    + ("jar".equals(configurationId.getType()) ? "" : "/" + configurationId.getType());
-        }
+    private String locateBundle(Artifact configurationId) throws NoSuchConfigException, IOException, InvalidConfigException {        
         for (Repository repo : repositories) {
             if (repo.contains(configurationId)) {
-                return "reference:file://" + repo.getLocation(configurationId).getAbsolutePath();
+                return BundleUtil.toReferenceFileLocation(repo.getLocation(configurationId));
             }
         }
         throw new NoSuchConfigException(configurationId);

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java (original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java Sat Mar 31 16:13:05 2012
@@ -367,7 +367,7 @@ public class RepositoryConfigurationStor
                 if (log.isDebugEnabled()) {
                     log.debug("Packing bundle from " + source + " to destination " + destination);
                 }
-                JarUtils.jarDirectory(source, destination);
+                FileUtils.recursiveCopy(source, destination);
             }
         } else {
             if (log.isDebugEnabled()) {

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/util/ConfiguredEncryption.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/util/ConfiguredEncryption.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/util/ConfiguredEncryption.java (original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/util/ConfiguredEncryption.java Sat Mar 31 16:13:05 2012
@@ -57,7 +57,7 @@ public class ConfiguredEncryption extend
     private final SecretKeySpec spec;
 
     public ConfiguredEncryption(String path, ServerInfo serverInfo) throws IOException, ClassNotFoundException {
-        File location = serverInfo.resolve(path);
+        File location = serverInfo.resolveServer(path);
         if (location.exists()) {
             FileInputStream in = new FileInputStream(location);
             try {

Modified: geronimo/server/branches/3.0-beta/plugins/aries/aries-deployer/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/aries/aries-deployer/src/main/history/dependencies.xml?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/aries/aries-deployer/src/main/history/dependencies.xml (original)
+++ geronimo/server/branches/3.0-beta/plugins/aries/aries-deployer/src/main/history/dependencies.xml Sat Mar 31 16:13:05 2012
@@ -177,6 +177,11 @@
         <type>jar</type>
     </dependency>
     <dependency>
+        <groupId>org.apache.geronimo.modules</groupId>
+        <artifactId>geronimo-wab</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
         <groupId>org.apache.geronimo.specs</groupId>
         <artifactId>geronimo-activation_1.1_spec</artifactId>
         <type>jar</type>

Modified: geronimo/server/branches/3.0-beta/plugins/aries/aries/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/aries/aries/src/main/history/dependencies.xml?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/aries/aries/src/main/history/dependencies.xml (original)
+++ geronimo/server/branches/3.0-beta/plugins/aries/aries/src/main/history/dependencies.xml Sat Mar 31 16:13:05 2012
@@ -187,6 +187,11 @@
         <type>jar</type>
     </dependency>
     <dependency>
+        <groupId>org.apache.geronimo.modules</groupId>
+        <artifactId>geronimo-wab</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
         <groupId>org.apache.geronimo.specs</groupId>
         <artifactId>geronimo-activation_1.1_spec</artifactId>
         <type>jar</type>

Modified: geronimo/server/branches/3.0-beta/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/GeronimoApplication.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/GeronimoApplication.java?rev=1307840&r1=1307839&r2=1307840&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/GeronimoApplication.java (original)
+++ geronimo/server/branches/3.0-beta/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/GeronimoApplication.java Sat Mar 31 16:13:05 2012
@@ -19,6 +19,7 @@ package org.apache.geronimo.aries;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URL;
 import java.util.Enumeration;
@@ -32,8 +33,10 @@ import org.apache.aries.application.Depl
 import org.apache.aries.application.management.AriesApplication;
 import org.apache.aries.application.management.BundleInfo;
 import org.apache.aries.application.utils.AppConstants;
+import org.apache.aries.application.utils.filesystem.IOUtils;
 import org.apache.aries.application.utils.management.SimpleBundleInfo;
 import org.apache.aries.application.utils.manifest.BundleManifest;
+import org.apache.geronimo.kernel.util.BundleUtil;
 import org.osgi.framework.Bundle;
 
 /**
@@ -49,25 +52,37 @@ public class GeronimoApplication impleme
                                ApplicationMetadataFactory applicationFactory, 
                                DeploymentMetadataFactory deploymentFactory) 
         throws IOException {
-        URL applicationMF = bundle.getEntry(AppConstants.APPLICATION_MF);
-        applicationMetadata = applicationFactory.parseApplicationMetadata(applicationMF.openStream());
         
+        URL applicationMF = bundle.getEntry(AppConstants.APPLICATION_MF);
+        InputStream applicationMFStream = null;
+        try {
+            applicationMFStream = applicationMF.openStream();
+            applicationMetadata = applicationFactory.parseApplicationMetadata(applicationMFStream);
+        } finally {
+            IOUtils.close(applicationMFStream);
+        }
+
         bundleInfo = new HashSet<BundleInfo>();
-        Enumeration<URL> e = bundle.findEntries("/", "*", true);
-        while (e.hasMoreElements()) {
-            URL url = e.nextElement();
-            if (url.getPath().endsWith("/")) {
-                continue;
-            }
-            BundleManifest bm = BundleManifest.fromBundle(url.openStream());
-            if (bm != null && bm.isValid()) {
-                bundleInfo.add(new SimpleBundleInfo(applicationFactory, bm, url.toExternalForm()));
-            }
+
+        boolean bundleInfoCollected = false;
+        File bundleFile = BundleUtil.toFile(bundle);
+        if (bundleFile != null && bundleFile.isDirectory()) {
+            collectFileSystemBasedBundleInfos(bundleFile, applicationFactory);
+            bundleInfoCollected = true;
         }
-        
+        if (!bundleInfoCollected) {
+            collectBundleEntryBasedBundleInfos(bundle, applicationFactory);
+        }
+
         URL deploymentMF = bundle.getEntry(AppConstants.DEPLOYMENT_MF);
         if (deploymentMF != null) {
-            deploymentMetadata = deploymentFactory.createDeploymentMetadata(deploymentMF.openStream());
+            InputStream deploymentMFStream = null;
+            try {
+                deploymentMFStream = deploymentMF.openStream();
+                deploymentMetadata = deploymentFactory.createDeploymentMetadata(deploymentMFStream);
+            } finally {
+                IOUtils.close(deploymentMFStream);
+            }
         }
     }
 
@@ -95,4 +110,29 @@ public class GeronimoApplication impleme
         throw new UnsupportedOperationException();        
     }
    
+    private void collectFileSystemBasedBundleInfos(File baseDir, ApplicationMetadataFactory applicationFactory) throws IOException {
+        for (File file : baseDir.listFiles()) {
+            if (file.isDirectory()) {
+                continue;
+            }
+            BundleManifest bm = BundleManifest.fromBundle(file);
+            if (bm != null && bm.isValid()) {
+                bundleInfo.add(new SimpleBundleInfo(applicationFactory, bm, "reference:file://" + file.getCanonicalPath()));
+            }
+        }
+    }
+
+    private void collectBundleEntryBasedBundleInfos(Bundle bundle, ApplicationMetadataFactory applicationFactory) throws IOException {
+        Enumeration<URL> e = bundle.findEntries("/", "*", true);
+        while (e.hasMoreElements()) {
+            URL url = e.nextElement();
+            if (url.getPath().endsWith("/")) {
+                continue;
+            }
+            BundleManifest bm = BundleManifest.fromBundle(url.openStream());
+            if (bm != null && bm.isValid()) {
+                bundleInfo.add(new SimpleBundleInfo(applicationFactory, bm, url.toExternalForm()));
+            }
+        }
+    }
 }



Mime
View raw message