org.tranche.clc
Class TrancheServerCommandLineClient

java.lang.Object
  extended by java.lang.Thread
      extended by org.tranche.commons.DebuggableThread
          extended by org.tranche.clc.TrancheServerCommandLineClient
All Implemented Interfaces:
java.lang.Runnable

public class TrancheServerCommandLineClient
extends org.tranche.commons.DebuggableThread

This is a simple command line client that can be used with any TrancheServer implementation. The abstraction lets you control either a remote or local implementation through the same interface.

The DistributedFileSystemCommandLineClient class is headless. You can run it from any command prompt. It is primarily tested on Windows and Linux.

This class handles launching the appropriate client (e.g. remote connection, local file system, etc.).

Author:
Jayson Falkner - jfalkner@umich.edu, James "Augie" Hill - augman85@gmail.com

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  java.util.Map<java.lang.String,TrancheServerCommandLineClientItem> items
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TrancheServerCommandLineClient(TrancheServer dfs, java.io.InputStream in, java.io.PrintStream out)
           The basic constructor for the command line client.
 
Method Summary
 void addItem(TrancheServerCommandLineClientItem dfsclci)
          Adds a new command line command to this client.
 TrancheServerCommandLineClientItem getItem(java.lang.String item)
           
 int getMaxLineLength()
          Retrieve maximum characters per line.
 boolean isRun()
          Return true if this object is running; false otherwise.
 void run()
           This is a command line client that is designed to manipulate any implementation of TrancheServer.
 void setMaxLineLength(int length)
          Set the maximum characters allowed per line.
 void setRun(boolean run)
          Set if this object is runnablble.
 Server startServer(int port, boolean secure)
           
 
Methods inherited from class org.tranche.commons.DebuggableThread
debugErr, debugErr, debugOut, isDebug, setDebug
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

items

protected java.util.Map<java.lang.String,TrancheServerCommandLineClientItem> items
Constructor Detail

TrancheServerCommandLineClient

public TrancheServerCommandLineClient(TrancheServer dfs,
                                      java.io.InputStream in,
                                      java.io.PrintStream out)

The basic constructor for the command line client. It assumes that there is an implementation of TrancheServer to control, an input stream for commands, and an outputstream for results.

Parameters:
dfs - The DistributedFileSystem implementation that will be manipulated by this code.
in - the input source for text commands
out - The output where text is sent.
Method Detail

getMaxLineLength

public int getMaxLineLength()
Retrieve maximum characters per line.

Returns:
The maximum characters per line in the print stream.

setMaxLineLength

public void setMaxLineLength(int length)
Set the maximum characters allowed per line. param length The maximum line length for the print stream.


getItem

public TrancheServerCommandLineClientItem getItem(java.lang.String item)
Parameters:
item -
Returns:

addItem

public void addItem(TrancheServerCommandLineClientItem dfsclci)
Adds a new command line command to this client.

Parameters:
dfsclci - the command line item to add

startServer

public Server startServer(int port,
                          boolean secure)
Parameters:
port -
secure -

run

public void run()

This is a command line client that is designed to manipulate any implementation of TrancheServer.

This class is also extensible, allowing custom keywords and actions to be plugged in by sub-classes.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

setRun

public void setRun(boolean run)
Set if this object is runnablble.

Parameters:
run - the flag for running

isRun

public boolean isRun()
Return true if this object is running; false otherwise.

Returns:
true if the flag for running is enabled; false otherwise


This code is free for use both commercially and non-commercially as stated in the project's license