Package com.aspectran.core.activity
Interface Activity
-
- All Known Implementing Classes:
AbstractActivity,AdviceActivity,CoreActivity,DefaultActivity,InstantActivity,JobActivity
public interface ActivityThe Interface Activity.Created: 2008. 03. 22 PM 5:48:09
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclearRaisedException()Clears the exception that occurred during activity processing.booleancontainsBean(java.lang.Class<?> type)Returns whether a bean with the specified object type is present.booleancontainsBean(java.lang.Class<?> type, java.lang.String id)Returns whether the bean corresponding to the specified object type and ID exists.booleancontainsBean(java.lang.String id)Returns whether a bean with the specified id is present.voidexecuteAdvice(AspectAdviceRule aspectAdviceRule, boolean throwable)Executes an aspect advice with a given rule.voidexecuteAdvice(java.util.List<AspectAdviceRule> aspectAdviceRuleList, boolean throwable)Execute aspect advices with given rules.ActivityContextgetActivityContext()Gets the activity context.ApplicationAdaptergetApplicationAdapter()Gets the application adapter.<V> VgetAspectAdviceBean(java.lang.String aspectId)Gets the aspect advice bean.<V> VgetBean(java.lang.Class<V> type)Returns an instance of the bean that matches the given object type.<V> VgetBean(java.lang.Class<V> type, java.lang.String id)Returns an instance of the bean that matches the given object type.<V> VgetBean(java.lang.String id)Returns an instance of the bean that matches the given id.ResponsegetDeclaredResponse()Returns the originally declared response.EnvironmentgetEnvironment()Returns the environment of the current activity context.ProcessResultgetProcessResult()Returns the process result.java.lang.ObjectgetProcessResult(java.lang.String actionId)Returns an action result for the specified action id from the process result, ornullif the action does not exist.<V> VgetPrototypeScopeBean(BeanRule beanRule)java.lang.ThrowablegetRaisedException()Returns an instance of the currently raised exception.RequestAdaptergetRequestAdapter()Gets the request adapter.ResponseAdaptergetResponseAdapter()Gets the response adapter.java.lang.ThrowablegetRootCauseOfRaisedException()Returns the innermost one of the chained (wrapped) exceptions.SessionAdaptergetSessionAdapter()Gets the session adapter.<V> VgetSetting(java.lang.String settingName)Gets the setting value in the translet scope.TransletgetTranslet()Returns an instance of the current translet.voidhandleException(java.util.List<ExceptionRule> exceptionRuleList)Exception handling.booleanisExceptionRaised()Returns whether the exception was thrown.booleanisResponseReserved()Returns whether the response is reserved.voidperform()Performs the prepared activity.<V> Vperform(java.util.concurrent.Callable<V> instantAction)Performs the given instant activity.voidregisterAspectAdviceRule(AspectRule aspectRule)Register an aspect rule dynamically.voidregisterSettingsAdviceRule(SettingsAdviceRule settingsAdviceRule)Register a settings advice rule dynamically.voidsetRaisedException(java.lang.Throwable raisedException)Sets an instance of the currently raised exception.voidterminate()Throws an ActivityTerminatedException to terminate the current activity.voidterminate(java.lang.String cause)Throws an ActivityTerminatedException with the reason for terminating the current activity.
-
-
-
Method Detail
-
perform
void perform() throws ActivityPerformExceptionPerforms the prepared activity.- Throws:
ActivityPerformException- thrown when an exception occurs while performing an activity
-
perform
<V> V perform(java.util.concurrent.Callable<V> instantAction) throws ActivityPerformExceptionPerforms the given instant activity.- Type Parameters:
V- the result type of the instant action- Parameters:
instantAction- the instant action- Returns:
- An object that is the result of performing an instant activity
- Throws:
ActivityPerformException- thrown when an exception occurs while performing an activity
-
terminate
void terminate() throws ActivityTerminatedExceptionThrows an ActivityTerminatedException to terminate the current activity.- Throws:
ActivityTerminatedException- if an activity terminated without completion
-
terminate
void terminate(java.lang.String cause) throws ActivityTerminatedExceptionThrows an ActivityTerminatedException with the reason for terminating the current activity.- Parameters:
cause- the termination cause- Throws:
ActivityTerminatedException- the exception to terminate activity
-
getTranslet
Translet getTranslet()
Returns an instance of the current translet.- Returns:
- an instance of the current translet
-
getProcessResult
ProcessResult getProcessResult()
Returns the process result.- Returns:
- the process result
-
getProcessResult
java.lang.Object getProcessResult(java.lang.String actionId)
Returns an action result for the specified action id from the process result, ornullif the action does not exist.- Parameters:
actionId- the specified action id- Returns:
- an action result
-
getDeclaredResponse
Response getDeclaredResponse()
Returns the originally declared response.- Returns:
- the declared response
- Since:
- 5.2.0
-
isResponseReserved
boolean isResponseReserved()
Returns whether the response is reserved.- Returns:
- true, if the response is reserved
-
isExceptionRaised
boolean isExceptionRaised()
Returns whether the exception was thrown.- Returns:
- true, if is exception raised
-
getRaisedException
java.lang.Throwable getRaisedException()
Returns an instance of the currently raised exception.- Returns:
- an instance of the currently raised exception
-
getRootCauseOfRaisedException
java.lang.Throwable getRootCauseOfRaisedException()
Returns the innermost one of the chained (wrapped) exceptions.- Returns:
- the innermost one of the chained (wrapped) exceptions
-
setRaisedException
void setRaisedException(java.lang.Throwable raisedException)
Sets an instance of the currently raised exception.- Parameters:
raisedException- an instance of the currently raised exception
-
clearRaisedException
void clearRaisedException()
Clears the exception that occurred during activity processing.
-
registerAspectAdviceRule
void registerAspectAdviceRule(AspectRule aspectRule) throws AdviceConstraintViolationException, AspectAdviceException
Register an aspect rule dynamically.- Parameters:
aspectRule- the aspect rule- Throws:
AdviceConstraintViolationException- thrown when an Advice Constraint Violation occursAspectAdviceException- thrown when an error occurs while running advice
-
registerSettingsAdviceRule
void registerSettingsAdviceRule(SettingsAdviceRule settingsAdviceRule)
Register a settings advice rule dynamically.- Parameters:
settingsAdviceRule- the settings advice rule
-
executeAdvice
void executeAdvice(java.util.List<AspectAdviceRule> aspectAdviceRuleList, boolean throwable) throws AspectAdviceException
Execute aspect advices with given rules.- Parameters:
aspectAdviceRuleList- the aspect advice rulesthrowable- whether to raise an exception- Throws:
AspectAdviceException- thrown when an error occurs while running advice
-
executeAdvice
void executeAdvice(AspectAdviceRule aspectAdviceRule, boolean throwable) throws AspectAdviceException
Executes an aspect advice with a given rule.- Parameters:
aspectAdviceRule- the aspect advice rulethrowable- whether to raise an exception- Throws:
AspectAdviceException- thrown when an error occurs while running advice
-
handleException
void handleException(java.util.List<ExceptionRule> exceptionRuleList) throws ActionExecutionException
Exception handling.- Parameters:
exceptionRuleList- the exception rule list- Throws:
ActionExecutionException- thrown when an error occurs while executing an action
-
getSetting
<V> V getSetting(java.lang.String settingName)
Gets the setting value in the translet scope.- Type Parameters:
V- the type of the value- Parameters:
settingName- the setting name- Returns:
- the setting value
-
getAspectAdviceBean
<V> V getAspectAdviceBean(java.lang.String aspectId)
Gets the aspect advice bean.- Type Parameters:
V- the type of the bean- Parameters:
aspectId- the aspect id- Returns:
- the aspect advice bean object
-
getActivityContext
ActivityContext getActivityContext()
Gets the activity context.- Returns:
- the activity context
-
getEnvironment
Environment getEnvironment()
Returns the environment of the current activity context.- Returns:
- the environment
-
getApplicationAdapter
ApplicationAdapter getApplicationAdapter()
Gets the application adapter.- Returns:
- the application adapter
-
getSessionAdapter
SessionAdapter getSessionAdapter()
Gets the session adapter.- Returns:
- the session adapter
-
getRequestAdapter
RequestAdapter getRequestAdapter()
Gets the request adapter.- Returns:
- the request adapter
-
getResponseAdapter
ResponseAdapter getResponseAdapter()
Gets the response adapter.- Returns:
- the response adapter
-
getBean
<V> V getBean(java.lang.String id)
Returns an instance of the bean that matches the given id.- Type Parameters:
V- the result type of the bean- Parameters:
id- the id of the bean to retrieve- Returns:
- an instance of the bean
-
getBean
<V> V getBean(java.lang.Class<V> type)
Returns an instance of the bean that matches the given object type.- Type Parameters:
V- the result type of the bean- Parameters:
type- the type the bean must match; can be an interface or superclass.nullis disallowed.- Returns:
- an instance of the bean
- Since:
- 1.3.1
-
getBean
<V> V getBean(java.lang.Class<V> type, java.lang.String id)Returns an instance of the bean that matches the given object type.- Type Parameters:
V- the result type of the bean- Parameters:
type- type the bean must match; can be an interface or superclass.nullis allowed.id- the id of the bean to retrieve- Returns:
- an instance of the bean
- Since:
- 2.0.0
-
getPrototypeScopeBean
<V> V getPrototypeScopeBean(BeanRule beanRule)
-
containsBean
boolean containsBean(java.lang.String id)
Returns whether a bean with the specified id is present.- Parameters:
id- the id of the bean to query- Returns:
- whether a bean with the specified id is present
-
containsBean
boolean containsBean(java.lang.Class<?> type)
Returns whether a bean with the specified object type is present.- Parameters:
type- the object type of the bean to query- Returns:
- whether a bean with the specified type is present
-
containsBean
boolean containsBean(java.lang.Class<?> type, java.lang.String id)Returns whether the bean corresponding to the specified object type and ID exists.- Parameters:
type- the object type of the bean to queryid- the id of the bean to query- Returns:
- whether a bean with the specified type is present
-
-