Package com.sun.grid.jsv
Class JsvManager
java.lang.Object
com.sun.grid.jsv.JsvManager
The JsvManager class is implements the JSV protocol. A JSV can use the
JsvManager class either by instantiating an instance and passing in the
Jsv implementation instance or by running the JsvManager class directly
and passing as an arguement the name of the class to be run as the Jsv
implementation.
Once started, the JsvManager instance reads the input from the JSV framework
from stdin and writes commands to stdout. The JSV protocol is completely
encapsulated, however, allowing the Jsv implementation to work at the
level of JobDescription objects.
The JsvManager class uses the Logger named "com.sun.grid.Jsv". By default
the Logger is set not to pass log records to its parent logger because
the default Logger writes to stdout and would disrupt the JSV protocol. By
default, the Logger has no handlers installed. In order to enable logging,
add a handler, i.e. a FileHandler instance.
It is always a good idea to enabling logging, as errors in JSV protocol
handling will be logged as warnings, but will not be visible any other way.
TODO: Write docs
TODO: Add method to log the entire parameter set
TODO: Look at showMaps() to see if it can be done more cleanly
TODO: Add main() method
TODO: ant script
TODO: Wrapper script
TODO: correct=>modify in other languages
- Since:
- 6.2u5
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
The LogLevel enumeration is used to control the log level of messages logged through the JSV framework.static enum
The Result enumeration is used to set the result of a JSV verification operation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Accept the job.Get the description of the job for the current verification operation.Return the current result.void
log
(JsvManager.LogLevel level, String message) Write a log message to the JSV's log.static void
The main() method takes the name of a Jsv implementation class and uses that class to instantiate and run a JSV.void
Modify the job.void
Start the JSV.void
Reject the job.void
rejectWait
(String message) Reject the job but indicate that it may succeed later.void
requestEnvironment
(boolean request) Indicate whether the JSV is interested in information about jobs' environment variables.void
setResult
(JsvManager.Result result, String message) Set the result of the JSV verification operation.
-
Constructor Details
-
JsvManager
public JsvManager()
-
-
Method Details
-
main
The main() method takes the name of a Jsv implementation class and uses that class to instantiate and run a JSV.- Parameters:
args
- String array that contains the name of the class to run
-
parse
Start the JSV. This method reads input and triggers appropriate actions on the given Jsv implementation. It will not return until it receives the "QUIT" command from the JSV framework.- Parameters:
jsv
- The Jsv implementation to be run- Throws:
IOException
- Thrown if it is not possible to communicate with the JSV framework
-
log
Write a log message to the JSV's log.- Parameters:
level
- The LogLevel to use for the messagemessage
- The message to log
-
accept
Accept the job.- Parameters:
message
- Detail about the acceptance
-
modify
Modify the job.- Parameters:
message
- Detail about the modification
-
reject
Reject the job.- Parameters:
message
- Detail about the rejection
-
rejectWait
Reject the job but indicate that it may succeed later.- Parameters:
message
- Detail about the rejection
-
setResult
Set the result of the JSV verification operation.- Parameters:
result
- The result of the verification operationmessage
- Detail about the result
-
getResult
Return the current result. The result is not final until the onVerify() method has returned.- Returns:
- the current result
- See Also:
-
requestEnvironment
public void requestEnvironment(boolean request) Indicate whether the JSV is interested in information about jobs' environment variables. This method is normally called from the onStart() method, but it can be called any time prior to the receipt of a "START" command- Parameters:
request
- Whether to request that the JSV framework send the complete list of environment variables for every job.- See Also:
-
getJobDescription
Get the description of the job for the current verification operation.- Returns:
- the current job description
-