You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by ch...@apache.org on 2011/02/22 04:14:38 UTC

svn commit: r1073209 - /karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/jline/Console.java

Author: chirino
Date: Tue Feb 22 03:14:37 2011
New Revision: 1073209

URL: http://svn.apache.org/viewvc?rev=1073209&view=rev
Log:
Fixes KARAF-478 : Subclasses of Console should be able to change the history file.

Modified:
    karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/jline/Console.java

Modified: karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/jline/Console.java
URL: http://svn.apache.org/viewvc/karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/jline/Console.java?rev=1073209&r1=1073208&r2=1073209&view=diff
==============================================================================
--- karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/jline/Console.java (original)
+++ karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/jline/Console.java Tue Feb 22 03:14:37 2011
@@ -101,8 +101,7 @@ public class Console implements Runnable
                                    getClass().getResourceAsStream("keybinding.properties"),
                                    this.terminal);
 
-        File file = new File(System.getProperty("karaf.history",
-                             new File(System.getProperty("user.home"), ".karaf/karaf.history").toString()));
+        final File file = getHistoryFile();
         file.getParentFile().mkdirs();
         reader.setHistory(new FileHistory(file));
         session.put(".jline.history", reader.getHistory());
@@ -118,6 +117,14 @@ public class Console implements Runnable
         pipe.setDaemon(true);
     }
 
+    /**
+     * Subclasses can override to use a different history file.
+     * @return
+     */
+    protected File getHistoryFile() {
+        return new File(System.getProperty("karaf.history", new File(System.getProperty("user.home"), ".karaf/karaf.history").toString()));
+    }
+
     public CommandSession getSession() {
         return session;
     }