geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r659486 - in /geronimo/gshell/trunk: gshell-assembly/ gshell-assembly/src/main/assembly/ gshell-assembly/src/main/underlay/etc/ gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ gshell-core/src/main...
Date Fri, 23 May 2008 10:04:36 GMT
Author: jdillon
Date: Fri May 23 03:04:33 2008
New Revision: 659486

URL: http://svn.apache.org/viewvc?rev=659486&view=rev
Log:
Implemented the application context stuff
Moved the layout model bits to gshell-model
Drop the layout loader cruft
Changed the DefaultLayoutManager to use the applcation context to initialize the layout

Added:
    geronimo/gshell/trunk/gshell-assembly/src/main/assembly/bin.xml   (contents, props changed)
      - copied, changed from r659462, geronimo/gshell/trunk/gshell-assembly/src/main/assembly/full.xml
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java   (with props)
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java   (contents, props changed)
      - copied, changed from r659462, geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/SourceRepository.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/AliasNode.java   (contents, props changed)
      - copied, changed from r659462, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/AliasNode.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/CommandNode.java   (contents, props changed)
      - copied, changed from r659462, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/CommandNode.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/GroupNode.java   (contents, props changed)
      - copied, changed from r659462, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/GroupNode.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Layout.java
      - copied, changed from r659462, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/Layout.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Node.java   (contents, props changed)
      - copied, changed from r659462, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/Node.java
    geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/layout/GroupNodeTest.java   (contents, props changed)
      - copied, changed from r659462, geronimo/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/layout/model/GroupNodeTest.java
    geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/layout/NodeTest.java   (contents, props changed)
      - copied, changed from r659462, geronimo/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/layout/model/NodeTest.java
Removed:
    geronimo/gshell/trunk/gshell-assembly/src/main/assembly/full.xml
    geronimo/gshell/trunk/gshell-assembly/src/main/assembly/minimal.xml
    geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh.properties
    geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/layout.xml
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/loader/
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/package-info.java
    geronimo/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/layout/
    geronimo/gshell/trunk/gshell-core/src/test/resources/org/apache/geronimo/gshell/layout/model/
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/SourceRepository.java
Modified:
    geronimo/gshell/trunk/gshell-assembly/pom.xml
    geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationContext.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/layout/DefaultLayoutManager.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/LayoutException.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/LayoutManager.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/NotFoundException.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Application.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationMarshaller.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/Settings.java
    geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/application/ApplicationMarshallerTest.java
    geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/plugin/PluginMarshallerTest.java
    geronimo/gshell/trunk/gshell-model/src/test/resources/org/apache/geronimo/gshell/model/application/application1.xml
    geronimo/gshell/trunk/gshell-support/gshell-plexus/src/main/java/org/apache/geronimo/gshell/plexus/LookupFactorySupport.java

Modified: geronimo/gshell/trunk/gshell-assembly/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/pom.xml?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-assembly/pom.xml Fri May 23 03:04:33 2008
@@ -136,12 +136,7 @@
                 </executions>
                 <configuration>
                     <descriptors>
-                        <!--
-                        NOTE: Disabled while refactoring
-                        
-                        <descriptor>${pom.basedir}/src/main/assembly/minimal.xml</descriptor>
-                        -->
-                        <descriptor>${pom.basedir}/src/main/assembly/full.xml</descriptor>
+                        <descriptor>${pom.basedir}/src/main/assembly/bin.xml</descriptor>
                     </descriptors>
                     <finalName>gshell-${version}</finalName>
                 </configuration>

Copied: geronimo/gshell/trunk/gshell-assembly/src/main/assembly/bin.xml (from r659462, geronimo/gshell/trunk/gshell-assembly/src/main/assembly/full.xml)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/src/main/assembly/bin.xml?p2=geronimo/gshell/trunk/gshell-assembly/src/main/assembly/bin.xml&p1=geronimo/gshell/trunk/gshell-assembly/src/main/assembly/full.xml&r1=659462&r2=659486&rev=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/src/main/assembly/full.xml (original)
+++ geronimo/gshell/trunk/gshell-assembly/src/main/assembly/bin.xml Fri May 23 03:04:33 2008
@@ -21,7 +21,7 @@
 <!-- $Rev$ $Date$ -->
 
 <assembly>
-    <id>full</id>
+    <id>bin</id>
     
     <formats>
         <format>tar.gz</format>

Propchange: geronimo/gshell/trunk/gshell-assembly/src/main/assembly/bin.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-assembly/src/main/assembly/bin.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-assembly/src/main/assembly/bin.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml (original)
+++ geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml Fri May 23 03:04:33 2008
@@ -21,28 +21,20 @@
 <!-- $Rev$ $Date$ -->
 
 <application>
-    <!--
-    <id>app.test</id>
-    <name>App Test</name>
-    <description>A test app descriptor.</description>
-    -->
     
-    <!--
-    <properties>
-        <property name="a" value="b"/>
-    </properties>
-    -->
+    <localRepository>
+        <directory>repository</directory>
+    </localRepository>
 
