atg.droplet.sql
Class SwitchDataSourceFormHandler

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.droplet.EmptyFormHandler
              extended by atg.droplet.GenericFormHandler
                  extended by atg.droplet.sql.SwitchDataSourceFormHandler
All Implemented Interfaces:
DropletFormHandler, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class SwitchDataSourceFormHandler
extends GenericFormHandler

This form handler allows a SwitchingDataSource to be switch through jhtml.

See Also:
SwitchingDataSource

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.droplet.GenericFormHandler
PARAM_DEFER_FORWARD_OR_REDIRECT, PARAM_USE_FORWARDS
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
SwitchDataSourceFormHandler()
           
 
Method Summary
 java.lang.String getErrorURL()
          where to go on error
 java.lang.String getNextDataSource()
          The name of the data source to switch to.
 java.lang.String getSuccessURL()
          Where to go on success
 SwitchingDataSource getSwitchingDataSource()
          This is the data source being controlled by this form handler.
 boolean handlePrepareForSwitch(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Switching a data source is a two step process.
 boolean handleSwitchDataSource(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This handler method performs the second step in the switch process: the switch.
 void setErrorURL(java.lang.String pErrorURL)
           
 void setNextDataSource(java.lang.String pNextDataSource)
           
 void setSuccessURL(java.lang.String pSuccessURL)
           
 void setSwitchingDataSource(SwitchingDataSource pSwitchingDataSource)
           
 
Methods inherited from class atg.droplet.GenericFormHandler
addFormException, addUncheckedFormException, afterSet, beforeSet, checkFormRedirect, createFormSubmissionMessage, getCancelURL, getCheckForValidSession, getFormError, getFormExceptions, getFormName, getMessagePort, getMessageSource, getMessageType, getPropertyExceptions, getSendMessages, getUncheckedFormExceptions, handleCancel, handleFormException, handleUncheckedFormException, hasUncheckedFormExceptions, isDeferForwardsAndRedirects, isRestorableForm, isUseForwards, isValidSession, redirectOrForward, resetFormExceptions, setCancelURL, setCheckForValidSession, setDeferForwardsAndRedirects, setFormName, setMessagePort, setMessageSource, setMessageType, setRestorableForm, setSendMessages, setUseForwards
 
Methods inherited from class atg.droplet.EmptyFormHandler
afterGet, beforeGet
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

SwitchDataSourceFormHandler

public SwitchDataSourceFormHandler()
Method Detail

setSwitchingDataSource

public void setSwitchingDataSource(SwitchingDataSource pSwitchingDataSource)

getSwitchingDataSource

public SwitchingDataSource getSwitchingDataSource()
This is the data source being controlled by this form handler. The switch will happen on this data source.


setNextDataSource

public void setNextDataSource(java.lang.String pNextDataSource)

getNextDataSource

public java.lang.String getNextDataSource()
The name of the data source to switch to. This name is mapped to a DataSource in the SwitchingDataSource.


setSuccessURL

public void setSuccessURL(java.lang.String pSuccessURL)

getSuccessURL

public java.lang.String getSuccessURL()
Where to go on success


setErrorURL

public void setErrorURL(java.lang.String pErrorURL)

getErrorURL

public java.lang.String getErrorURL()
where to go on error


handlePrepareForSwitch

public boolean handlePrepareForSwitch(DynamoHttpServletRequest pRequest,
                                      DynamoHttpServletResponse pResponse)
                               throws javax.servlet.ServletException,
                                      java.io.IOException
Switching a data source is a two step process. This handler performs step one: preparing the data source. It will call the method prepareNextDataSource on hte SwitchingDataSource.

Parameters:
pRequest - The request object.
pResponse - The response object.
Returns:
true if succesful, false otherwise
Throws:
javax.servlet.ServletException
java.io.IOException
See Also:
SwitchingDataSource.prepareNextDataSource(java.lang.String)

handleSwitchDataSource

public boolean handleSwitchDataSource(DynamoHttpServletRequest pRequest,
                                      DynamoHttpServletResponse pResponse)
                               throws javax.servlet.ServletException,
                                      java.io.IOException
This handler method performs the second step in the switch process: the switch. It calls the performSwitch method on the SwitchingDataSource

Parameters:
pRequest - The request object.
pResponse - The response object.
Returns:
true if succesful, false otherwise
Throws:
javax.servlet.ServletException
java.io.IOException
See Also:
SwitchingDataSource.performSwitch()