|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessif.utility.CoreApplication
public class CoreApplication
This class implements a standalone client for MESSIF-enabled algorithms.
Via the client, a user can use methods provided in this class. For example,
an algorithm is started by 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>.outputFile = <filename> <actionName>.assign = <variable name> <actionName>.postponeUntil = hh:mm:ss
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.
Field Summary | |
---|---|
protected Algorithm |
algorithm
Currently running algorithm |
protected java.util.List<Algorithm> |
algorithms
List of running algorithms |
protected java.lang.String |
bindOperationStatsRegexp
Regular expression for binding OperationStatistics in every operationExecute(java.io.PrintStream, java.lang.String...) call |
protected java.nio.channels.ServerSocketChannel |
cmdSocket
Socket used for command communication |
protected AbstractOperation |
lastOperation
Last executed operation |
protected static java.util.logging.Logger |
log
Logger |
protected MethodExecutor |
methodExecutor
Internal list of methods that can be executed |
protected java.util.Map<java.lang.String,java.lang.Object> |
namedInstances
List of currently created named instances |
Constructor Summary | |
---|---|
protected |
CoreApplication()
Create new instance of CoreApplication. |
Method Summary | |
---|---|
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 |
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 |
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)
This method reads and executes one action (with name actionName) from the control file (props). |
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. |
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 loging messages. |
boolean |
loggingFileChangeLevel(java.io.PrintStream out,
java.lang.String... args)
Changes the loging level of an opened logging file. |
boolean |
loggingFileRemove(java.io.PrintStream out,
java.lang.String... args)
Removes loging file. |
boolean |
loggingLevel(java.io.PrintStream out,
java.lang.String... args)
Get or set 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 |
namedInstanceAdd(java.io.PrintStream out,
java.lang.String... args)
Creates a new 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 |
objectStreamClose(java.io.PrintStream out,
java.lang.String... args)
Closes a named 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 |
operationAnswer(java.io.PrintStream out,
java.lang.String... args)
Show the answer of the last executed query 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 |
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 last executed operation. |
boolean |
operationInfo(java.io.PrintStream out,
java.lang.String... args)
Show information about the last executed operation. |
boolean |
operationWaitBg(java.io.PrintStream out,
java.lang.String... args)
Synchronize on all operations run on the background. |
protected boolean |
parseArguments(java.lang.String[] args,
int argIndex)
Internal method called from main method
to read parameters and initialize the application. |
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 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. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.util.logging.Logger log
protected Algorithm algorithm
protected java.util.List<Algorithm> algorithms
protected AbstractOperation lastOperation
protected java.lang.String bindOperationStatsRegexp
OperationStatistics
in every operationExecute(java.io.PrintStream, java.lang.String...)
call
protected final MethodExecutor methodExecutor
protected final java.util.Map<java.lang.String,java.lang.Object> namedInstances
protected java.nio.channels.ServerSocketChannel cmdSocket
Constructor Detail |
---|
protected CoreApplication()
main(java.lang.String[])
method.
Method Detail |
---|
protected static void logException(java.lang.Throwable e)
Level.SEVERE
level.
e
- the exception to logpublic 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 arguments
public 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 algorithm
algorithmStore(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 stored
algorithmRestore(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 arguments
public 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 arguments
public 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 arguments
public 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 arguments
public 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 number
algorithmInfoAll(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 arguments
operationExecute(java.io.PrintStream, java.lang.String...)
public boolean operationExecute(java.io.PrintStream out, java.lang.String... args)
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 arguments
public boolean operationBgExecute(java.io.PrintStream out, java.lang.String... args)
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 updated, however, the control is returned immediately.
So if there is another operation executed meanwhile (either background or normal), the results
of this operation will be replaced. Use operationWaitBg(java.io.PrintStream, java.lang.String...)
method to wait for the operation
to finish.
out
- a stream where the application writes information for the userargs
- operation class followed by constructor arguments
public boolean operationWaitBg(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> operationWaitBg
out
- a stream where the application writes information for the userargs
- this method has no arguments
public boolean operationExecuteAgain(java.io.PrintStream out, java.lang.String... args)
Example of usage:
MESSIF >>> operationExecuteAgain true
out
- a stream where the application writes information for the userargs
- flag whether to reset operation answer
public boolean operationInfo(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(java.io.PrintStream, java.lang.String...)
to wait for background operations to finish.
Example of usage:
MESSIF >>> operationInfo
out
- a stream where the application writes information for the userargs
- this method has no arguments
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 arguments
public 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(java.io.PrintStream, java.lang.String...)
to wait for background operations to finish.
If the last operation was not query
operation,
this method will fail.
An optional argument is accepted:
Example of usage:
MESSIF >>> operationAnswer , Locators
out
- a stream where the application writes information for the userargs
- display separator for the list of objects and type of the display
public 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 arguments
public 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 statistics
public 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 values
public 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 statistic
public 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 names
public 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 values
public 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 bind
public 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 constructor
public 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 parameter
public 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 stream
public 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 stream
public 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)
public boolean namedInstanceAdd(java.io.PrintStream out, java.lang.String... args)
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 register
public 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 required
public 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 remove
public 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 level
public 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 level
public 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
values for explanation.
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 and which part of the message is matched
public 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 remove
public 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 level
public 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 miliseconds specified.
Example of usage:
MESSIF >>> collectGarbage 30000
out
- a stream where the application writes information for the userargs
- number of miliseconds to sleep after the garbage collection
public 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 arguments
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 arguments
public 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 arguments
public 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 print
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 sum
public 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 pairs
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)
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 streams
public 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 action
protected void processInteractiveSocket(java.nio.channels.SocketChannel connection) throws java.io.IOException
connection
- the connection to process
java.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 start
public static void main(java.lang.String[] args)
args
- the command line arguments
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |