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/13 10:16:11 UTC

svn commit: r703962 - in /geronimo/gshell/trunk/gshell-wisdom: gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/

Author: jdillon
Date: Mon Oct 13 01:16:10 2008
New Revision: 703962

URL: http://svn.apache.org/viewvc?rev=703962&view=rev
Log:
Use the xstore to persist the classpath cache in core, update the file used in bootstrap (can't use the xstore here because its not loaded yet)

Modified:
    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-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java

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=703962&r1=703961&r2=703962&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 Mon Oct 13 01:16:10 2008
@@ -197,7 +197,7 @@
         assert model != null;
 
         Marshaller<ClassPath> marshaller = new MarshallerSupport<ClassPath>(ClassPathImpl.class);
-        File file = new File(new File(System.getProperty("gshell.home")), "var/gshell/classpath.xml");  // FIXME: Get state directory from application/branding
+        File file = new File(new File(System.getProperty("gshell.home")), "var/xstore/gshell/classpath.xml");  // FIXME: Get state directory from application/branding
         ClassPath classPath;
 
         if (file.exists()) {

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=703962&r1=703961&r2=703962&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 Mon Oct 13 01:16:10 2008
@@ -30,13 +30,13 @@
 import org.apache.geronimo.gshell.event.EventListener;
 import org.apache.geronimo.gshell.event.EventManager;
 import org.apache.geronimo.gshell.event.EventPublisher;
-import org.apache.geronimo.gshell.marshal.MarshallerSupport;
-import org.apache.geronimo.gshell.marshal.Marshaller;
 import org.apache.geronimo.gshell.model.application.PluginArtifact;
 import org.apache.geronimo.gshell.spring.BeanContainer;
 import org.apache.geronimo.gshell.spring.BeanContainerAware;
 import org.apache.geronimo.gshell.wisdom.application.ApplicationConfiguredEvent;
 import org.apache.geronimo.gshell.wisdom.application.ClassPathImpl;
+import org.apache.geronimo.gshell.xstore.XStore;
+import org.apache.geronimo.gshell.xstore.XStoreRecord;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
@@ -46,11 +46,10 @@
 import org.springframework.beans.factory.annotation.Autowired;
 
 import javax.annotation.PostConstruct;
-import java.io.File;
+import java.net.URL;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
-import java.net.URL;
 
 /**
  * Default implementation of the {@link PluginManager} component.
@@ -74,6 +73,9 @@
     @Autowired
     private EventPublisher eventPublisher;
 
+    @Autowired
+    private XStore xstore;
+
     private BeanContainer container;
 
     private Set<Plugin> plugins = new LinkedHashSet<Plugin>();
@@ -159,22 +161,19 @@
         assert application != null;
         assert artifact != null;
 
-        Marshaller<ClassPath> marshaller = new MarshallerSupport<ClassPath>(ClassPathImpl.class);
-        File file = new File(new File(System.getProperty("gshell.home")), "var/gshell/" + artifact.getGroupId() + "/" + artifact.getArtifactId() + "/classpath.xml");  // FIXME: Get state directory from application/branding
         ClassPath classPath;
-
-        if (file.exists()) {
-            classPath = marshaller.unmarshal(file);
-            log.debug("Loaded classpath from cache: {}", file);
+        XStoreRecord record = xstore.resolveRecord("gshell/" + artifact.getGroupId() + "/" + artifact.getArtifactId() + "/classpath.xml"); // FIXME: Get state directory from application/branding
+        if (record.exists()) {
+            classPath = record.get(ClassPath.class);
+            log.debug("Loaded classpath from cache: {}", record);
         }
         else {
             Set<Artifact> artifacts = resolveArtifacts(application, artifact);
             classPath = new ClassPathImpl(artifacts);
-            log.debug("Saving classpath to cache: {}", file);
-            file.getParentFile().mkdirs();
-            marshaller.marshal(classPath, file);
+            log.debug("Saving classpath to cache: {}", record);
+            record.set(classPath);
         }
-
+        
         if (log.isDebugEnabled()) {
             log.debug("Plugin classpath:");