atg.svc.agent.environment
Class ServiceEnvironmentMonitor

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.svc.agent.environment.EnvironmentMonitor
              extended by atg.svc.agent.environment.ServiceEnvironmentMonitor
All Implemented Interfaces:
atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.logging.ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener, java.util.EventListener

public class ServiceEnvironmentMonitor
extends EnvironmentMonitor

This environment monitor manages changes to the active ticket and active customer.

See Also:
EnvironmentMonitor

Field Summary
static java.lang.String ACTIVE_CUSTOMER_PROFILE_COMPONENT_PATH
          The active customer profile component path
static java.lang.String ACTIVE_TICKET_HOLDER_COMPONENT_PATH
          ticket holder component path
static java.lang.String AGENT_PROFILE_COMPONENT_PATH
          The agent profile component path
static java.lang.String AGENT_PROFILE_SEARCH_REQUEST_TRACKER_PATH
          The path to the agentProfileSearchRequestTracker component
static java.lang.String CALL_STATE_COMPONENT_PATH
          The call state component path
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String CURRENT_SITE_HOLDER_PATH
          The path to the environment's current site holder component
protected static java.lang.String MY_RESOURCES
           
protected  java.util.ResourceBundle sBundle
           
 
Fields inherited from class atg.svc.agent.environment.EnvironmentMonitor
mEnvironmentTools
 
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
ServiceEnvironmentMonitor()
           
 
Method Summary
 void applyActiveCustomerChangeDetail(EnvironmentChangeDetail pEnvironmentChangeDetail, EnvironmentChangeState pEnvironmentChangeState)
          Applies the change to the current active customer based on the change detail.
 void applyActiveTicketChangeDetail(EnvironmentChangeDetail pEnvironmentChangeDetail, EnvironmentChangeState pEnvironmentChangeState)
          Applies the change to the active ticket.
 void applyChanges(EnvironmentChangeState pEnvironmentChangeState)
          Applies changes to the environment based on the details in the environment change state.
 void applySiteChangeDetail(EnvironmentChangeDetail pEnvironmentChangeDetail, EnvironmentChangeState pEnvironmentChangeState)
          Changes the current site based on the change detail.
 void createWarningsForEnvironmentChange(EnvironmentChangeState pEnvironmentChangeState)
          Creates the warnings related to Service environment object changes
protected  void generateChangeDetailsForChangeKey(java.lang.String pChangeKey, EnvironmentChangeState pEnvironmentChangeState)
          This method is called to generate change details for the given change key.
protected  void generateDependentChangeDetails(EnvironmentChangeDetail pEnvironmentChangeDetail, EnvironmentChangeState pEnvironmentChangeState)
          This method is called to generate change details that result from the given EnvironmentChangeDetail.
protected  void generateDependentDetailsForActiveCustomerChange(EnvironmentChangeDetail pEnvironmentChangeDetail, EnvironmentChangeState pEnvironmentChangeState)
          Generates change details that result from a change of profile.
protected  void generateDependentDetailsForActiveTicketChange(EnvironmentChangeDetail pEnvironmentChangeDetail, EnvironmentChangeState pEnvironmentChangeState)
          Generates change details that result from a change of ticket.
protected  void generateInitialChangesForChangeSite(EnvironmentChangeState pEnvironmentChangeState)
          This method creates the initial changes details for the change of site
protected  void generateInitialChangesForInitEnvironment(EnvironmentChangeState pEnvironmentChangeState)
          This method creates the initial change details for the initialize environment change.
 atg.userprofiling.Profile getActiveCustomerProfileComponent()
          Returns the active customer profile component.
 atg.repository.RepositoryItem getActiveTicket()
          Returns the active ticket from the holder.
 java.lang.Object getEnvironmentObject(java.lang.String pEnvironmentObjectName)
          Returns the current customer profile and ticket environment objects
 void initializeNewTicket(java.lang.String pApplicationName, java.lang.String pInboundChannel)
          Initializes a new ticket in the holder
 boolean loadNewProfile(java.lang.String pProfileId)
          Loads a profile item into the active customer profile.
 void postApplyChanges(EnvironmentChangeState pEnvironmentChangeState)
          Sends the start call event for start new call and end and start new call changes and also resets the call state
 void preApplyChanges(EnvironmentChangeState pEnvironmentChangeState)
          Executes ticket disposition handling for the current ticket.
