org.tranche.clc
Class TrancheServerCommandLineClientItem

java.lang.Object
  extended by org.tranche.clc.TrancheServerCommandLineClientItem
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
AddAdministratorItem, ConfigurationItem, HelpItem, KillItem, ServerItem, UserZipFileItem

public abstract class TrancheServerCommandLineClientItem
extends java.lang.Object
implements java.lang.Comparable

Class that implements a Client Item for the Trancher server CLC.

Author:
Jayson Falkner - jfalkner@umich.edu

Constructor Summary
TrancheServerCommandLineClientItem(TrancheServer dfs, TrancheServerCommandLineClient dfsclc, java.lang.String name, java.lang.String description)
          Creates a new instance of the command line client item.
 
Method Summary
 void addAttribute(java.lang.String name, java.lang.String description)
          Add attribute and description to CLC.
 void addAttribute(java.lang.String name, java.lang.String description, boolean required)
          Add attribute, description, and marking whether it is a required attribute for the CLC.
 int compareTo(java.lang.Object o)
          Compare to TrancheServerCommandLineItems for equality.
abstract  void doAction(java.io.BufferedReader in, java.io.PrintStream out)
          Abstract class for doAction.
 TrancheServerCommandLineClientItemAttribute[] getAttributes()
          Retrieve all attributes of the CLC.
 java.lang.String getDescription()
          Retrieve description of CLC.
 java.lang.String getName()
          Retrieve name of CLC.
 java.lang.String getParameter(java.lang.String name)
          Retrieve parameter, asa string, given the parameter's name.
 TrancheServer getTrancheServer()
          Retrieve DistributedFileSystem that is being handled by this CLC.
 TrancheServerCommandLineClient getTrancheServerCommandLineClient()
          Retrieve the TracheServerCommandLineClient that is being handled by this CLC.
 void preDoAction(java.lang.String commandLine, java.io.BufferedReader in, java.io.PrintStream out)
          Populate CLC with opetions from input buffer.
static java.lang.String[] splitCommandLine(java.lang.String commandLine)
          Split the string of command line parameters into a array of of strings for each option.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrancheServerCommandLineClientItem

public TrancheServerCommandLineClientItem(TrancheServer dfs,
                                          TrancheServerCommandLineClient dfsclc,
                                          java.lang.String name,
                                          java.lang.String description)
Creates a new instance of the command line client item.

Parameters:
dfs - The DistributedFileSystem implementation that will be manipulated by this code.
dfsclc - the command line client received
name - the command line client item name received
description - the command line client item description received
Method Detail

getTrancheServer

public TrancheServer getTrancheServer()
Retrieve DistributedFileSystem that is being handled by this CLC.

Returns:
The distributed file system manipulated by this code.

getTrancheServerCommandLineClient

public TrancheServerCommandLineClient getTrancheServerCommandLineClient()
Retrieve the TracheServerCommandLineClient that is being handled by this CLC.

Returns:
the distributed file system command line client

getName

public java.lang.String getName()
Retrieve name of CLC.

Returns:
the name of the command line client

getDescription

public java.lang.String getDescription()
Retrieve description of CLC.

Returns:
the description of the command line client

preDoAction

public void preDoAction(java.lang.String commandLine,
                        java.io.BufferedReader in,
                        java.io.PrintStream out)
Populate CLC with opetions from input buffer.

Parameters:
commandLine - the command line of parameters
in - the input buffered reader
out - the output print stream

getParameter

public java.lang.String getParameter(java.lang.String name)
Retrieve parameter, asa string, given the parameter's name.

Parameters:
name - the attribute's name
Returns:
the value of the named attribute

doAction

public abstract void doAction(java.io.BufferedReader in,
                              java.io.PrintStream out)
Abstract class for doAction.

Parameters:
in - the input buffered reader
out - the output print stream

addAttribute

public void addAttribute(java.lang.String name,
                         java.lang.String description)
Add attribute and description to CLC.

Parameters:
name - the name of the attribute to be added
description - the description of the atribute to be added since 1.0

addAttribute

public void addAttribute(java.lang.String name,
                         java.lang.String description,
                         boolean required)
Add attribute, description, and marking whether it is a required attribute for the CLC.

Parameters:
name - the name of the attribute to be added
description - the description of the attribute to be added
required - the required flag

getAttributes

public TrancheServerCommandLineClientItemAttribute[] getAttributes()
Retrieve all attributes of the CLC.

Returns:
the command line client's attributes

splitCommandLine

public static final java.lang.String[] splitCommandLine(java.lang.String commandLine)
Split the string of command line parameters into a array of of strings for each option.

Parameters:
commandLine - the command line of parameters
Returns:
the good parameters

compareTo

public int compareTo(java.lang.Object o)
Compare to TrancheServerCommandLineItems for equality.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - the object whose name is to be compared
Returns:
the value 0 if the object's name is equal to this object's name; a value less than 0 if the object's name is lexicographically less than this object's name; a value greater than 0 if the object's name is lexicographically greater than this object's name.


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