Add configuration property to control whether we check for available
input or not. (FELIX-619)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@811863 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java b/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java
index 993482a..caa3e04 100644
--- a/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java
+++ b/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java
@@ -25,16 +25,23 @@
 
 public class Activator implements BundleActivator
 {
+    private static final String CHECK_INPUT_PROP = "shell.tui.checkinput";
+
     private BundleContext m_context = null;
     private volatile ShellTuiRunnable m_runnable = null;
     private volatile Thread m_thread = null;
     private ServiceReference m_shellRef = null;
     private ShellService m_shell = null;
+    private volatile boolean m_checkInput = false;
 
     public void start(BundleContext context)
     {
         m_context = context;
 
+        // Check for configuration property.
+        String s = context.getProperty(CHECK_INPUT_PROP);
+        m_checkInput = (s == null) ? false : Boolean.valueOf(s).booleanValue();
+
         // Listen for registering/unregistering impl service.
         ServiceListener sl = new ServiceListener() {
             public void serviceChanged(ServiceEvent event)
@@ -131,20 +138,23 @@
                         needPrompt = false;
                     }
 
-                    available = System.in.available();
-
-                    if (available == 0)
+                    if (m_checkInput)
                     {
-                        try
+                        available = System.in.available();
+
+                        if (available == 0)
                         {
-                            Thread.sleep(200);
+                            try
+                            {
+                                Thread.sleep(200);
+                            }
+                            catch (InterruptedException ex)
+                            {
+                                // No one should be interrupting this thread, so
+                                // ignore it.
+                            }
+                            continue;
                         }
-                        catch (InterruptedException ex)
-                        {
-                            // No one should be interrupting this thread, so
-                            // ignore it.
-                        }
-                        continue;
                     }
 
                     line = in.readLine();