Class CondorVersion


  • public class CondorVersion
    extends java.lang.Object
    A utility class that allows us to determine condor version.
    Author:
    Karan Vahi
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  CondorVersion.CondorVersionCallback
      An inner class, that implements the StreamGobblerCallback to determine the version of Condor being used.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CONDOR_VERSION_COMMAND
      The condor version command to be executed.
      private static int MAX_NUMBER_OF_VERSION_COMPONENTS
      The maximum number of components version can have.
      private static int MAX_VERSION_PRECISION
      The maximum number of digits each component of version can have.
      private LogManager mLogger
      The default logger.
      private static java.util.regex.Pattern mPattern
      Stores compiled patterns at first use, quasi-Singleton.
      private static java.lang.String mRegexExpression
      Store the regular expressions necessary to parse the output of condor_version.
      static long v_7_1_0
      Predefined Constant for condor version 7.1.0
      static long v_7_1_2
      Predefined Constant for condor version 7.1.2
      static long v_7_1_3
      Predefined Constant for condor version 7.1.3
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private CondorVersion​(LogManager logger)
      The default constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static CondorVersion getInstance()
      Factory method to instantiate the class.
      static CondorVersion getInstance​(LogManager logger)
      Factory method to instantiate the class.
      static int intValue​(java.lang.String version)
      Deprecated. 
      static void main​(java.lang.String[] args)
      The main program to test.
      long numericValue()
      Returns the condor version parsed by executing the condor_version command.
      static long numericValue​(java.lang.String version)
      Converts a string into the corresponding numeric value.
      java.lang.String version()
      Returns the condor version parsed by executing the condor_version command.
      • Methods inherited from class java.lang.Object

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

      • v_7_1_0

        public static final long v_7_1_0
        Predefined Constant for condor version 7.1.0
      • v_7_1_2

        public static final long v_7_1_2
        Predefined Constant for condor version 7.1.2
      • v_7_1_3

        public static final long v_7_1_3
        Predefined Constant for condor version 7.1.3
      • MAX_NUMBER_OF_VERSION_COMPONENTS

        private static final int MAX_NUMBER_OF_VERSION_COMPONENTS
        The maximum number of components version can have. MAJOR, MINOR, PATCH
        See Also:
        Constant Field Values
      • MAX_VERSION_PRECISION

        private static final int MAX_VERSION_PRECISION
        The maximum number of digits each component of version can have.
        See Also:
        Constant Field Values
      • CONDOR_VERSION_COMMAND

        public static final java.lang.String CONDOR_VERSION_COMMAND
        The condor version command to be executed.
        See Also:
        Constant Field Values
      • mRegexExpression

        private static final java.lang.String mRegexExpression
        Store the regular expressions necessary to parse the output of condor_version. The rule for the format is $CondorVersion: 7.4.1 Dec 17 2009 $ where may or may not be there, and can include spaces but is really completely arbitrary. e.g. $CondorVersion: 7.1.0 Apr 1 2008 BuildID: 80895$
        See Also:
        Constant Field Values
      • mPattern

        private static java.util.regex.Pattern mPattern
        Stores compiled patterns at first use, quasi-Singleton.
      • mLogger

        private LogManager mLogger
        The default logger.
    • Constructor Detail

      • CondorVersion

        private CondorVersion​(LogManager logger)
        The default constructor.
        Parameters:
        logger - the logger object
    • Method Detail

      • intValue

        public static int intValue​(java.lang.String version)
        Deprecated.
        Converts a string into the corresponding integer value.
        Parameters:
        version -
        Returns:
        int value of the version, else -1 in case of null version or incorrect formatted string
      • numericValue

        public static long numericValue​(java.lang.String version)
        Converts a string into the corresponding numeric value.
        Parameters:
        version - in form of major.minor.patch. You can opt to omit the minor and patch versions if you want
        Returns:
        float value of the version, else -1 in case of null version or incorrect formatted string
      • getInstance

        public static CondorVersion getInstance()
        Factory method to instantiate the class.
        Returns:
        instance to the class
      • getInstance

        public static CondorVersion getInstance​(LogManager logger)
        Factory method to instantiate the class.
        Parameters:
        logger - the logger object
        Returns:
        instance to the class.
      • numericValue

        public long numericValue()
        Returns the condor version parsed by executing the condor_version command.
        Returns:
        the version number as int else -1 if unable to determine.
      • version

        public java.lang.String version()
        Returns the condor version parsed by executing the condor_version command.
        Returns:
        the version number as String else null if unable to determine.
      • main

        public static void main​(java.lang.String[] args)
        The main program to test.
        Parameters:
        args -