de.esprit.appsuite.jversion

## Class JavaVersionManager<C extends ApplicationContext>

- java.lang.Object
- - de.esprit.common.util.DumpableObject
  - - de.esprit.appsuite.launch.AbstractApplicationObject<C>
    - - de.esprit.appsuite.launch.AbstractInitializableObject<C>
      - - de.esprit.appsuite.launch.AsyncInitializableObject<C>
        - - de.esprit.appsuite.jversion.JavaVersionManager<C>

- All Implemented Interfaces:
    ApplicationObject<C>, AsyncInitializable, Initializable, SimpleLogSupport, Dumpable

      public class JavaVersionManager<C extends ApplicationContext>
      extends AsyncInitializableObject<C>

  This class scans the file system for available java installations. The lookup path must be defined in the JAVA_INSTALLATION_PATH env-variable. It returns a list of detected versions encapsulated in `JavaVersion` objects. Note: if the env-variable is not set, then the java.home property is used as a default for determining the base installation path for scanning.
  Author:
    Rainer Buesch

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JavaVersionManager(C ctx)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `AsyncTask` | `buildScanJavaVersionTask()`
    `AsyncTask` | `buildScanJavaVersionWFT(AbstractWorkflow workflow)`
    `protected AsyncTask` | `createInitTask()`
    `TaskAction` | `getActionInit()`
    `JavaVersion[]` | `getJavaVersions()` Returns the available Java versions that have been found on the local system.
    `JavaVersion` | `getLatestJavaVersion()` Returns the latest java version of all installed java versions.
    `JavaVersion` | `getLatestJavaVersionOf(JavaTechnology technology)` Returns the latest java version for the given technology.
    `void` | `init()` Note that initialization scans for all java versions in the system.
    `JavaVersion[]` | `scanJavaVersions()` Scans the file system for available Java versions.
    `void` | `setScanPathEnvironmentVariableName(java.lang.String variableName)` Sets the name for the environment variable which is supposed to store the path to be scanned.
    `void` | `setVersionComparator(java.util.Comparator<JavaVersion> cmp)` Resorts the version list according to the given comparator.

    - ### Methods inherited from class de.esprit.appsuite.launch.AsyncInitializableObject

      `awaitInitialized, checkInitialized, initAsyc, setInitialized`

    - ### Methods inherited from class de.esprit.appsuite.launch.AbstractInitializableObject

      `isInitialized`

    - ### Methods inherited from class de.esprit.appsuite.launch.AbstractApplicationObject

      `getApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel`

    - ### Methods inherited from class de.esprit.common.util.DumpableObject

      `configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface de.esprit.appsuite.launch.Initializable

      `isInitialized`

- - ### Constructor Detail

    - #### JavaVersionManager

          public JavaVersionManager(C ctx)

  - ### Method Detail

    - #### getActionInit

          public final TaskAction getActionInit()

    - #### setVersionComparator

          public final void setVersionComparator(java.util.Comparator<JavaVersion> cmp)

      Resorts the version list according to the given comparator. If set to null, then the default comparator is used.

    - #### setScanPathEnvironmentVariableName

          public final void setScanPathEnvironmentVariableName(java.lang.String variableName)

      Sets the name for the environment variable which is supposed to store the path to be scanned. The default name is AppSuiteEnv.JAVA_INSTALLATION_PATH.

    - #### getJavaVersions

          public final JavaVersion[] getJavaVersions()

      Returns the available Java versions that have been found on the local system. Note that you must call `scanJavaVersions()` for an initial scan.
      See Also:
        `scanJavaVersions()`

    - #### getLatestJavaVersion

          public final JavaVersion getLatestJavaVersion()

      Returns the latest java version of all installed java versions. May return null if no java is installed or no version has been found by a version-scan.

    - #### getLatestJavaVersionOf

          public final JavaVersion getLatestJavaVersionOf(JavaTechnology technology)

      Returns the latest java version for the given technology. May return null if no java of the given technology is installed.

    - #### init

          public void init()
                    throws java.lang.Exception

      Note that initialization scans for all java versions in the system. This is quite slow and should only be done when actually needed.
      Specified by:
        `init` in interface `Initializable`
      Specified by:
        `init` in class `AbstractInitializableObject<C extends ApplicationContext>`
      Throws:
        `java.lang.Exception`
      See Also:
        `AsyncInitializableObject.initAsyc()`

    - #### scanJavaVersions

          public final JavaVersion[] scanJavaVersions()
                                               throws java.lang.Exception

      Scans the file system for available Java versions. Note that the scanPathVarName env-variable must be set in order to define the lookup locations (in same syntax an the PATH system variable). This method should be called once for initialization.
      Throws:
        `java.lang.Exception`

    - #### createInitTask

          protected AsyncTask createInitTask()

      Overrides:
        `createInitTask` in class `AsyncInitializableObject<C extends ApplicationContext>`

    - #### buildScanJavaVersionTask

          public final AsyncTask buildScanJavaVersionTask()

    - #### buildScanJavaVersionWFT

          public final AsyncTask buildScanJavaVersionWFT(AbstractWorkflow workflow)

Copyright © 2014 EsprIT-Systems. All Rights Reserved.