geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r692840 - in /geronimo/gshell/trunk: gshell-buildsupport/javacc-maven-plugin/ gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ gshell-wisdom/ gshell-wisdom/src/main/java/org/apache/geronimo/gshell/...
Date Sun, 07 Sep 2008 13:03:15 GMT
Author: jdillon
Date: Sun Sep  7 06:03:14 2008
New Revision: 692840

URL: http://svn.apache.org/viewvc?rev=692840&view=rev
Log:
More spring container stuff

Added:
    geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/plexus.xml   (with
props)
Modified:
    geronimo/gshell/trunk/gshell-buildsupport/javacc-maven-plugin/pom.xml
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java
    geronimo/gshell/trunk/gshell-wisdom/pom.xml
    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/application/SettingsManagerImpl.java
    geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerFactoryImpl.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/LayoutManagerImpl.java
    geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
    geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellInfoImpl.java
    geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/components.xml
    geronimo/gshell/trunk/gshell-wisdom/src/test/java/org/apache/geronimo/gshell/wisdom/MySpringComponent.java
    geronimo/gshell/trunk/gshell-wisdom/src/test/resources/org/apache/geronimo/gshell/wisdom/ArtifactManagerTest-context.xml
    geronimo/gshell/trunk/gshell-wisdom/src/test/resources/org/apache/geronimo/gshell/wisdom/BasicSpringTest-context.xml
    geronimo/gshell/trunk/gshell-wisdom/src/test/resources/org/apache/geronimo/gshell/wisdom/PlexusSpringTest-context.xml

Modified: geronimo/gshell/trunk/gshell-buildsupport/javacc-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-buildsupport/javacc-maven-plugin/pom.xml?rev=692840&r1=692839&r2=692840&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-buildsupport/javacc-maven-plugin/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-buildsupport/javacc-maven-plugin/pom.xml Sun Sep  7 06:03:14
2008
@@ -44,7 +44,7 @@
         
         <dependency>
             <groupId>org.codehaus.groovy.maven.runtime</groupId>
-            <artifactId>gmaven-runtime-default</artifactId>
+            <artifactId>gmaven-runtime-1.5</artifactId>
         </dependency>
         
         <dependency>

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=692840&r1=692839&r2=692840&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
Sun Sep  7 06:03:14 2008
@@ -23,7 +23,14 @@
 import org.apache.geronimo.gshell.ansi.Renderer;
 import org.apache.geronimo.gshell.application.ApplicationManager;
 import org.apache.geronimo.gshell.clp.Argument;
-import org.apache.geronimo.gshell.command.*;
+import org.apache.geronimo.gshell.command.Command;
+import org.apache.geronimo.gshell.command.CommandAction;
+import org.apache.geronimo.gshell.command.CommandContext;
+import org.apache.geronimo.gshell.command.CommandDocumenter;
+import org.apache.geronimo.gshell.command.CommandException;
+import org.apache.geronimo.gshell.command.CommandInfo;
+import org.apache.geronimo.gshell.command.CommandResolver;
+import org.apache.geronimo.gshell.command.Variables;
 import org.apache.geronimo.gshell.command.annotation.CommandComponent;
 import org.apache.geronimo.gshell.command.annotation.Requirement;
 import org.apache.geronimo.gshell.io.IO;
@@ -54,9 +61,6 @@
     private CommandResolver commandResolver;
 
     @Requirement
-    private CommandContainerFactory commandContainerFactory;
-
-    @Requirement
     private LayoutManager layoutManager;
 
     @Argument(metaVar="COMMAND", required=true, description="Display help for COMMAND")
@@ -102,37 +106,38 @@
 
         GroupNode group = layoutManager.getLayout();
 
-        displayGroupCommands(io, group);
+        displayGroupCommands(io, group, context.getVariables());
     }
 
