You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2011/02/22 22:27:25 UTC

svn commit: r1073515 - /incubator/clerezza/trunk/parent/shell/src/main/scala/org/apache/clerezza/shell/ConsoleShell.scala

Author: reto
Date: Tue Feb 22 21:27:25 2011
New Revision: 1073515

URL: http://svn.apache.org/viewvc?rev=1073515&view=rev
Log:
CLEREZZA-434 when starting clerezza with the java argument -Dclerezza.shell.disable=true the console shell will be disabled (but not connecting via ssh)

Modified:
    incubator/clerezza/trunk/parent/shell/src/main/scala/org/apache/clerezza/shell/ConsoleShell.scala

Modified: incubator/clerezza/trunk/parent/shell/src/main/scala/org/apache/clerezza/shell/ConsoleShell.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/shell/src/main/scala/org/apache/clerezza/shell/ConsoleShell.scala?rev=1073515&r1=1073514&r2=1073515&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/shell/src/main/scala/org/apache/clerezza/shell/ConsoleShell.scala (original)
+++ incubator/clerezza/trunk/parent/shell/src/main/scala/org/apache/clerezza/shell/ConsoleShell.scala Tue Feb 22 21:27:25 2011
@@ -45,19 +45,21 @@ class ConsoleShell()  {
 
 	def activate(componentContext: ComponentContext)= {
 		bundleContext = componentContext.getBundleContext
-		for (bundle <- bundleContext.getBundles;
-				if (bundle.getSymbolicName == "org.apache.felix.shell.tui");
-				if (bundle.getState == Bundle.ACTIVE)) {
-			println("stopping "+bundle);
-			bundle.stop()
-			stoppedBundle = Some(bundle)
+		if ("true" != bundleContext.getProperty("clerezza.shell.disable")) {
+			for (bundle <- bundleContext.getBundles;
+					if (bundle.getSymbolicName == "org.apache.felix.shell.tui");
+					if (bundle.getState == Bundle.ACTIVE)) {
+				println("stopping "+bundle);
+				bundle.stop()
+				stoppedBundle = Some(bundle)
+			}
+			val in =  Channels.newInputStream(
+				(new FileInputStream(FileDescriptor.in)).getChannel());
+			interruptibleIn = new InterruptibleInputStream(in)
+			val shell = factory.createShell(interruptibleIn, System.out)
+			shell.start()
+			shellOption = Some(shell)
 		}
-		val in =  Channels.newInputStream(
-            (new FileInputStream(FileDescriptor.in)).getChannel());
-		interruptibleIn = new InterruptibleInputStream(in)
-		val shell = factory.createShell(interruptibleIn, System.out)
-		shell.start()
-		shellOption = Some(shell)
 	}
 
 
@@ -71,7 +73,9 @@ class ConsoleShell()  {
 			case Some(shell) => shell.stop()
 			case _ =>
 		}
-		interruptibleIn.terminate()
+		if (interruptibleIn != null) {
+			interruptibleIn.terminate()
+		}
 	}
 
 	def bindShellFactory(f: ShellFactory) = {