Class JsvManager


  • public class JsvManager
    extends java.lang.Object
    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:
    JobDescription
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  JsvManager.LogLevel
      The LogLevel enumeration is used to control the log level of messages logged through the JSV framework.
      static class  JsvManager.Result
      The Result enumeration is used to set the result of a JSV verification operation.
    • Constructor Summary

      Constructors 
      Constructor Description
      JsvManager()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(java.lang.String message)
      Accept the job.
      JobDescription getJobDescription()
      Get the description of the job for the current verification operation.
      JsvManager.Result getResult()
      Return the current result.
      void log​(JsvManager.LogLevel level, java.lang.String message)
      Write a log message to the JSV's log.
      static void main​(java.lang.String[] args)
      The main() method takes the name of a Jsv implementation class and uses that class to instantiate and run a JSV.
      void modify​(java.lang.String message)
      Modify the job.
      void parse​(Jsv jsv)
      Start the JSV.
      void reject​(java.lang.String message)
      Reject the job.
      void rejectWait​(java.lang.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, java.lang.String message)
      Set the result of the JSV verification operation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JsvManager

        public JsvManager()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
        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

        public void parse​(Jsv jsv)
                   throws java.io.IOException
        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:
        java.io.IOException - Thrown if it is not possible to communicate with the JSV framework
      • log

        public void log​(JsvManager.LogLevel level,
                        java.lang.String message)
        Write a log message to the JSV's log.
        Parameters:
        level - The LogLevel to use for the message
        message - The message to log
      • accept

        public void accept​(java.lang.String message)
        Accept the job.
        Parameters:
        message - Detail about the acceptance
      • modify

        public void modify​(java.lang.String message)
        Modify the job.
        Parameters:
        message - Detail about the modification
      • reject

        public void reject​(java.lang.String message)
        Reject the job.
        Parameters:
        message - Detail about the rejection
      • rejectWait

        public void rejectWait​(java.lang.String message)
        Reject the job but indicate that it may succeed later.
        Parameters:
        message - Detail about the rejection
      • setResult

        public void setResult​(JsvManager.Result result,
                              java.lang.String message)
        Set the result of the JSV verification operation.
        Parameters:
        result - The result of the verification operation
        message - Detail about the result
      • 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:
        Jsv.onStart(com.sun.grid.jsv.JsvManager)
      • getJobDescription

        public JobDescription getJobDescription()
        Get the description of the job for the current verification operation.
        Returns:
        the current job description