Package edu.isi.pegasus.common.util
Class CondorVersion
- java.lang.Object
-
- edu.isi.pegasus.common.util.CondorVersion
-
public class CondorVersion extends java.lang.ObjectA utility class that allows us to determine condor version.- Author:
- Karan Vahi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classCondorVersion.CondorVersionCallbackAn 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.StringCONDOR_VERSION_COMMANDThe condor version command to be executed.private static intMAX_NUMBER_OF_VERSION_COMPONENTSThe maximum number of components version can have.private static intMAX_VERSION_PRECISIONThe maximum number of digits each component of version can have.private LogManagermLoggerThe default logger.private static java.util.regex.PatternmPatternStores compiled patterns at first use, quasi-Singleton.private static java.lang.StringmRegexExpressionStore the regular expressions necessary to parse the output of condor_version.static longv_7_1_0Predefined Constant for condor version 7.1.0static longv_7_1_2Predefined Constant for condor version 7.1.2static longv_7_1_3Predefined Constant for condor version 7.1.3
-
Constructor Summary
Constructors Modifier Constructor Description privateCondorVersion(LogManager logger)The default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static CondorVersiongetInstance()Factory method to instantiate the class.static CondorVersiongetInstance(LogManager logger)Factory method to instantiate the class.static intintValue(java.lang.String version)Deprecated.static voidmain(java.lang.String[] args)The main program to test.longnumericValue()Returns the condor version parsed by executing the condor_version command.static longnumericValue(java.lang.String version)Converts a string into the corresponding numeric value.java.lang.Stringversion()Returns the condor version parsed by executing the condor_version command.
-
-
-
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-
-
-