geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r658598 - in /geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell: ./ application/ settings/
Date Wed, 21 May 2008 08:38:53 GMT
Author: jdillon
Date: Wed May 21 01:38:53 2008
New Revision: 658598

URL: http://svn.apache.org/viewvc?rev=658598&view=rev
Log:
Add SettingsConfiguration, tidy up some other bits

Added:
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsConfiguration.java
      - copied, changed from r658594, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsManager.java
Modified:
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationConfiguration.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationManager.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsManager.java

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java?rev=658598&r1=658597&r2=658598&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java
Wed May 21 01:38:53 2008
@@ -28,6 +28,7 @@
 import org.apache.geronimo.gshell.model.settings.Settings;
 import org.apache.geronimo.gshell.plexus.GShellPlexusContainer;
 import org.apache.geronimo.gshell.settings.SettingsManager;
+import org.apache.geronimo.gshell.settings.SettingsConfiguration;
 import org.apache.geronimo.gshell.shell.Environment;
 import org.codehaus.plexus.ContainerConfiguration;
 import org.codehaus.plexus.DefaultContainerConfiguration;
@@ -54,10 +55,10 @@
 
     private ClassWorld classWorld;
 
-    private Settings settings;
-
     private SettingsManager settingsManager;
 
+    private SettingsConfiguration settingsConfig = new SettingsConfiguration();
+
     private ApplicationManager applicationManager;
 
     private ApplicationConfiguration applicationConfig = new ApplicationConfiguration();
@@ -71,8 +72,6 @@
         
         config.setName(DEFAULT_CONTAINER_NAME);
         config.setClassWorld(getClassWorld());
-        // config.addComponentDiscoverer(new PluginDiscoverer());
-        // config.addComponentDiscoveryListener(new PluginCollector());
 
         return new GShellPlexusContainer(config);
     }
