You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/10/17 18:58:16 UTC
svn commit: r705671 - in /geronimo/gshell/trunk:
gshell-assembly/src/main/underlay/etc/
gshell-model/src/main/java/org/apache/geronimo/gshell/model/
gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/
gshell-wisdom/gshell-wisdom-boo...
Author: jdillon
Date: Fri Oct 17 09:58:16 2008
New Revision: 705671
URL: http://svn.apache.org/viewvc?rev=705671&view=rev
Log:
For now move the ivy cache into var/cache
The stupid java.beans.XML[Encoder|Decoder] is crap crap crap, so just serialize the damn object for the app cp cache
Modified:
geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/ivysettings.xml
geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Artifact.java
geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/IvyFactoryBean.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ClassPathImpl.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java
Modified: geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/ivysettings.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/ivysettings.xml?rev=705671&r1=705670&r2=705671&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/ivysettings.xml (original)
+++ geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/ivysettings.xml Fri Oct 17 09:58:16 2008
@@ -28,7 +28,7 @@
<property name="ivy.m2local.default.artifact.pattern" value="[organisation]/[module]/[revision]/[module]-[revision].[ext]" override="false"/>
<resolvers>
- <chain name="default"> <!-- returnFirst="true" checkmodified="true"> -->
+ <chain name="default">
<filesystem name="m2local" m2compatible="true">
<ivy pattern="${ivy.m2local.default.root}/${ivy.m2local.default.ivy.pattern}"/>
<artifact pattern="${ivy.m2local.default.root}/${ivy.m2local.default.artifact.pattern}"/>
@@ -39,4 +39,8 @@
-->
</chain>
</resolvers>
+
+ <caches defaultCacheDir="${gshell.home}/var/cache"
+ ivyPattern="[organisation]/[module]/[revision]/[module]-[revision].pom"
+ artifactPattern="[organisation]/[module]/[revision]/[module]-[revision].[ext]"/>
</ivysettings>
\ No newline at end of file
Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Artifact.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Artifact.java?rev=705671&r1=705670&r2=705671&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Artifact.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Artifact.java Fri Oct 17 09:58:16 2008
@@ -19,9 +19,8 @@
package org.apache.geronimo.gshell.model;
-import org.apache.geronimo.gshell.model.Element;
-
import java.io.File;
+import java.io.Serializable;
/**
* Defines an artifact (groupId, artifactId, version, etc).
@@ -30,6 +29,7 @@
*/
public class Artifact
extends Element
+ implements Serializable
{
public static final String DEFAULT_TYPE = "jar";
Modified: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/IvyFactoryBean.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/IvyFactoryBean.java?rev=705671&r1=705670&r2=705671&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/IvyFactoryBean.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/IvyFactoryBean.java Fri Oct 17 09:58:16 2008
@@ -61,6 +61,8 @@
log.debug("Settings URL: {}", url);
ivy.configure(url);
+ // settings.setVariable("ivy.default.configuration.m2compatible", "true")
+
return ivy;
}
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java?rev=705671&r1=705670&r2=705671&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java Fri Oct 17 09:58:16 2008
@@ -27,6 +27,7 @@
import org.apache.geronimo.gshell.application.plugin.PluginManager;
import org.apache.geronimo.gshell.chronos.StopWatch;
import org.apache.geronimo.gshell.event.EventPublisher;
+import org.apache.geronimo.gshell.io.Closer;
import org.apache.geronimo.gshell.model.ApplicationModel;
import org.apache.geronimo.gshell.model.Artifact;
import org.apache.geronimo.gshell.shell.Shell;
@@ -45,14 +46,21 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
+import java.net.URL;
import java.util.LinkedHashSet;
-import java.util.Set;
import java.util.List;
-import java.net.URL;
+import java.util.Set;
/**
* Default implementation of the {@link ApplicationManager} component.
@@ -139,32 +147,30 @@
private ClassPath loadClassPath(final ApplicationModel model) throws Exception {
assert model != null;
- Set<Artifact> artifacts = resolveArtifacts(model);
- ClassPath classPath = new ClassPathImpl(artifacts);
-
- /*
- FIXME: This needs to find a way to work w/o XStream, which isn't available on the classpath yet.
-
- File file = new File(new File(System.getProperty("gshell.home")), "var/xstore/classpath.xml"); // FIXME: Get state directory from application/branding
+ // FIXME: Get state directory from application/branding
+ File file = new File(new File(System.getProperty("gshell.home")), "var/classpath.ser");
ClassPath classPath;
+ //
+ // HACK: Using a serialized object here, for lack of a better choice. XStream is not on the classpath yet, and the java.beans.XMLEncoder sucks my balls.
+ //
+
if (file.exists()) {
- XMLDecoder decoder = new XMLDecoder(new BufferedInputStream(new FileInputStream(file)));
- classPath = (ClassPath)decoder.readObject();
+ ObjectInputStream input = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file)));
+ classPath = (ClassPath)input.readObject();
log.debug("Loaded classpath from cache: {}", file);
- decoder.close();
+ Closer.close(input);
}
else {
Set<Artifact> artifacts = resolveArtifacts(model);
classPath = new ClassPathImpl(artifacts);
log.debug("Saving classpath to cache: {}", file);
file.getParentFile().mkdirs();
- XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(new FileOutputStream(file)));
- encoder.writeObject(classPath);
- encoder.close();
+ ObjectOutputStream output = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
+ output.writeObject(classPath);
+ Closer.close(output);
}
- */
-
+
if (log.isDebugEnabled()) {
log.debug("Application classpath:");
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ClassPathImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ClassPathImpl.java?rev=705671&r1=705670&r2=705671&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ClassPathImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ClassPathImpl.java Fri Oct 17 09:58:16 2008
@@ -22,14 +22,14 @@
import org.apache.geronimo.gshell.application.ClassPath;
import org.apache.geronimo.gshell.model.Artifact;
+import java.io.File;
+import java.io.Serializable;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Set;
import java.util.List;
-import java.util.ArrayList;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.io.File;
/**
* {@link ClassPath} implementation backed up by a set of artifacts.
@@ -37,15 +37,15 @@
* @version $Rev$ $Date$
*/
public class ClassPathImpl
- implements ClassPath
+ implements ClassPath, Serializable
{
private Collection<Artifact> artifacts;
- private Collection<URL> urls;
+ private transient Collection<URL> urls;
public ClassPathImpl() {}
- public ClassPathImpl(final Set<Artifact> artifacts) {
+ public ClassPathImpl(final Collection<Artifact> artifacts) {
assert artifacts != null;
this.artifacts = artifacts;
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java?rev=705671&r1=705670&r2=705671&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java Fri Oct 17 09:58:16 2008
@@ -166,7 +166,8 @@
assert artifact != null;
ClassPath classPath;
- XStoreRecord record = xstore.resolveRecord(artifact.getGroupId() + "/" + artifact.getArtifactId() + "/classpath.xml"); // FIXME: Get state directory from application/branding
+ // FIXME: Get state directory from application/branding
+ XStoreRecord record = xstore.resolveRecord(artifact.getGroupId() + "/" + artifact.getArtifactId() + "/classpath.xml");
if (record.exists()) {
classPath = record.get(ClassPathImpl.class);
log.debug("Loaded classpath from cache: {}", record);