edu.isi.pegasus.common.util
Class CondorVersion

java.lang.Object
  extended by edu.isi.pegasus.common.util.CondorVersion

public class CondorVersion
extends Object

A utility class that allows us to determine condor version.

Author:
Karan Vahi

Nested Class Summary
private  class CondorVersion.CondorVersionCallback
          An inner class, that implements the StreamGobblerCallback to determine the version of Condor being used.
 
Field Summary
static 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 Pattern mPattern
          Stores compiled patterns at first use, quasi-Singleton.
private static 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
private CondorVersion(LogManager logger)
          The default constructor.
 
Method Summary
static CondorVersion getInstance()
          Factory method to instantiate the class.
static CondorVersion getInstance(LogManager logger)
          Factory method to instantiate the class.
static int intValue(String version)
          Deprecated.  
static void main(String[] args)
          The main program to test.
 long numericValue()
          Returns the condor version parsed by executing the condor_version command.
static long numericValue(String version)
          Converts a string into the corresponding numeric value.
 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 String CONDOR_VERSION_COMMAND
The condor version command to be executed.

See Also:
Constant Field Values

mRegexExpression

private static final 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 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(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(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 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(String[] args)
The main program to test.

Parameters:
args -


Copyright © 2011 The University of Southern California. All Rights Reserved.