geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r384686 [3/3] - in /geronimo/branches/1.1: applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/ configs/geronimo-gbean-deployer/src/plan/ configs/j2ee-deployer/ configs/j2ee-deployer/src/plan/ configs/jett...
Date Fri, 10 Mar 2006 02:57:39 GMT
Modified: geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java?rev=384686&r1=384685&r2=384686&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
(original)
+++ geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
Thu Mar  9 18:57:07 2006
@@ -22,6 +22,7 @@
 import java.util.HashMap;
 import java.util.Enumeration;
 import java.util.Iterator;
+import java.util.Collections;
 import java.util.zip.ZipEntry;
 import java.util.jar.JarFile;
 import java.io.File;
@@ -62,6 +63,8 @@
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.ImportType;
+import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.security.jacc.ComponentPermissions;
 import org.apache.geronimo.security.util.URLPattern;
 
@@ -76,11 +79,10 @@
     protected static final ObjectName ENTITY_BEAN_PATTERN;
     protected final Kernel kernel;
 
-    public AbstractWebModuleBuilder(Kernel kernel) {
+    protected AbstractWebModuleBuilder(Kernel kernel) {
         this.kernel = kernel;
     }
 
-
     static {
         try {
             MANAGED_CONNECTION_FACTORY_PATTERN = ObjectName.getInstance("*:j2eeType=" + NameFactory.JCA_MANAGED_CONNECTION_FACTORY
+  ",*");
@@ -166,7 +168,7 @@
         return path;
     }
 
-    public void installModule(JarFile earFile, EARContext earContext, Module module, ConfigurationStore
configurationStore) throws DeploymentException {
+    public void installModule(JarFile earFile, EARContext earContext, Module module, ConfigurationStore
configurationStore, Repository repository) throws DeploymentException {
         EARContext moduleContext;
         if (module.isStandAlone()) {
             moduleContext = earContext;
@@ -188,6 +190,7 @@
                 moduleContext = new EARContext(configurationDir,
                         environment,
                         ConfigurationModuleType.WAR,
+                        Collections.singleton(repository),
                         kernel,
                         earContext.getJ2EEApplicationName(),
                         earContext.getTransactionContextManagerObjectName(),
@@ -202,7 +205,7 @@
             }
             //TODO this is extremely fishy
             //Add the ear parent here since it can't be loaded by any config store.
-            environment.addImport(earConfigId);
+            environment.addDependency(earConfigId, ImportType.ALL);
         }
         module.setEarContext(moduleContext);
 

Modified: geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/BaseConfigInstaller.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/BaseConfigInstaller.java?rev=384686&r1=384685&r2=384686&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/BaseConfigInstaller.java
(original)
+++ geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/BaseConfigInstaller.java
Thu Mar  9 18:57:07 2006
@@ -18,6 +18,7 @@
 
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactManager;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
@@ -25,16 +26,17 @@
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.FileWriteMonitor;
-import org.apache.geronimo.kernel.repository.ListableRepository;
 import org.apache.geronimo.kernel.repository.MissingDependencyException;
-import org.apache.geronimo.kernel.repository.Repository;
-import org.apache.geronimo.kernel.repository.WriteableRepository;
+import org.apache.geronimo.kernel.repository.Dependency;
+import org.apache.geronimo.kernel.repository.WritableListableRepository;
+import org.apache.geronimo.system.repository.Maven1Repository;
+import org.apache.geronimo.system.repository.Maven2Repository;
+import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
 
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 
@@ -42,28 +44,42 @@
  * @version $Rev$ $Date$
  */
 public class BaseConfigInstaller {
+    public static final FileWriteMonitor LOG_COPY_START = new StartFileWriteMonitor();
+
     /**
      * root file of the targetConfigStore and TargetRepository.  Typically $GERONIMO_HOME
of the
      * geronimo server being assembled
      */
-    protected File targetRoot;
+    private File targetRoot;
+
     /**
      * location of the target config store relative to targetRoot.  Typically "config-store"
      */
-    protected String targetConfigStore;
+    private String targetConfigStore;
+
     /**
      * location of the target repository relative to targetRoot.  Typically "repository"
      */
-    protected String targetRepository;
+    private String targetRepository;
+
     /**
      * location of the configuration to be installed relative to the sourceRepository
      */
     private String artifact;
+
     /**
      * location of the source repository for the dependencies
      */
     private File sourceRepository;
 
+    private ArtifactResolver artifactResolver;
+
+    private WritableListableRepository targetRepo;
+    private RepositoryConfigurationStore targetStore;
+
+    private WritableListableRepository sourceRepo;
+    private RepositoryConfigurationStore sourceStore;
+
     public File getTargetRoot() {
         return targetRoot;
     }
@@ -104,81 +120,88 @@
         this.sourceRepository = sourceRepository;
     }
 
-    protected void execute(InstallAdapter installAdapter, ListableRepository sourceRepo,
WriteableRepository targetRepo) throws IOException, InvalidConfigException, MissingDependencyException
{
-        Artifact configId = Artifact.create(artifact);
+    public void execute() throws Exception {
         ArtifactManager artifactManager = new DefaultArtifactManager();
-        ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager,
sourceRepo);
-        execute(configId, installAdapter, sourceRepo, targetRepo, artifactManager, artifactResolver);
-    }
+        artifactResolver = new DefaultArtifactResolver(artifactManager, sourceRepo);
+
+        sourceRepo = new Maven1Repository(getSourceRepository());
+        sourceStore = new RepositoryConfigurationStore(sourceRepo);
+
+        targetRepo = new Maven2Repository(new File(targetRoot, targetRepository));
+        targetStore = new RepositoryConfigurationStore(targetRepo);
+
+        Artifact configId = Artifact.create(artifact);
+
+        // does this configuration exist?
+        if (!sourceRepo.contains(configId)) {
+            throw new NoSuchConfigException(configId.toString());
+        }
 
-    protected void execute(Artifact configId, InstallAdapter installAdapter, Repository sourceRepo,
WriteableRepository targetRepo, ArtifactManager artifactManager, ArtifactResolver artifactResolver)
throws IOException, InvalidConfigException, MissingDependencyException {
-        if (installAdapter.containsConfiguration(configId)) {
+        // is this config already installed?
+        if (targetStore.containsConfiguration(configId)) {
             System.out.println("Configuration " + configId + " already present in configuration
store");
             return;
         }
-        GBeanData config = installAdapter.install(sourceRepo, configId);
-        Environment environment = (Environment) config.getAttribute("environment");
-        LinkedHashSet imports = environment.getImports();
-        recursiveExecute(artifactResolver, imports, installAdapter, sourceRepo, targetRepo,
artifactManager);
-
-        LinkedHashSet references = environment.getReferences();
-        recursiveExecute(artifactResolver, references, installAdapter, sourceRepo, targetRepo,
artifactManager);
-
-        LinkedHashSet dependencies = environment.getDependencies();
-        dependencies = recursiveResolve(artifactResolver, dependencies, sourceRepo);
-        System.out.println("Installed configuration " + configId);
+        execute(configId);
+    }
 
-        FileWriteMonitor monitor = new StartFileWriteMonitor();
+    private void execute(Artifact configId) throws IOException, InvalidConfigException, MissingDependencyException
{
+        LinkedHashSet dependencies;
+        if (sourceStore.containsConfiguration(configId)) {
+            // Copy the configuration into the target configuration store
+            if (!targetStore.containsConfiguration(configId)) {
+                File sourceFile = sourceRepo.getLocation(configId);
+                InputStream in = new FileInputStream(sourceFile);
+                try {
+                    targetStore.install(in, configId, LOG_COPY_START);
+                } finally {
+                    in.close();
+                }
+            }
 
-        for (Iterator iterator = dependencies.iterator(); iterator.hasNext();) {
-            Artifact dependency = (Artifact) iterator.next();
-            if (!sourceRepo.contains(dependency)) {
-                throw new RuntimeException("Dependency: " + dependency + " not found in local
maven repo: for configuration: " + artifact);
+            // Determine the dependencies of this configuration
+            try {
+                GBeanData config = targetStore.loadConfiguration(configId);
+                Environment environment = (Environment) config.getAttribute("environment");
+                dependencies = new LinkedHashSet();
+                for (Iterator iterator = environment.getDependencies().iterator(); iterator.hasNext();)
{
+                    Dependency dependency = (Dependency) iterator.next();
+                    dependencies.add(dependency.getArtifact());
+                }
+
+                System.out.println("Installed configuration " + configId);
+            } catch (IOException e) {
+                throw new InvalidConfigException("Unable to load configuration: " + configId,
e);
+            } catch (NoSuchConfigException e) {
+                throw new InvalidConfigException("Unable to load configuration: " + configId,
e);
             }
-            if (!targetRepo.contains(dependency)) {
-                File sourceFile = sourceRepo.getLocation(dependency);
-                InputStream in = new FileInputStream(sourceFile);
-                targetRepo.copyToRepository(in, dependency, monitor);
+        } else {
+            if (!sourceRepo.contains(configId)) {
+                throw new RuntimeException("Dependency: " + configId + " not found in local
maven repo: for configuration: " + artifact);
             }
-        }
-        Artifact[] parentId = (Artifact[]) config.getAttribute("parentId");
-        if (parentId != null) {
-            for (int i = 0; i < parentId.length; i++) {
-                Artifact parent = parentId[i];
-                execute(parent, installAdapter, sourceRepo, targetRepo, artifactManager,
artifactResolver);
+
+            // Copy the artifact into the target repo
+            if (!targetRepo.contains(configId)) {
+                File sourceFile = sourceRepo.getLocation(configId);
+                InputStream in = new FileInputStream(sourceFile);
+                try {
+                    targetRepo.copyToRepository(in, configId, LOG_COPY_START);
+                } finally {
+                    in.close();
+                }
             }
-        }
-    }
 
-    private void recursiveExecute(ArtifactResolver artifactResolver, LinkedHashSet imports,
InstallAdapter installAdapter, Repository sourceRepo, WriteableRepository targetRepo, ArtifactManager
artifactManager) throws MissingDependencyException, IOException, InvalidConfigException {
-        imports = artifactResolver.resolve(imports);
-        for (Iterator iterator = imports.iterator(); iterator.hasNext();) {
-            Artifact parentId = (Artifact) iterator.next();
-            execute(parentId, installAdapter, sourceRepo, targetRepo, artifactManager, artifactResolver);
+            // Determine the dependencies of this artifact
+            dependencies = sourceRepo.getDependencies(configId);
         }
-    }
-
-    private LinkedHashSet recursiveResolve(ArtifactResolver artifactResolver, LinkedHashSet
dependencies, Repository repository) throws MissingDependencyException {
         dependencies = artifactResolver.resolve(dependencies);
-        for (Iterator iterator = new ArrayList(dependencies).iterator(); iterator.hasNext();)
{
-            Artifact dependency = (Artifact) iterator.next();
-            if (repository.contains(dependency)) {
-                LinkedHashSet subDependencies = repository.getDependencies(dependency);
-                subDependencies = recursiveResolve(artifactResolver, subDependencies, repository);
-                dependencies.addAll(subDependencies);
-            }
+        for (Iterator iterator = dependencies.iterator(); iterator.hasNext();) {
+            Artifact artifact = (Artifact) iterator.next();
+            execute(artifact);
         }
-        return dependencies;
-    }
-
-    protected interface InstallAdapter {
-
-        GBeanData install(Repository sourceRepo, Artifact configId) throws IOException, InvalidConfigException;
-
-        boolean containsConfiguration(Artifact configID);
     }
 
-    static class StartFileWriteMonitor implements FileWriteMonitor {
+    private static class StartFileWriteMonitor implements FileWriteMonitor {
         public void writeStarted(String fileDescription) {
             System.out.println("Copying " + fileDescription);
         }

Modified: geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/LocalConfigInstaller.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/LocalConfigInstaller.java?rev=384686&r1=384685&r2=384686&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/LocalConfigInstaller.java
(original)
+++ geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/LocalConfigInstaller.java
Thu Mar  9 18:57:07 2006
@@ -17,21 +17,6 @@
 
 package org.apache.geronimo.plugin.assembly;
 
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.FileInputStream;
-
-import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.geronimo.kernel.config.NoSuchConfigException;
-import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.ListableRepository;
-import org.apache.geronimo.kernel.repository.Repository;
-import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
-import org.apache.geronimo.system.repository.Maven1Repository;
-import org.apache.geronimo.system.repository.Maven2Repository;
-
 /**
  * JellyBean that installs configuration artifacts into a LocalConfigurationStore,  It also
copies all
  * configuration dependencies into the repository
@@ -39,37 +24,4 @@
  * @version $Rev$ $Date$
  */
 public class LocalConfigInstaller extends BaseConfigInstaller {
-
-    public void execute() throws Exception {
-        final Maven2Repository targetRepo = new Maven2Repository(new File(targetRoot, targetRepository));
-
-        final RepositoryConfigurationStore store = new RepositoryConfigurationStore(targetRepo);
-
-        InstallAdapter installAdapter = new InstallAdapter() {
-
-            public GBeanData install(Repository sourceRepo, Artifact configId) throws IOException,
InvalidConfigException {
-                File artifact = sourceRepo.getLocation(configId);
-                InputStream in = new FileInputStream(artifact);
-                try {
-                    store.install(in, configId, new StartFileWriteMonitor());
-                } finally {
-                    in.close();
-                }
-                GBeanData config;
-                try {
-                    config = store.loadConfiguration(configId);
-                } catch (NoSuchConfigException e) {
-                    throw new InvalidConfigException(e);
-                }
-                return config;
-            }
-
-            public boolean containsConfiguration(Artifact configID) {
-                return store.containsConfiguration(configID);
-            }
-        };
-        ListableRepository sourceRepo = new Maven1Repository(getSourceRepository());
-
-        execute(installAdapter, sourceRepo, targetRepo);
-    }
 }

Modified: geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/RepoConfigInstaller.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/RepoConfigInstaller.java?rev=384686&r1=384685&r2=384686&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/RepoConfigInstaller.java
(original)
+++ geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/RepoConfigInstaller.java
Thu Mar  9 18:57:07 2006
@@ -17,22 +17,6 @@
 
 package org.apache.geronimo.plugin.assembly;
 
-import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.geronimo.kernel.config.NoSuchConfigException;
-import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.ListableRepository;
-import org.apache.geronimo.kernel.repository.Repository;
-import org.apache.geronimo.kernel.repository.WritableListableRepository;
-import org.apache.geronimo.system.repository.Maven1Repository;
-import org.apache.geronimo.system.repository.Maven2Repository;
-import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
 /**
  * JellyBean that installs configuration artifacts into a repository based ConfigurationStore,
 It also copies all
  * configuration dependencies into the repository
@@ -40,46 +24,4 @@
  * @version $Rev$ $Date$
  */
 public class RepoConfigInstaller extends BaseConfigInstaller {
-    public void execute() throws Exception {
-        ListableRepository sourceRepo = new Maven1Repository(getSourceRepository());
-
-        WritableListableRepository targetRepo = new Maven2Repository(new File(targetRoot,
targetRepository));
-        RepositoryConfigurationStore configurationStore = new RepositoryConfigurationStore(targetRepo);
-        InstallAdapter installAdapter = new CopyConfigStore(configurationStore);
-
-        execute(installAdapter, sourceRepo, targetRepo);
-   }
-
-    private static class CopyConfigStore implements InstallAdapter {
-        private final RepositoryConfigurationStore configurationStore;
-
-        public CopyConfigStore(RepositoryConfigurationStore configurationStore) {
-            this.configurationStore = configurationStore;
-        }
-
-        public GBeanData install(Repository sourceRepo, Artifact configId) throws IOException,
InvalidConfigException {
-            if (!configurationStore.containsConfiguration(configId)) {
-                File sourceFile = sourceRepo.getLocation(configId);
-                InputStream in = new FileInputStream(sourceFile);
-                try {
-                    configurationStore.install(in, configId, new StartFileWriteMonitor());
-                } finally {
-                    in.close();
-                }
-            }
-
-            try {
-                GBeanData config = configurationStore.loadConfiguration(configId);
-                return config;
-            } catch (IOException e) {
-                throw new InvalidConfigException("Unable to load configuration: " + configId,
e);
-            } catch (NoSuchConfigException e) {
-                throw new InvalidConfigException("Unable to load configuration: " + configId,
e);
-            }
-        }
-
-        public boolean containsConfiguration(Artifact configID) {
-            return configurationStore.containsConfiguration(configID);
-        }
-    }
 }

Modified: geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/RepoCopier.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/RepoCopier.java?rev=384686&r1=384685&r2=384686&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/RepoCopier.java
(original)
+++ geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/RepoCopier.java
Thu Mar  9 18:57:07 2006
@@ -96,7 +96,7 @@
         }
         if (!targetRepository.contains(configId)) {
             File sourceFile = sourceRepository.getLocation(configId);
-            targetRepository.copyToRepository(sourceFile, configId, new BaseConfigInstaller.StartFileWriteMonitor());
+            targetRepository.copyToRepository(sourceFile, configId, BaseConfigInstaller.LOG_COPY_START);
         }
     }
 }

Modified: geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java?rev=384686&r1=384685&r2=384686&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
(original)
+++ geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
Thu Mar  9 18:57:07 2006
@@ -16,7 +16,10 @@
  */
 package org.apache.geronimo.plugin.packaging;
 
-import org.apache.geronimo.gbean.GBeanData;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.kernel.config.ConfigurationData;
@@ -24,19 +27,9 @@
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.repository.WritableListableRepository;
 import org.apache.geronimo.system.configuration.ExecutableConfigurationUtil;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
+import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
 
 /**
  * Implementation of ConfigurationStore that loads Configurations from a repository.
@@ -45,46 +38,9 @@
  *
  * @version $Rev$ $Date$
  */
-public class MavenConfigStore implements ConfigurationStore {
-    private final ObjectName objectName;
-    private final Repository repository;
-
-    public MavenConfigStore(String objectName, Repository repository) throws MalformedObjectNameException
{
-        this.objectName = new ObjectName(objectName);
-        this.repository = repository;
-    }
-
-    public String getObjectName() {
-        return objectName.toString();
-    }
-
-    public synchronized GBeanData loadConfiguration(Artifact configId) throws NoSuchConfigException,
IOException, InvalidConfigException {
-        if (!repository.contains(configId)) {
-            throw new NoSuchConfigException("Configuration not found: " + configId);
-        }
-
-        GBeanData config = new GBeanData();
-        URL baseURL = new URL("jar:" + repository.getLocation(configId).toURL().toString()
+ "!/");
-        InputStream jis = null;
-        try {
-            URL stateURL = new URL(baseURL, "META-INF/config.ser");
-            jis = stateURL.openStream();
-            ObjectInputStream ois = new ObjectInputStream(jis);
-            config.readExternal(ois);
-        } catch (ClassNotFoundException e) {
-            throw new InvalidConfigException("Unable to load class from config: " + configId,
e);
-        } finally {
-            if (jis != null) {
-                jis.close();
-            }
-        }
-
-        return config;
-    }
-
-
-    public boolean containsConfiguration(Artifact configID) {
-        return repository.contains(configID);
+public class MavenConfigStore extends RepositoryConfigurationStore {
+    public MavenConfigStore(String objectName, WritableListableRepository repository) {
+        super(null, objectName, repository);
     }
 
     public File createNewConfigurationDir(Artifact configId) {
@@ -105,18 +61,13 @@
         }
     }
 
-    public URL resolve(Artifact configId, URI uri) throws NoSuchConfigException, MalformedURLException
{
-        URL baseURL = new URL("jar:" + repository.getLocation(configId).toURL().toString()
+ "!/");
-        return new URL(baseURL, uri.toString());
-    }
-
     public void install(ConfigurationData configurationData) throws IOException, InvalidConfigException
{
         File source = configurationData.getConfigurationDir();
         if (!source.isDirectory()) {
             throw new InvalidConfigException("Source must be a directory: source=" + source);
         }
         Artifact configId = configurationData.getId();
-        File targetFile =repository.getLocation(configId);
+        File targetFile = repository.getLocation(configId);
         ExecutableConfigurationUtil.createExecutableConfiguration(configurationData, null,
targetFile);
     }
 
@@ -128,7 +79,6 @@
         throw new UnsupportedOperationException();
     }
 
-
     public static final GBeanInfo GBEAN_INFO;
 
     public static GBeanInfo getGBeanInfo() {
@@ -138,8 +88,9 @@
     static {
         GBeanInfoBuilder builder = GBeanInfoBuilder.createStatic(MavenConfigStore.class);
         builder.addInterface(ConfigurationStore.class);
+        builder.addInterface(ConfigurationStore.class);
         builder.addAttribute("objectName", String.class, false);
-        builder.addReference("Repository", Repository.class);
+        builder.addReference("Repository", WritableListableRepository.class, "Repository");
         builder.setConstructor(new String[]{"objectName", "Repository"});
         GBEAN_INFO = builder.getBeanInfo();
     }

Modified: geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java?rev=384686&r1=384685&r2=384686&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
(original)
+++ geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
Thu Mar  9 18:57:07 2006
@@ -94,7 +94,7 @@
             REPOSITORY_NAME = new ObjectName(KERNEL_NAME + ":name=Repository,j2eeType=Repository");
             ARTIFACT_MANAGER_NAME = new ObjectName(KERNEL_NAME + ":name=ArtifactManager");
             ARTIFACT_RESOLVER_NAME = new ObjectName(KERNEL_NAME + ":name=ArtifactResolver");
-            CONFIGSTORE_NAME = new ObjectName(KERNEL_NAME + ":name=MavenConfigStore,j2eeType=ConfigurationStore");
+            CONFIGSTORE_NAME = new ObjectName(KERNEL_NAME + ":name=PackageBuilderConfigStore,j2eeType=ConfigurationStore");
             CONFIGMANAGER_NAME = new ObjectName(KERNEL_NAME + ":name=ConfigurationManager,j2eeType=ConfigurationManager");
             ATTRIBUTESTORE_NAME = new ObjectName(KERNEL_NAME + ":name=ManagedAttributeStore");
         } catch (MalformedObjectNameException e) {

Modified: geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShell.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShell.java?rev=384686&r1=384685&r2=384686&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShell.java
(original)
+++ geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShell.java
Thu Mar  9 18:57:07 2006
@@ -25,16 +25,13 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
 
-import org.apache.commons.jelly.JellyContext;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.system.repository.Maven1Repository;
 import org.apache.maven.jelly.MavenJellyContext;
 import org.apache.maven.project.Dependency;
 import org.apache.maven.repository.Artifact;
-import org.apache.geronimo.system.repository.Maven1Repository;
 
 /**
  * JellyBean that builds a Geronimo Configuration using the local Mavem

Modified: geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java?rev=384686&r1=384685&r2=384686&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java
(original)
+++ geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java
Thu Mar  9 18:57:07 2006
@@ -37,7 +37,6 @@
 import javax.xml.namespace.QName;
 import java.io.File;
 import java.io.StringWriter;
-import java.util.Collection;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -176,16 +175,11 @@
 
                 org.apache.geronimo.kernel.repository.Artifact configId = new org.apache.geronimo.kernel.repository.Artifact(groupId,
artifactId, version, "car");
 
-                Collection imports = toArtifacts(IMPORT_PROPERTY);
-//                Collection includes = toArtifacts(INCLUDE_PROPERTY);
-                Collection dependencies = toArtifacts(DEPENDENCY_PROPERTY);
-                Collection references = toArtifacts(REFERENCE_PROPERTY);
+                LinkedHashSet dependencies = toDependencies();
 
                 Environment newEnvironment = new Environment();
                 newEnvironment.setConfigId(configId);
-                newEnvironment.setImports(imports);
                 newEnvironment.setDependencies(dependencies);
-                newEnvironment.setReferences(references);
 
                 EnvironmentBuilder.mergeEnvironments(oldEnvironment, newEnvironment);
                 EnvironmentType environmentType = EnvironmentBuilder.buildEnvironmentType(oldEnvironment);
@@ -219,23 +213,38 @@
         }
     }
 
-    private Collection toArtifacts(String artifactProperty) {
-        Collection artifactList = new LinkedHashSet();
+    private LinkedHashSet toDependencies() {
+        LinkedHashSet dependencies = new LinkedHashSet();
         for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
             Artifact artifact = (Artifact) iterator.next();
             Dependency dependency = artifact.getDependency();
-            if ("true".equals(dependency.getProperty(artifactProperty))) {
-                String groupId = dependency.getGroupId();
-                String artifactId = dependency.getArtifactId();
-                String version = dependency.getVersion();
-                String type = dependency.getType();
-                if (type == null) {
-                    type = "jar";
-                }
-                artifactList.add(new org.apache.geronimo.kernel.repository.Artifact(groupId,
artifactId,  version, type));
+            org.apache.geronimo.kernel.repository.Dependency geronimoDependency = toGeronimoDependency(dependency);
+            if (geronimoDependency != null) {
+                dependencies.add(geronimoDependency);
             }
         }
-        return artifactList;
+        return dependencies;
+    }
+
+    private static org.apache.geronimo.kernel.repository.Dependency toGeronimoDependency(Dependency
dependency) {
+        org.apache.geronimo.kernel.repository.Artifact artifact = toGeronimoArtifact(dependency);
+        if ("true".equals(dependency.getProperty(DEPENDENCY_PROPERTY))) {
+            return new org.apache.geronimo.kernel.repository.Dependency(artifact, org.apache.geronimo.kernel.repository.ImportType.CLASSES);
+        } else if ("true".equals(dependency.getProperty(REFERENCE_PROPERTY))) {
+            return new org.apache.geronimo.kernel.repository.Dependency(artifact, org.apache.geronimo.kernel.repository.ImportType.SERVICES);
+        } else if ("true".equals(dependency.getProperty(IMPORT_PROPERTY))) {
+            return new org.apache.geronimo.kernel.repository.Dependency(artifact, org.apache.geronimo.kernel.repository.ImportType.ALL);
+        } else {
+            // not one of ours
+            return null;
+        }
+    }
+    private static org.apache.geronimo.kernel.repository.Artifact toGeronimoArtifact(Dependency
dependency) {
+        String groupId = dependency.getGroupId();
+        String artifactId = dependency.getArtifactId();
+        String version = dependency.getVersion();
+        String type = dependency.getType();
+        return new org.apache.geronimo.kernel.repository.Artifact(groupId, artifactId, version,
type);
     }
 
     interface Inserter {



Mime
View raw message