felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r945099 - in /felix/trunk/karaf/shell/console/src/main: java/org/apache/felix/karaf/shell/console/jline/ConsoleFactory.java java/org/apache/felix/karaf/shell/console/jline/TerminalFactory.java resources/OSGI-INF/blueprint/karaf-console.xml
Date Mon, 17 May 2010 11:46:18 GMT
Author: gnodet
Date: Mon May 17 11:46:18 2010
New Revision: 945099

URL: http://svn.apache.org/viewvc?rev=945099&view=rev
Log:
FELIX-2327: Disable and delay Jline terminal initialization

Modified:
    felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/ConsoleFactory.java
    felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/TerminalFactory.java
    felix/trunk/karaf/shell/console/src/main/resources/OSGI-INF/blueprint/karaf-console.xml

Modified: felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/ConsoleFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/ConsoleFactory.java?rev=945099&r1=945098&r2=945099&view=diff
==============================================================================
--- felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/ConsoleFactory.java
(original)
+++ felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/ConsoleFactory.java
Mon May 17 11:46:18 2010
@@ -38,7 +38,7 @@ public class ConsoleFactory {
     private BundleContext bundleContext;
     private CommandProcessor commandProcessor;
     private List<Completer> completers;
-    private Terminal terminal;
+    private TerminalFactory terminalFactory;
     private Console console;
     private boolean start;
 
@@ -60,8 +60,8 @@ public class ConsoleFactory {
         this.completers = completers;
     }
 
-    public void setTerminal(Terminal terminal) {
-        this.terminal = terminal;
+    public void setTerminalFactory(TerminalFactory terminalFactory) {
+        this.terminalFactory = terminalFactory;
     }
 
     public void setStart(boolean start) {
@@ -82,6 +82,7 @@ public class ConsoleFactory {
                     }
                 }
             };
+            Terminal terminal = terminalFactory.getTerminal();
             this.console = new Console(commandProcessor,
                                        in,
                                        wrap(out),

Modified: felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/TerminalFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/TerminalFactory.java?rev=945099&r1=945098&r2=945099&view=diff
==============================================================================
--- felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/TerminalFactory.java
(original)
+++ felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/TerminalFactory.java
Mon May 17 11:46:18 2010
@@ -27,14 +27,19 @@ public class TerminalFactory {
 
     private Terminal term;
 
-    public Terminal getTerminal() throws Exception {
+    public synchronized Terminal getTerminal() throws Exception {
         if (term == null) {
             init();
         }
         return term;
     }
 
-    public synchronized void init() throws Exception {
+    public void init() throws Exception {
+        if ("jline.UnsupportedTerminal".equals(System.getProperty("jline.terminal"))) {
+            term = new UnsupportedTerminal();
+            return;
+        }
+        
         boolean windows = System.getProperty("os.name").toLowerCase().contains("windows");
         try {
             if (windows) {
@@ -54,8 +59,10 @@ public class TerminalFactory {
     }
 
     public synchronized void destroy() throws Exception {
-        term.restoreTerminal();
-        term = null;
+        if (term != null) {
+            term.restoreTerminal();
+            term = null;
+        }
     }
 
 }

Modified: felix/trunk/karaf/shell/console/src/main/resources/OSGI-INF/blueprint/karaf-console.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/shell/console/src/main/resources/OSGI-INF/blueprint/karaf-console.xml?rev=945099&r1=945098&r2=945099&view=diff
==============================================================================
--- felix/trunk/karaf/shell/console/src/main/resources/OSGI-INF/blueprint/karaf-console.xml
(original)
+++ felix/trunk/karaf/shell/console/src/main/resources/OSGI-INF/blueprint/karaf-console.xml
Mon May 17 11:46:18 2010
@@ -47,15 +47,10 @@
                 <ref component-id="commandCompleter"/>
             </list>
         </property>
-        <property name="terminal" ref="terminal"/>
+        <property name="terminalFactory" ref="terminalFactory"/>
     </bean>
 
-    <bean id="terminal"
-          factory-ref="terminalFactory"
-          factory-method="getTerminal"/>
-
     <bean id="terminalFactory" class="org.apache.felix.karaf.shell.console.jline.TerminalFactory"
-          init-method="init"
           destroy-method="destroy"/>
 
 



Mime
View raw message