org.opends.server.util
Class SetupUtils

java.lang.Object
  extended by org.opends.server.util.SetupUtils

@PublicAPI(stability=VOLATILE,
           mayInstantiate=false,
           mayExtend=false,
           mayInvoke=true)
public class SetupUtils
extends java.lang.Object

This class provides a number of utility methods that may be used during the graphical or command-line setup process.


Field Summary
static java.lang.String BUILD_ID
          Build ID.
static java.lang.String BUILD_JAVA_VENDOR
          The java vendor of the JVM used to build.
static java.lang.String BUILD_JAVA_VERSION
          The java version used to generate the build.
static java.lang.String BUILD_JVM_VENDOR
          The vendor of the JVM used to create the build.
static java.lang.String BUILD_JVM_VERSION
          The version of the JVM used to create the build.
static java.lang.String BUILD_NUMBER
          The build number.
static java.lang.String BUILD_OS
          The OS used during the build.
static java.lang.String BUILD_USER
          The user that generated the build.
static java.lang.String DEBUG_BUILD
          Debug build identifier.
static java.lang.String FIX_IDS
          Fix IDs associated with the build.
static java.lang.String INCOMPATIBILITY_EVENTS
          Incompatibilities found between builds (used by the upgrade tool).
static java.lang.String IS_WEBSTART
          Java property used to known if we are using web start or not.
static java.lang.String LAZY_JAR_URLS
          Java property used to know which are the jar files that must be downloaded lazily.
static java.lang.String LIBRARIES_PATH_RELATIVE
          The relative path where all the libraries (jar files) are.
static java.lang.String MAJOR_VERSION
          Major version.
static java.lang.String MINOR_VERSION
          Minor version.
static java.lang.String NAME
          Product name.
static java.lang.String OPENDS_JAVA_HOME
          Specific environment variable used by the scripts to find java.
static java.lang.String POINT_VERSION
          Point version of the product.
static java.lang.String REVISION_NUMBER
          Revision number in SVN.
static java.lang.String VERSION_QUALIFIER
          The version qualifier.
static java.lang.String ZIP_FILE_NAME
          Java property used to know which is the name of the zip file that must be unzipped and whose contents must be extracted during the Web Start based setup.
 
Constructor Summary
SetupUtils()
           
 
Method Summary
static boolean canUseAsPort(int port)
          Returns true if the provided port is free and we can use it, false otherwise.
static boolean canUseAsPort(java.lang.String hostname, int port)
          Returns true if the provided port is free and we can use it, false otherwise.
static java.io.File createTemplateFile(java.lang.String baseDN, int numEntries)
          Creates a MakeLDIF template file using the provided information.
static int getDefaultJMXPort()
          Returns the default value for the JMX Port.
static OperatingSystem getOperatingSystem()
          Commodity method to help identifying the OS we are running on.
static java.lang.String getOSString()
          Returns a String representation of the OS we are running.
static java.lang.String getScriptPath(java.lang.String script)
          Returns the String that can be used to launch an script using Runtime.exec.
static boolean isMacOS()
          Returns true if we are running under Mac OS and false otherwise.
static boolean isPriviledgedPort(int port)
          Returns true if the provided port is a priviledged port, false otherwise.
static boolean isUnix()
          Returns true if we are running under Unix and false otherwise.
static boolean isVista()
          Indicates whether the underlying operating system is Windows Vista.
static boolean isWebStart()
          Indicates whether we are in a web start installation or not.
static boolean isWindows()
          Indicates whether the underlying operating system is a Windows variant.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IS_WEBSTART

public static final java.lang.String IS_WEBSTART
Java property used to known if we are using web start or not.

See Also:
Constant Field Values

OPENDS_JAVA_HOME

public static final java.lang.String OPENDS_JAVA_HOME
Specific environment variable used by the scripts to find java.

See Also:
Constant Field Values

LAZY_JAR_URLS

public static final java.lang.String LAZY_JAR_URLS
Java property used to know which are the jar files that must be downloaded lazily. The current code in WebStartDownloader that uses this property assumes that the URL are separated with an space.

See Also:
Constant Field Values

ZIP_FILE_NAME

public static final java.lang.String ZIP_FILE_NAME
Java property used to know which is the name of the zip file that must be unzipped and whose contents must be extracted during the Web Start based setup.

See Also:
Constant Field Values

LIBRARIES_PATH_RELATIVE

public static final java.lang.String LIBRARIES_PATH_RELATIVE
The relative path where all the libraries (jar files) are.

See Also:
Constant Field Values

NAME

public static final java.lang.String NAME
Product name.

See Also:
Constant Field Values

BUILD_ID

public static final java.lang.String BUILD_ID
Build ID.

See Also:
Constant Field Values

MAJOR_VERSION

public static final java.lang.String MAJOR_VERSION
Major version.

