Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jasig.portal.tools.versioning
Class VersionsManager

    java.lang.Object
      org.jasig.portal.tools.versioning.VersionsManager

    public class VersionsManager

extends java.lang.Object

Provides access to and persistence of version information for pieces of code installed in the portal. Identification of pieces of code is by functional name. Version is represented by three integers. In most significant order these are Major, Minor, and Micro.

Version:
  $Revision: 1.3 $
Author:
  Mark Boyd

Field Summary
`private static VersionsManager` | `instance`
`private static org.apache.commons.logging.Log` | `log`
`private static java.util.LinkedList` | `versions`
`private static Version[]` | `VERSIONS_ARRAY_TYPE`

Constructor Summary
`private` | `VersionsManager()`

Method Summary
`static VersionsManager` | `getInstance()` Returns the singleton instance of the VersionsManager.
`Version` | `getVersion(java.lang.String fname)` Returns the version for a specified functional name or null if no version information is available.
`Version[]` | `getVersions()` Returns an array of Versions representing all version information registered with the VersionsManager.
`private boolean` | `insertVersion(java.lang.String fname, java.lang.String description, int major, int minor, int micro)` Attempts to insert new version information into the database.
`private static java.util.LinkedList` | `loadVersions()` Loads all version information from the back end database and returns it as a LinkedList containing Version objects.
`private boolean` | `remove(Version v)` Removes this version from the backend database.
`boolean` | `removeVersion(java.lang.String fname)` Removes version information for the specified functional name.
`boolean` | `setVersion(java.lang.String fname, java.lang.String description, int major, int minor, int micro)` Updates the version information for the indicated functional name to the passed in values only if: a) a version already exists and the values in the database match those obtained via getVersion(fname).
`private boolean` | `updateVersion(Version old, Version next)` Attempts to update version information in the database.
`private static void` | `updateVersions()` Updates the cached version information from the database.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    private static final org.apache.commons.logging.Log log

### VERSIONS_ARRAY_TYPE

    private static final Version[] VERSIONS_ARRAY_TYPE

### instance

    private static final VersionsManager instance

### versions

    private static java.util.LinkedList versions

Constructor Detail

### VersionsManager

    private VersionsManager()

Method Detail

### loadVersions

    private static java.util.LinkedList loadVersions()

  Loads all version information from the back end database and returns it as a LinkedList containing Version objects.

  Returns:
    java.util.LinkedList

### updateVersions

    private static void updateVersions()

  Updates the cached version information from the database.

### getInstance

    public static final VersionsManager getInstance()

  Returns the singleton instance of the VersionsManager.

  Returns:
    VersionManager

### getVersions

    public Version[] getVersions()

  Returns an array of Versions representing all version information registered with the VersionsManager.

  Returns:
    Version[]

### getVersion

    public Version getVersion(java.lang.String fname)

  Returns the version for a specified functional name or null if no version information is available.

  Parameters:
    `fname` - java.lang.String
  Returns:
    Version

### removeVersion

    public boolean removeVersion(java.lang.String fname)

  Removes version information for the specified functional name. Returns true if version information existed and was removed.

  Parameters:
    `fname` - java.lang.String
  Returns:
    boolean

### remove

    private boolean remove(Version v)

  Removes this version from the backend database. Returns true if version information was indeed removed.

  Parameters:
    `v` -
  Returns:
    boolean

### setVersion

    public boolean setVersion(java.lang.String fname,
                              java.lang.String description,
                              int major,
                              int minor,
                              int micro)

  Updates the version information for the indicated functional name to the passed in values only if: a) a version already exists and the values in the database match those obtained via getVersion(fname). A database update is performed in this case. b) a version does not already exist for this functional name. A database insert is performed in this case. Returns true if this call resulted in a database change. Use of primary keys in the database table is critical for (b) in the scenario where more than one portal is running against the same database to prevent two inserts to the table from succeeding and masking which portal successfully changed the version.

  Parameters:
    `fname` -
    `major` -
    `minor` -
    `micro` -
  Returns:
    boolean

### updateVersion

    private boolean updateVersion(Version old,
                                  Version next)

  Attempts to update version information in the database. Returns true if the update was successful, false otherwise. If multiple portals share the same database two portals may try this at the same time and one should fail since the major, minor, and/or micro versions had in cache will not map to those now in the database.

  Parameters:
    `old` -
    `next` -
  Returns:
    boolean

### insertVersion

    private boolean insertVersion(java.lang.String fname,
                                  java.lang.String description,
                                  int major,
                                  int minor,
                                  int micro)

  Attempts to insert new version information into the database. Returns true if the insert was successful, false otherwise. If multiple portals share the same database two portals may try this at the same time and one should fail provided primary keys have been specified for the table.

  Parameters:
    `fname` -
    `major` -
    `minor` -
    `micro` -
  Returns:
    boolean

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD