org.cafesip.upgrade.patchers
Class JdbcPatchEngine

java.lang.Object
  extended by org.cafesip.upgrade.patchers.JdbcPatchEngine
All Implemented Interfaces:
PatchEngine

public class JdbcPatchEngine
extends java.lang.Object
implements PatchEngine

This class persists patch information for a given installation. It provides the upgrader tool information about the current patch level and can set patch level among other things. This class uses a database to persist the information and uses JDBC to connect to the database.

Author:
Amit Chatterjee

Constructor Summary
JdbcPatchEngine()
           
 
Method Summary
 void addPatchInfo(int level)
          Add new patch information.
 void close()
          Close connection to the persistence layer.
 void commit()
          Commit all the patch information added by the upgrade process along with other changes executed by patch scripts.
 int getPatchLevel()
          Returns the current patch level.
 void init()
          This method is called immediately upon instantiation of the patch engine object.
 void rollback()
          Rolls back all the patch information added during the upgrade process along with other changes executed by the patch script.
 void setAutoCommit(boolean value)
          Sets auto-commit to on or off.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcPatchEngine

public JdbcPatchEngine()
Method Detail

addPatchInfo

public void addPatchInfo(int level)
                  throws java.lang.Exception
Description copied from interface: PatchEngine
Add new patch information. This method is invoked after a patch has been executed succesfully and the system wants to persist the patch information.

Specified by:
addPatchInfo in interface PatchEngine
Throws:
java.lang.Exception

getPatchLevel

public int getPatchLevel()
                  throws java.lang.Exception
Description copied from interface: PatchEngine
Returns the current patch level.

Specified by:
getPatchLevel in interface PatchEngine
Returns:
the patch level.
Throws:
java.lang.Exception

init

public void init()
          throws java.lang.Exception
Description copied from interface: PatchEngine
This method is called immediately upon instantiation of the patch engine object. It enables a patch engine object to perform any initialization function. If the initialization fails, this method must throw an exception.

Specified by:
init in interface PatchEngine
Throws:
java.lang.Exception

commit

public void commit()
            throws java.lang.Exception
Description copied from interface: PatchEngine
Commit all the patch information added by the upgrade process along with other changes executed by patch scripts. If a database is used to persist the patch information, the implementing method could use a JDBC commit() at this point.

Specified by:
commit in interface PatchEngine
Throws:
java.lang.Exception

rollback

public void rollback()
              throws java.lang.Exception
Description copied from interface: PatchEngine
Rolls back all the patch information added during the upgrade process along with other changes executed by the patch script.

Specified by:
rollback in interface PatchEngine
Throws:
java.lang.Exception

close

public void close()
           throws java.lang.Exception
Description copied from interface: PatchEngine
Close connection to the persistence layer. This is the final method that is invoked by the tool.

Specified by:
close in interface PatchEngine
Throws:
java.lang.Exception

setAutoCommit

public void setAutoCommit(boolean value)
                   throws java.lang.Exception
Description copied from interface: PatchEngine
Sets auto-commit to on or off. By default the implementing class must set auto-commit to false;

Specified by:
setAutoCommit in interface PatchEngine
Parameters:
value - true or false.
Throws:
java.lang.Exception


Copyright © 2009 CafeSip.org. All Rights Reserved.