See Also:
Constant Field Values

MINOR_VERSION

public static final java.lang.String MINOR_VERSION
Minor version.

See Also:
Constant Field Values

POINT_VERSION

public static final java.lang.String POINT_VERSION
Point version of the product.

See Also:
Constant Field Values

REVISION_NUMBER

public static final java.lang.String REVISION_NUMBER
Revision number in SVN.

See Also:
Constant Field Values

VERSION_QUALIFIER

public static final java.lang.String VERSION_QUALIFIER
The version qualifier.

See Also:
Constant Field Values

INCOMPATIBILITY_EVENTS

public static final java.lang.String INCOMPATIBILITY_EVENTS
Incompatibilities found between builds (used by the upgrade tool).

See Also:
Constant Field Values

FIX_IDS

public static final java.lang.String FIX_IDS
Fix IDs associated with the build.

See Also:
Constant Field Values

DEBUG_BUILD

public static final java.lang.String DEBUG_BUILD
Debug build identifier.

See Also:
Constant Field Values

BUILD_OS

public static final java.lang.String BUILD_OS
The OS used during the build.

See Also:
Constant Field Values

BUILD_USER

public static final java.lang.String BUILD_USER
The user that generated the build.

See Also:
Constant Field Values

BUILD_JAVA_VERSION

public static final java.lang.String BUILD_JAVA_VERSION
The java version used to generate the build.

See Also:
Constant Field Values

BUILD_JAVA_VENDOR

public static final java.lang.String BUILD_JAVA_VENDOR
The java vendor of the JVM used to build.

See Also:
Constant Field Values

BUILD_JVM_VERSION

public static final java.lang.String BUILD_JVM_VERSION
The version of the JVM used to create the build.

See Also:
Constant Field Values

BUILD_JVM_VENDOR

public static final java.lang.String BUILD_JVM_VENDOR
The vendor of the JVM used to create the build.

See Also:
Constant Field Values

BUILD_NUMBER

public static final java.lang.String BUILD_NUMBER
The build number.

See Also:
Constant Field Values
Constructor Detail

SetupUtils

public SetupUtils()
Method Detail

createTemplateFile

public static java.io.File createTemplateFile(java.lang.String baseDN,
                                              int numEntries)
                                       throws java.io.IOException
Creates a MakeLDIF template file using the provided information.

Parameters:
baseDN - The base DN for the data in the template file.
numEntries - The number of user entries the template file should create.
Returns:
The File object that references the created template file.
Throws:
java.io.IOException - If a problem occurs while writing the template file.

isMacOS

public static boolean isMacOS()
Returns true if we are running under Mac OS and false otherwise.

Returns:
true if we are running under Mac OS and false otherwise.

isUnix

public static boolean isUnix()
Returns true if we are running under Unix and false otherwise.

Returns:
true if we are running under Unix and false otherwise.

isWindows

public static boolean isWindows()
Indicates whether the underlying operating system is a Windows variant.

Returns:
true if the underlying operating system is a Windows variant, or false if not.

isVista

public static boolean isVista()
Indicates whether the underlying operating system is Windows Vista.

Returns:
true if the underlying operating system is Windows Vista, or false if not.

getOSString

public static java.lang.String getOSString()
Returns a String representation of the OS we are running.

Returns:
a String representation of the OS we are running.

getOperatingSystem

public static OperatingSystem getOperatingSystem()
Commodity method to help identifying the OS we are running on.

Returns:
the OperatingSystem we are running on.

canUseAsPort

public static boolean canUseAsPort(java.lang.String hostname,
                                   int port)
Returns true if the provided port is free and we can use it, false otherwise.

Parameters:
hostname - the host name we are analyzing.
port - the port we are analyzing.
Returns:
true if the provided port is free and we can use it, false otherwise.

canUseAsPort

public static boolean canUseAsPort(int port)
Returns true if the provided port is free and we can use it, false otherwise.

Parameters:
port - the port we are analyzing.
Returns:
true if the provided port is free and we can use it, false otherwise.

isPriviledgedPort

public static boolean isPriviledgedPort(int port)
Returns true if the provided port is a priviledged port, false otherwise.

Parameters:
port - the port we are analyzing.
Returns:
true if the provided port is a priviledged port, false otherwise.

getDefaultJMXPort

public static int getDefaultJMXPort()
Returns the default value for the JMX Port.

Returns:
the default value for the JMX Port.

isWebStart

public static boolean isWebStart()
Indicates whether we are in a web start installation or not.

Returns:
true if we are in a web start installation and false if not.

getScriptPath

public static java.lang.String getScriptPath(java.lang.String script)
Returns the String that can be used to launch an script using Runtime.exec. This method is required because in Windows the script that contain a "=" in their path must be quoted.

Parameters:
script - the script name
Returns:
the absolute path for the given parentPath and relativePath.