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 CALL_STATE_COMPONENT_PATH
          The call state component path
static java.lang.String CLASS_VERSION
          Class version string
 
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 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.
 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.
 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 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, 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 final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values

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
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

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.

Parameters:
pEnvironmentChangeDetail -
pEnvironmentChangeState -
Throws:
EnvironmentException

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