geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r344302 - in /geronimo/trunk: configs/client-system/src/plan/ configs/j2ee-system/src/plan/ plugins/geronimo-assembly-plugin/ plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/
Date Tue, 15 Nov 2005 03:55:25 GMT
Author: djencks
Date: Mon Nov 14 19:55:21 2005
New Revision: 344302

URL: http://svn.apache.org/viewcvs?rev=344302&view=rev
Log:
GERONIMO-1127 progress.  Load dependencies from configurations dependency lists

Modified:
    geronimo/trunk/configs/client-system/src/plan/plan.xml
    geronimo/trunk/configs/j2ee-system/src/plan/plan.xml
    geronimo/trunk/plugins/geronimo-assembly-plugin/plugin.jelly
    geronimo/trunk/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/LocalConfigInstaller.java

Modified: geronimo/trunk/configs/client-system/src/plan/plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/configs/client-system/src/plan/plan.xml?rev=344302&r1=344301&r2=344302&view=diff
==============================================================================
--- geronimo/trunk/configs/client-system/src/plan/plan.xml (original)
+++ geronimo/trunk/configs/client-system/src/plan/plan.xml Mon Nov 14 19:55:21 2005
@@ -66,9 +66,6 @@
         <reference name="ServerInfo">
             <name>ServerInfo</name>
         </reference>
-        <reference name="AttributeStore">
-            <name>AttributeManager</name>
-        </reference>
     </gbean>
 
     <!-- Repository -->

Modified: geronimo/trunk/configs/j2ee-system/src/plan/plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/configs/j2ee-system/src/plan/plan.xml?rev=344302&r1=344301&r2=344302&view=diff
==============================================================================
--- geronimo/trunk/configs/j2ee-system/src/plan/plan.xml (original)
+++ geronimo/trunk/configs/j2ee-system/src/plan/plan.xml Mon Nov 14 19:55:21 2005
@@ -64,9 +64,6 @@
         <reference name="ServerInfo">
             <name>ServerInfo</name>
         </reference>
-        <reference name="AttributeStore">
-            <name>AttributeManager</name>
-        </reference>
     </gbean>
 
     <!-- Persistent List of running Configurations service -->

Modified: geronimo/trunk/plugins/geronimo-assembly-plugin/plugin.jelly
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/geronimo-assembly-plugin/plugin.jelly?rev=344302&r1=344301&r2=344302&view=diff
==============================================================================
--- geronimo/trunk/plugins/geronimo-assembly-plugin/plugin.jelly (original)
+++ geronimo/trunk/plugins/geronimo-assembly-plugin/plugin.jelly Mon Nov 14 19:55:21 2005
@@ -98,6 +98,7 @@
                         <ant:include name="${dependency.getArtifactDirectory()}/${dependency.getType()}s/${dependency.getArtifact()}"/>
                     </j:if>
                 </j:forEach>
+                <ant:exclude name="**/*"/>
             </ant:fileset>
         </ant:copy>
     </goal>
@@ -105,14 +106,20 @@
     <!-- todo automatically add dependencies from configurations into the repo -->
     <!-- todo automatically add libraries listed in an executable's MCP in the right place,
relative to it -->
     <goal name="geronimo:assemble-configurations">
-        <j:set var="configStore" value="${geronimo.assembly.dest}/config-store"/>
-        <ant:delete dir="${configStore}"/>
-        <ant:mkdir dir="${configStore}"/>
+        <j:set var="configStoreDir" value="${geronimo.assembly.dest}/config-store"/>
+        <ant:delete dir="${configStoreDir}"/>
+        <ant:mkdir dir="${configStoreDir}"/>
+        <ant:mkdir dir="${geronimo.assembly.dest}/repository"/>
         <j:forEach var="artifact" items="${pom.artifacts}">
             <j:set var="dependency" value="${artifact.dependency}"/>
             <j:if test="${dependency.type == 'car'}">
                 <j:if test="${dependency.getProperty('geronimo.assemble') == 'install'}">
-                    <assemble:installConfig root="${configStore}" artifact="${artifact.file}"/>
+                    <assemble:installConfig
+                        root="${geronimo.assembly.dest}"
+                        configStore="config-store"
+                        repository="repository"
+                        mavenRepoLocal="${maven.repo.local}"
+                        artifact="${artifact.file}"/>
                 </j:if>
 
                 <!-- handle executable configs -->