@@ -120,11 +119,11 @@
     }
 
     public Settings getSettings() {
-        return settings;
+        return settingsConfig.getSettings();
     }
 
     public void setSettings(final Settings settings) {
-        this.settings = settings;
+        settingsConfig.setSettings(settings);
     }
 
     private SettingsManager createSettingsManager() throws ComponentLookupException {
@@ -187,17 +186,14 @@
     public GShell build() throws Exception {
         log.debug("Building");
 
-        // Initialize the container & components
+        // Initialize the container
         getContainer();
 
         // Configure download monitor
         getArtifactManager().setDownloadMonitor(new ProgressSpinnerMonitor(getIo()));
 
-        // Configure settings (settings)
-        if (settings != null) {
-            getSettingsManager().setSettings(settings);
-        }
-        getSettingsManager().configure();
+        // Configure settings
+        getSettingsManager().configure(settingsConfig);
 
         // Configure application
         getApplicationManager().configure(applicationConfig);

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationConfiguration.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationConfiguration.java?rev=658598&r1=658597&r2=658598&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationConfiguration.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationConfiguration.java
Wed May 21 01:38:53 2008
@@ -19,10 +19,10 @@
 
 package org.apache.geronimo.gshell.application;
 
+import org.apache.geronimo.gshell.DefaultEnvironment;
 import org.apache.geronimo.gshell.io.IO;
-import org.apache.geronimo.gshell.shell.Environment;
 import org.apache.geronimo.gshell.model.application.Application;
-import org.apache.geronimo.gshell.DefaultEnvironment;
+import org.apache.geronimo.gshell.shell.Environment;
 
 /**
  * ???

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationManager.java?rev=658598&r1=658597&r2=658598&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationManager.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationManager.java
Wed May 21 01:38:53 2008
@@ -19,15 +19,6 @@
 
 package org.apache.geronimo.gshell.application;
 
-import org.apache.geronimo.gshell.model.application.Application;
-import org.apache.geronimo.gshell.io.IO;
-import org.apache.geronimo.gshell.shell.Environment;
-import org.apache.maven.artifact.InvalidRepositoryException;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-import org.codehaus.plexus.PlexusContainerException;
-
-import java.net.MalformedURLException;
-
 /**
  * ???
  *

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java?rev=658598&r1=658597&r2=658598&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
Wed May 21 01:38:53 2008
@@ -116,7 +116,7 @@
         // Setup container
         ArtifactFactory factory = artifactManager.getArtifactFactory();
 
-        Artifact originating = factory.createArtifact("dummy", "dummy", "1.0", null, "jar");
+        Artifact originating = factory.createArtifact("dummy", "dummy", "dummy", null, "jar");
 
         ArtifactResolutionRequest request = new ArtifactResolutionRequest();
         request.setArtifact(originating);
@@ -164,6 +164,8 @@
         cc.setName(application.getId());
         cc.setClassWorld(classWorld);
         cc.setRealm(realm);
+
+        // For now use the old Command* bits to get things working, then refactor to use
the new Plugin* bits
         cc.addComponentDiscoverer(new CommandDiscoverer());
         cc.addComponentDiscoveryListener(new CommandDiscoveryListener());
         // cc.addComponentDiscoverer(new PluginDiscoverer());

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java?rev=658598&r1=658597&r2=658598&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java
Wed May 21 01:38:53 2008
@@ -19,18 +19,16 @@
 
 package org.apache.geronimo.gshell.settings;
 
+import org.apache.geronimo.gshell.artifact.ArtifactManager;
+import org.apache.geronimo.gshell.model.common.SourceRepository;
+import org.apache.geronimo.gshell.model.settings.Settings;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
-import org.apache.geronimo.gshell.model.settings.Settings;
-import org.apache.geronimo.gshell.model.common.SourceRepository;
-import org.apache.geronimo.gshell.artifact.ArtifactManager;
-import org.apache.maven.artifact.UnknownRepositoryLayoutException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.List;
 import java.net.URL;
-import java.net.MalformedURLException;
+import java.util.List;
 
 /**
  * Default implementation of the {@link SettingsManager} component.
@@ -46,20 +44,25 @@
     @Requirement
     private ArtifactManager artifactManager;
 
-    private Settings settings;
+    private SettingsConfiguration settingsConfiguration;
 
-    public void setSettings(final Settings settings) {
-        assert settings != null;
+    public Settings getSettings() {
+        if (settingsConfiguration == null) {
+            throw new IllegalStateException("Not configured");
+        }
 
-        this.settings = settings;
+        return settingsConfiguration.getSettings();
     }
 
-    public Settings getSettings() {
-        return settings;
-    }
+    public void configure(SettingsConfiguration config) throws Exception {
+        assert config != null;
 
-    public void configure() throws Exception {
-        log.debug("Configuring");
+        log.debug("Configuring; config: {}", config);
+
+        Settings settings = config.getSettings();
+        if (settings == null) {
+            throw new IllegalStateException("Missing settings configuration");
+        }
 
         List<SourceRepository> sourceRepositories = settings.sourceRepositories();
         if (sourceRepositories != null) {
@@ -73,5 +76,7 @@
         }
         
         // TODO: apply other artifact related settings (proxy, auth, whatever)
+
+        settingsConfiguration = config;
     }
 }
\ No newline at end of file

Copied: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsConfiguration.java
(from r658594, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsManager.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsConfiguration.java?p2=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsConfiguration.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsManager.java&r1=658594&r2=658598&rev=658598&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsManager.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsConfiguration.java
Wed May 21 01:38:53 2008
@@ -20,20 +20,21 @@
 package org.apache.geronimo.gshell.settings;
 
 import org.apache.geronimo.gshell.model.settings.Settings;
-import org.apache.maven.artifact.UnknownRepositoryLayoutException;
-
-import java.net.MalformedURLException;
 
 /**
  * ???
  *
  * @version $Rev$ $Date$
  */
-public interface SettingsManager
+public class SettingsConfiguration
 {
-    void setSettings(Settings settings);
+    private Settings settings;
 
-    Settings getSettings();
+    public Settings getSettings() {
+        return settings;
+    }
 
-    void configure() throws Exception;
+    public void setSettings(final Settings settings) {
+        this.settings = settings;
+    }
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsManager.java?rev=658598&r1=658597&r2=658598&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsManager.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsManager.java
Wed May 21 01:38:53 2008
@@ -20,9 +20,6 @@
 package org.apache.geronimo.gshell.settings;
 
 import org.apache.geronimo.gshell.model.settings.Settings;
-import org.apache.maven.artifact.UnknownRepositoryLayoutException;
-
-import java.net.MalformedURLException;
 
 /**
  * ???
@@ -31,9 +28,7 @@
  */
 public interface SettingsManager
 {
-    void setSettings(Settings settings);
-
     Settings getSettings();
 
-    void configure() throws Exception;
+    void configure(SettingsConfiguration config) throws Exception;
 }
\ No newline at end of file



Mime
View raw message