atg.service.actor
Class ActorChainService

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.service.actor.ActorChainService
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, Actor, VariantActor, java.util.EventListener

@Service(requiredProperties="definitionFile")
public class ActorChainService
extends GenericService
implements VariantActor

The ActorChainService reads actors from an xml definition file. The file defines one or more actor chains. This service passes control to the actor chain to execute the chain's actors. Actor nucleus components will use the this class to define an actor component.

If you want to use custom getActorContextFactory() and getModelMapFactory() instead of the OTB factories, you can configure them in this component. These factories are used use the nest chains as well.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String ERROR_ACTOR_CONTEXT_OR_MODEL_MAP_NULL
           
static java.lang.String ERROR_ACTOR_NAME_NULL
           
static java.lang.String ERROR_ACTOR_OR_MESSAGE
           
static java.lang.String ERROR_ACTOR_VALUE_NULL
           
static java.lang.String ERROR_EXPECTED_MAP_VALUE
           
static java.lang.String ERROR_REQUEST_NULL
           
protected  ActorContextFactory mActorContextFactory
           
protected  atg.xml.XMLFile mDefinitionFile
           
protected  java.lang.String mJAXBContextPath
           
protected  ModelMapFactory mModelMapFactory
           
 
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
ActorChainService()
           
 
Method Summary
 void act(ActorContext pActorContext, ModelMap pModelMap)
          This method takes a non-null ActorContext and a non-null ModelMap.
protected  javax.servlet.Servlet createAdminServlet()
          Create the administration servlet.
protected  atg.service.actor.ObjectFactory createObjectFactoryInstance()
          This method creates an actor framework ObjectFactory instance.
 void doStartService()
          This method is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values.
 java.util.List<atg.service.actor.ActorChain> getActorChains()
           
 atg.service.actor.ActorChainValidationService getActorChainValidationService()
           
 ActorContextFactory getActorContextFactory()
          Returns the actorContextFactory
 java.lang.String getDefaultActorChainId()
          This method calls ActorTemplate.computeDefaultActorChainId() to get the default chain id for this actor chain service.
 atg.xml.XMLFile getDefinitionFile()
          Returns the definitionFile
protected  java.lang.String getJAXBContextPath()
          Returns the jAXBContextPath
 ModelMapFactory getModelMapFactory()
          Returns the modelMapFactory
protected  java.util.List<Actor> getSortedActors(ActorContext pActorContext, java.util.List<Actor> pUnsortedActors)
          This method takes unsorted actors and sorts them based on the follows and followsIfPresent xml definitions of an actor definition.
protected  void initializeActorTemplate()
          This method calls unmarshal(XMLFile) to un-marshal the xml file and initializes actorTemplate property.
 boolean isEnableValidateComponentExists()
          Should validation check if the chains in this component that contain component actors reference components that exist?
 boolean isEnableValidateComponentInputs()
          Should validation check if the chains in this actor that contain component have valid inputs
 boolean isEnableValidateComponentMethod()
          Should validation check if the chains in this actor that contain components with methods have a valid method
 boolean isEnableValidateDefaultChainId()
          Should validation check for a valid default chain id
 boolean isEnableValidateDropletExists()
          Should validation check if the chains in this actor that contain droplet actors reference droplet that exist?
 boolean isEnableValidateDropletInputsUseTernaryOperator()
          Should validation check if the droplet inputs use ternary operator?
 boolean isEnableValidateFormInputs()
          Should validation check if the chains in this actor that contain form actors reference inputs that exist?
 boolean isEnableValidateFoward()
          Should validation check if the chains in this actor that contain form actors have a success or error URL that is handling forward/redirect incorrectly?
 boolean isEnableValidateHandleMethodExists()
          Should validation check that handle method exists
 boolean isEnableValidateInputsExist()
          Should validation check that inputs exist
 boolean isEnableValidateNestedActorExists()
          Should validation check if the chains in this actor that contain nested actors reference actors that exist?
 boolean isEnableValidateRegistration()
          Should validation check if the chains in this component are registered for REST access? Validation logs an info if not registered.
 boolean isEnableValidateSuccessErrorUrlExist()
          Should validation check if the chains in this actor that contain form actors have a success and error URL?
 void reinitializeActorTemplate()
          If the getDefinitionFile() has been modified, then this method calls initializeActorTemplate() to initialize the actor template
 void setActorChainValidationService(atg.service.actor.ActorChainValidationService pActorChainValidationService)
           
 void setActorContextFactory(ActorContextFactory pActorContextFactory)
          Sets the actorContextFactory
