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/09/10 09:33:39 UTC
svn commit: r693716 [1/2] - in /geronimo/gshell/trunk: ./
gshell-api/src/main/java/org/apache/geronimo/gshell/command/
gshell-application/src/main/java/org/apache/geronimo/gshell/application/
gshell-assembly/src/main/underlay/etc/ gshell-cli/ gshell-cl...
Author: jdillon
Date: Wed Sep 10 00:33:37 2008
New Revision: 693716
URL: http://svn.apache.org/viewvc?rev=693716&view=rev
Log:
Disable rapture/plexus bits from the build, focus on getting wisdom/spring working
Added:
geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainerAware.java (contents, props changed)
- copied, changed from r680934, geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainer.java
geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/
geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/
geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/gshell/
geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/gshell/commands.xml (with props)
geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/
geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml (with props)
geronimo/gshell/trunk/gshell-support/gshell-spring/
geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml (with props)
geronimo/gshell/trunk/gshell-support/gshell-spring/src/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java (with props)
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAware.java (with props)
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java (with props)
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java (with props)
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/resources/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/resources/META-INF/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/resources/META-INF/spring/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/resources/META-INF/spring/components.xml (with props)
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java (with props)
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/SpringTestSupport.java (with props)
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml (with props)
geronimo/gshell/trunk/gshell-support/gshell-url/src/main/java/org/apache/geronimo/gshell/url/URLHandlerFactoryImpl.java (contents, props changed)
- copied, changed from r680934, geronimo/gshell/trunk/gshell-support/gshell-url/src/main/java/org/apache/geronimo/gshell/url/DefaultURLHandlerFactory.java
geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/LoggingVisitor.java (with props)
Removed:
geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/
geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/plugin/
geronimo/gshell/trunk/gshell-support/gshell-url/src/main/java/org/apache/geronimo/gshell/url/DefaultURLHandlerFactory.java
Modified:
geronimo/gshell/trunk/gshell-application/src/main/java/org/apache/geronimo/gshell/application/ApplicationContext.java
geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml
geronimo/gshell/trunk/gshell-cli/pom.xml
geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java
geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceCommand.java
geronimo/gshell/trunk/gshell-rapture/gshell-rapture-core/src/main/java/org/apache/geronimo/gshell/rapture/shell/VariableInterpolator.java
geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml
geronimo/gshell/trunk/gshell-support/gshell-url/pom.xml
geronimo/gshell/trunk/gshell-support/pom.xml
geronimo/gshell/trunk/gshell-wisdom/pom.xml
geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/ShellBuilder.java
geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerImpl.java
geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandDocumenterImpl.java
geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineBuilderImpl.java
geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java
geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java
geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
geronimo/gshell/trunk/pom.xml
Copied: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainerAware.java (from r680934, geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainer.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainerAware.java?p2=geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainerAware.java&p1=geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainer.java&r1=680934&r2=693716&rev=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainer.java (original)
+++ geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainerAware.java Wed Sep 10 00:33:37 2008
@@ -24,41 +24,7 @@
*
* @version $Rev$ $Date$
*/
-public interface CommandContainer
+public interface CommandContainerAware
{
- /**
- * Returns the configured identifier of the command.
- *
- * @return The command identifier; never null;
- */
- String getId();
-
- /**
- * Returns the action of the command.
- *
- * @return The command action; never null;
- */
- CommandAction getAction();
-
- /**
- * Returns the documenter for the command.
- *
- * @return The command documenter; never null;
- */
- CommandDocumenter getDocumenter();
-
- /**
- * Returns the completer for the command.
- *
- * @return The command completer; never null;
- */
- CommandCompleter getCompleter();
-
- /**
- * Execute the command action.
- *
- * @param context The execution context.
- * @return The result of the action execution.
- */
- CommandResult execute(CommandContext context);
+ void setCommandContainer(CommandContainer container);
}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainerAware.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainerAware.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainerAware.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainerAware.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/gshell/trunk/gshell-application/src/main/java/org/apache/geronimo/gshell/application/ApplicationContext.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-application/src/main/java/org/apache/geronimo/gshell/application/ApplicationContext.java?rev=693716&r1=693715&r2=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-application/src/main/java/org/apache/geronimo/gshell/application/ApplicationContext.java (original)
+++ geronimo/gshell/trunk/gshell-application/src/main/java/org/apache/geronimo/gshell/application/ApplicationContext.java Wed Sep 10 00:33:37 2008
@@ -30,9 +30,13 @@
*/
public interface ApplicationContext
{
+ // TODO: Rename to Application
+
IO getIo();
Variables getVariables();
+ // TODO: Rename to ApplicationModel
+
Application getApplication();
}
\ No newline at end of file
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=693716&r1=693715&r2=693716&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 Wed Sep 10 00:33:37 2008
@@ -93,6 +93,10 @@
</dependencyGroup>
</dependencyGroups>
+ <!--
+ TODO: Need plugins
+ -->
+
<branding>
<name>gshell</name>
</branding>
Modified: geronimo/gshell/trunk/gshell-cli/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-cli/pom.xml?rev=693716&r1=693715&r2=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-cli/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-cli/pom.xml Wed Sep 10 00:33:37 2008
@@ -49,9 +49,31 @@
</dependency>
<dependency>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-io</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-application</artifactId>
+ </dependency>
+
+ <!--
+ <dependency>
<groupId>org.apache.geronimo.gshell.rapture</groupId>
<artifactId>gshell-rapture-bootstrap</artifactId>
</dependency>
+ -->
+
+ <dependency>
+ <groupId>org.apache.geronimo.gshell</groupId>
+ <artifactId>gshell-wisdom</artifactId>
+ </dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
Modified: geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java?rev=693716&r1=693715&r2=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java (original)
+++ geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java Wed Sep 10 00:33:37 2008
@@ -31,7 +31,6 @@
import org.apache.geronimo.gshell.model.application.Application;
import org.apache.geronimo.gshell.model.settings.Settings;
import org.apache.geronimo.gshell.application.settings.SettingsLocator;
-import org.apache.geronimo.gshell.rapture.ShellBuilder;
import org.codehaus.plexus.classworlds.ClassWorld;
import java.util.ArrayList;
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=693716&r1=693715&r2=693716&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 Wed Sep 10 00:33:37 2008
@@ -54,13 +54,13 @@
{
private final Logger log = LoggerFactory.getLogger(getClass());
- @Requirement
+ // @Autowired
private ApplicationManager applicationManager;
- @Requirement
+ // @Autowired
private CommandResolver commandResolver;
- @Requirement
+ // @Autowired
private LayoutManager layoutManager;
@Argument(metaVar="COMMAND", required=true, description="Display help for COMMAND")
Modified: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceCommand.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceCommand.java?rev=693716&r1=693715&r2=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceCommand.java (original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceCommand.java Wed Sep 10 00:33:37 2008
@@ -23,13 +23,16 @@
import org.apache.geronimo.gshell.command.CommandAction;
import org.apache.geronimo.gshell.command.CommandContext;
import org.apache.geronimo.gshell.command.annotation.CommandComponent;
-import org.apache.geronimo.gshell.command.annotation.Requirement;
import org.apache.geronimo.gshell.commandline.CommandLineExecutor;
import org.codehaus.plexus.util.IOUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
@@ -44,7 +47,7 @@
{
private final Logger log = LoggerFactory.getLogger(getClass());
- @Requirement
+ // @Autowired
private CommandLineExecutor executor;
@Argument(required=true, description="Source file")
Added: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/gshell/commands.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/gshell/commands.xml?rev=693716&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/gshell/commands.xml (added)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/gshell/commands.xml Wed Sep 10 00:33:37 2008
@@ -0,0 +1,55 @@
+<?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$ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+
+ <context:annotation-config/>
+
+ <!-- TODO: Need CommandContainerAware interface for all components -->
+
+ <bean class="org.apache.geronimo.gshell.wisdom.command.CommandContainerImpl">
+ <property name="id" value="geronimo-builtins:echo"/>
+
+ <property name="action">
+ <bean class="org.apache.geronimo.gshell.commands.builtins.EchoCommand"/>
+ </property>
+
+ <property name="completer">
+ <bean class="org.apache.geronimo.gshell.wisdom.command.CommandCompleterImpl"/>
+ </property>
+
+ <property name="documenter">
+ <bean class="org.apache.geronimo.gshell.wisdom.command.CommandDocumenterImpl">
+ <property name="name" value="echo"/>
+ <property name="description" value="Blah, blah, blah"/>
+ </bean>
+ </property>
+ </bean>
+
+</beans>
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/gshell/commands.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/gshell/commands.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/gshell/commands.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/gshell/commands.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml?rev=693716&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml (added)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml Wed Sep 10 00:33:37 2008
@@ -0,0 +1,36 @@
+<?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$ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+
+ <context:annotation-config/>
+
+ <!-- TODO: -->
+
+</beans>
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: geronimo/gshell/trunk/gshell-rapture/gshell-rapture-core/src/main/java/org/apache/geronimo/gshell/rapture/shell/VariableInterpolator.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-rapture/gshell-rapture-core/src/main/java/org/apache/geronimo/gshell/rapture/shell/VariableInterpolator.java?rev=693716&r1=693715&r2=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-rapture/gshell-rapture-core/src/main/java/org/apache/geronimo/gshell/rapture/shell/VariableInterpolator.java (original)
+++ geronimo/gshell/trunk/gshell-rapture/gshell-rapture-core/src/main/java/org/apache/geronimo/gshell/rapture/shell/VariableInterpolator.java Wed Sep 10 00:33:37 2008
@@ -35,6 +35,7 @@
import java.util.Collection;
import java.util.Map;
import java.util.Set;
+import java.util.List;
/**
* Provides interpolation for shell variables using Jexl.
Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml?rev=693716&r1=693715&r2=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml Wed Sep 10 00:33:37 2008
@@ -55,8 +55,18 @@
</dependency>
<dependency>
- <groupId>org.apache.geronimo.gshell.support</groupId>
- <artifactId>gshell-plexus</artifactId>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-annotations</artifactId>
</dependency>
<dependency>
Added: geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml?rev=693716&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml Wed Sep 10 00:33:37 2008
@@ -0,0 +1,112 @@
+<?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-spring</artifactId>
+ <name>GShell Support :: Spring</name>
+
+ <description>
+ Spring support for GShell.
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl104-over-slf4j</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.0_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jmock</groupId>
+ <artifactId>jmock-junit3</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-classworlds</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-spring</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java?rev=693716&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java Wed Sep 10 00:33:37 2008
@@ -0,0 +1,36 @@
+/*
+ * 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.spring;
+
+import org.springframework.beans.BeansException;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BeanContainer
+{
+ <T> T getBean(Class<T> type) throws BeansException;
+
+ <T> T getBean(String name, Class<T> requiredType) throws BeansException;
+
+ // Create children
+}
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAware.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAware.java?rev=693716&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAware.java (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAware.java Wed Sep 10 00:33:37 2008
@@ -0,0 +1,32 @@
+/*
+ * 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.spring;
+
+import org.springframework.beans.BeansException;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BeanContainerAware
+{
+ void setBeanContainer(BeanContainer container);
+}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAware.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAware.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAware.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAware.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java?rev=693716&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java Wed Sep 10 00:33:37 2008
@@ -0,0 +1,54 @@
+/*
+ * 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.spring;
+
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanContainerAwareProcessor
+ implements BeanPostProcessor
+{
+ private final BeanContainer container;
+
+ public BeanContainerAwareProcessor(final BeanContainer container) {
+ assert container != null;
+
+ this.container = container;
+ }
+
+ public Object postProcessBeforeInitialization(final Object bean, final String beanName) throws BeansException {
+ assert bean != null;
+
+ if (bean instanceof BeanContainerAware) {
+ ((BeanContainerAware)bean).setBeanContainer(container);
+ }
+
+ return bean;
+ }
+
+ public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException {
+ return bean;
+ }
+}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java?rev=693716&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java Wed Sep 10 00:33:37 2008
@@ -0,0 +1,87 @@
+/*
+ * 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.spring;
+
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanContainerImpl
+ implements BeanContainer
+{
+ private static final String[] CONFIG_LOCATIONS = {
+ "classpath*:META-INF/spring/components.xml",
+ "classpath*:META-INF/gshell/commands.xml"
+ };
+
+ private ClassPathXmlApplicationContext context;
+
+ public BeanContainerImpl() {
+ context = new ClassPathXmlApplicationContext(CONFIG_LOCATIONS, false);
+ context.registerShutdownHook();
+
+ addBeanPostProcessor(new BeanContainerAwareProcessor(BeanContainerImpl.this));
+
+ // TODO: Set classloader
+
+ context.refresh();
+ }
+
+ private void addBeanPostProcessor(final BeanPostProcessor processor) {
+ assert processor != null;
+
+ context.addBeanFactoryPostProcessor(new BeanFactoryPostProcessor()
+ {
+ public void postProcessBeanFactory(final ConfigurableListableBeanFactory beanFactory) throws BeansException {
+ beanFactory.addBeanPostProcessor(processor);
+ }
+ });
+ }
+
+ public <T> T getBean(final Class<T> type) throws BeansException {
+ assert type != null;
+
+ String[] names = context.getBeanNamesForType(type);
+ if (names.length == 0) {
+ throw new NoSuchBeanDefinitionException(type, "No bean defined for type: " + type);
+ }
+ if (names.length > 1) {
+ throw new NoSuchBeanDefinitionException(type, "Duplicate bean defined for type: " + type);
+ }
+
+ return getBean(names[0], type);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public <T> T getBean(final String name, final Class<T> requiredType) throws BeansException {
+ assert name != null;
+ assert requiredType != null;
+
+ return (T) context.getBean(name, requiredType);
+ }
+}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/resources/META-INF/spring/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/resources/META-INF/spring/components.xml?rev=693716&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/resources/META-INF/spring/components.xml (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/resources/META-INF/spring/components.xml Wed Sep 10 00:33:37 2008
@@ -0,0 +1,36 @@
+<?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$ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+
+ <context:annotation-config/>
+
+ <!-- TODO: -->
+
+</beans>
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/resources/META-INF/spring/components.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/resources/META-INF/spring/components.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/resources/META-INF/spring/components.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java?rev=693716&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java Wed Sep 10 00:33:37 2008
@@ -0,0 +1,69 @@
+/*
+ * 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.spring;
+
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+
+import org.jmock.Mockery;
+
+import javax.annotation.PostConstruct;
+
+import junit.framework.Assert;
+
+/**
+ * Unit tests for the {@link BeanContainerAwareProcessor} class.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanContainerAwareProcessorTest
+ extends SpringTestSupport
+{
+ private Mockery context = new Mockery();
+
+ protected void customizeBeanFactory(DefaultListableBeanFactory beanFactory) {
+ BeanContainer container = context.mock(BeanContainer.class);
+ beanFactory.addBeanPostProcessor(new BeanContainerAwareProcessor(container));
+ }
+
+ public void testProcessor() throws Exception {
+ Target target = (Target) applicationContext.getBean("target");
+ assertNotNull(target);
+ assertNotNull(target.container);
+ }
+
+ //
+ // Target
+ //
+
+ public static class Target
+ implements BeanContainerAware
+ {
+ public BeanContainer container;
+
+ public void setBeanContainer(BeanContainer container) {
+ this.container = container;
+ }
+
+ @PostConstruct
+ public void init() {
+ Assert.assertNotNull(container);
+ }
+ }
+}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/SpringTestSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/SpringTestSupport.java?rev=693716&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/SpringTestSupport.java (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/SpringTestSupport.java Wed Sep 10 00:33:37 2008
@@ -0,0 +1,37 @@
+/*
+ * 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.spring;
+
+import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class SpringTestSupport
+ extends AbstractDependencyInjectionSpringContextTests
+{
+ protected String[] getConfigLocations() {
+ return new String[] {
+ "classpath:" + getClass().getName().replace('.', '/') + "-context.xml"
+ };
+ }
+}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/SpringTestSupport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/SpringTestSupport.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/SpringTestSupport.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/SpringTestSupport.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml?rev=693716&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml Wed Sep 10 00:33:37 2008
@@ -0,0 +1,36 @@
+<?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$ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+
+ <context:annotation-config/>
+
+ <bean id="target" class="org.apache.geronimo.gshell.spring.BeanContainerAwareProcessorTest$Target"/>
+
+</beans>
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: geronimo/gshell/trunk/gshell-support/gshell-url/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-url/pom.xml?rev=693716&r1=693715&r2=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-url/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-url/pom.xml Wed Sep 10 00:33:37 2008
@@ -44,8 +44,8 @@
</dependency>
<dependency>
- <groupId>org.apache.geronimo.gshell.support</groupId>
- <artifactId>gshell-plexus</artifactId>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-annotations</artifactId>
</dependency>
</dependencies>
Copied: geronimo/gshell/trunk/gshell-support/gshell-url/src/main/java/org/apache/geronimo/gshell/url/URLHandlerFactoryImpl.java (from r680934, geronimo/gshell/trunk/gshell-support/gshell-url/src/main/java/org/apache/geronimo/gshell/url/DefaultURLHandlerFactory.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-url/src/main/java/org/apache/geronimo/gshell/url/URLHandlerFactoryImpl.java?p2=geronimo/gshell/trunk/gshell-support/gshell-url/src/main/java/org/apache/geronimo/gshell/url/URLHandlerFactoryImpl.java&p1=geronimo/gshell/trunk/gshell-support/gshell-url/src/main/java/org/apache/geronimo/gshell/url/DefaultURLHandlerFactory.java&r1=680934&r2=693716&rev=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-url/src/main/java/org/apache/geronimo/gshell/url/DefaultURLHandlerFactory.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-url/src/main/java/org/apache/geronimo/gshell/url/URLHandlerFactoryImpl.java Wed Sep 10 00:33:37 2008
@@ -19,10 +19,6 @@
package org.apache.geronimo.gshell.url;
-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,20 +36,18 @@
*
* @version $Rev$ $Date$
*/
-@Component(role=URLHandlerFactory.class, instantiationStrategy="singleton-keep-alive")
-public class DefaultURLHandlerFactory
- implements URLHandlerFactory,Initializable
+public class URLHandlerFactoryImpl
+ implements URLHandlerFactory
{
- private static DefaultURLHandlerFactory SINGLETON;
+ private static URLHandlerFactoryImpl SINGLETON;
private final Logger log = LoggerFactory.getLogger(getClass());
private final Factory factory = new Factory();
- @Requirement(role=URLStreamHandler.class)
private Map<String,URLStreamHandler> handlers;
- public DefaultURLHandlerFactory() {
+ public URLHandlerFactoryImpl() {
// Just sanity check that only one of these puppies gets constructed... ever
synchronized (URLHandlerFactory.class) {
if (SINGLETON != null) {
@@ -63,14 +57,22 @@
}
}
- public void initialize() throws InitializationException {
+ public Map<String, URLStreamHandler> getHandlers() {
+ return handlers;
+ }
+
+ public void setHandlers(final Map<String, URLStreamHandler> handlers) {
+ this.handlers = handlers;
+ }
+
+ public void init() {
try {
URL.setURLStreamHandlerFactory(factory);
log.debug("URL stream handler factory installed");
}
catch (Throwable t) {
- throw new InitializationException("Failed to install URL stream handler factory", t);
+ throw new RuntimeException("Failed to install URL stream handler factory", t);
}
// Log the initial handlers which were injected
Propchange: geronimo/gshell/trunk/gshell-support/gshell-url/src/main/java/org/apache/geronimo/gshell/url/URLHandlerFactoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-url/src/main/java/org/apache/geronimo/gshell/url/URLHandlerFactoryImpl.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-url/src/main/java/org/apache/geronimo/gshell/url/URLHandlerFactoryImpl.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/gshell/trunk/gshell-support/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/pom.xml?rev=693716&r1=693715&r2=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-support/pom.xml Wed Sep 10 00:33:37 2008
@@ -48,7 +48,10 @@
<module>gshell-i18n</module>
<module>gshell-io</module>
<module>gshell-prefs</module>
+ <module>gshell-spring</module>
+ <!--
<module>gshell-plexus</module>
+ -->
<module>gshell-url</module>
<module>gshell-console</module>
</modules>
Modified: geronimo/gshell/trunk/gshell-wisdom/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/pom.xml?rev=693716&r1=693715&r2=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-wisdom/pom.xml Wed Sep 10 00:33:37 2008
@@ -70,6 +70,11 @@
</dependency>
<dependency>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-spring</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.geronimo.gshell</groupId>
<artifactId>gshell-api</artifactId>
</dependency>
@@ -98,131 +103,17 @@
<groupId>commons-jexl</groupId>
<artifactId>commons-jexl</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-annotation_1.0_spec</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>2.5.5</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>2.5.5</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- <version>2.5.5</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
+ <groupId>org.apache.geronimo.gshell.support</groupId>
+ <artifactId>gshell-artifact</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- <version>2.5.5</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
- <version>2.5.5</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!--
- <dependency>
- <groupId>org.springframework.osgi</groupId>
- <artifactId>spring-osgi-core</artifactId>
- <version>1.1.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.springframework.osgi</groupId>
- <artifactId>spring-osgi-extender</artifactId>
- <version>1.1.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.springframework.osgi</groupId>
- <artifactId>spring-osgi-io</artifactId>
- <version>1.1.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.springframework.osgi</groupId>
- <artifactId>spring-osgi-annotation</artifactId>
- <version>1.1.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.springframework.osgi</groupId>
- <artifactId>spring-osgi-test</artifactId>
- <version>1.1.0</version>
<scope>test</scope>
</dependency>
- -->
-
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-spring</artifactId>
- <version>1.0.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.gshell.support</groupId>
- <artifactId>gshell-artifact</artifactId>
- </dependency>
</dependencies>
- <!--
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.1</version>
- <extensions>true</extensions>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
- -->
-
</project>
Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/ShellBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/ShellBuilder.java?rev=693716&r1=693715&r2=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/ShellBuilder.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/ShellBuilder.java Wed Sep 10 00:33:37 2008
@@ -32,8 +32,12 @@
import org.apache.geronimo.gshell.model.settings.Settings;
import org.apache.geronimo.gshell.shell.Shell;
import org.apache.geronimo.gshell.shell.ShellFactory;
+import org.apache.geronimo.gshell.spring.BeanContainer;
+import org.apache.geronimo.gshell.spring.BeanContainerImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.codehaus.plexus.classworlds.ClassWorld;
+import org.springframework.beans.BeansException;
/**
* Builds {@link org.apache.geronimo.gshell.shell.Shell} instances.
@@ -45,16 +49,12 @@
{
private final Logger log = LoggerFactory.getLogger(getClass());
- /*
private static final String DEFAULT_REALM_ID = "gshell";
- private static final String DEFAULT_CONTAINER_NAME = "gshell";
-
- private GShellPlexusContainer container;
+ private BeanContainer container;
private ClassWorld classWorld;
- */
-
+
private SettingsManager settingsManager;
private SettingsConfiguration settingsConfig = new SettingsConfiguration();
@@ -67,34 +67,22 @@
public ShellBuilder() {}
- /*
- private GShellPlexusContainer createContainer() throws PlexusContainerException {
- ContainerConfiguration config = new DefaultContainerConfiguration();
-
- config.setName(DEFAULT_CONTAINER_NAME);
- config.setClassWorld(getClassWorld());
-
- GShellPlexusContainer container = new GShellPlexusContainer(config);
-
- // Install our logging muck
- container.setLoggerManager(new Slf4jLoggingManager());
-
+ private BeanContainer createContainer() {
+ BeanContainer container = new BeanContainerImpl();
return container;
}
- public GShellPlexusContainer getContainer() throws PlexusContainerException {
+ public BeanContainer getContainer() {
if (container == null) {
container = createContainer();
}
return container;
}
- public void setContainer(final GShellPlexusContainer container) {
+ public void setContainer(final BeanContainer container) {
this.container = container;
}
- */
- /*
private ClassWorld createClassWorld() {
return new ClassWorld(DEFAULT_REALM_ID, Thread.currentThread().getContextClassLoader());
}
@@ -109,7 +97,6 @@
public void setClassWorld(final ClassWorld classWorld) {
this.classWorld = classWorld;
}
- */
public IO getIo() {
return applicationConfig.getIo();
@@ -135,11 +122,11 @@
settingsConfig.setSettings(settings);
}
- private SettingsManager createSettingsManager() /*FIXME: throws ComponentLookupException */ {
- return null; // FIXME: container.lookupComponent(SettingsManager.class);
+ private SettingsManager createSettingsManager() throws BeansException {
+ return getContainer().getBean(SettingsManager.class);
}
- public SettingsManager getSettingsManager() /*FIXME: throws ComponentLookupException*/ {
+ public SettingsManager getSettingsManager() throws BeansException {
if (settingsManager == null) {
settingsManager = createSettingsManager();
}
@@ -158,11 +145,11 @@
applicationConfig.setApplication(application);
}
- private ApplicationManager createApplicationManager() /*FIXME: throws ComponentLookupException*/ {
- return null; // FIXME: container.lookupComponent(ApplicationManager.class);
+ private ApplicationManager createApplicationManager() throws BeansException {
+ return getContainer().getBean(ApplicationManager.class);
}
- public ApplicationManager getApplicationManager() /*FIXME: throws ComponentLookupException*/ {
+ public ApplicationManager getApplicationManager() throws BeansException {
if (applicationManager == null) {
applicationManager = createApplicationManager();
}
@@ -173,11 +160,11 @@
this.applicationManager = applicationManager;
}
- private ArtifactManager createArtifactManager() /*FIXME: throws PlexusContainerException, ComponentLookupException*/ {
- return null; // FIXME: getContainer().lookupComponent(ArtifactManager.class);
+ private ArtifactManager createArtifactManager() throws BeansException {
+ return getContainer().getBean(ArtifactManager.class);
}
- public ArtifactManager getArtifactManager() /*FIXME: throws ComponentLookupException, PlexusContainerException*/ {
+ public ArtifactManager getArtifactManager() throws BeansException {
if (artifactManager == null) {
artifactManager = createArtifactManager();
}
@@ -213,12 +200,9 @@
SystemOutputHijacker.register(io.outputStream, io.errorStream);
// Initialize the container
- /*
- FIXME:
getContainer();
log.debug("Container: {}", container);
- */
-
+
//
// TODO: Allow someway to configure a non-interactive monitor
//
Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java?rev=693716&r1=693715&r2=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java Wed Sep 10 00:33:37 2008
@@ -46,7 +46,6 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import javax.annotation.Resource;
import java.io.File;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
@@ -170,7 +169,6 @@
}
}
- // ctx.registerShutdownHook();
/*
private GShellPlexusContainer createContainer(final Application application) throws Exception {
assert application != null;
Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerImpl.java?rev=693716&r1=693715&r2=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerImpl.java Wed Sep 10 00:33:37 2008
@@ -34,6 +34,8 @@
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
+import javax.annotation.PostConstruct;
+
/**
* The default {@link CommandContainer} component.
*
@@ -44,51 +46,67 @@
{
private final Logger log = LoggerFactory.getLogger(getClass());
- // private GShellPlexusContainer container;
+ private String id;
+
+ private CommandAction action;
- private String commandId;
+ private CommandDocumenter documenter;
- // Command
+ private CommandCompleter completer;
public String getId() {
- return commandId;
+ return id;
}
- private <T> T lookupComponent(final Class<T> role) {
- /*
- assert role != null;
- assert container != null;
+ public void setId(final String id) {
+ assert id != null;
- try {
- return container.lookupComponent(role, commandId);
- }
- catch (ComponentLookupException e) {
- throw new RuntimeException(e);
- }
- */
-
- return null;
+ this.id = id;
}
public CommandAction getAction() {
- return lookupComponent(CommandAction.class);
+ return action;
+ }
+
+ public void setAction(final CommandAction action) {
+ assert action != null;
+
+ this.action = action;
}
public CommandDocumenter getDocumenter() {
- return lookupComponent(CommandDocumenter.class);
+ return documenter;
+ }
+
+ public void setDocumenter(final CommandDocumenter documenter) {
+ // documenter could be null
+
+ this.documenter = documenter;
}
public CommandCompleter getCompleter() {
- return lookupComponent(CommandCompleter.class);
+ return completer;
}
+ public void setCompleter(final CommandCompleter completer) {
+ // completer could be null
+
+ this.completer = completer;
+ }
+
+ @PostConstruct
+ public void init() {
+ // TODO: Validate properties
+ // TODO: Inject ourself into CommandContainerAware instances
+ }
+
public CommandResult execute(final CommandContext context) {
assert context != null;
log.trace("Executing; context={}");
// Provide logging context for the command execution
- MDC.put("commandId", commandId);
+ MDC.put("command-id", id);
CommandResult result;
@@ -137,12 +155,16 @@
* @param args The arguments to the action.
* @return True if --help was detetected, else execute the action.
*
- * @throws org.apache.geronimo.gshell.clp.ProcessingException A failure occured while processing the command-line.
+ * @throws ProcessingException A failure occured while processing the command-line.
*/
private boolean processArguments(final CommandContext context, final CommandAction action, final Object[] args) throws ProcessingException {
assert context != null;
assert args != null;
+ //
+ // TODO: Add preferences processor
+ //
+
CommandLineProcessor clp = new CommandLineProcessor();
clp.addBean(action);
Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandDocumenterImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandDocumenterImpl.java?rev=693716&r1=693715&r2=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandDocumenterImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandDocumenterImpl.java Wed Sep 10 00:33:37 2008
@@ -24,7 +24,6 @@
import org.apache.geronimo.gshell.command.CommandAction;
import org.apache.geronimo.gshell.command.CommandDocumenter;
import org.apache.geronimo.gshell.command.CommandInfo;
-import org.apache.geronimo.gshell.command.annotation.CommandComponent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,8 +39,6 @@
{
private final Logger log = LoggerFactory.getLogger(getClass());
- // private GShellPlexusContainer container;
-
/**
* Get the action instance for the given command context.
*
@@ -51,19 +48,9 @@
private CommandAction getAction(final CommandInfo info) {
assert info != null;
- /*
- FIXME:
- assert container != null;
-
- try {
- return container.lookupComponent(CommandAction.class, info.getId());
- }
- catch (ComponentLookupException e) {
- throw new RuntimeException(e);
- }
- */
+ // TODO:
- return null;
+ throw new Error();
}
// CommandDocumenter
@@ -83,17 +70,9 @@
public String getDescription(final CommandInfo info) {
assert info != null;
- //
- // HACK: This needs to chagne, doing this for now to make it work
- //
-
- CommandAction action = getAction(info);
- CommandComponent annotation = action.getClass().getAnnotation(CommandComponent.class);
- if (annotation == null) {
- throw new IllegalStateException("Command description not found");
- }
-
- return annotation.description();
+ // TODO:
+
+ throw new Error();
}
//
Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineBuilderImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineBuilderImpl.java?rev=693716&r1=693715&r2=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineBuilderImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineBuilderImpl.java Wed Sep 10 00:33:37 2008
@@ -31,7 +31,6 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import javax.annotation.Resource;
import java.io.Reader;
import java.io.StringReader;
@@ -65,13 +64,10 @@
}
// If debug is enabled, the log the parse tree
- /*
- FIXME:
if (log.isDebugEnabled()) {
LoggingVisitor logger = new LoggingVisitor(log);
cl.jjtAccept(logger, null);
}
- */
return cl;
}
Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java?rev=693716&r1=693715&r2=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java Wed Sep 10 00:33:37 2008
@@ -42,6 +42,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
+import javax.annotation.PostConstruct;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PipedInputStream;
@@ -76,16 +77,13 @@
public CommandLineExecutorImpl() {}
- /*
- FIXME:
@PostConstruct
- public void initialize() throws InitializationException {
+ public void init() {
assert applicationManager != null;
this.variables = applicationManager.getContext().getVariables();
this.io = applicationManager.getContext().getIo();
}
- */
public Object execute(final String line) throws Exception {
assert line != null;
Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java?rev=693716&r1=693715&r2=693716&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java Wed Sep 10 00:33:37 2008
@@ -20,6 +20,14 @@
package org.apache.geronimo.gshell.wisdom.shell;
import jline.History;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.geronimo.gshell.application.ApplicationManager;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import javax.annotation.PostConstruct;
+import java.io.IOException;
+import java.io.File;
/**
* Default implementation of the {@link jline.History} component.
@@ -27,7 +35,40 @@
* @version $Rev$ $Date$
*/
public class HistoryImpl
- // FIXME: extends FileHistory
+ extends History
{
- // Empty
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ @Autowired
+ private ApplicationManager applicationManager;
+
+ public HistoryImpl() {}
+
+ @PostConstruct
+ public void init() {
+ assert applicationManager != null;
+
+ try {
+ setHistoryFile(applicationManager.getContext().getApplication().getBranding().getHistoryFile());
+ }
+ catch (IOException e) {
+ throw new RuntimeException("Failed to set history file", e);
+ }
+ }
+
+ public void setHistoryFile(final File file) throws IOException {
+ assert file != null;
+
+ File dir = file.getParentFile();
+
+ if (!dir.exists()) {
+ dir.mkdirs();
+
+ log.debug("Created base directory for history file: {}", dir);
+ }
+
+ log.debug("Using history file: {}", file);
+
+ super.setHistoryFile(file);
+ }
}
\ No newline at end of file