com.ibm.commerce.payments.configurator
Class GenericCassetteConfigurator

java.lang.Object
  |
  +--com.ibm.commerce.payments.configurator.CassetteConfiguratorAdapter
        |
        +--com.ibm.commerce.payments.configurator.GenericCassetteConfigurator
All Implemented Interfaces:
com.ibm.commerce.payments.configurator.ICassetteConfigurator

public class GenericCassetteConfigurator
extends CassetteConfiguratorAdapter

The GenericCassetteConfigurator class. Supports the configuration of cassettes into a specific WCPayments instance.

This class adds some of creates/remove/migrate tables in the instance database on behave of cassettes. If a cassette does not specify a Cassette Configuration class within their cassette_properties.xml, the system will use this class to add/remove/migrate their tables.

Cassette developers can extend this class if they choose to, they will only need to implements the one following methods:


Fields inherited from interface com.ibm.commerce.payments.configurator.ICassetteConfigurator
CASSETTE_CLASSPATH, CASSETTE_CONFIG_CLASS, CASSETTE_NAME, CASSETTE_VENDOR, CASSETTE_VERSION, MIN_FRAMEWORK_VERSION
 
Constructor Summary
GenericCassetteConfigurator()
           
 
Method Summary
 void addToInstance(IDatabase database, java.util.Properties properties)
          Adds the cassette into the target Commerce Payments instance.
 java.util.Map getSystemProperties()
          Gets the system propeties required for a cassette to be added
 void migrate(IDatabase database, java.lang.String currentVersion)
          Upgrades the cassette to the current version in the target Commerce Payments instance.
 void removeFromInstance(IDatabase database)
           Removes the cassette from target Commerce Payments instance.
 
Methods inherited from class com.ibm.commerce.payments.configurator.CassetteConfiguratorAdapter
copyCassetteToEAR, getArchiveName, getConfigClass, getCreateScript, getDatabaseScripts, getDatabaseType, getDeleteScript, getLastCopiedTime, getMigrateScript, getMinFrameworkVersion, getName, getPspl, getRequiredParameters, getVendor, getVersion, init, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GenericCassetteConfigurator

public GenericCassetteConfigurator()
Method Detail

addToInstance

public void addToInstance(IDatabase database,
                          java.util.Properties properties)
                   throws CassetteAlreadyExistsException,
                          CassetteCannotBeAddedException,
                          DatabaseOperationFailedException
Adds the cassette into the target Commerce Payments instance.
Parameters:
database - Represents the Payments instance database
properties - Optional parameter with specific cassette properties
Throws:
CassetteAlreadyExistsException - Thrown if the cassette already exists in the target PM instance
CassetteCannotBeAddedException - Thrown if the cassette does not exist in the target Payments instance but cannot be added to that instance; this can be used to signalize a temporary problem, e.g., specific cassette properties are missing
DatabaseOperationFailedException - Thrown if a database operation failed preventing the addition of the cassette in the target Payments instance

removeFromInstance

public void removeFromInstance(IDatabase database)
                        throws CassetteDoesNotExistException,
                               CassetteCannotBeRemovedException,
                               DatabaseOperationFailedException

Removes the cassette from target Commerce Payments instance.

Parameters:
database - Represents the Payments instance database
Throws:
CassetteDoesNotExistException - Thrown if the cassette does not exist in the target PM instance
CassetteCannotBeRemovedException - Thrown if the cassette exists in the target Payments instance but cannot be removed from the instance; this can be used to signalize a temporary problem, e.g., pending requests need to be processed, or the cassette must be inactivated first
DatabaseOperationFailedException - Thrown if a database operation failed preventing the remotion of the cassette from the target Payments instance

migrate

public void migrate(IDatabase database,
                    java.lang.String currentVersion)
             throws CassetteDoesNotExistException,
                    com.ibm.commerce.payments.configurator.InvalidMigrationException,
                    MigrationErrorException,
                    DatabaseOperationFailedException
Upgrades the cassette to the current version in the target Commerce Payments instance. The cassette has to figurate out its current version and assess the validity of the migration.
Parameters:
database - represents the Payments instance database
targetVersion - the new version number in a String value
Throws:
CassetteDoesNotExistException - Thrown if the cassette does not exist in the target PM instance
com.ibm.commerce.payments.configurator.InvalidMigrationException - Thrownn if the migration is not supported for the current and target versions of the cassette
MigrationErrorException - Thrown if the cassette cannot be migrated to the target version of the cassette; this can be used to signalize a temporary problem, e.g., pending requests need to be processed, or the cassette must be inactivated first
DatabaseOperationFailedException - Thrown if a database operation failed preventing the migration of the cassette in target PM instance

getSystemProperties

public java.util.Map getSystemProperties()
Gets the system propeties required for a cassette to be added
Returns:
properties Properties object containing the system properties, or null if there are not any system properties