protected  void setActorTemplate(atg.service.actor.ActorTemplate pActorTemplate)
          Sets the actorTemplate
 void setDefinitionFile(atg.xml.XMLFile pDefinitionFile)
          Sets the definitionFile
 void setEnableValidateComponentExists(boolean pEnableValidateComponentExists)
          Should validation check if the chains in this component that contain component actors reference components that exist?
 void setEnableValidateComponentInputs(boolean pEnableValidateComponentInputs)
          Should validation check if the chains in this actor that contain component have valid inputs
 void setEnableValidateComponentMethod(boolean pEnableValidateComponentMethod)
          Should validation check if the chains in this actor that contain components with methods have a valid method
 void setEnableValidateDefaultChainId(boolean pEnableValidateDefaultChainId)
          Should validation check for a valid default chain id
 void setEnableValidateDropletExists(boolean pEnableValidateDropletExists)
          Should validation check if the chains in this actor that contain droplet actors reference droplet that exist?
 void setEnableValidateDropletInputsUseTernaryOperator(boolean pEnableValidateDropletInputsUseTernaryOperator)
          Should validation check if the droplet inputs use ternary operator?
 void setEnableValidateFormInputs(boolean pEnableValidateFormInputs)
          Should validation check if the chains in this actor that contain form actors reference inputs that exist?
 void setEnableValidateFoward(boolean pEnableValidateFoward)
          Should validation check if the chains in this actor that contain form actors have a success or error URL that is handling forward/redirect incorrectly?
 void setEnableValidateHandleMethodExists(boolean pEnableValidateHandleMethodExists)
          Should validation check for that handle method exists
 void setEnableValidateInputsExist(boolean pEnableValidateInputsExist)
          Should validation check for that inputs exist
 void setEnableValidateNestedActorExists(boolean pEnableValidateNestedActorExists)
          Should validation check if the chains in this actor that contain nested actors reference actors that exist?
 void setEnableValidateRegistration(boolean pEnableValidateRegistration)
          Should validation check if the chains in this component are registered for REST access? Validation logs an info if not registered.
 void setEnableValidateSuccessErrorUrlExist(boolean pEnableValidateSuccessErrorUrlExist)
          Should validation check if the chains in this actor that contain form actors have a success and error URL?
protected  void setJAXBContextPath(java.lang.String pJAXBContextPath)
          Sets the jAXBContextPath
 void setModelMapFactory(ModelMapFactory pModelMapFactory)
          Sets the modelMapFactory
protected  atg.service.actor.ActorTemplate unmarshal(atg.xml.XMLFile pXMLFile)
          This method un-marshals actor xml definitions into actorTemplate property.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, 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


ERROR_ACTOR_CONTEXT_OR_MODEL_MAP_NULL

public static final java.lang.String ERROR_ACTOR_CONTEXT_OR_MODEL_MAP_NULL
See Also:
Constant Field Values

ERROR_REQUEST_NULL

public static final java.lang.String ERROR_REQUEST_NULL
See Also:
Constant Field Values

ERROR_ACTOR_NAME_NULL

public static final java.lang.String ERROR_ACTOR_NAME_NULL
See Also:
Constant Field Values

ERROR_ACTOR_VALUE_NULL

public static final java.lang.String ERROR_ACTOR_VALUE_NULL
See Also:
Constant Field Values

ERROR_ACTOR_OR_MESSAGE

public static final java.lang.String ERROR_ACTOR_OR_MESSAGE
See Also:
Constant Field Values

ERROR_EXPECTED_MAP_VALUE

public static final java.lang.String ERROR_EXPECTED_MAP_VALUE
See Also:
Constant Field Values

mActorContextFactory

protected ActorContextFactory mActorContextFactory

mModelMapFactory

protected ModelMapFactory mModelMapFactory

mDefinitionFile

protected atg.xml.XMLFile mDefinitionFile

mJAXBContextPath

protected java.lang.String mJAXBContextPath
Constructor Detail

ActorChainService

public ActorChainService()
Method Detail

getActorContextFactory

public ActorContextFactory getActorContextFactory()
Returns the actorContextFactory

Returns:
the actorContextFactory

setActorContextFactory

public void setActorContextFactory(ActorContextFactory pActorContextFactory)
Sets the actorContextFactory

Parameters:
pActorContextFactory - the actorContextFactory to set

