com.buglabs.osgi.shell.pub
Class AbstractCommand

java.lang.Object
  extended by com.buglabs.osgi.shell.pub.AbstractCommand
All Implemented Interfaces:
ICommand
Direct Known Subclasses:
Bundles, GC, ListTestsCommand, OSGiProp, Package, RunTestCaseCommand, SS

public abstract class AbstractCommand
extends java.lang.Object
implements ICommand

A helper base class for commands for the command line. Refer to ICommand for details of how to write commands for OSGi shell.


Field Summary
protected  java.util.List arguments
           
protected  BundleContext context
           
protected  java.io.OutputStream err
           
protected  java.io.OutputStream out
           
protected  java.io.BufferedWriter outWriter
           
 
Constructor Summary
AbstractCommand()
           
 
Method Summary
 java.lang.String getDescription()
           
 java.lang.String getUsage()
           
 void initialize(java.util.List arguments, java.io.OutputStream out, java.io.OutputStream err, BundleContext context)
          Command initialization.
 boolean isValid()
           
protected  void printError(java.lang.String message)
          Print message to error stream.
protected  void println(java.lang.String message)
          Print line to standard out.
protected  void setDefaultFilter(TableViewer tv, int position)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.buglabs.osgi.shell.ICommand
execute, getName
 

Field Detail

arguments

protected java.util.List arguments

outWriter

protected java.io.BufferedWriter outWriter

err

protected java.io.OutputStream err

context

protected BundleContext context

out

protected java.io.OutputStream out
Constructor Detail

AbstractCommand

public AbstractCommand()
Method Detail

initialize

public void initialize(java.util.List arguments,
                       java.io.OutputStream out,
                       java.io.OutputStream err,
                       BundleContext context)
Description copied from interface: ICommand
Command initialization.

Specified by:
initialize in interface ICommand

printError

protected void printError(java.lang.String message)
                   throws java.io.IOException
Print message to error stream.

Parameters:
message -
Throws:
java.io.IOException

println

protected void println(java.lang.String message)
                throws java.io.IOException
Print line to standard out.

Parameters:
message -
Throws:
java.io.IOException

isValid

public boolean isValid()
Specified by:
isValid in interface ICommand
Returns:
true if the command and parameters are valid.

getUsage

public java.lang.String getUsage()
Specified by:
getUsage in interface ICommand
Returns:
A short textual description of command usage.

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface ICommand
Returns:
A description of what the command does.

setDefaultFilter

protected void setDefaultFilter(TableViewer tv,
                                int position)