org.cafesip.upgrade
Interface PatchEngine

All Known Implementing Classes:
JdbcPatchEngine

public interface PatchEngine

An interface that patch engines must implement. A patch engine acts as a persistence layer for patch information. It is used by the upgrader tool to store and retrieve patch information among other things. A default patch engine is provided by the tool org.cafesip.upgrade.patchers.JdbcPathEngine but application can override the default patch engine by setting the property - org.cafesip.upgrade.custom.patcher. The the value for the property must contain a fully qualified class name of the patch engine.

Author:
Amit Chatterjee

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.
 

Method Detail

init

void init()
          throws java.lang.Exception
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.

Throws:
java.lang.Exception

getPatchLevel

int getPatchLevel()
                  throws java.lang.Exception
Returns the current patch level.

Returns:
the patch level.
Throws:
java.lang.Exception

addPatchInfo

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

Parameters:
level -
Throws:
java.lang.Exception

commit

void commit()
            throws java.lang.Exception
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.

Throws:
java.lang.Exception

rollback

void rollback()
              throws java.lang.Exception
Rolls back all the patch information added during the upgrade process along with other changes executed by the patch script.

Throws:
java.lang.Exception

close

void close()
           throws java.lang.Exception
Close connection to the persistence layer. This is the final method that is invoked by the tool.

Throws:
java.lang.Exception

setAutoCommit

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

Parameters:
value - true or false.
Throws:
java.lang.Exception


Copyright © 2009 CafeSip.org. All Rights Reserved.