protected  void pushSite(EnvironmentChangeState pEnvironmentChangeState, atg.multisite.Site pSite)
          Pushes the given site into the current site context.
 void revertActiveCustomerChangeDetail(EnvironmentChangeDetail pEnvironmentChangeDetail, EnvironmentChangeState pEnvironmentChangeState)
          Loads the old customer profile contained in the detail as the active customer.
 void revertActiveTicketChangeDetail(EnvironmentChangeDetail pEnvironmentChangeDetail, EnvironmentChangeState pEnvironmentChangeState)
          Loads the old ticket contained in the detail as the active ticket
 void revertChanges(EnvironmentChangeState pEnvironmentChangeState)
          Reverts the active customer and ticket with the original objects before the change was executed.
 void revertSiteChangeDetail(EnvironmentChangeDetail pEnvironmentChangeDetail, EnvironmentChangeState pEnvironmentChangeState)
          Reverts the site change.
 void setActiveTicket(atg.repository.RepositoryItem pTicket)
          Sets the active ticket to the given ticket
 
Methods inherited from class atg.svc.agent.environment.EnvironmentMonitor
generateChangeDetails, getAgentMessagingTools, getEnvironmentTools, initializeDefaultsForProfile, setAgentMessagingTools, setEnvironmentTools
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, 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


ACTIVE_TICKET_HOLDER_COMPONENT_PATH

public static final java.lang.String ACTIVE_TICKET_HOLDER_COMPONENT_PATH
ticket holder component path

See Also:
Constant Field Values

ACTIVE_CUSTOMER_PROFILE_COMPONENT_PATH

public static final java.lang.String ACTIVE_CUSTOMER_PROFILE_COMPONENT_PATH
The active customer profile component path

See Also:
Constant Field Values

AGENT_PROFILE_COMPONENT_PATH

public static final java.lang.String AGENT_PROFILE_COMPONENT_PATH
The agent profile component path

See Also:
Constant Field Values

CALL_STATE_COMPONENT_PATH

public static final java.lang.String CALL_STATE_COMPONENT_PATH
The call state component path

See Also:
Constant Field Values

AGENT_PROFILE_SEARCH_REQUEST_TRACKER_PATH

public static final java.lang.String AGENT_PROFILE_SEARCH_REQUEST_TRACKER_PATH
The path to the agentProfileSearchRequestTracker component

See Also:
Constant Field Values

CURRENT_SITE_HOLDER_PATH

public static final java.lang.String CURRENT_SITE_HOLDER_PATH
The path to the environment's current site holder component

See Also:
Constant Field Values

MY_RESOURCES

protected static final java.lang.String MY_RESOURCES
See Also:
Constant Field Values

sBundle

protected final java.util.ResourceBundle sBundle
Constructor Detail

ServiceEnvironmentMonitor

public ServiceEnvironmentMonitor()
Method Detail

setActiveTicket

public void setActiveTicket(atg.repository.RepositoryItem pTicket)
Sets the active ticket to the given ticket


getActiveTicket

public atg.repository.RepositoryItem getActiveTicket()
Returns the active ticket from the holder.

Returns:
active ticket repository item

getActiveCustomerProfileComponent

public atg.userprofiling.Profile getActiveCustomerProfileComponent()
Returns the active customer profile component.

Returns:
active customer profile component.

generateChangeDetailsForChangeKey

protected void generateChangeDetailsForChangeKey(java.lang.String pChangeKey,
                                                 EnvironmentChangeState pEnvironmentChangeState)
                                          throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                                 EnvironmentException
This method is called to generate change details for the given change key.

This implementation adds details for the following change keys:

