geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r694400 - in /geronimo/gshell/trunk/gshell-wisdom: gshell-wisdom-bootstrap/ gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/builder/ gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/ gshell-...
Date Thu, 11 Sep 2008 18:31:40 GMT
Author: jdillon
Date: Thu Sep 11 11:31:38 2008
New Revision: 694400

URL: http://svn.apache.org/viewvc?rev=694400&view=rev
Log:
Reduce some code dup with CommandContainerComponentSupport
Add timeing logs for building a Shell via ShellBuilderImpl

Added:
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerComponentSupport.java
  (contents, props changed)
      - copied, changed from r694366, geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandCompleterImpl.java
Modified:
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/pom.xml
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/builder/ShellBuilderImpl.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandCompleterImpl.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandDocumenterImpl.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/LayoutManagerImpl.java

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/pom.xml?rev=694400&r1=694399&r2=694400&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/pom.xml Thu Sep 11 11:31:38
2008
@@ -54,6 +54,11 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.geronimo.gshell.support</groupId>
+            <artifactId>gshell-chronos</artifactId>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.geronimo.gshell</groupId>
             <artifactId>gshell-api</artifactId>
         </dependency>

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/builder/ShellBuilderImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/builder/ShellBuilderImpl.java?rev=694400&r1=694399&r2=694400&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/builder/ShellBuilderImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/builder/ShellBuilderImpl.java
Thu Sep 11 11:31:38 2008
@@ -33,6 +33,7 @@
 import org.apache.geronimo.gshell.shell.Shell;
 import org.apache.geronimo.gshell.spring.BeanContainer;
 import org.apache.geronimo.gshell.spring.BeanContainerImpl;
+import org.apache.geronimo.gshell.chronos.StopWatch;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -60,8 +61,6 @@
 
     private ArtifactManager artifactManager;
 
-    public ShellBuilderImpl() {}
-
     private BeanContainer createContainer() {
         return new BeanContainerImpl(getClassLoader());
     }
@@ -168,6 +167,9 @@
     public Shell create() throws Exception {
         log.debug("Building");
 
+        StopWatch watch = new StopWatch();
+        watch.start();
+        
         // Set some defaults
         if (applicationConfig.getIo() == null) {
             applicationConfig.setIo(new IO());
@@ -202,6 +204,10 @@
         // Configure application
         getApplicationManager().configure(applicationConfig);
 
-        return getApplicationManager().create();
+        Shell shell = getApplicationManager().create();
+
+        log.debug("Created shell in {}", watch);
+
+        return shell;
     }
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandCompleterImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandCompleterImpl.java?rev=694400&r1=694399&r2=694400&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandCompleterImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandCompleterImpl.java
Thu Sep 11 11:31:38 2008
@@ -33,18 +33,9 @@
  * @version $Rev$ $Date$
  */
 public class CommandCompleterImpl
-    implements CommandCompleter, CommandContainerAware
+    extends CommandContainerComponentSupport
+    implements CommandCompleter
 {
-    private final Logger log = LoggerFactory.getLogger(getClass());
-
-    private CommandContainer container;
-
-    public void setCommandContainer(final CommandContainer container) {
-        assert container != null;
-
-        this.container = container;
-    }
-
     public Completor createCompletor(final CommandInfo info) {
         assert info != null;
 

Copied: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerComponentSupport.java
(from r694366, geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandCompleterImpl.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerComponentSupport.java?p2=geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerComponentSupport.java&p1=geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandCompleterImpl.java&r1=694366&r2=694400&rev=694400&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandCompleterImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerComponentSupport.java
Thu Sep 11 11:31:38 2008
@@ -19,37 +19,26 @@
 
 package org.apache.geronimo.gshell.wisdom.command;
 
-import jline.Completor;
-import org.apache.geronimo.gshell.command.CommandCompleter;
-import org.apache.geronimo.gshell.command.CommandInfo;
-import org.apache.geronimo.gshell.command.CommandContainerAware;
 import org.apache.geronimo.gshell.command.CommandContainer;
+import org.apache.geronimo.gshell.command.CommandContainerAware;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * The default {@link CommandCompleter} component.
+ * Support for componets of a {@link CommandContainer}.
  *
  * @version $Rev$ $Date$
  */
-public class CommandCompleterImpl
-    implements CommandCompleter, CommandContainerAware
+public class CommandContainerComponentSupport
+    implements CommandContainerAware
 {
-    private final Logger log = LoggerFactory.getLogger(getClass());
+    protected final Logger log = LoggerFactory.getLogger(getClass());
 
-    private CommandContainer container;
+    protected CommandContainer container;
 
     public void setCommandContainer(final CommandContainer container) {
         assert container != null;
 
         this.container = container;
     }
-
-    public Completor createCompletor(final CommandInfo info) {
-        assert info != null;
-
-        // TODO:
-
-        throw new Error("Not implemented");
-    }
 }
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerComponentSupport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerComponentSupport.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerComponentSupport.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerComponentSupport.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandDocumenterImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandDocumenterImpl.java?rev=694400&r1=694399&r2=694400&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandDocumenterImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandDocumenterImpl.java
Thu Sep 11 11:31:38 2008
@@ -37,18 +37,9 @@
  * @version $Rev$ $Date$
  */
 public class CommandDocumenterImpl
-    implements CommandDocumenter, CommandContainerAware
+    extends CommandContainerComponentSupport
+    implements CommandDocumenter
 {
-    private final Logger log = LoggerFactory.getLogger(getClass());
-
-    private CommandContainer container;
-
-    public void setCommandContainer(final CommandContainer container) {
-        assert container != null;
-
-        this.container = container;
-    }
-
     /**
      * Get the action instance for the given command context.
      *

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/LayoutManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/LayoutManagerImpl.java?rev=694400&r1=694399&r2=694400&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/LayoutManagerImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/LayoutManagerImpl.java
Thu Sep 11 11:31:38 2008
@@ -25,9 +25,12 @@
 import org.apache.geronimo.gshell.model.layout.GroupNode;
 import org.apache.geronimo.gshell.model.layout.Layout;
 import org.apache.geronimo.gshell.model.layout.Node;
+import org.apache.geronimo.gshell.wisdom.application.event.ApplicationConfiguredEvent;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.ApplicationListener;
 
 /**
  * The default implementation of the {@link LayoutManager} component.
@@ -35,7 +38,7 @@
  * @version $Rev$ $Date$
  */
 public class LayoutManagerImpl
-    implements LayoutManager
+    implements LayoutManager, ApplicationListener
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
@@ -46,23 +49,21 @@
 
     public LayoutManagerImpl() {}
 
-    private Layout lookupLayout() {
-        assert applicationManager != null;
+    public void onApplicationEvent(final ApplicationEvent event) {
+        assert event != null;
 
-        Layout layout = applicationManager.getApplication().getModel().getLayout();
+        if (event instanceof ApplicationConfiguredEvent) {
+            ApplicationConfiguredEvent targetEvent = (ApplicationConfiguredEvent)event;
 
-        if (layout == null) {
-            throw new IllegalStateException("Layout has not been configured for application");
-        }
+            layout = targetEvent.getApplication().getModel().getLayout();
 
-        return layout;
+            log.debug("Using layout: {}", layout);
+        }
     }
 
     public Layout getLayout() {
         if (layout == null) {
-            layout = lookupLayout();
-
-            log.debug("Using layout: {}", layout);
+            throw new IllegalStateException("Layout not configured");
         }
 
         return layout;



Mime
View raw message