getModelMapFactory

public ModelMapFactory getModelMapFactory()
Returns the modelMapFactory

Returns:
the modelMapFactory

setModelMapFactory

public void setModelMapFactory(ModelMapFactory pModelMapFactory)
Sets the modelMapFactory

Parameters:
pModelMapFactory - the modelMapFactory to set

setActorTemplate

protected void setActorTemplate(atg.service.actor.ActorTemplate pActorTemplate)
Sets the actorTemplate

Parameters:
pActorTemplate - the actorTemplate to set

getDefinitionFile

public atg.xml.XMLFile getDefinitionFile()
Returns the definitionFile

Returns:
the definitionFile

setDefinitionFile

public void setDefinitionFile(atg.xml.XMLFile pDefinitionFile)
Sets the definitionFile

Parameters:
pDefinitionFile - the definitionFile to set

getJAXBContextPath

protected java.lang.String getJAXBContextPath()
Returns the jAXBContextPath

This value is used to set the JAXB Context.

Returns:
the jAXBContextPath

setJAXBContextPath

protected void setJAXBContextPath(java.lang.String pJAXBContextPath)
Sets the jAXBContextPath

This value is used to set the JAXB Context.

Parameters:
pJAXBContextPath - the jAXBContextPath to set

getActorChainValidationService

public atg.service.actor.ActorChainValidationService getActorChainValidationService()
See Also:
ActorChainValidationService

setActorChainValidationService

public void setActorChainValidationService(atg.service.actor.ActorChainValidationService pActorChainValidationService)
See Also:
ActorChainValidationService

getActorChains

public java.util.List<atg.service.actor.ActorChain> getActorChains()

isEnableValidateDefaultChainId

public boolean isEnableValidateDefaultChainId()
Should validation check for a valid default chain id


setEnableValidateDefaultChainId

public void setEnableValidateDefaultChainId(boolean pEnableValidateDefaultChainId)
Should validation check for a valid default chain id


isEnableValidateInputsExist

public boolean isEnableValidateInputsExist()
Should validation check that inputs exist


setEnableValidateInputsExist

public void setEnableValidateInputsExist(boolean pEnableValidateInputsExist)
Should validation check for that inputs exist


isEnableValidateHandleMethodExists

public boolean isEnableValidateHandleMethodExists()
Should validation check that handle method exists


setEnableValidateHandleMethodExists

public void setEnableValidateHandleMethodExists(boolean pEnableValidateHandleMethodExists)
Should validation check for that handle method exists


isEnableValidateRegistration

public boolean isEnableValidateRegistration()
Should validation check if the chains in this component are registered for REST access? Validation logs an info if not registered.


setEnableValidateRegistration

public void setEnableValidateRegistration(boolean pEnableValidateRegistration)
Should validation check if the chains in this component are registered for REST access? Validation logs an info if not registered.


isEnableValidateComponentExists

public boolean isEnableValidateComponentExists()
Should validation check if the chains in this component that contain component actors reference components that exist?


setEnableValidateComponentExists

public void setEnableValidateComponentExists(boolean pEnableValidateComponentExists)
Should validation check if the chains in this component that contain component actors reference components that exist?


isEnableValidateFormInputs

public boolean isEnableValidateFormInputs()
Should validation check if the chains in this actor that contain form actors reference inputs that exist?


setEnableValidateFormInputs

public void setEnableValidateFormInputs(boolean pEnableValidateFormInputs)
Should validation check if the chains in this actor that contain form actors reference inputs that exist?


isEnableValidateDropletExists

public boolean isEnableValidateDropletExists()
Should validation check if the chains in this actor that contain droplet actors reference droplet that exist?


setEnableValidateDropletExists

public void setEnableValidateDropletExists(boolean pEnableValidateDropletExists)
Should validation check if the chains in this actor that contain droplet actors reference droplet that exist?


isEnableValidateSuccessErrorUrlExist

public boolean isEnableValidateSuccessErrorUrlExist()
Should validation check if the chains in this actor that contain form actors have a success and error URL?


setEnableValidateSuccessErrorUrlExist

public void setEnableValidateSuccessErrorUrlExist(boolean pEnableValidateSuccessErrorUrlExist)
Should validation check if the chains in this actor that contain form actors have a success and error URL?


isEnableValidateFoward

public boolean isEnableValidateFoward()
Should validation check if the chains in this actor that contain form actors have a success or error URL that is handling forward/redirect incorrectly?


setEnableValidateFoward

