public class CoreApplication
extends java.lang.Object
algorithmStart(java.io.PrintStream, java.lang.String...)
.
To start the client issue the following command:
java -classpath MESSIF.jar:<algorithm's jar file or directory> messif.utility.CoreApplication [parameters]The parameters can be any combination of
<cmdport>
a TCP port with telnet interface-register <host>:<port>
send UDP "alive" announcements to the specified <host>:<port><controlFile> [action] [var=value ...]]
executes action
in the specified controlFile
(optionally with setting variables)CoreApplication
's methods.
Automatic (context) help is generated whenever user provides incorrect data. For example, entering empty text on the
MESSIF prompt will list all available commands. Type just the command name to get help on its arguments (of course
there are commands without arguments that will get executed that way).
For example, to get information about the last executed operation a method operationInfo(java.io.PrintStream, java.lang.String...)
is offered
by CoreApplication
. To use it from the command line, do something like:
.... telnet <localhost> <cmdport> MESSIF >>> operationInfo Range query .... returned 8 objects MESSIF >>>The control file is another way of issuing application commands. It allows to prepare batches of commands that can be run either immediately after the process is started (see the parameters above) or through the
controlFile(java.io.PrintStream, java.lang.String...)
method.
The control file is a text file with the following syntax. Empty lines or lines beginning
with # are ignored. All other lines are actions with the following syntax:
<actionName> = <methodName | otherActionName1 otherActionName2 ...> <actionName>.param.1 = <first parameter of the method methodName> <actionName>.param.2 = <second parameter of the method methodName> <actionName>.param.3 = <third parameter of the method methodName> <actionName>.param.4 = <fourth parameter of the method methodName> ... <actionName>.repeat = <repeats> <actionName>.foreach = <value> <value> ... <actionName>.repeatUntilException = <some exception class, e.g. java.util.NoSuchElementException> <actionName>.loopVariable = <variable name> <actionName>.repeatEvery = <time specification> <actionName>.ignoreException = <some exception class, e.g. messif.buckets.DuplicateObjectException> <actionName>.outputFile = <filename> <actionName>.outputLog = <target logger name and optionally logging level> <actionName>.assign = <variable name> <actionName>.postponeUntil = hh:mm:ss <actionName>.description = <any text with variable expansion> <actionName>.descriptionAfter = <any text with variable expansion> <actionName>.descriptionOnException = <any text with variable expansion printed when an exception occurs>
CoreApplication
method, which is to be executed if <actionName> is called.
If a space-separated list of other action names is provided, they will be executed one by one
in the order they were specified. Parameters for the method are specified using <actionName>.param.x,
see the documentation of the respective CoreApplication
methods for their parameters.All parameters, method name and output file are subject to variable expansion. Variables can be specified as additional arguments to controlFile command and referred to using "<" and ">" delimiters. For example:
execmyop = operationExecute execmyop.param.1 = messif.operations.<myop> execmyop.param.2 = <myparam1:0> execmyop.param.3 = ...This action will execute the operation whose name is provided in the variable myop. If the variable is not set, it is replaced by an empty string, which in this particular case will result in error. Therefore, it is possible to provide a default value for a variable by appending a colon and the default value to the variable name. This is shown in the second parameter in the example above - if the myparam1 variable is not set, the zero value is used for the execmyop.param.2.
The default action name that is looked up in the control file is actions if another name is not provided on command line or by a parameter.
Modifier and Type | Field and Description |
---|---|
protected static java.util.logging.Logger |
log
Logger
|
Modifier | Constructor and Description |
---|---|
protected |
CoreApplication()
Create new instance of CoreApplication.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
addNamedInstance(java.lang.String name,
java.lang.Object instance,
boolean replace)
Add the given named instance to the internal storage.
|
boolean |
algorithmInfo(java.io.PrintStream out,
java.lang.String... args)
Show some information about the current algorithm.
|
boolean |
algorithmInfoAll(java.io.PrintStream out,
java.lang.String... args)
Show some information about all algorithms.
|
boolean |
algorithmRestore(java.io.PrintStream out,
java.lang.String... args)
Restores a previously serialized algorithm from file.
|
boolean |
algorithmSelect(java.io.PrintStream out,
java.lang.String... args)
Select algorithm to manage.
|
boolean |
algorithmSelectByName(java.io.PrintStream out,
java.lang.String... args)
Select algorithm to manage using the name of a named instance with this algorithm.
|
boolean |
algorithmStart(java.io.PrintStream out,
java.lang.String... args)
Creates a new instance of algorithm.
|
boolean |
algorithmStop(java.io.PrintStream out,
java.lang.String... args)
Stops current algorithm and clear the memory used.
|
boolean |
algorithmStopAll(java.io.PrintStream out,
java.lang.String... args)
Stops all algorithms and clear the memory used.
|
boolean |
algorithmStore(java.io.PrintStream out,
java.lang.String... args)
Serialize current algorithm to file.
|
boolean |
algorithmSupportedOperations(java.io.PrintStream out,
java.lang.String... args)
Show information about supported operations for the current algorithm.
|
boolean |
algorithmToNamedInstance(java.io.PrintStream out,
java.lang.String... args)
Assign one or more running algorithms to a given named instance.
|
boolean |
collectGarbage(java.io.PrintStream out,
java.lang.String... args)
Schedules
full garbage collection . |
boolean |
controlFile(java.io.PrintStream out,
java.lang.String... args)
Executes actions from a control file.
|
protected boolean |
controlFileExecuteAction(java.io.PrintStream out,
java.util.Properties props,
java.lang.String actionName,
java.util.Map<java.lang.String,java.lang.String> variables,
java.util.Map<java.lang.String,java.io.PrintStream> outputStreams,
boolean throwException)
This method reads and executes one action (with name actionName) from the control file (props).
|
protected boolean |
controlFileExecuteMethod(java.io.PrintStream out,
java.util.Properties props,
java.lang.String actionName,
java.util.Map<java.lang.String,java.lang.String> variables,
java.util.List<java.lang.String> arguments)
This method reads and executes one action (with name actionName) from the control file (props).
|
protected void |
createCFActionRepeatEveryThread(java.lang.String repeatEveryModifier,
java.io.PrintStream out,
java.util.Properties props,
java.lang.String actionName,
java.util.Map<java.lang.String,java.lang.String> variables,
java.util.Map<java.lang.String,java.io.PrintStream> outputStreams)
Creates a thread that processes the given action in given time intervals.
|
boolean |
currentTime(java.io.PrintStream out,
java.lang.String... args)
Returns current time in milliseconds or the specified date format.
|
boolean |
decode(java.io.PrintStream out,
java.lang.String... args)
Decodes a value to some other value according to a regular expression.
|
boolean |
echo(java.io.PrintStream out,
java.lang.String... args)
Prints the parameters to the output.
|
protected java.util.List<java.lang.String> |
getCFActionArguments(java.util.Properties props,
java.lang.String actionName,
java.util.Map<java.lang.String,java.lang.String> variables)
Returns a control file action arguments from properties with variable substitution.
|
protected java.lang.Class<? extends java.lang.Throwable> |
getCFActionException(java.io.PrintStream out,
java.util.Properties props,
java.lang.String actionName,
java.lang.String modifierName,
java.util.Map<java.lang.String,java.lang.String> variables)
Returns the repeat-until exception class from properties with variable substitution.
|
protected java.lang.String[] |
getCFActionForeach(java.io.PrintStream out,
java.util.Properties props,
java.lang.String actionName,
java.util.Map<java.lang.String,java.lang.String> variables)
Returns foreach values from properties with variable substitution.
|
protected java.io.PrintStream |
getCFActionOutput(java.io.PrintStream out,
java.util.Properties props,
java.lang.String actionName,
java.util.Map<java.lang.String,java.lang.String> variables,
java.util.Map<java.lang.String,java.io.PrintStream> outputStreams,
java.io.ByteArrayOutputStream assignOutput)
Returns the output stream for the given action.
|
protected int |
getCFActionRepeat(java.io.PrintStream out,
java.util.Properties props,
java.lang.String actionName,
java.util.Map<java.lang.String,java.lang.String> variables,
java.lang.String[] foreachValues,
java.lang.Class<? extends java.lang.Throwable> repeatUntilExceptionClass)
Returns the number of repeats with variable substitution.
|
protected java.nio.channels.ServerSocketChannel |
getCmdSocket()
Returns the socket used for command communication.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getExtendedNamedInstances(java.lang.String key,
java.lang.Object value,
boolean replaceExisting)
Returns a copy of the current named instances with the given value set for the given key.
|
protected java.lang.Object |
getNamedInstance(java.lang.String name)
Returns the stored named instance with the given name.
|
protected java.lang.Throwable |
getRootCauseInvocationTargetException(java.lang.reflect.InvocationTargetException invocationTargetException)
Returns the cause exception unwrapped from the
InvocationTargetException s. |
boolean |
help(java.io.PrintStream out,
java.lang.String... args)
Shows a list of commands with help.
|
protected static void |
logException(java.lang.Throwable e)
Log an exception with a
Level.SEVERE level. |
boolean |
loggingConsoleChangeLevel(java.io.PrintStream out,
java.lang.String... args)
Set the logging level of console.
|
boolean |
loggingFileAdd(java.io.PrintStream out,
java.lang.String... args)
Adds a file for writing logging messages.
|
boolean |
loggingFileChangeLevel(java.io.PrintStream out,
java.lang.String... args)
Changes the logging level of an opened logging file.
|
boolean |
loggingFileRemove(java.io.PrintStream out,
java.lang.String... args)
Removes a logging file.
|
boolean |
loggingLevel(java.io.PrintStream out,
java.lang.String... args)
Get or set the global level of logging.
|
static void |
main(java.lang.String[] args)
Start a MESSIF application.
|
boolean |
memoryUsage(java.io.PrintStream out,
java.lang.String... args)
Displays the memory usage of this virtual machine.
|
boolean |
methodExecute(java.io.PrintStream out,
java.lang.String... args)
Directly execute a method of the running algorithm.
|
boolean |
methodExecuteOnAlgorithm(java.io.PrintStream out,
java.lang.String... args)
Directly execute a method of specified running algorithm.
|
boolean |
namedInstanceAdd(java.io.PrintStream out,
java.lang.String... args)
Creates a new named instance.
|
boolean |
namedInstanceConstructor(java.io.PrintStream out,
java.lang.String... args)
Creates a new named instance or replaces an old one via constructor call.
|
boolean |
namedInstanceEcho(java.io.PrintStream out,
java.lang.String... args)
Prints the value of a named instance.
|
boolean |
namedInstanceList(java.io.PrintStream out,
java.lang.String... args)
Prints the list of all named instances.
|
boolean |
namedInstanceRemove(java.io.PrintStream out,
java.lang.String... args)
Removes a named instances.
|
boolean |
namedInstanceReplace(java.io.PrintStream out,
java.lang.String... args)
Creates a new named instance or replaces an old one.
|
boolean |
namedInstanceRestore(java.io.PrintStream out,
java.lang.String... args)
Creates a new named instance from an object serialized in a file.
|
boolean |
namedInstanceStore(java.io.PrintStream out,
java.lang.String... args)
Serializes the value of a named instance into a file.
|
boolean |
namedInstanceThread(java.io.PrintStream out,
java.lang.String... args)
Creates a named instance for the current running thread.
|
boolean |
objectStreamClose(java.io.PrintStream out,
java.lang.String... args)
Closes a named object stream.
|
boolean |
objectStreamConvert(java.io.PrintStream out,
java.lang.String... args)
Applies an additional conversion on the objects returned by an object stream.
|
boolean |
objectStreamOpen(java.io.PrintStream out,
java.lang.String... args)
Open a named stream which allows to read
objects from a file. |
boolean |
objectStreamReset(java.io.PrintStream out,
java.lang.String... args)
Resets a named object stream.
|
boolean |
objectStreamSetParameter(java.io.PrintStream out,
java.lang.String... args)
Sets a value of additional constructor parameter of an opened object stream.
|
boolean |
objectStreamSkip(java.io.PrintStream out,
java.lang.String... args)
Skip objects in a named object stream.
|
boolean |
operationAnswer(java.io.PrintStream out,
java.lang.String... args)
Show the answer of the last executed query operation.
|
boolean |
operationAnswerRawObjects(java.io.PrintStream out,
java.lang.String... args)
Write the raw objects (using
LocalAbstractObject.write(java.io.OutputStream) ) from the answer of the last executed query operation. |
boolean |
operationArgument(java.io.PrintStream out,
java.lang.String... args)
Show argument of the last executed operation.
|
boolean |
operationBgExecute(java.io.PrintStream out,
java.lang.String... args)
Executes a specified operation on current algorithm in a new thread (i.e., on the background).
|
boolean |
operationErrorCode(java.io.PrintStream out,
java.lang.String... args)
Show the
ErrorCode returned by the last executed operation. |
boolean |
operationExecute(java.io.PrintStream out,
java.lang.String... args)
Executes a specified operation on current algorithm.
|
boolean |
operationExecuteAgain(java.io.PrintStream out,
java.lang.String... args)
Executes the last operation once more.
|
boolean |
operationChangeAnswerCollection(java.io.PrintStream out,
java.lang.String... args)
Changes the answer collection of the prepared or last executed operation.
|
boolean |
operationChangeAnswerNamedInstance(java.io.PrintStream out,
java.lang.String... args)
Changes the answer collection of the prepared or last executed operation.
|
boolean |
operationInfo(java.io.PrintStream out,
java.lang.String... args)
Show information about the last executed operation.
|
boolean |
operationObjectCount(java.io.PrintStream out,
java.lang.String... args)
Show the number of objects returned by the last executed operation.
|
boolean |
operationParam(java.io.PrintStream out,
java.lang.String... args)
Show or set a parameter of the last executed operation.
|
boolean |
operationParamProcessByMethod(java.io.PrintStream out,
java.lang.String... args)
Processes a parameter from the last executed operation by a given method.
|
boolean |
operationPrepare(java.io.PrintStream out,
java.lang.String... args)
Prepares a new instance of the specified operation without executing it.
|
boolean |
operationProcessByMethod(java.io.PrintStream out,
java.lang.String... args)
Processes the last executed operation by a given method.
|
boolean |
operationQueryObjectLocator(java.io.PrintStream out,
java.lang.String... args)
Show the
locatorURI of the query object of the last executed operation. |
boolean |
operationSubAnswer(java.io.PrintStream out,
java.lang.String... args)
Show the sub-answer of the last executed query operation if possible.
|
protected boolean |
parseArguments(java.lang.String[] args,
int argIndex)
Internal method called from
main method
to read parameters and initialize the application. |
protected boolean |
postponeCFAction(java.io.PrintStream out,
java.util.Properties props,
java.lang.String actionName,
java.util.Map<java.lang.String,java.lang.String> variables)
Postpone the current action according to the "postponeUntil" argument.
|
protected void |
processException(java.lang.Throwable exception,
java.io.PrintStream out,
boolean logException)
Process exception from exception.
|
protected void |
processInteractiveSocket(java.nio.channels.SocketChannel connection)
Process an incoming command-prompt connection.
|
boolean |
propertiesOpen(java.io.PrintStream out,
java.lang.String... args)
Creates a new named properties.
|
boolean |
quit(java.io.PrintStream out,
java.lang.String... args)
Exits this application.
|
protected int |
retrieveIntArgument(java.lang.String[] args,
int index,
int defaultValue,
int minValue,
int maxValue)
Returns the given argument converted to integer.
|
protected void |
startApplication(java.lang.String[] args)
Internal method called from
main method
to initialize this application. |
boolean |
statisticsDisable(java.io.PrintStream out,
java.lang.String... args)
Disable (or enable) gathering of statistics.
|
boolean |
statisticsGlobal(java.io.PrintStream out,
java.lang.String... args)
Print all global statistics.
|
boolean |
statisticsGlobalGet(java.io.PrintStream out,
java.lang.String... args)
Gets a value from a global statistic.
|
boolean |
statisticsLastOperation(java.io.PrintStream out,
java.lang.String... args)
Print statistics gathered by the last executed operation.
|
boolean |
statisticsResetGlobal(java.io.PrintStream out,
java.lang.String... args)
Reset all global statistics.
|
boolean |
statisticsSetAutoBinding(java.io.PrintStream out,
java.lang.String... args)
Regular expression on global statistics' names that are bound for each executed operation.
|
void |
stopRepeatEveryThread(java.io.PrintStream out,
java.lang.String... args) |
protected java.lang.String |
substituteVariables(java.lang.String value,
java.util.Map<java.lang.String,java.lang.String> variables)
Returns the value with substituted variables.
|
boolean |
sum(java.io.PrintStream out,
java.lang.String... args)
Computes a sum of the parameters and prints the result to the output.
|
protected java.lang.String |
usage()
Returns the command line arguments description.
|
void |
waitForRepeatEveryThread(java.io.PrintStream out,
java.lang.String... args) |
protected CoreApplication()
main(java.lang.String[])
method.protected static void logException(java.lang.Throwable e)
Level.SEVERE
level.e
- the exception to logprotected java.lang.Throwable getRootCauseInvocationTargetException(java.lang.reflect.InvocationTargetException invocationTargetException)
InvocationTargetException
s.invocationTargetException
- the InvocationTargetException
to unwrapprotected void processException(java.lang.Throwable exception, java.io.PrintStream out, boolean logException)
InvocationTargetException
or AlgorithmMethodException
,
the causing exception is unwrapped first.exception
- the exception to processout
- the output stream where to show the error (if not null)logException
- if true, the exception is logged via logException(java.lang.Throwable)
protected int retrieveIntArgument(java.lang.String[] args, int index, int defaultValue, int minValue, int maxValue) throws java.lang.NumberFormatException
args
- the list of argumentsindex
- the index of the argument to convertdefaultValue
- the default value if the argument index is out of range, null or empty stringminValue
- the minimal value for the returned valuemaxValue
- the maximal value for the returned valuejava.lang.NumberFormatException
- if the value cannot be converted or is out of rangeprotected final java.nio.channels.ServerSocketChannel getCmdSocket()
public boolean algorithmStart(java.io.PrintStream out, java.lang.String... args)
Algorithm
.
To create algorithm, at least the name of the algorithm class must be provided. Additional parameters are passed to the algorithm's constructor. The following example starts ExampleTree algorithm from package exampletree (do not forget to add a jar file with ExampleTree).
MESSIF >>> algorithmStart messif.algorithms.impl.ParallelSequentialScan 4Note, that the name of the class is provided fully qualified. The number 4 (after the class name) is passed to the ParallelSequentialScan's constructor (see
ParallelSequentialScan
for more informations).
If some wrong constructor parameters are specified, the constructor annotations are shown for the class.
out
- a stream where the application writes information for the userargs
- algorithm class followed by constructor argumentspublic boolean algorithmRestore(java.io.PrintStream out, java.lang.String... args)
MESSIF >>> algorithmRestore /some/where/file/algorithm.serialized
out
- a stream where the application writes information for the userargs
- file name with the serialized algorithmalgorithmStore(java.io.PrintStream, java.lang.String...)
public boolean algorithmStore(java.io.PrintStream out, java.lang.String... args)
MESSIF >>> algorithmStore /some/where/file/algorithm.serialized
out
- a stream where the application writes information for the userargs
- file name where the serialized algorithm is storedalgorithmRestore(java.io.PrintStream, java.lang.String...)
public boolean algorithmStop(java.io.PrintStream out, java.lang.String... args)
MESSIF >>> algorithmStop
out
- a stream where the application writes information for the userargs
- this method has no argumentspublic boolean algorithmStopAll(java.io.PrintStream out, java.lang.String... args)
MESSIF >>> algorithmStopAll
out
- a stream where the application writes information for the userargs
- this method has no argumentspublic boolean algorithmInfo(java.io.PrintStream out, java.lang.String... args)
Object.toString()
method is used.
Example of usage:
MESSIF >>> algorithmInfo
out
- a stream where the application writes information for the userargs
- this method has no argumentspublic boolean algorithmInfoAll(java.io.PrintStream out, java.lang.String... args)
Object.toString()
method is used.
Example of usage:
MESSIF >>> algorithmInfoAll
out
- a stream where the application writes information for the userargs
- this method has no argumentspublic boolean algorithmSelect(java.io.PrintStream out, java.lang.String... args)
MESSIF >>> algorithmSelect 0
out
- a stream where the application writes information for the userargs
- the algorithm sequence numberalgorithmInfoAll(java.io.PrintStream, java.lang.String...)
public boolean algorithmToNamedInstance(java.io.PrintStream out, java.lang.String... args)
algorithmSelect(java.io.PrintStream, java.lang.String...)
);MESSIF >>> algorithmToNamedInstace runningAlgs 0-2,6,9
out
- a stream where the application writes information for the userargs
- the name of the variable and, optionally, the algorithm sequence number selectorpublic boolean algorithmSelectByName(java.io.PrintStream out, java.lang.String... args)
MESSIF >>> algorithmSelectByName my_index
out
- a stream where the application writes information for the userargs
- the algorithm sequence numberalgorithmToNamedInstance(java.io.PrintStream, java.lang.String...)
public boolean algorithmSupportedOperations(java.io.PrintStream out, java.lang.String... args)
MESSIF >>> algorithmSupportedOperations
out
- a stream where the application writes information for the userargs
- this method has no argumentsoperationExecute(java.io.PrintStream, java.lang.String...)
public boolean operationPrepare(java.io.PrintStream out, java.lang.String... args) throws java.lang.reflect.InvocationTargetException
algorithmStart(java.io.PrintStream, java.lang.String...)
, the name of operation's class
must be provided and all the additional arguments are passed to its constructor.
The operation can be modified using operationChangeAnswerCollection(java.io.PrintStream, java.lang.String...)
or operationParam(java.io.PrintStream, java.lang.String...)
and the executed by operationExecuteAgain(java.io.PrintStream, java.lang.String...)
.
Note that if there is another call to operationPrepare(java.io.PrintStream, java.lang.String...)
, operationExecute(java.io.PrintStream, java.lang.String...)
,
or operationBgExecute(java.io.PrintStream, java.lang.String...)
, the prepared operation is replaced.
Example of usage:
MESSIF >>> operationPrepare messif.operations.query.RangeQueryOperation objects 1.3Note that the
range query operation
requires two parameters - a LocalAbstractObject
and a radius. The LocalAbstractObject
is usually entered
as a next object from a stream (see objectStreamOpen(java.io.PrintStream, java.lang.String...)
).out
- a stream where the application writes information for the userargs
- operation class followed by constructor argumentsjava.lang.reflect.InvocationTargetException
- if there was an error while creating an instance of the operationpublic boolean operationExecute(java.io.PrintStream out, java.lang.String... args) throws java.lang.reflect.InvocationTargetException, AlgorithmMethodException
algorithmStart(java.io.PrintStream, java.lang.String...)
, the name of operation's class
must be provided and all the additional arguments are passed to its constructor.
Example of usage:
MESSIF >>> operationExecute messif.operations.query.RangeQueryOperation objects 1.3Note that the
range query operation
requires two parameters - a LocalAbstractObject
and a radius. The LocalAbstractObject
is usually entered
as a next object from a stream (see objectStreamOpen(java.io.PrintStream, java.lang.String...)
).out
- a stream where the application writes information for the userargs
- operation class followed by constructor argumentsjava.lang.reflect.InvocationTargetException
- if there was an error while creating an instance of the operationAlgorithmMethodException
- if there was an error executing the operationpublic boolean operationBgExecute(java.io.PrintStream out, java.lang.String... args) throws java.lang.reflect.InvocationTargetException
algorithmStart(java.io.PrintStream, java.lang.String...)
, the name of operation's class
must be provided and all the additional arguments are passed to its constructor.
Example of usage:
MESSIF >>> operationBgExecute messif.operations.query.RangeQueryOperation objects 1.3
Note that the last operation is not updated and the control is returned immediately.
out
- a stream where the application writes information for the userargs
- operation class followed by constructor argumentsjava.lang.reflect.InvocationTargetException
- if there was an error while creating an instance of the operationpublic boolean operationExecuteAgain(java.io.PrintStream out, java.lang.String... args) throws AlgorithmMethodException
Example of usage:
MESSIF >>> operationExecuteAgain true
out
- a stream where the application writes information for the userargs
- flag whether to reset operation answerAlgorithmMethodException
- if there was an error executing the operationpublic boolean operationInfo(java.io.PrintStream out, java.lang.String... args)
operationPrepare(java.io.PrintStream, java.lang.String...)
, operationExecute(java.io.PrintStream, java.lang.String...)
, or operationBgExecute(java.io.PrintStream, java.lang.String...)
is shown. Note that the operation might be still running if the
operationBgExecute(java.io.PrintStream, java.lang.String...)
was used and thus the results might not be complete.
Example of usage:
MESSIF >>> operationInfo
out
- a stream where the application writes information for the userargs
- optional flag whether to show parametric values,
optional parameter name-value separator (defaults to colon), and
optional parameter record separator (defaults to newline)public boolean operationErrorCode(java.io.PrintStream out, java.lang.String... args)
ErrorCode
returned by the last executed operation.
Example of usage:
MESSIF >>> operationErrorCode
out
- a stream where the application writes information for the userargs
- this method has no argumentspublic boolean operationObjectCount(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> operationObjectCount
out
- a stream where the application writes information for the userargs
- this method has no argumentspublic boolean operationQueryObjectLocator(java.io.PrintStream out, java.lang.String... args)
locatorURI
of the query object of the last executed operation.
Note that a RankingSingleQueryOperation
must have been executed prior to calling this method.
Optionally, the argument specifies text written after the locator (defaults to new line).
Example of usage:
MESSIF >>> operationQueryObjectLocator :
out
- a stream where the application writes information for the userargs
- optional suffix to writepublic boolean operationArgument(java.io.PrintStream out, java.lang.String... args)
operationPrepare(java.io.PrintStream, java.lang.String...)
, operationExecute(java.io.PrintStream, java.lang.String...)
, or operationBgExecute(java.io.PrintStream, java.lang.String...)
is shown. Note that the operation might be still running if the
operationBgExecute(java.io.PrintStream, java.lang.String...)
was used and thus the results might not be complete.
Use #operationWaitBg
to wait for background operations to finish.
Example of usage:
MESSIF >>> operationArgument 0
out
- a stream where the application writes information for the userargs
- zero-based index of the argument to showpublic boolean operationParam(java.io.PrintStream out, java.lang.String... args)
operationPrepare(java.io.PrintStream, java.lang.String...)
, operationExecute(java.io.PrintStream, java.lang.String...)
, or operationBgExecute(java.io.PrintStream, java.lang.String...)
is shown. Note that the operation might be still running if the
operationBgExecute(java.io.PrintStream, java.lang.String...)
was used and thus the results might not be complete.
Use #operationWaitBg
to wait for background operations to finish.
Note that a set parameter can be used when operationExecuteAgain(java.io.PrintStream, java.lang.String...)
is called.
Example of usage:
MESSIF >>> operationParam myparam 1 java.lang.Integer MESSIF >>> operationParam myparamThe first example set the parameter "myparam" to "1" converted to integer. The second example shows the value of the parameter myparam, i.e. "1" is displayed.
out
- a stream where the application writes information for the userargs
- name of the parameter to show (if this is the only argument) or set (if a value is provided),
the new value of the parameter, and the class of the parameter (must be convertible
)public boolean operationChangeAnswerCollection(java.io.PrintStream out, java.lang.String... args)
RankingQueryOperation
.
Example of usage:
MESSIF >>> operationChangeAnswerCollection messif.objects.util.RankedSortedCollection
out
- a stream where the application writes information for the userargs
- answer collection class followed by its constructor argumentspublic boolean operationChangeAnswerNamedInstance(java.io.PrintStream out, java.lang.String... args)
RankingQueryOperation
. The collection must be
prepared as a named instance first. Note that the collection will be cleared
and its contents replaced by the current operation answer.
Example of usage:
MESSIF >>> operationChangeAnswerNamedInstance collection_named_instance
out
- a stream where the application writes information for the userargs
- answer collection named instance namepublic boolean operationParamProcessByMethod(java.io.PrintStream out, java.lang.String... args) throws java.lang.reflect.InvocationTargetException
Example of usage:
MESSIF >>> operationParamProcessByMethod paramName somePackage.someClass someMethod methodArg2 methodArg3
out
- a stream where the application writes information for the userargs
- the name of the parameter to get from the operation,
the fully specified name of the class where the method is defined,
the name of the method, and
any number of additional argumentsjava.lang.reflect.InvocationTargetException
- if there was an error while executing the methodpublic boolean operationProcessByMethod(java.io.PrintStream out, java.lang.String... args) throws java.lang.reflect.InvocationTargetException
AbstractOperation
(or its
descendant) as its first argument. Additional arguments for the method
can be specified. The modified (or the original) operation must be returned
from the method.
Example of usage:
MESSIF >>> operationProcessByMethod somePackage.someClass someMethod methodArg2 methodArg3
out
- a stream where the application writes information for the userargs
- the fully specified name of the class where the method is defined, the name of the method and
any number of additional argumentsjava.lang.reflect.InvocationTargetException
- if there was an error while executing the methodpublic boolean operationAnswer(java.io.PrintStream out, java.lang.String... args)
operationExecute(java.io.PrintStream, java.lang.String...)
or operationBgExecute(java.io.PrintStream, java.lang.String...)
is shown. Note that
the operation might be still running if the operationBgExecute(java.io.PrintStream, java.lang.String...)
was
used and thus the results might not be complete. Use #operationWaitBg
to wait for background operations to finish.
If the last operation was not query
operation,
this method will fail.
The following optional arguments are accepted:
MessageFormat
with four (zero-base indexed) arguments containing:
the given answer object as-is,
the AbstractObject
from the answer object,
the locator
of the AbstractObject
,
the distance.Example of usage:
MESSIF >>> operationAnswer DistanceLocators , en
out
- a stream where the application writes information for the userargs
- display separator for the list of objects and type of the displaypublic boolean operationSubAnswer(java.io.PrintStream out, java.lang.String... args)
operationExecute(java.io.PrintStream, java.lang.String...)
or operationBgExecute(java.io.PrintStream, java.lang.String...)
is shown. Note that
the operation might be still running if the operationBgExecute(java.io.PrintStream, java.lang.String...)
was
used and thus the results might not be complete. Use #operationWaitBg
to wait for background operations to finish.
If the last operation was not query
operation,
this method will fail.
The following arguments are accepted:
MessageFormat
with five (zero-base indexed) arguments containing:
the given answer object as-is,
the AbstractObject
from the answer object,
the locator
of the AbstractObject
,
the distance,
the respective sub-distance if the meta-object distances were stored.Example of usage:
MESSIF >>> operationSubAnswer 1 Locators
out
- a stream where the application writes information for the userargs
- sub-answer index, display separator for the list of objects, and type of the displaypublic boolean operationAnswerRawObjects(java.io.PrintStream out, java.lang.String... args) throws java.io.IOException, java.lang.ClassCastException
LocalAbstractObject.write(java.io.OutputStream)
) from the answer of the last executed query operation.
Specifically, the answer of the operation created by last call to
operationExecute(java.io.PrintStream, java.lang.String...)
or operationBgExecute(java.io.PrintStream, java.lang.String...)
is written.
Note that the operation might be still running if the operationBgExecute(java.io.PrintStream, java.lang.String...)
was
used and thus the results might not be complete. Use #operationWaitBg
to wait for background operations to finish.
If the last operation was not query
operation,
this method will fail.
Example of usage:
MESSIF >>> operationAnswerRawObjects
out
- a stream where the application writes information for the userargs
- no arguments requiredjava.io.IOException
- if some of the objects failed to write themselves to outputjava.lang.ClassCastException
- if the operation did not provide LocalAbstractObject
s in its answerpublic boolean methodExecute(java.io.PrintStream out, java.lang.String... args)
convertible
types can
be passed as arguments and if there are several methods with the same name,
the first one that matches the number of arguments is selected.
Example of usage:
MESSIF >>> methodExecute mySpecialAlgorithmMethod 1 false string_string
out
- a stream where the application writes information for the userargs
- method name followed by the values for its argumentspublic boolean methodExecuteOnAlgorithm(java.io.PrintStream out, java.lang.String... args)
convertible
types can
be passed as arguments and if there are several methods with the same name,
the first one that matches the number of arguments is selected.
Example of usage:
MESSIF >>> methodExecuteOnAlgorithm 0 mySpecialAlgorithmMethod 1 false string_string
out
- a stream where the application writes information for the userargs
- method name followed by the values for its argumentspublic boolean statisticsDisable(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> statisticsDisable false
out
- a stream where the application writes information for the userargs
- flag whether to disable (true) or enable (false) the statisticspublic boolean statisticsGlobal(java.io.PrintStream out, java.lang.String... args)
name: value
.
Three optional arguments are accepted:
Example of usage: To print statistics comma-separated, use:
MESSIF >>> statisticsGlobal DistanceComputations.* ,To avoid appending newline and append comma, use:
MESSIF >>> statisticsGlobal DistanceComputations.* , ,
out
- a stream where the application writes information for the userargs
- regular expression to match statistic names and the display separators for the statistic valuespublic boolean statisticsGlobalGet(java.io.PrintStream out, java.lang.String... args)
Two arguments are required:
Example of usage:
MESSIF >>> statisticsGlobalGet DistanceComputations messif.statistics.StatisticCounter
out
- a stream where the application writes information for the userargs
- the name and class of the global statisticpublic boolean statisticsResetGlobal(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> statisticsResetGlobal DistanceComputations
out
- a stream where the application writes information for the userargs
- regular expression to match statistic namespublic boolean statisticsLastOperation(java.io.PrintStream out, java.lang.String... args)
bound
statistics are
reported. Usually, algorithms bind the relevant statistics automatically, but
it can be done explicitely using the statisticsSetAutoBinding(java.io.PrintStream, java.lang.String...)
method.
Statistics are shown as name: value
.
Three optional arguments are accepted:
Example of usage: To print statistics comma-separated, use:
MESSIF >>> statisticsLastOperation DistanceComputations.* ,To avoid appending newline and append comma, use:
MESSIF >>> statisticsLastOperation DistanceComputations.* , ,
out
- a stream where the application writes information for the userargs
- regular expression to match statistic names and the display separators for the statistic valuespublic boolean statisticsSetAutoBinding(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> statisticsSetAutoBinding .*
out
- a stream where the application writes information for the userargs
- regular expression to match statistic names to bindpublic boolean objectStreamOpen(java.io.PrintStream out, java.lang.String... args)
objects
from a file.
The first required argument specifies a file name from which to open the stream.
The second required argument gives a fully-qualified name of the stored object class
.
The third required argument is a name under which the stream is opened.
If the name (third argument) is then specified in place where LocalAbstractObject
is argument required, the next object is read from the stream and used as the argument's value.
Example of usage:
MESSIF >>> objectStreamOpen /my/data/file.xx messif.objects.impl.ObjectByteVectorL1 my_data MESSIF >>> operationExecute messif.operations.query.RangeQueryOperation my_data 1.3 MESSIF >>> operationExecute messif.operations.query.kNNQueryOperation my_data 10Note that the first two objects are read from the stream file /my/data/file.xx, first is used as a query object for the range query, the second is used in the k-NN query. A second example with a special class that requires some additional constructor parameters:
public class MyClass { public MyClass(BufferedReader stream, int value, String text) { ... construct object from the stream ... } } MESSIF >>> objectStreamOpen /my/data/file.xx MyClass other_data 10 string_value
out
- a stream where the application writes information for the userargs
- file name to read from,
class name of objects to be read from the file,
optional name of the object stream,
optional additional arguments for the object constructorpublic boolean objectStreamSetParameter(java.io.PrintStream out, java.lang.String... args)
objectStreamOpen(java.io.PrintStream, java.lang.String...)
method for explanation of the concept of
additional constructor parameters.
This method requires three arguments:
Example of usage:
MESSIF >>> objectStreamSetParameter other_data new_string_value 1
out
- a stream where the application writes information for the userargs
- name of the object stream, new parameter value to object's contructor, and zero-based index of the parameterpublic boolean objectStreamConvert(java.io.PrintStream out, java.lang.String... args)
Convertor
instance.
Extension: if the second argument (convertor instance name) starts with a dot,
a new convertor instance is created that converts a MetaObject
to the
respective encapsulated object with that name (without the dot).
Example of usage:
MESSIF >>> objectStreamConvert my_data my_data_convertor_named_instance MESSIF >>> objectStreamConvert my_data .MySpecialLocalObjectName
out
- a stream where the application writes information for the userargs
- opened object stream to restrict,
the name of a convertor instancepublic boolean objectStreamClose(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> objectStreamClose my_data
out
- a stream where the application writes information for the userargs
- name of an opened object streampublic boolean objectStreamReset(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> objectStreamReset my_data
out
- a stream where the application writes information for the userargs
- name of an opened object streampublic boolean objectStreamSkip(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> objectStreamSkip my_data 100 abcd
out
- a stream where the application writes information for the userargs
- the name of an opened object stream,
the number of objects to skip (or zero for infinite),
the locator (regular expression) of an object to skip topublic boolean propertiesOpen(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> propertiesOpen someparameters.cf my_props begins_with_this host=localhost,port=1000
out
- a stream where the application writes information for the userargs
- the property file, the new name, the restrict prefix (not required) and the variables (not required)protected final java.lang.Object getNamedInstance(java.lang.String name)
name
- the name of the instance to getprotected final boolean addNamedInstance(java.lang.String name, java.lang.Object instance, boolean replace)
name
- the name of the instance to addinstance
- the instance to addreplace
- flag whether to replace existing instance with the given one (true) or notprotected final java.util.Map<java.lang.String,java.lang.Object> getExtendedNamedInstances(java.lang.String key, java.lang.Object value, boolean replaceExisting)
key
- the name for the new named instancevalue
- the new named instancereplaceExisting
- flag whether to replace the instance if it already existspublic boolean namedInstanceAdd(java.io.PrintStream out, java.lang.String... args) throws java.lang.reflect.InvocationTargetException
namedInstanceReplace
instead.
Note that a "lastOperation" temporary named instance is available during the instantiation.
Example of usage for constructor, factory method and static field:
MESSIF >>> namedInstanceAdd messif.objects.impl.ObjectByteVectorL1(1,2,3,4,5,6,7,8,9,10) my_object MESSIF >>> namedInstanceAdd messif.utility.ExtendedProperties.getProperties(someparameters.cf) my_props MESSIF >>> namedInstanceAdd messif.buckets.index.LocalAbstractObjectOrder.locatorToLocalObjectComparator my_comparator
out
- a stream where the application writes information for the userargs
- the instance constructor, factory method or static field signature and the name to registerjava.lang.reflect.InvocationTargetException
- if there was an error while creating a named instancepublic boolean namedInstanceReplace(java.io.PrintStream out, java.lang.String... args) throws java.lang.reflect.InvocationTargetException
Example of usage for constructor, factory method and static field:
MESSIF >>> namedInstanceReplace messif.objects.impl.ObjectByteVectorL1(1,2,3,4,5,6,7,8,9,10) my_object MESSIF >>> namedInstanceReplace messif.utility.ExtendedProperties.getProperties(someparameters.cf) my_props MESSIF >>> namedInstanceReplace messif.buckets.index.LocalAbstractObjectOrder.locatorToLocalObjectComparator my_comparator
out
- a stream where the application writes information for the userargs
- the instance constructor, factory method or static field signature and the name to registerjava.lang.reflect.InvocationTargetException
- if there was an error while creating a named instancepublic boolean namedInstanceThread(java.io.PrintStream out, java.lang.String... args) throws java.lang.reflect.InvocationTargetException
Example of usage for constructor, factory method and static field:
MESSIF >>> namedInstanceThread messif.objects.impl.ObjectByteVectorL1(1,2,3,4,5,6,7,8,9,10) my_object MESSIF >>> namedInstanceThread messif.utility.ExtendedProperties.getProperties(someparameters.cf) my_props MESSIF >>> namedInstanceThread messif.buckets.index.LocalAbstractObjectOrder.locatorToLocalObjectComparator my_comparator
out
- a stream where the application writes information for the userargs
- the instance constructor, factory method or static field signature and the name to registerjava.lang.reflect.InvocationTargetException
- if there was an error while creating a named instancepublic boolean namedInstanceConstructor(java.io.PrintStream out, java.lang.String... args) throws java.lang.reflect.InvocationTargetException
Example of usage for constructor, factory method and static field:
MESSIF >>> namedInstanceConstructor my_object false messif.objects.impl.ObjectByteVectorL1 1,2,3,4,5,6,7,8,9,10
out
- a stream where the application writes information for the userargs
- the instance constructor, factory method or static field signature and the name to registerjava.lang.reflect.InvocationTargetException
- if there was an error while creating a named instancepublic boolean namedInstanceList(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> namedInstanceList
out
- a stream where the application writes information for the userargs
- no arguments requiredpublic boolean namedInstanceRemove(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> namedInstanceRemove my_object
out
- a stream where the application writes information for the userargs
- the name of the instance to removepublic boolean namedInstanceEcho(java.io.PrintStream out, java.lang.String... args) throws java.lang.reflect.InvocationTargetException
namedInstanceReplace(java.io.PrintStream, java.lang.String[])
.
Example of usage:
MESSIF >>> namedInstanceEcho my_object
out
- a stream where the application writes information for the userargs
- the name of the instance to printjava.lang.reflect.InvocationTargetException
- if there was an error while printing a named instancepublic boolean namedInstanceRestore(java.io.PrintStream out, java.lang.String... args) throws java.io.IOException, java.lang.ClassNotFoundException
Example of usage:
MESSIF >>> namedInstanceRestore path/to/serialized/object.bin my_object
out
- a stream where the application writes information for the userargs
- the file with the serialized object and the name to registerjava.io.IOException
- if there was an error while reading from the filejava.lang.ClassNotFoundException
- if there was an error while creating a named instancepublic boolean namedInstanceStore(java.io.PrintStream out, java.lang.String... args) throws java.io.IOException
Example of usage:
MESSIF >>> namedInstanceStore my_object path/to/serialized/object.bin
out
- a stream where the application writes information for the userargs
- the name of the instance to write and the file namejava.io.IOException
- if there was an error while storing the named instancepublic boolean loggingLevel(java.io.PrintStream out, java.lang.String... args)
logging level
constants.
Otherwise the current logging level is printed out.
Example of usage:
MESSIF >>> loggingLevel warning
out
- a stream where the application writes information for the userargs
- the new logging levelpublic boolean loggingConsoleChangeLevel(java.io.PrintStream out, java.lang.String... args)
logging level
constants.
Note that the messages with lower logging level than the current global
logging level will not be printed regardless of the console logging level setting.
Example of usage:
MESSIF >>> loggingConsoleChangeLevel info
out
- a stream where the application writes information for the userargs
- the new logging levelpublic boolean loggingFileAdd(java.io.PrintStream out, java.lang.String... args)
logging level
constants.
The fifth optional argument specifies a regular expression that the message must satisfy
in order to be written in this file.
The sixth argument specifies the message part that the regular expression
is applied to - see Logging.RegexpFilterAgainst
for explanation of
the various values.
The seventh argument is the maximum number of bytes to write to a logging
file before it is rotated (zero means unlimited).
The ninth argument is the number of logging files for rotation. This only
applies, if the maximal file size is given in previous argument.
In that case, once the file reaches the size, it is renamed with a numbering
prefix and all other logging file numbers are increased by one (log rotation).
The files with a greater or equal number than this argument specifies are deleted.
Note that the messages with lower logging level than the current global
logging level will not be printed regardless of the file's logging level.
Example of usage:
MESSIF >>> loggingFileAdd myFile.log info true false messif.* CLASS_NAME
out
- a stream where the application writes information for the userargs
- the file name,
logging level,
append to file flag,
simple/xml format selector,
regular expression,
which part of the message is matched by regular expression,
maximal log size, and
number of rotated logspublic boolean loggingFileRemove(java.io.PrintStream out, java.lang.String... args)
loggingFileAdd(java.io.PrintStream, java.lang.String...)
.
A required argument specifies the name of the opened logging file to close.
Example of usage:
MESSIF >>> loggingFileRemove myFile.log
out
- a stream where the application writes information for the userargs
- the logging file name to removepublic boolean loggingFileChangeLevel(java.io.PrintStream out, java.lang.String... args)
loggingFileAdd(java.io.PrintStream, java.lang.String...)
.
The first required argument specifies the name of the opened logging file to close
and the second one the new logging level to set.
Note that the messages with lower logging level than the current global
logging level will not be printed regardless of the file's logging level.
Example of usage:
MESSIF >>> loggingFileChangeLevel myFile.log fine
out
- a stream where the application writes information for the userargs
- the logging file name and the new logging levelpublic boolean collectGarbage(java.io.PrintStream out, java.lang.String... args)
full garbage collection
.
If an optional argument is passed, the application will sleep for the number
of milliseconds specified.
Example of usage:
MESSIF >>> collectGarbage 30000
out
- a stream where the application writes information for the userargs
- number of milliseconds to sleep after the garbage collectionpublic boolean memoryUsage(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> memoryUsage
out
- a stream where the application writes information for the userargs
- this method has no argumentspublic boolean currentTime(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> currentTime "d M yyyy HH:mm"
out
- a stream where the application writes information for the userargs
- an optional argument specifying the date/time format according to SimpleDateFormat
public boolean help(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> help
out
- a stream where the application writes information for the userargs
- this method has no argumentspublic boolean quit(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> quit
out
- a stream where the application writes information for the userargs
- this method has no argumentspublic boolean echo(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> echo NEWLINE+NEWLINE x y z
out
- a stream where the application writes information for the userargs
- output type separator and list of values to printpublic void stopRepeatEveryThread(java.io.PrintStream out, java.lang.String... args)
public void waitForRepeatEveryThread(java.io.PrintStream out, java.lang.String... args)
public boolean sum(java.io.PrintStream out, java.lang.String... args)
output format
used
for printing the value. All computations are done in doubles.
Example of usage:
MESSIF >>> sum #,##0.## 10 20 30
out
- a stream where the application writes information for the userargs
- format of the result followed by the list of values to sumpublic boolean decode(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> decode mySpecVal ^your Y ^my M .* unknown
Additionally, a map-based syntax can be used with only two parameters:
MESSIF >>> decode mySpecVal "^your"="Y","^my"=M,.*="unknown"
out
- a stream where the application writes information for the userargs
- checked value followed by matched and result value pairsprotected java.lang.String substituteVariables(java.lang.String value, java.util.Map<java.lang.String,java.lang.String> variables)
value
- the value in which to substitute the variablesvariables
- the current defined variablesprotected java.util.List<java.lang.String> getCFActionArguments(java.util.Properties props, java.lang.String actionName, java.util.Map<java.lang.String,java.lang.String> variables)
props
- the properties with parametersactionName
- the current action namevariables
- the current defined variablesprotected boolean postponeCFAction(java.io.PrintStream out, java.util.Properties props, java.lang.String actionName, java.util.Map<java.lang.String,java.lang.String> variables)
out
- the stream to write the output toprops
- the properties with actions and their parametersactionName
- the name of the postponed action (used in errors)variables
- the current variables environmentprotected java.io.PrintStream getCFActionOutput(java.io.PrintStream out, java.util.Properties props, java.lang.String actionName, java.util.Map<java.lang.String,java.lang.String> variables, java.util.Map<java.lang.String,java.io.PrintStream> outputStreams, java.io.ByteArrayOutputStream assignOutput)
out
- the stream to write the output toprops
- the properties with actionsactionName
- the name of the action to executevariables
- the current variables' environmentoutputStreams
- currently opened output streamsassignOutput
- the virtual output to which the result is stored
in order to put it into an "assign" variableprotected java.lang.String[] getCFActionForeach(java.io.PrintStream out, java.util.Properties props, java.lang.String actionName, java.util.Map<java.lang.String,java.lang.String> variables)
out
- the stream to write the output toprops
- the properties with actionsactionName
- the name of the action to executevariables
- the current variables' environmentprotected java.lang.Class<? extends java.lang.Throwable> getCFActionException(java.io.PrintStream out, java.util.Properties props, java.lang.String actionName, java.lang.String modifierName, java.util.Map<java.lang.String,java.lang.String> variables)
Exception
are allowed and a
Throwable
class is returned if the given class is not exception.out
- the stream to write the output toprops
- the properties with actionsactionName
- the name of the action to executemodifierName
- the action modifier name that contains the exceptionvariables
- the current variables' environmentprotected int getCFActionRepeat(java.io.PrintStream out, java.util.Properties props, java.lang.String actionName, java.util.Map<java.lang.String,java.lang.String> variables, java.lang.String[] foreachValues, java.lang.Class<? extends java.lang.Throwable> repeatUntilExceptionClass)
Integer.MAX_VALUE
is returned and
thus the action will be repeated until there is an exception.out
- the stream to write the output toprops
- the properties with actionsactionName
- the name of the action to executevariables
- the current variables' environmentforeachValues
- the foreach values for this actionrepeatUntilExceptionClass
- the class of the repeat-until exceptionprotected void createCFActionRepeatEveryThread(java.lang.String repeatEveryModifier, java.io.PrintStream out, java.util.Properties props, java.lang.String actionName, java.util.Map<java.lang.String,java.lang.String> variables, java.util.Map<java.lang.String,java.io.PrintStream> outputStreams)
repeatEveryModifier
- the hour-minute-second specification
of the time intervalout
- the stream to write the output toprops
- the properties with actionsactionName
- the name of the action to executevariables
- the current variables environmentoutputStreams
- currently opened output streamsprotected boolean controlFileExecuteMethod(java.io.PrintStream out, java.util.Properties props, java.lang.String actionName, java.util.Map<java.lang.String,java.lang.String> variables, java.util.List<java.lang.String> arguments) throws java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException
CoreApplication
.out
- the stream to write the output toprops
- the properties with actionsactionName
- the name of the action to executevariables
- the current variables environmentarguments
- the list of arguments parsed from the configuration filejava.lang.NoSuchMethodException
- if there was no method for the given actionjava.lang.reflect.InvocationTargetException
- if there was an error executing the action while the throwException
is trueprotected boolean controlFileExecuteAction(java.io.PrintStream out, java.util.Properties props, java.lang.String actionName, java.util.Map<java.lang.String,java.lang.String> variables, java.util.Map<java.lang.String,java.io.PrintStream> outputStreams, boolean throwException) throws java.lang.reflect.InvocationTargetException
CoreApplication
.out
- the stream to write the output toprops
- the properties with actionsactionName
- the name of the action to executevariables
- the current variables environmentoutputStreams
- currently opened output streamsthrowException
- flag whether to throw the InvocationTargetException
when an action encounters error instead of handling itjava.lang.reflect.InvocationTargetException
- if there was an error executing the action while the throwException
is truepublic boolean controlFile(java.io.PrintStream out, java.lang.String... args)
CoreApplication
.
Example of usage:
MESSIF >>> controlFile commands.cf var1=100 var2=data.file my_special_action
out
- a stream where the application writes information for the userargs
- file name followed by variable specifications and start actionprotected void processInteractiveSocket(java.nio.channels.SocketChannel connection) throws java.io.IOException
connection
- the connection to processjava.io.IOException
- if there was a communication errorprotected void startApplication(java.lang.String[] args)
main
method
to initialize this application. Basically, this method calls parseArguments(java.lang.String[], int)
and prints a usage if false is returned.args
- the command line argumentsprotected java.lang.String usage()
protected boolean parseArguments(java.lang.String[] args, int argIndex)
main
method
to read parameters and initialize the application.args
- the command line argumentsargIndex
- the index of the argument where to startpublic static void main(java.lang.String[] args)
args
- the command line arguments