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/10/07 10:58:29 UTC

svn commit: r702395 - /geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java

Author: jdillon
Date: Tue Oct  7 01:58:29 2008
New Revision: 702395

URL: http://svn.apache.org/viewvc?rev=702395&view=rev
Log:
Make history work as a singleton again for now

Modified:
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java?rev=702395&r1=702394&r2=702395&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java Tue Oct  7 01:58:29 2008
@@ -20,7 +20,9 @@
 package org.apache.geronimo.gshell.wisdom.shell;
 
 import jline.History;
-import org.apache.geronimo.gshell.application.Application;
+import org.apache.geronimo.gshell.event.EventAdapter;
+import org.apache.geronimo.gshell.event.EventManager;
+import org.apache.geronimo.gshell.wisdom.application.ApplicationConfiguredEvent;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -40,13 +42,19 @@
     private final Logger log = LoggerFactory.getLogger(getClass());
 
     @Autowired
-    private Application application;
-    
+    private EventManager eventManager;
+
     @PostConstruct
     public void init() {
-        assert application != null;
-        File file = application.getModel().getBranding().getHistoryFile();
-        log.debug("Application configured, setting history file: {}", file);
+        assert eventManager != null;
+        eventManager.addListener(new EventAdapter<ApplicationConfiguredEvent>() {
+            protected void handleEvent(final ApplicationConfiguredEvent event) throws Exception {
+                assert event != null;
+
+                File file = event.getApplication().getModel().getBranding().getHistoryFile();
+                log.debug("History file: {}", file);
+            }
+        });
     }
     
     public void setHistoryFile(final File file) throws IOException {