public abstract class AbstractCommand extends Object implements ICasaCommand
| Modifier and Type | Field and Description |
|---|---|
protected static Signature |
EMPTY_SIGNATURE |
DEFAULT_NAMESPACE, PROP_DESCRIPTION, PROP_NAME| Constructor and Description |
|---|
AbstractCommand() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addSignature(Signature signature) |
Object |
execute(InputStream in,
PrintStream out,
org.json.JSONObject param)
Execute a block of code and then returns the result from execution.
|
abstract Object |
execute(InputStream in,
PrintStream out,
org.json.JSONObject param,
Signature signature) |
String |
getDescription()
Get the command description.
|
Signature |
getSignature(int param)
Get signature by passing the number of arguments..
|
boolean |
validate(org.json.JSONObject param,
Signature signature)
To validate the given parameters.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetNameprotected static Signature EMPTY_SIGNATURE
public Object execute(InputStream in, PrintStream out, org.json.JSONObject param) throws Exception
ICasaCommandin and
out stream to print result instead of the direct use of System.in and System.outexecute in interface ICasaCommandin - : the input stream.out - : the output stream.param - a json object of parametersException - if anything goes wrongprotected void addSignature(Signature signature)
public Signature getSignature(int param)
ICasaCommandgetSignature in interface ICasaCommandpublic String getDescription()
getDescription in interface ICasaCommandpublic boolean validate(org.json.JSONObject param,
Signature signature)
throws Exception
ICasaCommandvalidate in interface ICasaCommandparam - The parameters in JSON formatExceptionpublic abstract Object execute(InputStream in, PrintStream out, org.json.JSONObject param, Signature signature) throws Exception
ExceptionCopyright © 2012-2013 ADELE Research Group. All Rights Reserved.