-    <repository>repository</repository>
-
-    <sourceRepositories>
-        <sourceRepository>
+    <remoteRepositories>
+        <remoteRepository>
             <location>file:/Users/jason/.m2/repository</location>
-        </sourceRepository>
-        <sourceRepository>
+        </remoteRepository>
+        
+        <remoteRepository>
             <location>http://repo1.maven.org/maven2</location>
-        </sourceRepository>
-    </sourceRepositories>
+        </remoteRepository>
+    </remoteRepositories>
 
     <dependencies>
         <dependency>
@@ -52,21 +44,137 @@
         </dependency>
     </dependencies>
 
-    <!--
-    <dependencyGroups>
-        <dependencyGroup>
-            <groupId>d</groupId>
-            <version>e</version>
-
-            <dependency>
-                <artifactId>f</artifactId>
-            </dependency>
-
-            <dependency>
-                <artifactId>g</artifactId>
-                <classifier>h</classifier>
-            </dependency>
-        </dependencyGroup>
-    </dependencyGroups>
-    -->
+    <layout>
+        <nodes>
+            <command>
+                <name>help</name>
+                <id>gshell-builtins:help</id>
+            </command>
+
+            <alias>
+                <name>?</name>
+                <command>help</command>
+            </alias>
+
+            <command>
+                <name>exit</name>
+                <id>gshell-builtins:exit</id>
+            </command>
+
+            <alias>
+                <name>quit</name>
+                <command>exit</command>
+            </alias>
+
+            <command>
+                <name>echo</name>
+                <id>gshell-builtins:echo</id>
+            </command>
+
+            <alias>
+                <name>print</name>
+                <command>echo</command>
+            </alias>
+
+            <command>
+                <name>clear</name>
+                <id>gshell-builtins:clear</id>
+            </command>
+
+            <command>
+                <name>source</name>
+                <id>gshell-builtins:source</id>
+            </command>
+
+            <alias>
+                <name>.</name>
+                <command>source</command>
+            </alias>
+
+            <command>
+                <name>set</name>
+                <id>gshell-builtins:set</id>
+            </command>
+
+            <command>
+                <name>unset</name>
+                <id>gshell-builtins:unset</id>
+            </command>
+
+            <group>
+                <name>optional</name>
+
+                <nodes>
+                    <command>
+                        <name>cat</name>
+                        <id>gshell-optional:cat</id>
+                    </command>
+
+                    <command>
+                        <name>exec</name>
+                        <id>gshell-optional:exec</id>
+                    </command>
+
+                    <command>
+                        <name>java</name>
+                        <id>gshell-optional:java</id>
+                    </command>
+
+                    <command>
+                        <name>sleep</name>
+                        <id>gshell-optional:sleep</id>
+                    </command>
+
+                    <command>
+                        <name>wait</name>
+                        <id>gshell-optional:wait</id>
+                    </command>
+                </nodes>
+            </group>
+
+            <group>
+                <name>bsf</name>
+
+                <nodes>
+                    <command>
+                        <name>script</name>
+                        <id>gshell-bsf:script</id>
+                    </command>
+                </nodes>
+            </group>
+
+            <group>
+                <name>vfs</name>
+
+                <nodes>
+                    <command>
+                        <name>copy</name>
+                        <id>gshell-vfs:copy</id>
+                    </command>
+                </nodes>
+            </group>
+
+            <group>
+                <name>remote</name>
+
+                <nodes>
+                    <command>
+                        <name>rsh</name>
+                        <id>gshell-remote:rsh</id>
+                    </command>
+
+                    <command>
+                        <name>rsh-server</name>
+                        <id>gshell-remote:rsh-server</id>
+                    </command>
+
+                    <alias>
+                        <name>rshd</name>
+                        <command>remote/rsh-server</command>
+                    </alias>
+                </nodes>
+            </group>
+        </nodes>
+    </layout>
+
 </application>
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java (original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java Fri May 23 03:04:33 2008
@@ -28,10 +28,10 @@
 import org.apache.geronimo.gshell.command.annotation.CommandComponent;
 import org.apache.geronimo.gshell.command.annotation.Requirement;
 import org.apache.geronimo.gshell.layout.LayoutManager;
-import org.apache.geronimo.gshell.layout.model.AliasNode;
-import org.apache.geronimo.gshell.layout.model.CommandNode;
-import org.apache.geronimo.gshell.layout.model.GroupNode;
-import org.apache.geronimo.gshell.layout.model.Node;
+import org.apache.geronimo.gshell.model.layout.AliasNode;
+import org.apache.geronimo.gshell.model.layout.GroupNode;
+import org.apache.geronimo.gshell.model.layout.CommandNode;
+import org.apache.geronimo.gshell.model.layout.Node;
 import org.apache.geronimo.gshell.registry.CommandRegistry;
 import org.apache.geronimo.gshell.registry.NotRegisteredException;
 import org.codehaus.plexus.util.StringUtils;

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java Fri May 23 03:04:33 2008
@@ -37,9 +37,9 @@
 import org.apache.geronimo.gshell.common.StopWatch;
 import org.apache.geronimo.gshell.layout.LayoutManager;
 import org.apache.geronimo.gshell.layout.NotFoundException;
-import org.apache.geronimo.gshell.layout.model.AliasNode;
-import org.apache.geronimo.gshell.layout.model.CommandNode;
-import org.apache.geronimo.gshell.layout.model.Node;
+import org.apache.geronimo.gshell.model.layout.AliasNode;
+import org.apache.geronimo.gshell.model.layout.CommandNode;
+import org.apache.geronimo.gshell.model.layout.Node;
 import org.apache.geronimo.gshell.registry.CommandRegistry;
 import org.apache.geronimo.gshell.registry.NotRegisteredException;
 import org.apache.geronimo.gshell.shell.Environment;

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationContext.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationContext.java?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationContext.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationContext.java Fri May 23 03:04:33 2008
@@ -19,6 +19,10 @@
 
 package org.apache.geronimo.gshell.application;
 
+import org.apache.geronimo.gshell.io.IO;
+import org.apache.geronimo.gshell.shell.Environment;
+import org.apache.geronimo.gshell.model.application.Application;
+
 /**
  * ???
  *
@@ -26,11 +30,11 @@
  */
 public interface ApplicationContext
 {
-    // getIo()
+    IO getIo();
 
-    // getEnvironment()
+    Environment getEnvironment();
 
-    // getApplication()
+    Application getApplication();
     
-    // getContainer()
+    // getContainer();
 }
\ No newline at end of file

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=659486&r1=659485&r2=659486&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 Fri May 23 03:04:33 2008
@@ -32,5 +32,5 @@
 
     GShell createShell() throws Exception;
 
-    // getContext()
+    ApplicationContext getContext();
 }