Specified by:
generateChangeDetailsForChangeKey in class EnvironmentMonitor
Parameters:
pChangeKey -
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
EnvironmentException
See Also:
ServiceEnvironmentConstants.ENV_CHG_START_NEW_CALL, ServiceEnvironmentConstants.ENV_CHG_CHANGE_ACTIVE_CUSTOMER, ServiceEnvironmentConstants.ENV_CHG_CHANGE_ACTIVE_TICKET

generateInitialChangesForInitEnvironment

protected void generateInitialChangesForInitEnvironment(EnvironmentChangeState pEnvironmentChangeState)
                                                 throws EnvironmentException
This method creates the initial change details for the initialize environment change.

This method initializes profile, ticket and site.

Parameters:
pEnvironmentChangeState -
Throws:
EnvironmentException

generateInitialChangesForChangeSite

protected void generateInitialChangesForChangeSite(EnvironmentChangeState pEnvironmentChangeState)
                                            throws EnvironmentException
This method creates the initial changes details for the change of site

Parameters:
pEnvironmentChangeState -
Throws:
EnvironmentException

generateDependentDetailsForActiveCustomerChange

protected void generateDependentDetailsForActiveCustomerChange(EnvironmentChangeDetail pEnvironmentChangeDetail,
                                                               EnvironmentChangeState pEnvironmentChangeState)
                                                        throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                                               EnvironmentException
Generates change details that result from a change of profile.

Parameters:
pEnvironmentChangeDetail -
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
EnvironmentException

generateDependentDetailsForActiveTicketChange

protected void generateDependentDetailsForActiveTicketChange(EnvironmentChangeDetail pEnvironmentChangeDetail,
                                                             EnvironmentChangeState pEnvironmentChangeState)
                                                      throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                                             EnvironmentException
Generates change details that result from a change of ticket.

Parameters:
pEnvironmentChangeDetail -
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
EnvironmentException

generateDependentChangeDetails

protected void generateDependentChangeDetails(EnvironmentChangeDetail pEnvironmentChangeDetail,
                                              EnvironmentChangeState pEnvironmentChangeState)
                                       throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                              EnvironmentException
This method is called to generate change details that result from the given EnvironmentChangeDetail.

Specified by:
generateDependentChangeDetails in class EnvironmentMonitor
Parameters:
pEnvironmentChangeDetail -
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
EnvironmentException

createWarningsForEnvironmentChange

public void createWarningsForEnvironmentChange(EnvironmentChangeState pEnvironmentChangeState)
                                        throws EnvironmentException
Creates the warnings related to Service environment object changes

Overrides:
createWarningsForEnvironmentChange in class EnvironmentMonitor
Throws:
EnvironmentException
See Also:
EnvironmentChangeState.addWarnings(List),

This is a noop implementation.


preApplyChanges

public void preApplyChanges(EnvironmentChangeState pEnvironmentChangeState)
                     throws EnvironmentException
Executes ticket disposition handling for the current ticket.

Overrides:
preApplyChanges in class EnvironmentMonitor
Throws:
EnvironmentException
See Also:
EnvironmentChangeState.isProcessActiveTicketDisposition(), EnvironmentTools.processTicketDisposition(RepositoryItem, TicketDispositionOptions, String)

applyChanges

public void applyChanges(EnvironmentChangeState pEnvironmentChangeState)
                  throws EnvironmentException
Applies changes to the environment based on the details in the environment change state.

Specified by:
applyChanges in class EnvironmentMonitor
Throws:
EnvironmentException
See Also:
EnvironmentTools.applyChanges(EnvironmentChangeState), EnvironmentMonitor.revertChanges(EnvironmentChangeState)

revertChanges

public void revertChanges(EnvironmentChangeState pEnvironmentChangeState)
Reverts the active customer and ticket with the original objects before the change was executed.

Overrides:
revertChanges in class EnvironmentMonitor
See Also:
EnvironmentTools.applyChanges(EnvironmentChangeState)

postApplyChanges

public void postApplyChanges(EnvironmentChangeState pEnvironmentChangeState)
                      throws EnvironmentException