-    private void displayGroupCommands(final IO io, final GroupNode group) throws Exception
{
+    private void displayGroupCommands(final IO io, final GroupNode group, final Variables
variables) throws Exception {
         assert io != null;
         int maxNameLen = 20; // FIXME: Figure this out dynamically
 
         // First display command/aliases nodes
         for (Node child : group.nodes()) {
+            log.debug("Render help tree for node: {}", child);
+            
             if (child instanceof CommandNode) {
-                try {
-                    CommandNode node = (CommandNode) child;
-                    String name = StringUtils.rightPad(node.getName(), maxNameLen);
+                String path = child.getPath();
 
-                    CommandContainer command = commandContainerFactory.create(node.getId());
+                log.debug("Resolving command for path: {}", path);
 
-                    // FIXME:
-                    String desc = command.toString(); // command.getDescription();
+                Command command = commandResolver.resolve(variables, path);
+                String name = StringUtils.rightPad(child.getName(), maxNameLen);
 
-                    io.out.print("  ");
-                    io.out.print(renderer.render(Renderer.encode(name, Code.BOLD)));
+                CommandDocumenter documenter = command.getContainer().getDocumenter();
+                CommandInfo info = command.getInfo();
+                String desc = documenter.getDescription(info);
+
+                io.out.print("  ");
+                io.out.print(renderer.render(Renderer.encode(name, Code.BOLD)));
 
-                    if (desc != null) {
-                        io.out.print("  ");
-                        io.out.println(desc);
-                    }
-                    else {
-                        io.out.println();
-                    }
-                } catch (/*NotRegistered*/Exception e) {
-                    // Ignore those exceptions (command will not be displayed)
+                if (desc != null) {
+                    io.out.print("  ");
+                    io.out.println(desc);
+                }
+                else {
+                    io.out.println();
                 }
             }
             else if (child instanceof AliasNode) {
@@ -170,7 +175,7 @@
                 io.out.println(renderer.render(Renderer.encode(path, Code.BOLD)));
 
                 io.out.println();
-                displayGroupCommands(io, node);
+                displayGroupCommands(io, node, variables);
                 io.out.println();
             }
         }

Modified: geronimo/gshell/trunk/gshell-wisdom/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/pom.xml?rev=692840&r1=692839&r2=692840&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-wisdom/pom.xml Sun Sep  7 06:03:14 2008
@@ -98,7 +98,12 @@
             <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>

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=692840&r1=692839&r2=692840&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
Sun Sep  7 06:03:14 2008
@@ -44,7 +44,9 @@
 import org.codehaus.plexus.interpolation.PropertiesBasedValueSource;
 import org.slf4j.Logger;
 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;
@@ -66,25 +68,12 @@
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
+    @Autowired
     private ArtifactManager artifactManager;
 
+    @Autowired
     private SettingsManager settingsManager;
 
-    /*
-    FIXME:
-    private GShellPlexusContainer parentContainer;
-
-    private GShellPlexusContainer container;
-    */
-
-    public ApplicationManagerImpl(final ArtifactManager artifactManager, final SettingsManager
settingsManager) {
-        assert artifactManager != null;
-        assert settingsManager != null;
-        
-        this.artifactManager = artifactManager;
-        this.settingsManager = settingsManager;
-    }
-
     private ApplicationContext applicationContext;
 
     public ApplicationContext getContext() {
@@ -181,6 +170,7 @@
         }
     }
 
+    // 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/application/SettingsManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/application/SettingsManagerImpl.java?rev=692840&r1=692839&r2=692840&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/application/SettingsManagerImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/application/SettingsManagerImpl.java
Sun Sep  7 06:03:14 2008
@@ -29,6 +29,7 @@
 import org.codehaus.plexus.interpolation.PropertiesBasedValueSource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * Default implementation of the {@link SettingsManager} component.
@@ -40,16 +41,11 @@
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
+    @Autowired
     private ArtifactManager artifactManager;
 
     private SettingsConfiguration settingsConfiguration;
 
-    public SettingsManagerImpl(final ArtifactManager artifactManager) {
-        assert artifactManager != null;
-        
-        this.artifactManager = artifactManager;
-    }
-
     public Settings getSettings() {
         if (settingsConfiguration == null) {
             throw new IllegalStateException("Not configured");

Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerFactoryImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerFactoryImpl.java?rev=692840&r1=692839&r2=692840&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerFactoryImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerFactoryImpl.java
Sun Sep  7 06:03:14 2008
@@ -21,7 +21,6 @@
 
 import org.apache.geronimo.gshell.command.CommandContainer;
 import org.apache.geronimo.gshell.command.CommandContainerFactory;
-import org.apache.geronimo.gshell.plexus.GShellPlexusContainer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,8 +34,6 @@
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    private GShellPlexusContainer container;
-
     public CommandContainer create(final String id) throws Exception {
         assert id != null;
 

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=692840&r1=692839&r2=692840&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
Sun Sep  7 06:03:14 2008
@@ -20,19 +20,18 @@
 package org.apache.geronimo.gshell.wisdom.shell;
 
 import org.apache.geronimo.gshell.application.ApplicationManager;
-import org.apache.geronimo.gshell.command.Variables;
 import org.apache.geronimo.gshell.commandline.CommandLine;
 import org.apache.geronimo.gshell.commandline.CommandLineBuilder;
-import org.apache.geronimo.gshell.commandline.CommandLineExecutor;
 import org.apache.geronimo.gshell.notification.ErrorNotification;
 import org.apache.geronimo.gshell.parser.ASTCommandLine;
 import org.apache.geronimo.gshell.parser.CommandLineParser;
 import org.apache.geronimo.gshell.parser.ParseException;
-import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.util.IOUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 
+import javax.annotation.Resource;
 import java.io.Reader;
 import java.io.StringReader;
 
@@ -46,22 +45,13 @@
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    private PlexusContainer container;
-
+    @Autowired
     private ApplicationManager applicationManager;
 
     private final CommandLineParser parser = new CommandLineParser();
 
     public CommandLineBuilderImpl() {}
 
-    public CommandLineBuilderImpl(final PlexusContainer container, final ApplicationManager
applicationManager) {
-        assert container != null;
-        assert applicationManager != null;
-
-        this.container = container;
-        this.applicationManager = applicationManager;
-    }
-
     private ASTCommandLine parse(final String input) throws ParseException {
         assert input != null;
 
@@ -94,14 +84,14 @@
         }
 
         try {
+            /*
+            FIXME:
             assert container != null;
             CommandLineExecutor executor = (CommandLineExecutor) container.lookup(CommandLineExecutor.class);
 
             assert applicationManager != null;
             Variables vars = applicationManager.getContext().getVariables();
 
-            /*
-            FIXME:
 
             final ExecutingVisitor visitor = new ExecutingVisitor(executor, vars);
             final ASTCommandLine root = parse(commandLine);

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=692840&r1=692839&r2=692840&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
Sun Sep  7 06:03:14 2008
@@ -39,7 +39,9 @@
 import org.codehaus.plexus.util.IOUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 
+import javax.annotation.Resource;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PipedInputStream;
@@ -59,10 +61,13 @@
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
+    @Autowired
     private ApplicationManager applicationManager;
 
+    @Autowired
     private CommandResolver commandResolver;
 
+    @Autowired
     private CommandLineBuilder commandLineBuilder;
 
     private Variables variables;
@@ -71,15 +76,9 @@
 
     public CommandLineExecutorImpl() {}
 
-    public CommandLineExecutorImpl(final ApplicationManager applicationManager, final CommandLineBuilder
commandLineBuilder) {
-        assert applicationManager != null;
-        assert commandLineBuilder != null;
-
-        this.applicationManager = applicationManager;
-        this.commandLineBuilder = commandLineBuilder;
-    }
-
     /*
+    FIXME:
+    @PostConstruct
     public void initialize() throws InitializationException {
         assert applicationManager != null;
 

Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/LayoutManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/LayoutManagerImpl.java?rev=692840&r1=692839&r2=692840&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/LayoutManagerImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/LayoutManagerImpl.java
Sun Sep  7 06:03:14 2008
@@ -27,6 +27,9 @@
 import org.apache.geronimo.gshell.model.layout.Node;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import javax.annotation.Resource;
 
 /**
  * The default implementation of the {@link LayoutManager} component.
@@ -38,18 +41,13 @@
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
+    @Autowired
     private ApplicationManager applicationManager;
 
     private Layout layout;
 
     public LayoutManagerImpl() {}
 
-    public LayoutManagerImpl(final ApplicationManager applicationManager) {
-        assert applicationManager != null;
-
-        this.applicationManager = applicationManager;
-    }
-
     private Layout lookupLayout() {
         assert applicationManager != null;
 

Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java?rev=692840&r1=692839&r2=692840&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
Sun Sep  7 06:03:14 2008
@@ -37,7 +37,9 @@
 import org.codehaus.plexus.util.IOUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 
+import javax.annotation.Resource;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
@@ -53,12 +55,16 @@
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
+    @Autowired
     private ApplicationManager applicationManager;
 
+    @Autowired
     private ShellInfo shellInfo;
 
+    @Autowired
     private CommandLineExecutor executor;
 
+    @Autowired
     private History history;
 
     private Variables variables;
@@ -72,19 +78,7 @@
     private ErrorHandler errorHandler;
 
     public ShellImpl() {}
-
-    public ShellImpl(final ApplicationManager applicationManager, final ShellInfo shellInfo,
final CommandLineExecutor executor, final History history) {
-        assert applicationManager != null;
-        assert shellInfo != null;
-        assert executor != null;
-        assert history != null;
-
-        this.applicationManager = applicationManager;
-        this.shellInfo = shellInfo;
-        this.executor = executor;
-        this.history = history;
-    }
-
+    
     public Variables getVariables() {
         return variables;
     }

Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellInfoImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellInfoImpl.java?rev=692840&r1=692839&r2=692840&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellInfoImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellInfoImpl.java
Sun Sep  7 06:03:14 2008
@@ -20,11 +20,10 @@
 package org.apache.geronimo.gshell.wisdom.shell;
 
 import org.apache.geronimo.gshell.shell.ShellInfo;
-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;
 
+import javax.annotation.PostConstruct;
 import java.io.File;
 import java.io.IOException;
 import java.net.InetAddress;
@@ -36,7 +35,7 @@
  * @version $Rev$ $Date$
  */
 public class ShellInfoImpl
-    implements ShellInfo, Initializable
+    implements ShellInfo
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
@@ -66,7 +65,8 @@
         return System.getProperty("user.name");
     }
 
-    public void initialize() throws InitializationException {
+    @PostConstruct
+    public void init() {
         homeDir = detectHomeDir();
 
         log.debug("Using home directory: {}", homeDir);
@@ -75,11 +75,11 @@
             localHost = InetAddress.getLocalHost();
         }
         catch (UnknownHostException e) {
-            throw new InitializationException("Unable to determine locahost", e);
+            throw new RuntimeException("Unable to determine locahost", e);
         }
     }
 
-    private File detectHomeDir() throws InitializationException {
+    private File detectHomeDir() {
         String homePath = System.getProperty("user.home");
 
         // And now lets resolve this sucker
@@ -89,12 +89,12 @@
             dir = new File(homePath).getCanonicalFile();
         }
         catch (IOException e) {
-            throw new InitializationException("Failed to resolve home directory: " + homePath,
e);
+            throw new RuntimeException("Failed to resolve home directory: " + homePath, e);
         }
 
         // And some basic sanity too
         if (!dir.exists() || !dir.isDirectory()) {
-            throw new InitializationException("Home directory configured but is not a valid
directory: " + dir);
+            throw new RuntimeException("Home directory configured but is not a valid directory:
" + dir);
         }
 
         return dir;

Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/components.xml?rev=692840&r1=692839&r2=692840&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/components.xml
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/components.xml
Sun Sep  7 06:03:14 2008
@@ -23,23 +23,26 @@
 <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/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/>
+    
+    <!--
+    default-init-method="init", or use annos @PostConstruct @PreDestroy
+    -->
 
     <!-- Application -->
 
     <bean id="applicationManager" class="org.apache.geronimo.gshell.wisdom.application.ApplicationManagerImpl">
-        <!--suppress SpringModelInspection -->
-        <constructor-arg ref="artifactManager"/>
-        <constructor-arg ref="settingsManager"/>
     </bean>
 
     <bean id="settingsManager" class="org.apache.geronimo.gshell.wisdom.application.SettingsManagerImpl">
-        <!--suppress SpringModelInspection -->
-        <constructor-arg ref="artifactManager"/>
     </bean>
-
+    
     <!-- Command -->
 
     <bean id="commandContainerFactory" class="org.apache.geronimo.gshell.wisdom.command.CommandContainerFactoryImpl">

Added: geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/plexus.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/plexus.xml?rev=692840&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/plexus.xml (added)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/plexus.xml Sun
Sep  7 06:03:14 2008
@@ -0,0 +1,37 @@
+<?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="artifactManager" class="org.apache.geronimo.gshell.artifact.DefaultArtifactManager">
+    </bean>
+
+</beans>
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/plexus.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/plexus.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/plexus.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/gshell/trunk/gshell-wisdom/src/test/java/org/apache/geronimo/gshell/wisdom/MySpringComponent.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/test/java/org/apache/geronimo/gshell/wisdom/MySpringComponent.java?rev=692840&r1=692839&r2=692840&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/test/java/org/apache/geronimo/gshell/wisdom/MySpringComponent.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/test/java/org/apache/geronimo/gshell/wisdom/MySpringComponent.java
Sun Sep  7 06:03:14 2008
@@ -19,6 +19,8 @@
 
 package org.apache.geronimo.gshell.wisdom;
 
+import org.springframework.beans.factory.annotation.Autowired;
+
 /**
  * ???
  *
@@ -26,6 +28,7 @@
  */
 public class MySpringComponent
 {
+    @Autowired
     private MyPlexusComponent plexusComponent;
 
     public void setPlexusComponent(final MyPlexusComponent plexusComponent) {

Modified: geronimo/gshell/trunk/gshell-wisdom/src/test/resources/org/apache/geronimo/gshell/wisdom/ArtifactManagerTest-context.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/test/resources/org/apache/geronimo/gshell/wisdom/ArtifactManagerTest-context.xml?rev=692840&r1=692839&r2=692840&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/test/resources/org/apache/geronimo/gshell/wisdom/ArtifactManagerTest-context.xml
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/test/resources/org/apache/geronimo/gshell/wisdom/ArtifactManagerTest-context.xml
Sun Sep  7 06:03:14 2008
@@ -19,17 +19,18 @@
 -->
 
 <!-- $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/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="settingsManager" class="org.apache.geronimo.gshell.wisdom.application.SettingsManagerImpl">
-        <!--suppress SpringModelInspection -->
-        <constructor-arg ref="artifactManager"/>
-    </bean>
+    <bean id="settingsManager" class="org.apache.geronimo.gshell.wisdom.application.SettingsManagerImpl"/>
 
 </beans>
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-wisdom/src/test/resources/org/apache/geronimo/gshell/wisdom/BasicSpringTest-context.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/test/resources/org/apache/geronimo/gshell/wisdom/BasicSpringTest-context.xml?rev=692840&r1=692839&r2=692840&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/test/resources/org/apache/geronimo/gshell/wisdom/BasicSpringTest-context.xml
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/test/resources/org/apache/geronimo/gshell/wisdom/BasicSpringTest-context.xml
Sun Sep  7 06:03:14 2008
@@ -19,12 +19,16 @@
 -->
 
 <!-- $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/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/>
     
 </beans>
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-wisdom/src/test/resources/org/apache/geronimo/gshell/wisdom/PlexusSpringTest-context.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/test/resources/org/apache/geronimo/gshell/wisdom/PlexusSpringTest-context.xml?rev=692840&r1=692839&r2=692840&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/test/resources/org/apache/geronimo/gshell/wisdom/PlexusSpringTest-context.xml
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/test/resources/org/apache/geronimo/gshell/wisdom/PlexusSpringTest-context.xml
Sun Sep  7 06:03:14 2008
@@ -19,16 +19,18 @@
 -->
 
 <!-- $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/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="springComponent" class="org.apache.geronimo.gshell.wisdom.MySpringComponent">
-        <property name="plexusComponent" ref="myPlexusComponent"/>
-    </bean>
+    <bean id="springComponent" class="org.apache.geronimo.gshell.wisdom.MySpringComponent"/>
 
 </beans>
\ No newline at end of file



Mime
View raw message