org.qtunes.console
Class ConsoleController

java.lang.Object
  extended by org.qtunes.console.ConsoleController
All Implemented Interfaces:
java.lang.Runnable, Service

public class ConsoleController
extends java.lang.Object
implements Service, java.lang.Runnable

A Simple controller that uses the System.in and System.out to read commands. It accepts "help" to list available commands, and the commands are formatted as you would call a method in JavaScript, eg qtunes.quit(), AppleServer.addRemote("*", "8192") or even db.getFields([1,2,3,4],["Artist","Title","Album"])


Constructor Summary
ConsoleController()
           
 
Method Summary
 ServiceContext getContext()
          Return the ServiceContext that was passed into Service.startService(org.qtunes.core.ServiceContext)
protected  java.io.BufferedReader getReader()
           
protected  java.io.PrintWriter getWriter()
           
 java.util.Map<java.lang.String,java.lang.Object> reportState()
          Return a Map describing the state of this Service, for serialization back to any client that needs to know (eg webplayer) - so values should be serializable objects, eg Lists, Maps or simple objects.
 void run()
           
 void startService(ServiceContext context)
          Start the Service
 void stopService(ServiceContext context)
          Stop the Service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsoleController

public ConsoleController()
Method Detail

getReader

protected java.io.BufferedReader getReader()

getWriter

protected java.io.PrintWriter getWriter()

startService

public void startService(ServiceContext context)
Description copied from interface: Service
Start the Service

Specified by:
startService in interface Service
Parameters:
context - the ServiceContext for this Service

stopService

public void stopService(ServiceContext context)
Description copied from interface: Service
Stop the Service

Specified by:
stopService in interface Service
Parameters:
context - the ServiceContext for this Service (same as was passed into start)

getContext

public ServiceContext getContext()
Description copied from interface: Service
Return the ServiceContext that was passed into Service.startService(org.qtunes.core.ServiceContext)

Specified by:
getContext in interface Service

run

public void run()
Specified by:
run in interface java.lang.Runnable

reportState

public java.util.Map<java.lang.String,java.lang.Object> reportState()
Description copied from interface: Service
Return a Map describing the state of this Service, for serialization back to any client that needs to know (eg webplayer) - so values should be serializable objects, eg Lists, Maps or simple objects. If no useful state, return null.

Specified by:
reportState in interface Service