\ No newline at end of file

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=659486&r1=659485&r2=659486&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 Fri May 23 03:04:33 2008
@@ -20,12 +20,16 @@
 package org.apache.geronimo.gshell.application;
 
 import org.apache.geronimo.gshell.GShell;
+import org.apache.geronimo.gshell.io.IO;
+import org.apache.geronimo.gshell.layout.LayoutManager;
 import org.apache.geronimo.gshell.artifact.ArtifactManager;
 import org.apache.geronimo.gshell.lookup.EnvironmentLookup;
 import org.apache.geronimo.gshell.lookup.IOLookup;
 import org.apache.geronimo.gshell.model.application.Application;
 import org.apache.geronimo.gshell.model.common.Dependency;
-import org.apache.geronimo.gshell.model.common.SourceRepository;
+import org.apache.geronimo.gshell.model.common.RemoteRepository;
+import org.apache.geronimo.gshell.model.common.LocalRepository;
+import org.apache.geronimo.gshell.model.layout.Layout;
 import org.apache.geronimo.gshell.plexus.GShellPlexusContainer;
 import org.apache.geronimo.gshell.shell.Environment;
 import org.apache.geronimo.gshell.shell.InteractiveShell;
@@ -74,7 +78,7 @@
 
     private GShellPlexusContainer container;
 
-    private ApplicationConfiguration applicationConfig;
+    private ApplicationContext applicationContext;
 
     public void contextualize(final Context context) throws ContextException {
         assert context != null;
@@ -84,9 +88,13 @@
         log.debug("Parent container: {}", parentContainer);
     }
 