Sends the start call event for start new call and end and start new call changes and also resets the call state

Overrides:
postApplyChanges in class EnvironmentMonitor
Throws:
EnvironmentException
See Also:
EnvironmentTools.applyChanges(EnvironmentChangeState)

revertActiveCustomerChangeDetail

public void revertActiveCustomerChangeDetail(EnvironmentChangeDetail pEnvironmentChangeDetail,
                                             EnvironmentChangeState pEnvironmentChangeState)
Loads the old customer profile contained in the detail as the active customer.

Parameters:
pEnvironmentChangeDetail -
pEnvironmentChangeState -

applyActiveCustomerChangeDetail

public void applyActiveCustomerChangeDetail(EnvironmentChangeDetail pEnvironmentChangeDetail,
                                            EnvironmentChangeState pEnvironmentChangeState)
                                     throws EnvironmentException
Applies the change to the current active customer based on the change detail.

Parameters:
pEnvironmentChangeDetail -
pEnvironmentChangeState -
Throws:
EnvironmentException

revertActiveTicketChangeDetail

public void revertActiveTicketChangeDetail(EnvironmentChangeDetail pEnvironmentChangeDetail,
                                           EnvironmentChangeState pEnvironmentChangeState)
Loads the old ticket contained in the detail as the active ticket

Parameters:
pEnvironmentChangeDetail -
pEnvironmentChangeState -

applyActiveTicketChangeDetail

public void applyActiveTicketChangeDetail(EnvironmentChangeDetail pEnvironmentChangeDetail,
                                          EnvironmentChangeState pEnvironmentChangeState)
                                   throws EnvironmentException
Applies the change to the active ticket.

If changing to a pre-existing ticket, the ticket is claimed by the agent and re-opened if necessary.

Parameters:
pEnvironmentChangeDetail -
pEnvironmentChangeState -
Throws:
EnvironmentException
See Also:
TicketingTools.workTicket(RepositoryItem, String, RepositoryItem)

initializeNewTicket

public void initializeNewTicket(java.lang.String pApplicationName,
                                java.lang.String pInboundChannel)
                         throws EnvironmentException
Initializes a new ticket in the holder

Parameters:
pApplicationName -
pInboundChannel -
Throws:
EnvironmentException

loadNewProfile

public boolean loadNewProfile(java.lang.String pProfileId)
Loads a profile item into the active customer profile.

Parameters:
pProfileId -
Returns:
true if the load was successfule
See Also:
EnvironmentTools.loadNewProfile(String, Profile)

getEnvironmentObject

public java.lang.Object getEnvironmentObject(java.lang.String pEnvironmentObjectName)
                                      throws EnvironmentException
Returns the current customer profile and ticket environment objects

Specified by:
getEnvironmentObject in class EnvironmentMonitor
Returns:
environment object for the given name
Throws:
EnvironmentException

applySiteChangeDetail

public void applySiteChangeDetail(EnvironmentChangeDetail pEnvironmentChangeDetail,
                                  EnvironmentChangeState pEnvironmentChangeState)
                           throws EnvironmentException
Changes the current site based on the change detail.

Parameters:
pEnvironmentChangeDetail -
pEnvironmentChangeState -
Throws:
EnvironmentException

revertSiteChangeDetail

public void revertSiteChangeDetail(EnvironmentChangeDetail pEnvironmentChangeDetail,
                                   EnvironmentChangeState pEnvironmentChangeState)
Reverts the site change.

Parameters:
pEnvironmentChangeDetail -
pEnvironmentChangeState -

pushSite

protected void pushSite(EnvironmentChangeState pEnvironmentChangeState,
                        atg.multisite.Site pSite)
Pushes the given site into the current site context. The SiteContext is stored in the EnvironmentChangeState and popped off in the reverse order using a transaction synchronization object.

This monitor uses this API when applying or reverting a site change so that the site context is properly set for the remaining of the apply or revert process. For example, other monitors that execute after the site change has been applied or reverted will perform their processing under the correct site context.

Parameters:
pEnvironmentChangeState -
pSite -