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/05/30 08:01:12 UTC
svn commit: r661572 [1/2] - in /geronimo/gshell/trunk: ./ gshell-assembly/
gshell-assembly/src/main/underlay/etc/ gshell-cli/ gshell-command-api/
gshell-command-api/src/main/java/org/apache/geronimo/gshell/ gshell-core/
gshell-core/src/main/java/org/ap...
Author: jdillon
Date: Thu May 29 23:01:10 2008
New Revision: 661572
URL: http://svn.apache.org/viewvc?rev=661572&view=rev
Log:
Moving stuff around to better isolate gshell-core
Added:
geronimo/gshell/trunk/gshell-command-api/src/main/java/org/apache/geronimo/gshell/ExitNotification.java (props changed)
- copied unchanged from r660920, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/ExitNotification.java
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/LoggingVisitor.java (contents, props changed)
- copied, changed from r660920, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/logging/LoggingVisitor.java
geronimo/gshell/trunk/gshell-loader/
geronimo/gshell/trunk/gshell-loader/pom.xml (with props)
geronimo/gshell/trunk/gshell-loader/src/
geronimo/gshell/trunk/gshell-loader/src/main/
geronimo/gshell/trunk/gshell-loader/src/main/java/
geronimo/gshell/trunk/gshell-loader/src/main/java/org/
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/DefaultEnvironment.java (props changed)
- copied unchanged from r660920, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultEnvironment.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/DefaultVariables.java (props changed)
- copied unchanged from r660920, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultVariables.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/GShell.java (props changed)
- copied unchanged from r660920, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShell.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java (contents, props changed)
- copied, changed from r660920, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/
- copied from r660920, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/ApplicationConfiguration.java
- copied unchanged from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationConfiguration.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/ApplicationContext.java
- copied unchanged from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationContext.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java
- copied, changed from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/ApplicationManager.java
- copied unchanged from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationManager.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
- copied, changed from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/
- copied from r660920, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/CommandCollector.java
- copied, changed from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandCollector.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/CommandContainer.java
- copied unchanged from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandContainer.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoverer.java
- copied unchanged from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoverer.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/ComponentDescriptorAdapter.java
- copied unchanged from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/ComponentDescriptorAdapter.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/ComponentSetDescriptorAdapter.java
- copied unchanged from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/ComponentSetDescriptorAdapter.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/DefaultPluginManager.java
- copied unchanged from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/DefaultPluginManager.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.java
- copied, changed from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/PluginCollector.java
- copied unchanged from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/PluginCollector.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/PluginContainer.java
- copied unchanged from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/PluginContainer.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/PluginContext.java
- copied unchanged from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/PluginContext.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/PluginDiscoverer.java
- copied unchanged from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/PluginDiscoverer.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/PluginManager.java
- copied unchanged from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/PluginManager.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/package-info.java
- copied unchanged from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/package-info.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/
- copied from r660920, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java
- copied, changed from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/SettingsConfiguration.java
- copied unchanged from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsConfiguration.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java
- copied, changed from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java
geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/SettingsManager.java
- copied unchanged from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsManager.java
geronimo/gshell/trunk/gshell-loader/src/test/
geronimo/gshell/trunk/gshell-loader/src/test/java/
geronimo/gshell/trunk/gshell-loader/src/test/java/org/
geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/
geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/
geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/
geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/DefaultVariablesTest.java (with props)
geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/GShellBuilderTest.java (with props)
geronimo/gshell/trunk/gshell-loader/src/test/resources/
geronimo/gshell/trunk/gshell-loader/src/test/resources/org/
geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/
geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/
geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/
geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/application1.xml (with props)
geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/settings1.xml (with props)
geronimo/gshell/trunk/gshell-support/gshell-expr/
geronimo/gshell/trunk/gshell-support/gshell-expr/pom.xml (with props)
geronimo/gshell/trunk/gshell-support/gshell-expr/src/
geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/
geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/
geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/
geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/
geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/
geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/
geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/
geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/ExpressionEvaluator.java (with props)
geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/JexlExpressionEvaluator.java (with props)
geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/package-info.java (with props)
geronimo/gshell/trunk/gshell-support/gshell-expr/src/test/
geronimo/gshell/trunk/gshell-support/gshell-expr/src/test/java/
geronimo/gshell/trunk/gshell-support/gshell-expr/src/test/java/org/
geronimo/gshell/trunk/gshell-support/gshell-expr/src/test/java/org/apache/
geronimo/gshell/trunk/gshell-support/gshell-expr/src/test/java/org/apache/geronimo/
geronimo/gshell/trunk/gshell-support/gshell-expr/src/test/java/org/apache/geronimo/gshell/
geronimo/gshell/trunk/gshell-support/gshell-expr/src/test/java/org/apache/geronimo/gshell/expression/
geronimo/gshell/trunk/gshell-support/gshell-expr/src/test/java/org/apache/geronimo/gshell/expression/JexlExpressionEvaluatorTest.java (with props)
Removed:
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultEnvironment.java
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultVariables.java
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/ExitNotification.java
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShell.java
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/
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/expression/
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/logging/
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/
geronimo/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/DefaultVariablesTest.java
geronimo/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/GShellBuilderTest.java
geronimo/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/expression/
geronimo/gshell/trunk/gshell-core/src/test/resources/
Modified:
geronimo/gshell/trunk/gshell-assembly/pom.xml
geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml
geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-classworlds.conf
geronimo/gshell/trunk/gshell-cli/pom.xml
geronimo/gshell/trunk/gshell-command-api/pom.xml
geronimo/gshell/trunk/gshell-core/pom.xml
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandLineBuilder.java
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShellInfo.java
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/ExecutingVisitor.java
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/DefaultCommandRegistry.java
geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/monitor/ProgressSpinnerMonitor.java
geronimo/gshell/trunk/gshell-support/pom.xml
geronimo/gshell/trunk/pom.xml
Modified: geronimo/gshell/trunk/gshell-assembly/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/pom.xml?rev=661572&r1=661571&r2=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-assembly/pom.xml Thu May 29 23:01:10 2008
@@ -44,6 +44,7 @@
<artifactId>gshell-bootstrap</artifactId>
</dependency>
+ <!--
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-core</artifactId>
@@ -53,6 +54,7 @@
<groupId>org.apache.geronimo.gshell.commands</groupId>
<artifactId>gshell-builtins</artifactId>
</dependency>
+ -->
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
@@ -60,6 +62,12 @@
</dependency>
<dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-loader</artifactId>
+ </dependency>
+
+ <!--
+ <dependency>
<groupId>org.apache.geronimo.gshell.commands</groupId>
<artifactId>gshell-optional</artifactId>
</dependency>
@@ -68,6 +76,7 @@
<groupId>org.apache.geronimo.gshell.commands</groupId>
<artifactId>gshell-repository</artifactId>
</dependency>
+ -->
<!--
<dependency>
@@ -143,7 +152,7 @@
</executions>
<configuration>
<descriptors>
- <descriptor>${pom.basedir}/src/main/assembly/bin.xml</descriptor>
+ <descriptor>src/main/assembly/bin.xml</descriptor>
</descriptors>
<finalName>gshell-${version}</finalName>
</configuration>
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=661572&r1=661571&r2=661572&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 Thu May 29 23:01:10 2008
@@ -27,6 +27,9 @@
<version>1.0-alpha-2-SNAPSHOT</version>
<localRepository>
+ <!--
+ <directory>${gshell.home}/repository</directory>
+ -->
<directory>repository</directory>
</localRepository>
@@ -39,13 +42,24 @@
<location>file:/Users/jason/.m2/repository</location>
</remoteRepository>
+ <!--
<remoteRepository>
<location>http://repo1.maven.org/maven2</location>
</remoteRepository>
+ -->
</remoteRepositories>
<dependencyGroups>
<dependencyGroup>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+
+ <dependency>
+ <artifactId>gshell-core</artifactId>
+ </dependency>
+ </dependencyGroup>
+
+ <dependencyGroup>
<groupId>org.apache.geronimo.gshell.commands</groupId>
<version>1.0-alpha-2-SNAPSHOT</version>
Modified: geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-classworlds.conf
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-classworlds.conf?rev=661572&r1=661571&r2=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-classworlds.conf (original)
+++ geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-classworlds.conf Thu May 29 23:01:10 2008
@@ -24,6 +24,6 @@
main is org.apache.geronimo.gshell.cli.Main from gshell
[gshell]
-load ${gshell.home}/etc
-load ${gshell.home}/lib/*.jar
+ load ${gshell.home}/etc
+ load ${gshell.home}/lib/*.jar
Modified: geronimo/gshell/trunk/gshell-cli/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-cli/pom.xml?rev=661572&r1=661571&r2=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-cli/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-cli/pom.xml Thu May 29 23:01:10 2008
@@ -44,8 +44,13 @@
</dependency>
<dependency>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-clp</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.geronimo.gshell</groupId>
- <artifactId>gshell-core</artifactId>
+ <artifactId>gshell-loader</artifactId>
</dependency>
<dependency>
Modified: geronimo/gshell/trunk/gshell-command-api/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-command-api/pom.xml?rev=661572&r1=661571&r2=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-command-api/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-command-api/pom.xml Thu May 29 23:01:10 2008
@@ -40,34 +40,14 @@
<dependencies>
<dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
- <artifactId>gshell-common</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.gshell.support</groupId>
- <artifactId>gshell-ansi</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.gshell.support</groupId>
- <artifactId>gshell-i18n</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-clp</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.gshell.support</groupId>
- <artifactId>gshell-prefs</artifactId>
- </dependency>
-
+
<dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-io</artifactId>
</dependency>
-
+
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Propchange: geronimo/gshell/trunk/gshell-command-api/src/main/java/org/apache/geronimo/gshell/ExitNotification.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-command-api/src/main/java/org/apache/geronimo/gshell/ExitNotification.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-command-api/src/main/java/org/apache/geronimo/gshell/ExitNotification.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/gshell/trunk/gshell-core/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/pom.xml?rev=661572&r1=661571&r2=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-core/pom.xml Thu May 29 23:01:10 2008
@@ -49,12 +49,22 @@
</dependency>
<dependency>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-expr</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-command-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-loader</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-parser</artifactId>
</dependency>
Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandLineBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandLineBuilder.java?rev=661572&r1=661571&r2=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandLineBuilder.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandLineBuilder.java Thu May 29 23:01:10 2008
@@ -21,7 +21,7 @@
import org.apache.geronimo.gshell.application.ApplicationManager;
import org.apache.geronimo.gshell.command.CommandExecutor;
-import org.apache.geronimo.gshell.logging.LoggingVisitor;
+import org.apache.geronimo.gshell.LoggingVisitor;
import org.apache.geronimo.gshell.parser.ASTCommandLine;
import org.apache.geronimo.gshell.parser.CommandLineParser;
import org.apache.geronimo.gshell.parser.ParseException;
Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShellInfo.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShellInfo.java?rev=661572&r1=661571&r2=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShellInfo.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShellInfo.java Thu May 29 23:01:10 2008
@@ -21,7 +21,6 @@
import org.apache.geronimo.gshell.shell.ShellInfo;
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;
Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/ExecutingVisitor.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/ExecutingVisitor.java?rev=661572&r1=661571&r2=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/ExecutingVisitor.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/ExecutingVisitor.java Thu May 29 23:01:10 2008
@@ -20,6 +20,7 @@
package org.apache.geronimo.gshell;
import org.apache.geronimo.gshell.command.CommandExecutor;
+import org.apache.geronimo.gshell.command.Variables;
import org.apache.geronimo.gshell.common.Arguments;
import org.apache.geronimo.gshell.expression.ExpressionEvaluator;
import org.apache.geronimo.gshell.expression.JexlExpressionEvaluator;
@@ -37,6 +38,9 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
/**
* Visitor which will execute command-lines as parsed.
@@ -115,10 +119,25 @@
return value;
}
+
+ private static Map convertToMap(final Variables vars) {
+ assert vars != null;
+
+ Map<String,Object> map = new HashMap<String,Object>();
+ Iterator<String> iter = vars.names();
+
+ while (iter.hasNext()) {
+ String name = iter.next();
+ map.put(name, vars.get(name));
+ }
+
+ return map;
+ }
+
private String evaluate(final String expr) {
assert expr != null;
- ExpressionEvaluator evaluator = new JexlExpressionEvaluator(env.getVariables());
+ ExpressionEvaluator evaluator = new JexlExpressionEvaluator(convertToMap(env.getVariables()));
try {
return evaluator.parse(expr);
Copied: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/LoggingVisitor.java (from r660920, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/logging/LoggingVisitor.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/LoggingVisitor.java?p2=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/LoggingVisitor.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/logging/LoggingVisitor.java&r1=660920&r2=661572&rev=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/logging/LoggingVisitor.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/LoggingVisitor.java Thu May 29 23:01:10 2008
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.geronimo.gshell.logging;
+package org.apache.geronimo.gshell;
import org.apache.geronimo.gshell.parser.ASTCommandLine;
import org.apache.geronimo.gshell.parser.ASTExpression;
Propchange: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/LoggingVisitor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/LoggingVisitor.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/LoggingVisitor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/DefaultCommandRegistry.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/DefaultCommandRegistry.java?rev=661572&r1=661571&r2=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/DefaultCommandRegistry.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/DefaultCommandRegistry.java Thu May 29 23:01:10 2008
@@ -20,10 +20,10 @@
package org.apache.geronimo.gshell.registry;
import org.apache.geronimo.gshell.model.command.Command;
+import org.apache.geronimo.gshell.plexus.GShellPlexusContainer;
import org.apache.geronimo.gshell.plugin.CommandCollector;
import org.apache.geronimo.gshell.plugin.PlexusCommandWrapper;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.context.Context;
@@ -50,7 +50,7 @@
{
private final Logger log = LoggerFactory.getLogger(getClass());
- private PlexusContainer container;
+ private GShellPlexusContainer container;
@Requirement
private CommandCollector collector;
@@ -60,7 +60,7 @@
public void contextualize(Context context) throws ContextException {
assert context != null;
- container = (PlexusContainer) context.get(PlexusConstants.PLEXUS_KEY);
+ container = (GShellPlexusContainer) context.get(PlexusConstants.PLEXUS_KEY);
assert container != null;
log.debug("Container: {}", container);
}
Added: geronimo/gshell/trunk/gshell-loader/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-loader/pom.xml?rev=661572&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-loader/pom.xml (added)
+++ geronimo/gshell/trunk/gshell-loader/pom.xml Thu May 29 23:01:10 2008
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>gshell-loader</artifactId>
+ <name>GShell Loader</name>
+
+ <description>
+ Provides loading infrastructure for GShell.
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-plexus</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-artifact</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-model</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-command-api</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
Propchange: geronimo/gshell/trunk/gshell-loader/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-loader/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-loader/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Propchange: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/DefaultEnvironment.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/DefaultEnvironment.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/DefaultEnvironment.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Propchange: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/DefaultVariables.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/DefaultVariables.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/DefaultVariables.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Propchange: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/GShell.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/GShell.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/GShell.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java (from r660920, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java?p2=geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java&r1=660920&r2=661572&rev=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java (original)
+++ geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java Thu May 29 23:01:10 2008
@@ -28,8 +28,6 @@
import org.apache.geronimo.gshell.model.settings.Settings;
import org.apache.geronimo.gshell.plexus.GShellPlexusContainer;
import org.apache.geronimo.gshell.plexus.Slf4jLoggingManager;
-import org.apache.geronimo.gshell.plugin.CommandCollector;
-import org.apache.geronimo.gshell.plugin.CommandDiscoverer;
import org.apache.geronimo.gshell.settings.SettingsConfiguration;
import org.apache.geronimo.gshell.settings.SettingsManager;
import org.apache.geronimo.gshell.shell.Environment;
@@ -76,10 +74,6 @@
config.setName(DEFAULT_CONTAINER_NAME);
config.setClassWorld(getClassWorld());
- // HACK: Should not need these here, but for some reason components are getting instantiated in the wrong container
- config.addComponentDiscoverer(new CommandDiscoverer());
- config.addComponentDiscoveryListener(new CommandCollector());
-
GShellPlexusContainer container = new GShellPlexusContainer(config);
// Install our logging muck
Propchange: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/GShellBuilder.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java (from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java?p2=geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java&r1=661571&r2=661572&rev=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java (original)
+++ geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java Thu May 29 23:01:10 2008
@@ -46,7 +46,7 @@
//
public Application locate() throws Exception {
- log.debug("Locating");
+ log.debug("Locating application descriptor");
URL url = getClass().getClassLoader().getResource("application.xml");
Copied: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java (from r661571, 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-loader/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java?p2=geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java&r1=661571&r2=661572&rev=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java (original)
+++ geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java Thu May 29 23:01:10 2008
@@ -20,6 +20,8 @@
package org.apache.geronimo.gshell.application;
import org.apache.geronimo.gshell.GShell;
+import org.apache.geronimo.gshell.plugin.CommandDiscoverer;
+import org.apache.geronimo.gshell.plugin.CommandCollector;
import org.apache.geronimo.gshell.artifact.ArtifactManager;
import org.apache.geronimo.gshell.io.IO;
import org.apache.geronimo.gshell.model.application.Application;
@@ -35,6 +37,7 @@
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultContainerConfiguration;
import org.codehaus.plexus.PlexusConstants;
@@ -54,6 +57,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
+import java.util.HashSet;
/**
* Default implementation of the {@link ApplicationManager} component.
@@ -98,13 +102,14 @@
public void configure(final ApplicationConfiguration config) throws Exception {
assert config != null;
- log.debug("Configuring; config: {}", config);
+ log.trace("Configuring; config: {}", config);
// Validate the configuration
config.validate();
Application application = config.getApplication();
- log.debug("Application: {}", application);
+ log.debug("Application ID: {}", application.getId());
+ log.trace("Application descriptor: {}", application);
// Apply artifact manager configuration settings for application
configureArtifactManager(application);
@@ -112,9 +117,6 @@
// Create the application container
container = createContainer(application);
- // 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
-
// Create a new context
applicationContext = new ApplicationContext() {
public IO getIo() {
@@ -155,8 +157,10 @@
log.debug("Creating application container");
List<URL> classPath = createClassPath(application);
- ClassWorld classWorld = parentContainer.getContainerRealm().getWorld();
- ClassRealm realm = parentContainer.getContainerRealm().createChildRealm(application.getId());
+
+ ClassWorld world = new ClassWorld();
+ ClassRealm realm = world.newRealm("gshell.application[" + application.getId().replace(".", "/") + "]");
+ realm.setParentRealm(parentContainer.getContainerRealm());
for (URL url : classPath) {
realm.addURL(url);
@@ -164,15 +168,12 @@
ContainerConfiguration config = new DefaultContainerConfiguration();
config.setName(application.getId());
- config.setClassWorld(classWorld);
+ config.setClassWorld(world);
config.setRealm(realm);
-
- // HACK: Should need these here, but for some reason components are getting instantiated in the wrong container
- // so for now to get something working again, use the parent containers configuration set in GShellBuilder
-
- // For now use the old Command* bits to get things working, then refactor to use the new Plugin* bits
- // config.addComponentDiscoverer(new CommandDiscoverer());
- // config.addComponentDiscoveryListener(new CommandCollector());
+
+ // FIXME: For now use the old Command* bits to get things working, then refactor to use the new Plugin* bits
+ config.addComponentDiscoverer(new CommandDiscoverer());
+ config.addComponentDiscoveryListener(new CommandCollector());
// config.addComponentDiscoverer(new PluginDiscoverer());
// config.addComponentDiscoveryListener(new PluginCollector());
@@ -217,17 +218,56 @@
List<URL> classPath = new LinkedList<URL>();
Set<Artifact> resolvedArtifacts = result.getArtifacts();
+ Set<String> excludes = new HashSet<String>();
+ excludes.add("aspectjrt");
+ excludes.add("plexus-classworlds");
+ excludes.add("gshell-ansi");
+ excludes.add("gshell-artifact");
+ excludes.add("gshell-cli");
+ excludes.add("gshell-clp");
+ excludes.add("gshell-command-api");
+ excludes.add("gshell-common");
+ excludes.add("gshell-diet-log4j");
+ excludes.add("gshell-i18n");
+ excludes.add("gshell-io");
+ excludes.add("gshell-loader");
+ excludes.add("gshell-model");
+ excludes.add("gshell-plexus");
+ excludes.add("jcl104-over-slf4j");
+ excludes.add("jline");
+ excludes.add("maven-artifact");
+ excludes.add("maven-model");
+ excludes.add("maven-profile");
+ excludes.add("maven-project");
+ excludes.add("maven-workspace");
+ excludes.add("plexus-component-annotations");
+ excludes.add("plexus-container-default");
+ excludes.add("plexus-interpolation");
+ excludes.add("plexus-utils");
+ excludes.add("slf4j-api");
+ excludes.add("slf4j-log4j12");
+ excludes.add("wagon-file");
+ excludes.add("wagon-http-lightweight");
+ excludes.add("wagon-http-shared");
+ excludes.add("wagon-provider-api");
+ excludes.add("xpp3_min");
+ excludes.add("xstream");
+
+ ExclusionSetFilter filter = new ExclusionSetFilter(excludes);
+
if (resolvedArtifacts != null && !resolvedArtifacts.isEmpty()) {
log.debug("Application classpath:");
for (Artifact artifact : resolvedArtifacts) {
- File file = artifact.getFile();
- assert file != null;
+ if (filter.include(artifact)) {
+ File file = artifact.getFile();
+ assert file != null;
- URL url = file.toURI().toURL();
- log.debug(" + {}", url);
+ URL url = file.toURI().toURL();
+ log.debug(" + {}", url);
- classPath.add(url);
+ classPath.add(url);
+ }
}
}
Copied: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/CommandCollector.java (from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandCollector.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/CommandCollector.java?p2=geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/CommandCollector.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandCollector.java&r1=661571&r2=661572&rev=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandCollector.java (original)
+++ geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/CommandCollector.java Thu May 29 23:01:10 2008
@@ -67,7 +67,8 @@
CommandSet commands = ((ComponentSetDescriptorAdapter)components).getCommands();
for (Command descriptor : commands.getCommands()) {
- log.debug("Found: {}", descriptor);
+ log.debug("Found command ID: {}", descriptor.getId());
+ log.trace("Found descriptor: {}", descriptor);
descriptors.put(descriptor.getId(), descriptor);
}
Copied: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.java (from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.java?p2=geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.java&r1=661571&r2=661572&rev=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.java (original)
+++ geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.java Thu May 29 23:01:10 2008
@@ -21,12 +21,10 @@
import org.apache.geronimo.gshell.command.CommandContext;
import org.apache.geronimo.gshell.model.command.Command;
-import org.codehaus.plexus.PlexusContainer;
+import org.apache.geronimo.gshell.plexus.GShellPlexusContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.UUID;
-
/**
* A wrapper for Plexus-based commands.
*
@@ -35,13 +33,16 @@
public class PlexusCommandWrapper
implements org.apache.geronimo.gshell.command.Command
{
- private Logger log = LoggerFactory.getLogger(getClass());
+ private final Logger log = LoggerFactory.getLogger(getClass());
private Command descriptor;
- private PlexusContainer container;
+ private GShellPlexusContainer container;
- public PlexusCommandWrapper(final PlexusContainer container, final Command descriptor) {
+ public PlexusCommandWrapper(final GShellPlexusContainer container, final Command descriptor) {
+ assert container != null;
+ assert descriptor != null;
+
this.container = container;
this.descriptor = descriptor;
}
@@ -55,25 +56,11 @@
}
public Object execute(final CommandContext context, final Object... args) throws Exception {
- // Create a new child container for the invocation and lookup the command instance
- String realmId = "gshell:" + UUID.randomUUID();
-
- log.debug("Child container realm: {}", realmId);
-
- PlexusContainer childContainer = container.createChildContainer(realmId, container.getContainerRealm());
-
- org.apache.geronimo.gshell.command.Command command = (org.apache.geronimo.gshell.command.Command) childContainer.lookup(org.apache.geronimo.gshell.command.Command.class, descriptor.getId());
-
- Object result;
+ assert context != null;
- try {
- result = command.execute(context, args);
- }
- finally {
- // Nuke the child container
- container.removeChildContainer(realmId);
- }
+ org.apache.geronimo.gshell.command.Command command =
+ container.lookupComponent(org.apache.geronimo.gshell.command.Command.class, descriptor.getId());
- return result;
+ return command.execute(context, args);
}
}
Copied: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java (from r661571, 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-loader/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java?p2=geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java&r1=661571&r2=661572&rev=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java (original)
+++ geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java Thu May 29 23:01:10 2008
@@ -54,7 +54,7 @@
public void configure(SettingsConfiguration config) throws Exception {
assert config != null;
- log.debug("Configuring; config: {}", config);
+ log.trace("Configuring; config: {}", config);
// Validate the configuration
config.validate();
Copied: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java (from r661571, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java?p2=geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java&r1=661571&r2=661572&rev=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java (original)
+++ geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java Thu May 29 23:01:10 2008
@@ -44,7 +44,7 @@
//
public Settings locate() throws Exception {
- log.debug("Locating");
+ log.debug("Locating settings descriptor");
//
// TODO: For now we just ignore user settings, but should try to locate a descriptor and unmarshal
Added: geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/DefaultVariablesTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/DefaultVariablesTest.java?rev=661572&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/DefaultVariablesTest.java (added)
+++ geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/DefaultVariablesTest.java Thu May 29 23:01:10 2008
@@ -0,0 +1,227 @@
+/*
+ * 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;
+
+import junit.framework.TestCase;
+import org.apache.geronimo.gshell.command.Variables;
+
+import java.util.Iterator;
+
+/**
+ * Unit tests for the {@link DefaultVariables} class.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultVariablesTest
+ extends TestCase
+{
+ public void testSet() throws Exception {
+ DefaultVariables vars = new DefaultVariables();
+ String name = "a";
+ Object value = new Object();
+
+ assertFalse(vars.contains(name));
+ vars.set(name, value);
+ assertTrue(vars.contains(name));
+
+ Object obj = vars.get(name);
+ assertEquals(value, obj);
+
+ String str = vars.names().next();
+ assertEquals(name, str);
+ }
+
+ public void testSetAsImmutable() throws Exception {
+ DefaultVariables vars = new DefaultVariables();
+ String name = "a";
+ Object value = new Object();
+
+ assertTrue(vars.isMutable(name));
+ vars.set(name, value, false);
+ assertFalse(vars.isMutable(name));
+
+ try {
+ vars.set(name, value);
+ fail("Set an immutable variable");
+ }
+ catch (Variables.ImmutableVariableException expected) {
+ // ignore
+ }
+ }
+
+ public void testSetAsImmutableInParent() throws Exception {
+ Variables parent = new DefaultVariables();
+ DefaultVariables vars = new DefaultVariables(parent);
+ String name = "a";
+ Object value = new Object();
+
+ parent.set(name, value, false);
+ assertFalse(parent.isMutable(name));
+ assertFalse(vars.isMutable(name));
+
+ try {
+ vars.set(name, value);
+ fail("Set an immutable variable");
+ }
+ catch (Variables.ImmutableVariableException expected) {
+ // ignore
+ }
+ }
+
+ public void testSetParentFromChild() throws Exception {
+ Variables parent = new DefaultVariables();
+ DefaultVariables vars = new DefaultVariables(parent);
+ String name = "a";
+ Object value = new Object();
+
+ // Make sure we can add to parent's scope from child
+ vars.parent().set(name, value);
+ assertEquals(value, parent.get(name));
+
+ // Make sure the iter sees it
+ assertTrue(vars.names().hasNext());
+ }
+
+ public void testGet() throws Exception {
+ DefaultVariables vars = new DefaultVariables();
+ String name = "a";
+ Object value = new Object();
+
+ Object obj1 = vars.get(name);
+ assertNull(obj1);
+
+ vars.set(name, value);
+ Object obj2 = vars.get(name);
+ assertSame(value, obj2);
+ }
+
+ public void testGetUsingDefault() throws Exception {
+ DefaultVariables vars = new DefaultVariables();
+ String name = "a";
+ Object value = new Object();
+
+ Object obj1 = vars.get(name);
+ assertNull(obj1);
+
+ Object obj2 = vars.get(name, value);
+ assertSame(value, obj2);
+ }
+
+ public void testGetCloaked() throws Exception {
+ Variables parent = new DefaultVariables();
+ DefaultVariables vars = new DefaultVariables(parent);
+ String name = "a";
+ Object value = new Object();
+
+ parent.set(name, value);
+ Object obj1 = vars.get(name);
+ assertEquals(value, obj1);
+
+ Object value2 = new Object();
+ vars.set(name, value2);
+
+ Object obj2 = vars.get(name);
+ assertSame(value2, obj2);
+ assertNotSame(value, obj2);
+ }
+
+ public void testUnsetAsImmutable() throws Exception {
+ DefaultVariables vars = new DefaultVariables();
+ String name = "a";
+ Object value = new Object();
+
+ assertTrue(vars.isMutable(name));
+ vars.set(name, value, false);
+ assertFalse(vars.isMutable(name));
+
+ try {
+ vars.unset(name);
+ fail("Unset an immutable variable");
+ }
+ catch (Variables.ImmutableVariableException expected) {
+ // ignore
+ }
+ }
+
+ public void testUnsetAsImmutableInParent() throws Exception {
+ Variables parent = new DefaultVariables();
+ DefaultVariables vars = new DefaultVariables(parent);
+ String name = "a";
+ Object value = new Object();
+
+ parent.set(name, value, false);
+ assertFalse(parent.isMutable(name));
+ assertFalse(vars.isMutable(name));
+
+ try {
+ vars.unset(name);
+ fail("Unset an immutable variable");
+ }
+ catch (Variables.ImmutableVariableException expected) {
+ // ignore
+ }
+ }
+
+ public void testCloaking() throws Exception {
+ Variables parent = new DefaultVariables();
+ DefaultVariables vars = new DefaultVariables(parent);
+ String name = "a";
+ Object value = new Object();
+
+ parent.set(name, value);
+ assertFalse(parent.isCloaked(name));
+ assertFalse(vars.isCloaked(name));
+
+ vars.set(name, new Object());
+ assertTrue(vars.isCloaked(name));
+ }
+
+ public void testParent() throws Exception {
+ Variables parent = new DefaultVariables();
+ assertNull(parent.parent());
+
+ DefaultVariables vars = new DefaultVariables(parent);
+ assertNotNull(vars.parent());
+
+ assertEquals(parent, vars.parent());
+ }
+
+ public void testNames() throws Exception {
+ DefaultVariables vars = new DefaultVariables();
+ Iterator<String> iter = vars.names();
+ assertNotNull(iter);
+ assertFalse(iter.hasNext());
+ }
+
+ public void testNamesImmutable() throws Exception {
+ DefaultVariables vars = new DefaultVariables();
+ vars.set("a", "b");
+
+ Iterator<String> iter = vars.names();
+ iter.next();
+
+ try {
+ iter.remove();
+ }
+ catch (UnsupportedOperationException expected) {
+ // ignore
+ }
+ }
+}
Propchange: geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/DefaultVariablesTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/DefaultVariablesTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/DefaultVariablesTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/GShellBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/GShellBuilderTest.java?rev=661572&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/GShellBuilderTest.java (added)
+++ geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/GShellBuilderTest.java Thu May 29 23:01:10 2008
@@ -0,0 +1,74 @@
+/*
+ * 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;
+
+import junit.framework.TestCase;
+import org.apache.geronimo.gshell.model.application.Application;
+import org.apache.geronimo.gshell.model.application.ApplicationMarshaller;
+import org.apache.geronimo.gshell.model.settings.Settings;
+import org.apache.geronimo.gshell.model.settings.SettingsMarshaller;
+
+import java.net.URL;
+
+/**
+ * Unit tests for the {@link GShellBuilder} class.
+ *
+ * @version $Rev$ $Date$
+ */
+public class GShellBuilderTest
+ extends TestCase
+{
+ private GShellBuilder builder;
+
+ protected void setUp() throws Exception {
+ builder = new GShellBuilder();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testBuild1() throws Exception {
+ SettingsMarshaller settingsMarshaller = new SettingsMarshaller();
+ URL settingsUrl = getClass().getResource("settings1.xml");
+ assertNotNull(settingsUrl);
+
+ Settings settings = settingsMarshaller.unmarshal(settingsUrl);
+ assertNotNull(settings);
+ System.out.println(settings);
+
+ builder.setSettings(settings);
+
+ ApplicationMarshaller applicationMarshaller = new ApplicationMarshaller();
+ URL applicationUrl = getClass().getResource("application1.xml");
+ assertNotNull(applicationUrl);
+
+ Application application = applicationMarshaller.unmarshal(applicationUrl);
+ assertNotNull(application);
+ System.out.println(application);
+
+ builder.setApplication(application);
+
+ // FIXME: Need to figure out a way to unit test this bitch
+
+ // GShell shell = builder.build();
+ // assertNotNull(shell);
+ }
+}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/GShellBuilderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/GShellBuilderTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-loader/src/test/java/org/apache/geronimo/gshell/GShellBuilderTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/application1.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/application1.xml?rev=661572&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/application1.xml (added)
+++ geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/application1.xml Thu May 29 23:01:10 2008
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<application>
+
+</application>
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/application1.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/application1.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/application1.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/settings1.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/settings1.xml?rev=661572&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/settings1.xml (added)
+++ geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/settings1.xml Thu May 29 23:01:10 2008
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<settings>
+
+</settings>
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/settings1.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/settings1.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-loader/src/test/resources/org/apache/geronimo/gshell/settings1.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/monitor/ProgressSpinnerMonitor.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/monitor/ProgressSpinnerMonitor.java?rev=661572&r1=661571&r2=661572&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/monitor/ProgressSpinnerMonitor.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/monitor/ProgressSpinnerMonitor.java Thu May 29 23:01:10 2008
@@ -63,29 +63,6 @@
}
}
- /*
- NOTE: Seems liked this is not always called, so use transferStarted to display the banner
-
- public void transferInitiated(final TransferEvent event) {
- assert event != null;
-
- super.transferInitiated(event);
-
- complete = 0;
-
- spinner.reset();
-
- String type = event.getRequestType() == REQUEST_PUT ? "Uploading" : "Downloading";
- String url = event.getWagon().getRepository().getUrl();
-
- String message = type + ": " + url + "/" + event.getResource().getName();
-
- log.debug(message);
-
- println(message);
- }
- */
-
//
// TODO: May actually want to use a little timmer thread to make this spin more often for better user feedback
// that we are still working, then use the event to update the message. Or really, put the timer in
@@ -128,7 +105,7 @@
message = complete + "/" + (total == UNKNOWN_LENGTH ? "?" : total + "b");
}
- log.debug(message);
+ log.trace(message);
print(spinner.spin(message));
}
Added: geronimo/gshell/trunk/gshell-support/gshell-expr/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-expr/pom.xml?rev=661572&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-expr/pom.xml (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-expr/pom.xml Thu May 29 23:01:10 2008
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-support</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>gshell-expr</artifactId>
+ <name>GShell Support :: Expression</name>
+
+ <description>
+ Simple expression evaluation support for GShell.
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-jexl</groupId>
+ <artifactId>commons-jexl</artifactId>
+ </dependency>
+
+ <!-- Required for commons-jexl usage -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl104-over-slf4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-support/gshell-expr/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-expr/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-expr/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/ExpressionEvaluator.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/ExpressionEvaluator.java?rev=661572&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/ExpressionEvaluator.java (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/ExpressionEvaluator.java Thu May 29 23:01:10 2008
@@ -0,0 +1,49 @@
+/*
+ * 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.expression;
+
+/**
+ * A very simple expression evalutator interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ExpressionEvaluator
+{
+ Object evaluate(String expression) throws Exception;
+
+ String parse(String input) throws SyntaxException;
+
+ /**
+ * Thrown to indicate a syntax error while parsing.
+ */
+ public static class SyntaxException
+ extends RuntimeException
+ {
+ ///CLOVER:OFF
+
+ public SyntaxException(final String msg) {
+ super(msg);
+ }
+
+ public SyntaxException(final String msg, final Throwable cause) {
+ super(msg, cause);
+ }
+ }
+}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/ExpressionEvaluator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/ExpressionEvaluator.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/ExpressionEvaluator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/JexlExpressionEvaluator.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/JexlExpressionEvaluator.java?rev=661572&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/JexlExpressionEvaluator.java (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/JexlExpressionEvaluator.java Thu May 29 23:01:10 2008
@@ -0,0 +1,178 @@
+/*
+ * 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.expression;
+
+import org.apache.commons.jexl.Expression;
+import org.apache.commons.jexl.ExpressionFactory;
+import org.apache.commons.jexl.JexlContext;
+import org.apache.commons.jexl.JexlHelper;
+import org.apache.commons.jexl.resolver.FlatResolver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+//
+// TODO: Consider using BeanShell for this instead, its about the same size dependency
+// can probably do about the same thing we want here? And the 'script' command
+// can also use it
+//
+
+/**
+ * A very simple expression evalutator using Jexl to do the hard work.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JexlExpressionEvaluator
+ implements ExpressionEvaluator
+{
+ private Logger log = LoggerFactory.getLogger(getClass());
+
+ //
+ // NOTE: May want to add the ${...} bits the the CommandLineParser directly.
+ // This sub-parser is probably only short-term so we can get soemthing working
+ //
+
+ private final JexlContext context;
+
+ public JexlExpressionEvaluator(final Map vars) {
+ assert vars != null;
+
+ context = JexlHelper.createContext();
+ context.setVars(vars);
+
+
+ log.trace("Using variables: {}", context.getVars());
+ }
+
+ public Map getVariables() {
+ return context.getVars();
+ }
+
+ private final FlatResolver resolver = new FlatResolver(true);
+
+ protected Expression createExpression(final String expression) throws Exception {
+ assert expression != null;
+
+ Expression expr = ExpressionFactory.createExpression(expression);
+ expr.addPreResolver(resolver);
+
+ return expr;
+ }
+
+ public Object evaluate(final String expression) throws Exception {
+ assert expression != null;
+
+ log.debug("Evaluating expression: {}", expression);
+
+ Expression expr = createExpression(expression);
+
+ Object result = expr.evaluate(context);
+
+ log.debug("Result: {}", result);
+
+ return result;
+ }
+
+ public String parse(final String input) throws SyntaxException {
+ assert input != null;
+
+ log.trace("Parsing input: {}", input);
+
+ StringBuffer buff = new StringBuffer();
+
+ int current = 0;
+
+ while (current < input.length()) {
+ boolean complex = false;
+
+ int start = input.indexOf("$", current);
+
+ if (start == -1) {
+ break;
+ }
+ else if (start + 1 < input.length()) {
+ if (input.charAt(start + 1) == '{') {
+ complex = true;
+ }
+ }
+
+ int end;
+ if (complex) {
+ end = input.indexOf("}", start);
+ if (end == -1) {
+ throw new SyntaxException("Missing '}': " + input);
+ }
+ }
+ else {
+ end = input.indexOf(" ", start);
+ if (end == -1) {
+ end = input.indexOf("\t", start);
+
+ if (end == -1) {
+ end = input.length();
+ }
+ }
+ }
+
+ String expr = input.substring(start + (complex ? 2 : 1), end);
+
+ // System.err.println("b: " + buff);
+ String tmp = input.substring(current, start);
+ // System.err.println("t: " + tmp + "<");
+ buff.append(tmp);
+
+ try {
+ buff.append(evaluate(expr));
+ }
+ catch (Exception e) {
+ throw new SyntaxException("Failed to evaluate: " + expr, e);
+ }
+
+ // System.err.println("s:" + start);
+ // System.err.println("e:" + end);
+ // System.err.println("c:" + current);
+
+ current = end + (complex ? 1 : 0);
+ }
+
+ // System.err.println("c:" + current);
+
+ if (current < input.length()) {
+ // System.err.println("b: " + buff);
+ String tmp = input.substring(current);
+ // System.err.println("t: " + tmp);
+ buff.append(tmp);
+ }
+
+ log.trace("Parsed result: {}", buff);
+
+ return buff.toString();
+ }
+
+ public String parse(final String input, final boolean trim) throws SyntaxException {
+ String output = parse(input);
+ if (trim && output != null) {
+ output = output.trim();
+ }
+
+ return output;
+ }
+}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/JexlExpressionEvaluator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/JexlExpressionEvaluator.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/JexlExpressionEvaluator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/package-info.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/package-info.java?rev=661572&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/package-info.java (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/package-info.java Thu May 29 23:01:10 2008
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+/**
+ * Simple expression evalutation muck.
+ *
+ * @version $Rev$ $Date$
+ */
+package org.apache.geronimo.gshell.expression;
Propchange: geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/package-info.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-expr/src/main/java/org/apache/geronimo/gshell/expression/package-info.java
------------------------------------------------------------------------------
svn:mime-type = text/plain