-    // createContext()
-    
-    // getContext()
+    public ApplicationContext getContext() {
+        if (applicationContext == null) {
+            throw new IllegalStateException("Application has not been configured");
+        }
+        
+        return applicationContext;
+    }
 
     public void configure(final ApplicationConfiguration config) throws Exception {
         assert config != null;
@@ -106,14 +114,27 @@
         // Create the application container
         container = createContainer(application);
 
-        // TODO: Configure other application bits (branding, layout)
+        // TODO: Configure other application bits (branding, etc) ?
+        // TODO: May want to have those components pull from the application's context instead, like we are doing for layout
 
         // Install lookup intestances
         IOLookup.set(container, config.getIo());
         EnvironmentLookup.set(container, config.getEnvironment());
 
-        // Track the configuration, mark configured
-        applicationConfig = config;
+        // Create a new context
+        applicationContext = new ApplicationContext() {
+            public IO getIo() {
+                return config.getIo();
+            }
+
+            public Environment getEnvironment() {
+                return config.getEnvironment();
+            }
+
+            public Application getApplication() {
+                return config.getApplication();
+            }
+        };
     }
 
     private void configureArtifactManager(final Application application) throws Exception {
@@ -121,15 +142,17 @@
         assert artifactManager != null;
 
         // Setup the local repository
-        File repository = application.getRepository();
-        if (repository != null) {
-            artifactManager.setLocalRepository(repository);
+        LocalRepository localRepository = application.getLocalRepository();
+
+        if (localRepository != null) {
+            artifactManager.setLocalRepository(localRepository.getDirectoryFile());
         }
 
         // Setup remote repositories
-        List<SourceRepository> sourceRepositories = application.sourceRepositories();
-        if (sourceRepositories != null) {
-            for (SourceRepository repo : sourceRepositories) {
+        List<RemoteRepository> remoteRepositories = application.remoteRepositories();
+
+        if (remoteRepositories != null) {
+            for (RemoteRepository repo : remoteRepositories) {
                 String loc = repo.getLocation();
                 URL url = new URL(loc);
                 String id = url.getHost(); // FIXME: Need to expose the repo id in the model, for now assume the id is the hostname
@@ -228,9 +251,8 @@
     }
 
     public GShell createShell() throws Exception {
-        if (applicationConfig == null) {
-            throw new IllegalStateException("Not configured");
-        }
+        // Make sure that we have a valid context
+        getContext();
 
         final InteractiveShell shell = container.lookupComponent(InteractiveShell.class);
 

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java Fri May 23 03:04:33 2008
@@ -19,17 +19,13 @@
 
 package org.apache.geronimo.gshell.layout;
 
-import java.io.IOException;
-
-import org.apache.geronimo.gshell.layout.loader.LayoutLoader;
-import org.apache.geronimo.gshell.layout.model.GroupNode;
-import org.apache.geronimo.gshell.layout.model.Layout;
-import org.apache.geronimo.gshell.layout.model.Node;
+import org.apache.geronimo.gshell.model.layout.GroupNode;
+import org.apache.geronimo.gshell.model.layout.Layout;
+import org.apache.geronimo.gshell.model.layout.Node;
 import org.apache.geronimo.gshell.shell.Environment;
+import org.apache.geronimo.gshell.application.ApplicationManager;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -40,40 +36,45 @@
  */
 @Component(role=LayoutManager.class)
 public class DefaultLayoutManager
-    implements LayoutManager, Initializable
+    implements LayoutManager
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
     @Requirement
-    private LayoutLoader loader;
+    private Environment env;
 
     @Requirement
-    private Environment env;
+    private ApplicationManager applicationManager;
     
     private Layout layout;
 
     public DefaultLayoutManager() {}
     
-    public DefaultLayoutManager(final LayoutLoader loader, final Environment env) {
-        this.loader = loader;
+    public DefaultLayoutManager(final Environment env) {
+        assert env != null;
+        
         this.env = env;
     }
 
-    public void initialize() throws InitializationException {
-        assert loader != null;
-
-        try {
-            layout = loader.load();
-        }
-        catch (IOException e) {
-            throw new InitializationException(e.getMessage(), e);
+    private Layout lookupLayout() {
+        Layout layout = applicationManager.getContext().getApplication().getLayout();
+        if (layout == null) {
+            throw new IllegalStateException("Layout has not been configured for application");
         }
+
+        return layout;
     }
 
     public Layout getLayout() {
+        if (layout == null) {
+            layout = lookupLayout();
+
+            log.debug("Using layout: {}", layout);
+        }
+        
         return layout;
     }
-    
+
     public Node findNode(final String path) throws NotFoundException {
         return findNode(path, null);
     }
@@ -81,6 +82,9 @@
     public Node findNode(final String path, final String searchPath) throws NotFoundException {
         assert path != null;
 
+        // Make sure we have initialized the layout
+        getLayout();
+
         Node start;
 
         if (path.startsWith(PATH_SEPARATOR)) {

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/LayoutException.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/LayoutException.java?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/LayoutException.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/LayoutException.java Fri May 23 03:04:33 2008
@@ -20,7 +20,7 @@
 package org.apache.geronimo.gshell.layout;
 
 /**
- * ???
+ * Thrown to indicate a layout-related problem.
  *
  * @version $Rev$ $Date$
  */

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/LayoutManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/LayoutManager.java?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/LayoutManager.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/LayoutManager.java Fri May 23 03:04:33 2008
@@ -19,9 +19,8 @@
 
 package org.apache.geronimo.gshell.layout;
 
-import org.apache.geronimo.gshell.command.Command;
-import org.apache.geronimo.gshell.layout.model.Layout;
-import org.apache.geronimo.gshell.layout.model.Node;
+import org.apache.geronimo.gshell.model.layout.Layout;
+import org.apache.geronimo.gshell.model.layout.Node;
 
 /**
  * Provies the shell with a simple mechanism to organize commands.
@@ -42,7 +41,7 @@
     String SEARCH_PATH_SEPARATOR = ":";
 
     Layout getLayout();
-
+    
     Node findNode(String path) throws NotFoundException;
     
     Node findNode(String path, String searchPath) throws NotFoundException;

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/NotFoundException.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/NotFoundException.java?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/NotFoundException.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/NotFoundException.java Fri May 23 03:04:33 2008
@@ -20,7 +20,7 @@
 package org.apache.geronimo.gshell.layout;
 
 /**
- * ???
+ * Thrown to indicate a missing node in the layout tree.
  *
  * @version $Rev$ $Date$
  */

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=659486&r1=659485&r2=659486&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 Fri May 23 03:04:33 2008
@@ -20,7 +20,7 @@
 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.common.RemoteRepository;
 import org.apache.geronimo.gshell.model.settings.Settings;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
@@ -72,9 +72,10 @@
     private void configure(final Settings settings) throws Exception {
         assert settings != null;
 
-        List<SourceRepository> sourceRepositories = settings.sourceRepositories();
-        if (sourceRepositories != null) {
-            for (SourceRepository repo : sourceRepositories) {
+        List<RemoteRepository> remoteRepositories = settings.remoteRepositories();
+        
+        if (remoteRepositories != null) {
+            for (RemoteRepository repo : remoteRepositories) {
                 String loc = repo.getLocation();
                 URL url = new URL(loc);
                 String id = url.getHost(); // FIXME: Need to expose the repo id in the model, for now assume the id is the hostname

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Application.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Application.java?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Application.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Application.java Fri May 23 03:04:33 2008
@@ -23,7 +23,8 @@
 import org.apache.geronimo.gshell.model.common.ModelRoot;
 import org.apache.geronimo.gshell.model.common.Dependency;
 import org.apache.geronimo.gshell.model.common.DependencyGroup;
-import org.apache.geronimo.gshell.model.common.SourceRepository;
+import org.apache.geronimo.gshell.model.common.RemoteRepository;
+import org.apache.geronimo.gshell.model.common.LocalRepository;
 import org.apache.geronimo.gshell.model.layout.Layout;
 
 import java.util.List;
@@ -43,11 +44,11 @@
     // TODO: Generate from g+a+v
     private String id;
 
-    // groupId
+    // TODO: groupId
 
-    // artifactId
+    // TODO: artifactId
 
-    // version
+    // TODO: version
     
     private String name;
 
@@ -55,10 +56,9 @@
 
     private Properties properties;
 
-    // TODO: Change to String, provide File get* accessor to type
-    private File repository;
+    private LocalRepository localRepository;
 
-    private List<SourceRepository> sourceRepositories;
+    private List<RemoteRepository> remoteRepositories;
 
     private List<Dependency> dependencies;
 
@@ -68,7 +68,7 @@
 
     private Layout layout;
 
-    // Paths
+    // TODO: Paths
 
     public String getId() {
         return id;
@@ -102,26 +102,26 @@
         this.properties = properties;
     }
 
-    public File getRepository() {
-        return repository;
+    public LocalRepository getLocalRepository() {
+        return localRepository;
     }
 
-    public void setRepository(final File repository) {
-        this.repository = repository;
+    public void setLocalRepository(final LocalRepository localRepository) {
+        this.localRepository = localRepository;
     }
 
-    public List<SourceRepository> sourceRepositories() {
-        return sourceRepositories;
+    public List<RemoteRepository> remoteRepositories() {
+        return remoteRepositories;
     }
 
-    public void add(final SourceRepository repository) {
+    public void add(final RemoteRepository repository) {
         assert repository != null;
 
-        if (sourceRepositories == null) {
-            sourceRepositories = new ArrayList<SourceRepository>();
+        if (remoteRepositories == null) {
+            remoteRepositories = new ArrayList<RemoteRepository>();
         }
 
-        sourceRepositories.add(repository);
+        remoteRepositories.add(repository);
     }
 
     //

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationMarshaller.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationMarshaller.java?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationMarshaller.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationMarshaller.java Fri May 23 03:04:33 2008
@@ -20,6 +20,9 @@
 package org.apache.geronimo.gshell.model.application;
 
 import org.apache.geronimo.gshell.model.marshal.MarshallerSupport;
+import org.apache.geronimo.gshell.model.layout.CommandNode;
+import org.apache.geronimo.gshell.model.layout.AliasNode;
+import com.thoughtworks.xstream.XStream;
 
 /**
  * Marshaller for {@link Application} models.
@@ -32,4 +35,12 @@
     public ApplicationMarshaller() {
         super(Application.class);
     }
+
+    @Override
+    protected void configure(final XStream xs) {
+        super.configure(xs);
+
+        // Need to provide some additional configuration to tell XStream about the Layout's node sub-classes
+        configureAnnotations(xs, CommandNode.class, AliasNode.class);
+    }
 }
\ No newline at end of file

Added: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java?rev=659486&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java (added)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java Fri May 23 03:04:33 2008
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.gshell.model.common;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+import java.io.File;
+
+/**
+ * Local repository configuration.
+ *
+ * @version $Rev$ $Date$
+ */
+@XStreamAlias("localRepository")
+public class LocalRepository
+    extends ModelElement
+{
+    private String directory;
+
+    public String getDirectory() {
+        return directory;
+    }
+
+    public void setDirectory(final String directory) {
+        this.directory = directory;
+    }
+
+    public File getDirectoryFile() {
+        String path = getDirectory();
+        assert path != null;
+        
+        return new File(path);
+    }
+
+    public void setDirectoryFile(final File directory) {
+        assert directory != null;
+
+        setDirectory(directory.getAbsolutePath());
+    }
+}
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java (from r659462, geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/SourceRepository.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java?p2=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java&p1=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/SourceRepository.java&r1=659462&r2=659486&rev=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/SourceRepository.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java Fri May 23 03:04:33 2008
@@ -21,24 +21,20 @@
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
 
+import java.net.URI;
+import java.net.URISyntaxException;
+
 /**
- * Source repository configuration.
+ * Remote repository configuration.
  *
  * @version $Rev$ $Date$
  */
-@XStreamAlias("sourceRepository")
-public class SourceRepository
+@XStreamAlias("remoteRepository")
+public class RemoteRepository
     extends ModelElement
 {
-    // ID
-
-    // Name
-
-    // TODO: Change to URI
     private String location;
 
-    // Layout
-
     public String getLocation() {
         return location;
     }
@@ -46,4 +42,17 @@
     public void setLocation(final String location) {
         this.location = location;
     }
+
+    public URI getLocationUri() throws URISyntaxException {
+        String tmp = getLocation();
+        assert tmp != null;
+
+        return new URI(tmp);
+    }
+
+    public void setLocationUri(final URI uri) {
+        assert uri != null;
+
+        setLocation(uri.toString());
+    }
 }
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/AliasNode.java (from r659462, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/AliasNode.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/AliasNode.java?p2=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/AliasNode.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/AliasNode.java&r1=659462&r2=659486&rev=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/AliasNode.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/AliasNode.java Fri May 23 03:04:33 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.layout.model;
+package org.apache.geronimo.gshell.model.layout;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
 

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/AliasNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/AliasNode.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/AliasNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/CommandNode.java (from r659462, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/CommandNode.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/CommandNode.java?p2=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/CommandNode.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/CommandNode.java&r1=659462&r2=659486&rev=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/CommandNode.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/CommandNode.java Fri May 23 03:04:33 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.layout.model;
+package org.apache.geronimo.gshell.model.layout;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
 

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/CommandNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/CommandNode.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/CommandNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/GroupNode.java (from r659462, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/GroupNode.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/GroupNode.java?p2=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/GroupNode.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/GroupNode.java&r1=659462&r2=659486&rev=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/GroupNode.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/GroupNode.java Fri May 23 03:04:33 2008
@@ -17,14 +17,14 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.layout.model;
+package org.apache.geronimo.gshell.model.layout;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
 
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
 /**
  * A group of nodes.
  *
@@ -75,6 +75,7 @@
     /**
      * Link children to their parent when deserializing.
      */
+    @SuppressWarnings({"UnusedDeclaration"})
     private Object readResolve() {
         if (!isEmpty()) {
             for (Node child : nodes) {

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/GroupNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/GroupNode.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/GroupNode.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Layout.java (from r659462, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/Layout.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Layout.java?p2=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Layout.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/Layout.java&r1=659462&r2=659486&rev=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/Layout.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Layout.java Fri May 23 03:04:33 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.layout.model;
+package org.apache.geronimo.gshell.model.layout;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
 

Copied: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Node.java (from r659462, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/Node.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Node.java?p2=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Node.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/Node.java&r1=659462&r2=659486&rev=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/model/Node.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Node.java Fri May 23 03:04:33 2008
@@ -17,10 +17,9 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.layout.model;
+package org.apache.geronimo.gshell.model.layout;
 
-import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
-import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
+import org.apache.geronimo.gshell.model.common.ModelElement;
 
 /**
  * The rudimentary element of a layout.
@@ -28,6 +27,7 @@
  * @version $Rev$ $Date$
  */
 public abstract class Node
+    extends ModelElement
 {
     public static final String SEPARATOR = "/";
 
@@ -75,8 +75,4 @@
 
         return buff.toString();
     }
-
-    public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
-    }
 }

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Node.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Node.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/layout/Node.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java Fri May 23 03:04:33 2008
@@ -39,7 +39,7 @@
 public class MarshallerSupport<T>
     implements Marshaller<T>
 {
-    private Class rootType;
+    private final Class rootType;
 
     protected MarshallerSupport(final Class rootType) {
         assert rootType != null;
@@ -47,7 +47,6 @@
         this.rootType = rootType;
     }
 
-
     protected XStream createXStream() {
         XStream xs;
 
@@ -59,11 +58,24 @@
             xs = new XStream(new DomDriver());
         }
 
-        xs.processAnnotations(rootType);
-
+        configure(xs);
+        
         return xs;
     }
 
+    protected void configure(final XStream xs) {
+        assert xs != null;
+
+        xs.processAnnotations(rootType);
+    }
+
+    protected void configureAnnotations(final XStream xs, final Class... classes) {
+        assert xs != null;
+        assert classes != null;
+
+        xs.processAnnotations(classes);
+    }
+    
     public void marshal(final T root, final OutputStream output) {
         assert root != null;
         assert output != null;
@@ -84,17 +96,17 @@
         return createXStream().toXML(root);
     }
 
+    @SuppressWarnings({"unchecked"})
     public T unmarshal(final InputStream input) {
         assert input != null;
 
-        //noinspection unchecked
         return (T)createXStream().fromXML(input);
     }
 
+    @SuppressWarnings({"unchecked"})
     public T unmarshal(final Reader reader) {
         assert reader != null;
 
-        //noinspection unchecked
         return (T)createXStream().fromXML(reader);
     }
 

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/Settings.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/Settings.java?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/Settings.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/Settings.java Fri May 23 03:04:33 2008
@@ -21,7 +21,7 @@
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
 import org.apache.geronimo.gshell.model.common.ModelRoot;
-import org.apache.geronimo.gshell.model.common.SourceRepository;
+import org.apache.geronimo.gshell.model.common.RemoteRepository;
 
 import java.util.Properties;
 import java.util.List;
@@ -38,13 +38,13 @@
 {
     private Properties properties;
 
-    // Proxies
+    // TODO: Proxies
 
-    private List<SourceRepository> sourceRepositories;
+    private List<RemoteRepository> remoteRepositories;
 
-    // Repository
+    // TODO: Repository
 
-    // Paths
+    // TODO: Paths
 
     public Properties getProperties() {
         return properties;
@@ -54,17 +54,17 @@
         this.properties = properties;
     }
 
-    public List<SourceRepository> sourceRepositories() {
-        return sourceRepositories;
+    public List<RemoteRepository> remoteRepositories() {
+        return remoteRepositories;
     }
 
-    public void add(final SourceRepository repository) {
+    public void add(final RemoteRepository repository) {
         assert repository != null;
 
-        if (sourceRepositories == null) {
-            sourceRepositories = new ArrayList<SourceRepository>();
+        if (remoteRepositories == null) {
+            remoteRepositories = new ArrayList<RemoteRepository>();
         }
 
-        sourceRepositories.add(repository);
+        remoteRepositories.add(repository);
     }
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/application/ApplicationMarshallerTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/application/ApplicationMarshallerTest.java?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/application/ApplicationMarshallerTest.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/application/ApplicationMarshallerTest.java Fri May 23 03:04:33 2008
@@ -22,10 +22,9 @@
 import junit.framework.TestCase;
 import org.apache.geronimo.gshell.model.common.Dependency;
 import org.apache.geronimo.gshell.model.common.DependencyGroup;
-import org.apache.geronimo.gshell.model.common.SourceRepository;
+import org.apache.geronimo.gshell.model.common.RemoteRepository;
 
 import java.net.URL;
-import java.net.URI;
 import java.io.InputStream;
 import java.util.Properties;
 
@@ -50,7 +49,7 @@
         props.setProperty("a", "b");
         root.setProperties(props);
 
-        SourceRepository sr1 = new SourceRepository();
+        RemoteRepository sr1 = new RemoteRepository();
         sr1.setLocation("foo:bar");
         root.add(sr1);
 

Copied: geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/layout/GroupNodeTest.java (from r659462, geronimo/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/layout/model/GroupNodeTest.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/layout/GroupNodeTest.java?p2=geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/layout/GroupNodeTest.java&p1=geronimo/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/layout/model/GroupNodeTest.java&r1=659462&r2=659486&rev=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/layout/model/GroupNodeTest.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/layout/GroupNodeTest.java Fri May 23 03:04:33 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.layout.model;
+package org.apache.geronimo.gshell.model.layout;
 
 import com.thoughtworks.xstream.XStream;
 import junit.framework.TestCase;

Propchange: geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/layout/GroupNodeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/layout/GroupNodeTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/layout/GroupNodeTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/layout/NodeTest.java (from r659462, geronimo/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/layout/model/NodeTest.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/layout/NodeTest.java?p2=geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/layout/NodeTest.java&p1=geronimo/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/layout/model/NodeTest.java&r1=659462&r2=659486&rev=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/layout/model/NodeTest.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/layout/NodeTest.java Fri May 23 03:04:33 2008
@@ -17,12 +17,12 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.layout.model;
+package org.apache.geronimo.gshell.model.layout;
 
 import junit.framework.TestCase;
 
 /**
- * Test for the {@link Node} class.
+ * Test for the {@link org.apache.geronimo.gshell.model.layout.Node} class.
  *
  * @version $Rev$ $Date$
  */

Propchange: geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/layout/NodeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/layout/NodeTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/layout/NodeTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/plugin/PluginMarshallerTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/plugin/PluginMarshallerTest.java?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/plugin/PluginMarshallerTest.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/plugin/PluginMarshallerTest.java Fri May 23 03:04:33 2008
@@ -22,12 +22,8 @@
 import junit.framework.TestCase;
 import org.apache.geronimo.gshell.model.common.Dependency;
 import org.apache.geronimo.gshell.model.common.DependencyGroup;
-import org.apache.geronimo.gshell.model.common.SourceRepository;
-import org.apache.geronimo.gshell.model.application.ApplicationMarshaller;
-import org.apache.geronimo.gshell.model.application.Application;
 
 import java.net.URL;
-import java.net.URI;
 import java.io.InputStream;
 import java.util.Properties;
 

Modified: geronimo/gshell/trunk/gshell-model/src/test/resources/org/apache/geronimo/gshell/model/application/application1.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/test/resources/org/apache/geronimo/gshell/model/application/application1.xml?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/test/resources/org/apache/geronimo/gshell/model/application/application1.xml (original)
+++ geronimo/gshell/trunk/gshell-model/src/test/resources/org/apache/geronimo/gshell/model/application/application1.xml Fri May 23 03:04:33 2008
@@ -29,11 +29,15 @@
         <property name="a" value="b"/>
     </properties>
 
-    <sourceRepositories>
-        <sourceRepository>
+    <localRepository>
+        <directory>repo</directory>
+    </localRepository>
+
+    <remoteRepositories>
+        <remoteRepository>
             <location>foo:bar</location>
-        </sourceRepository>
-    </sourceRepositories>
+        </remoteRepository>
+    </remoteRepositories>
 
     <dependencies>
         <dependency>
@@ -58,4 +62,138 @@
             </dependency>
         </dependencyGroup>
     </dependencyGroups>
+
+    <layout>
+        <nodes>
+            <command>
+                <name>help</name>
+                <id>gshell-builtins:help</id>
+            </command>
+
+            <alias>
+                <name>?</name>
+                <command>help</command>
+            </alias>
+
+            <command>
+                <name>exit</name>
+                <id>gshell-builtins:exit</id>
+            </command>
+
+            <alias>
+                <name>quit</name>
+                <command>exit</command>
+            </alias>
+
+            <command>
+                <name>echo</name>
+                <id>gshell-builtins:echo</id>
+            </command>
+
+            <alias>
+                <name>print</name>
+                <command>echo</command>
+            </alias>
+
+            <command>
+                <name>clear</name>
+                <id>gshell-builtins:clear</id>
+            </command>
+
+            <command>
+                <name>source</name>
+                <id>gshell-builtins:source</id>
+            </command>
+
+            <alias>
+                <name>.</name>
+                <command>source</command>
+            </alias>
+
+            <command>
+                <name>set</name>
+                <id>gshell-builtins:set</id>
+            </command>
+
+            <command>
+                <name>unset</name>
+                <id>gshell-builtins:unset</id>
+            </command>
+
+            <group>
+                <name>optional</name>
+
+                <nodes>
+                    <command>
+                        <name>cat</name>
+                        <id>gshell-optional:cat</id>
+                    </command>
+
+                    <command>
+                        <name>exec</name>
+                        <id>gshell-optional:exec</id>
+                    </command>
+
+                    <command>
+                        <name>java</name>
+                        <id>gshell-optional:java</id>
+                    </command>
+
+                    <command>
+                        <name>sleep</name>
+                        <id>gshell-optional:sleep</id>
+                    </command>
+
+                    <command>
+                        <name>wait</name>
+                        <id>gshell-optional:wait</id>
+                    </command>
+                </nodes>
+            </group>
+
+            <group>
+                <name>bsf</name>
+
+                <nodes>
+                    <command>
+                        <name>script</name>
+                        <id>gshell-bsf:script</id>
+                    </command>
+                </nodes>
+            </group>
+
+            <group>
+                <name>vfs</name>
+
+                <nodes>
+                    <command>
+                        <name>copy</name>
+                        <id>gshell-vfs:copy</id>
+                    </command>
+                </nodes>
+            </group>
+
+            <group>
+                <name>remote</name>
+
+                <nodes>
+                    <command>
+                        <name>rsh</name>
+                        <id>gshell-remote:rsh</id>
+                    </command>
+
+                    <command>
+                        <name>rsh-server</name>
+                        <id>gshell-remote:rsh-server</id>
+                    </command>
+
+                    <alias>
+                        <name>rshd</name>
+                        <command>remote/rsh-server</command>
+                    </alias>
+                </nodes>
+            </group>
+        </nodes>
+    </layout>
+    
 </application>
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-support/gshell-plexus/src/main/java/org/apache/geronimo/gshell/plexus/LookupFactorySupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-plexus/src/main/java/org/apache/geronimo/gshell/plexus/LookupFactorySupport.java?rev=659486&r1=659485&r2=659486&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-plexus/src/main/java/org/apache/geronimo/gshell/plexus/LookupFactorySupport.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-plexus/src/main/java/org/apache/geronimo/gshell/plexus/LookupFactorySupport.java Fri May 23 03:04:33 2008
@@ -35,7 +35,7 @@
 public class LookupFactorySupport<T>
     implements ComponentFactory
 {
-    protected Logger log = LoggerFactory.getLogger(getClass());
+    protected final Logger log = LoggerFactory.getLogger(getClass());
 
     protected final ThreadLocal<T> holder = new ThreadLocal<T>();
 
@@ -71,7 +71,8 @@
         Object obj = get();
 
         if (obj == null) {
-            throw new IllegalStateException("Instance not registered");
+            // Include the factory id in the detail for better error reporting
+            throw new IllegalStateException("Instance for " + getId() + " was not registered for thread: " + Thread.currentThread().getName());
         }
         
         log.trace("Handing out: {}", obj);



Mime
View raw message