public void setEnableValidateFoward(boolean pEnableValidateFoward)
Should validation check if the chains in this actor that contain form actors have a success or error URL that is handling forward/redirect incorrectly?


isEnableValidateDropletInputsUseTernaryOperator

public boolean isEnableValidateDropletInputsUseTernaryOperator()
Should validation check if the droplet inputs use ternary operator?


setEnableValidateDropletInputsUseTernaryOperator

public void setEnableValidateDropletInputsUseTernaryOperator(boolean pEnableValidateDropletInputsUseTernaryOperator)
Should validation check if the droplet inputs use ternary operator?


isEnableValidateComponentInputs

public boolean isEnableValidateComponentInputs()
Should validation check if the chains in this actor that contain component have valid inputs


setEnableValidateComponentInputs

public void setEnableValidateComponentInputs(boolean pEnableValidateComponentInputs)
Should validation check if the chains in this actor that contain component have valid inputs


isEnableValidateComponentMethod

public boolean isEnableValidateComponentMethod()
Should validation check if the chains in this actor that contain components with methods have a valid method


setEnableValidateComponentMethod

public void setEnableValidateComponentMethod(boolean pEnableValidateComponentMethod)
Should validation check if the chains in this actor that contain components with methods have a valid method


isEnableValidateNestedActorExists

public boolean isEnableValidateNestedActorExists()
Should validation check if the chains in this actor that contain nested actors reference actors that exist?


setEnableValidateNestedActorExists

public void setEnableValidateNestedActorExists(boolean pEnableValidateNestedActorExists)
Should validation check if the chains in this actor that contain nested actors reference actors that exist?


doStartService

public void doStartService()
                    throws ServiceException
This method is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values.

This method calls initializeActorTemplate() to initialize actor template data.

Overrides:
doStartService in class GenericService
Throws:
ServiceException - if the Service had a problem starting up
See Also:
initializes actor template

createAdminServlet

protected javax.servlet.Servlet createAdminServlet()
Create the administration servlet.

Overrides:
createAdminServlet in class GenericService

act

public void act(ActorContext pActorContext,
                ModelMap pModelMap)
         throws ActorException
This method takes a non-null ActorContext and a non-null ModelMap. This method does the following:

createObjectFactoryInstance

protected atg.service.actor.ObjectFactory createObjectFactoryInstance()
                                                               throws ActorException
This method creates an actor framework ObjectFactory instance.

If you extend any actor JAXB Beans, then you need to extend this method.

Returns:
Throws:
ActorException

unmarshal

protected atg.service.actor.ActorTemplate unmarshal(atg.xml.XMLFile pXMLFile)
                                             throws ActorException
This method un-marshals actor xml definitions into actorTemplate property.

The JAXB context is set using the getJAXBContextPath(). The ObjectFactory instance is created using createObjectFactoryInstance(). After setting up the required JAXB settings the getDefinitionFile() XML file is un-marshaled.

Throws:
ActorException
See Also:
getJAXBContextPath(), createObjectFactoryInstance()

getDefaultActorChainId

public java.lang.String getDefaultActorChainId()
                                        throws ActorException
This method calls ActorTemplate.computeDefaultActorChainId() to get the default chain id for this actor chain service.

Specified by:
getDefaultActorChainId in interface VariantActor
Throws:
ActorException
See Also:
ActorTemplate.computeDefaultActorChainId()

reinitializeActorTemplate

public void reinitializeActorTemplate()
                               throws ActorException
If the getDefinitionFile() has been modified, then this method calls initializeActorTemplate() to initialize the actor template

Throws:
ActorException
See Also:
If the XML file is modified, then the actorTemplate property is reinitialized., Initializes the actorTemplate property.

initializeActorTemplate

protected void initializeActorTemplate()
                                throws ActorException
This method calls unmarshal(XMLFile) to un-marshal the xml file and initializes actorTemplate property.

Throws:
ActorException
See Also:
#unmarshal(XMLFile)}

getSortedActors

protected java.util.List<Actor> getSortedActors(ActorContext pActorContext,
                                                java.util.List<Actor> pUnsortedActors)
                                         throws ActorException
This method takes unsorted actors and sorts them based on the follows and followsIfPresent xml definitions of an actor definition.

Parameters:
pActorContext -
pUnsortedActors -
Returns:
Throws:
ActorException
See Also:
BaseAbstractActor#addSortedActors(ActorContext, List, List)} Adds the follows, followsIfPresent actors