You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2005/12/10 02:28:06 UTC
svn commit: r355680 - in
/geronimo/branches/1.0/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly:
BaseConfigInstaller.java LocalConfigInstaller.java RepoConfigInstaller.java
Author: djencks
Date: Fri Dec 9 17:28:03 2005
New Revision: 355680
URL: http://svn.apache.org/viewcvs?rev=355680&view=rev
Log:
GERONIMO-1320 recursive car install in assembly plugin
Modified:
geronimo/branches/1.0/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/BaseConfigInstaller.java
geronimo/branches/1.0/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/LocalConfigInstaller.java
geronimo/branches/1.0/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/RepoConfigInstaller.java
Modified: geronimo/branches/1.0/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/BaseConfigInstaller.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/BaseConfigInstaller.java?rev=355680&r1=355679&r2=355680&view=diff
==============================================================================
--- geronimo/branches/1.0/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/BaseConfigInstaller.java (original)
+++ geronimo/branches/1.0/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/BaseConfigInstaller.java Fri Dec 9 17:28:03 2005
@@ -29,6 +29,7 @@
import org.apache.geronimo.kernel.repository.FileWriteMonitor;
import org.apache.geronimo.kernel.repository.Repository;
import org.apache.geronimo.system.repository.FileSystemRepository;
+import org.apache.geronimo.gbean.GBeanData;
/**
* @version $Rev: $ $Date: $
@@ -107,7 +108,13 @@
}
protected void execute(InstallAdapter installAdapter, Repository sourceRepo, FileSystemRepository targetRepo) throws IOException, InvalidConfigException {
- List dependencies = installAdapter.install(sourceRepo, artifact);
+ URI configId = URI.create(artifact);
+ execute(configId, installAdapter, sourceRepo, targetRepo);
+ }
+
+ protected void execute(URI configId, InstallAdapter installAdapter, Repository sourceRepo, FileSystemRepository targetRepo) throws IOException, InvalidConfigException {
+ GBeanData config = installAdapter.install(sourceRepo, configId);
+ List dependencies = (List) config.getAttribute("dependencies");
System.out.println("Installed configuration " + artifact);
FileWriteMonitor monitor = new StartFileWriteMonitor();
@@ -123,11 +130,18 @@
targetRepo.copyToRepository(in, dependency, monitor);
}
}
+ URI[] parentId = (URI[]) config.getAttribute("parentId");
+ if (parentId != null) {
+ for (int i = 0; i < parentId.length; i++) {
+ URI parent = parentId[i];
+ execute(parent, installAdapter, sourceRepo, targetRepo);
+ }
+ }
}
protected interface InstallAdapter {
- List install(Repository sourceRepo, String artifactPath) throws IOException, InvalidConfigException;
+ GBeanData install(Repository sourceRepo, URI configId) throws IOException, InvalidConfigException;
}
Modified: geronimo/branches/1.0/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/LocalConfigInstaller.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/LocalConfigInstaller.java?rev=355680&r1=355679&r2=355680&view=diff
==============================================================================
--- geronimo/branches/1.0/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/LocalConfigInstaller.java (original)
+++ geronimo/branches/1.0/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/LocalConfigInstaller.java Fri Dec 9 17:28:03 2005
@@ -43,11 +43,10 @@
store.doStart();
InstallAdapter installAdapter = new InstallAdapter() {
- public List install(Repository sourceRepo, String artifactPath) throws IOException, InvalidConfigException {
- URL artifact = sourceRepo.getURL(URI.create(artifactPath));
+ public GBeanData install(Repository sourceRepo, URI configId) throws IOException, InvalidConfigException {
+ URL artifact = sourceRepo.getURL(configId);
GBeanData config = store.install2(artifact);
- List dependencies = (List) config.getAttribute("dependencies");
- return dependencies;
+ return config;
}
};
Repository sourceRepo = new InnerRepository();
Modified: geronimo/branches/1.0/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/RepoConfigInstaller.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/RepoConfigInstaller.java?rev=355680&r1=355679&r2=355680&view=diff
==============================================================================
--- geronimo/branches/1.0/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/RepoConfigInstaller.java (original)
+++ geronimo/branches/1.0/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/RepoConfigInstaller.java Fri Dec 9 17:28:03 2005
@@ -17,14 +17,11 @@
package org.apache.geronimo.plugin.assembly;
-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.gbean.GBeanData;
import org.apache.geronimo.kernel.config.InvalidConfigException;
@@ -62,18 +59,17 @@
this.targetRepo = targetRepo;
}
- public List install(Repository sourceRepo, String artifactPath) throws IOException, InvalidConfigException {
- URI destination = URI.create(artifactPath);
- URL sourceURL = sourceRepo.getURL(destination);
+ public GBeanData install(Repository sourceRepo, URI configId) throws IOException, InvalidConfigException {
+ URL sourceURL = sourceRepo.getURL(configId);
InputStream in = sourceURL.openStream();
try {
- if (!targetRepo.hasURI(destination)) {
- targetRepo.copyToRepository(in, destination, new StartFileWriteMonitor());
+ if (!targetRepo.hasURI(configId)) {
+ targetRepo.copyToRepository(in, configId, new StartFileWriteMonitor());
}
} finally {
in.close();
}
- URL targetURL = targetRepo.getURL(destination);
+ URL targetURL = targetRepo.getURL(configId);
GBeanData config = new GBeanData();
URL baseURL = new URL("jar:" + targetURL.toString() + "!/");
InputStream jis = null;
@@ -83,14 +79,13 @@
ObjectInputStream ois = new ObjectInputStream(jis);
config.readExternal(ois);
} catch (ClassNotFoundException e) {
- throw new InvalidConfigException("Unable to load class from config: " + destination, e);
+ throw new InvalidConfigException("Unable to load class from config: " + configId, e);
} finally {
if (jis != null) {
jis.close();
}
}
- List dependencies = (List) config.getAttribute("dependencies");
- return dependencies;
+ return config;
}
}