org.lyra
Class Patch

java.lang.Object
  extended by org.lyra.Patch

public class Patch
extends java.lang.Object

Patch is a class that checks to ensure that the Host and Configuration databases are up to the version of Lyra that is making use of it. This will effectively permit users to keep their settings and options.

Implementation is rather primitive. It will check for version information and then create the changes accordingly. Since the versions are checked sequentially, a client at 1.0.0 will have no problem being upgraded to 1.0.5 without consequence.

Since:
1.0.1
Version:
1.0.5, %Revision, 176%, %LastChangedDate, 27/10/12 6:01PM%
Author:
Martin Foster

Field Summary
private static java.lang.String CLASS
           
private  Interface Db
           
private  Ledger Logger
           
private  java.lang.String Version
           
 
Constructor Summary
private Patch(Ledger logger, Interface db, java.lang.String version)
          Main constructor for class.
 
Method Summary
private  boolean compareVersion(java.lang.String current, java.lang.String target)
          Lyra makes use of the same designation for all of its versions and that means the Version.Major.Minor numbering scheme.
private  void confirmHost()
          Looks at the version information and will perform the necessary database updates in order to ensure they go through.
private  void confirmMain()
          Looks at the version information and will perform the necessary database updates in order to ensure they go through.
static void hostPatch(Ledger logger, Interface db, java.lang.String version)
          Static function which will handle all of the database updates necessary in order to actively bring older versions of host database.
static void mainPatch(Ledger logger, Interface db, java.lang.String version)
          Static function which will handle all of the database updates necessary in order to actively bring older versions of main database.
private  void updateVersion(java.util.List<java.lang.String> updates)
          Will cycle through all of the updates and insert them into a singular transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Db

private Interface Db

Logger

private Ledger Logger

Version

private java.lang.String Version

CLASS

private static final java.lang.String CLASS
See Also:
Constant Field Values
Constructor Detail

Patch

private Patch(Ledger logger,
              Interface db,
              java.lang.String version)
Main constructor for class.

Parameters:
logger - Ledger interface for logging.
db - Direct database handle.
version - Version information.
Method Detail

hostPatch

public static void hostPatch(Ledger logger,
                             Interface db,
                             java.lang.String version)
Static function which will handle all of the database updates necessary in order to actively bring older versions of host database. Since multiple hosts are permitted this may employed often.

Parameters:
logger - Ledger interface for logging.
db - Direct database handle.
version - Version information.

mainPatch

public static void mainPatch(Ledger logger,
                             Interface db,
                             java.lang.String version)
Static function which will handle all of the database updates necessary in order to actively bring older versions of main database.

Parameters:
logger - Ledger interface for logging.
db - Direct database handle.
version - Version information.

compareVersion

private boolean compareVersion(java.lang.String current,
                               java.lang.String target)
Lyra makes use of the same designation for all of its versions and that means the Version.Major.Minor numbering scheme. This will permit us to compare the versions and determine if a patch must be applied.

Parameters:
current - Current version to check.
target - Target version to compare against.
Returns:
boolean indicating elements.

confirmHost

private void confirmHost()
Looks at the version information and will perform the necessary database updates in order to ensure they go through.


confirmMain

private void confirmMain()
Looks at the version information and will perform the necessary database updates in order to ensure they go through.


updateVersion

private void updateVersion(java.util.List<java.lang.String> updates)
Will cycle through all of the updates and insert them into a singular transaction.

Parameters:
updates - List containing all of the updates to complete for a version.