Modified: geronimo/trunk/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/LocalConfigInstaller.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/LocalConfigInstaller.java?rev=344302&r1=344301&r2=344302&view=diff
==============================================================================
--- geronimo/trunk/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/LocalConfigInstaller.java
(original)
+++ geronimo/trunk/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/LocalConfigInstaller.java
Mon Nov 14 19:55:21 2005
@@ -18,9 +18,19 @@
 package org.apache.geronimo.plugin.assembly;
 
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
 import java.net.URI;
-
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.repository.FileWriteMonitor;
+import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.system.configuration.LocalConfigStore;
+import org.apache.geronimo.system.repository.FileSystemRepository;
 
 /**
  * JellyBean that installs configuration artifacts into a LocalConfigurationStore
@@ -29,7 +39,11 @@
  */
 public class LocalConfigInstaller {
     private File root;
+    private String configStore;
+    private String repository;
     private File artifact;
+    private File mavenRepoLocal;
+    private URI mavenRepoLocalURI;
 
     public File getRoot() {
         return root;
@@ -39,6 +53,22 @@
         this.root = root;
     }
 
+    public String getConfigStore() {
+        return configStore;
+    }
+
+    public void setConfigStore(String configStore) {
+        this.configStore = configStore;
+    }
+
+    public String getRepository() {
+        return repository;
+    }
+
+    public void setRepository(String repository) {
+        this.repository = repository;
+    }
+
     public File getArtifact() {
         return artifact;
     }
@@ -47,14 +77,76 @@
         this.artifact = artifact;
     }
 
+    public File getMavenRepoLocal() {
+        return mavenRepoLocal;
+    }
+
+    public void setMavenRepoLocal(File mavenRepoLocal) {
+        this.mavenRepoLocal = mavenRepoLocal;
+        mavenRepoLocalURI = mavenRepoLocal.toURI();
+    }
+
     public void execute() throws Exception {
-        LocalConfigStore store = new LocalConfigStore(root);
+        LocalConfigStore store = new LocalConfigStore(new File(root, configStore));
         store.doStart();
+        GBeanData config;
         try {
-            URI uri = store.install(artifact.toURL());
-            System.out.println("Installed configuration " + uri);
+            config = store.install2(artifact.toURL());
+            System.out.println("Installed configuration " + config.getAttribute("id"));
         } finally{
             store.doStop();
+        }
+        URI rootURI = root.toURI().resolve(repository);
+        Repository sourceRepo = new Repository() {
+
+            public boolean hasURI(URI uri) {
+                uri = mavenRepoLocalURI.resolve(uri);
+                if ("file".equals(uri.getScheme())) {
+                    return new File(uri).canRead();
+                } else {
+                    try {
+                        uri.toURL().openStream().close();
+                        return true;
+                    } catch (IOException e) {
+                        return false;
+                    }
+                }
+            }
+
+            public URL getURL(URI uri) throws MalformedURLException {
+                uri = mavenRepoLocalURI.resolve(uri);
+                return uri.toURL();
+            }
+        };
+
+        FileSystemRepository targetRepo = new FileSystemRepository(rootURI, null);
+        targetRepo.doStart();
+        List dependencies = (List) config.getAttribute("dependencies");
+        FileWriteMonitor monitor = new FileWriteMonitor() {
+
+            public void writeStarted(String fileDescription) {
+                System.out.println("Copying " + fileDescription);
+            }
+
+            public void writeProgress(int bytes) {
+
+            }
+
+            public void writeComplete(int bytes) {
+
+            }
+        };
+
+        for (Iterator iterator = dependencies.iterator(); iterator.hasNext();) {
+            URI dependency = (URI) iterator.next();
+            if (!sourceRepo.hasURI(dependency)) {
+                throw new RuntimeException("Dependency: " + dependency + " not found in local
maven repo: for configuration: " + config.getAttribute("id"));
+            }
+            if (!targetRepo.hasURI(dependency)) {
+                URL sourceURL = sourceRepo.getURL(dependency);
+                InputStream in = sourceURL.openStream();
+                targetRepo.copyToRepository(in, dependency, monitor);
+            }
         }
     }
 }



Mime
View raw message