Package com.aspectran.core.activity
Interface Activity
-
- All Known Implementing Classes:
AbstractActivity
,AdviceActivity
,AspectranActivity
,CoreActivity
,DaemonActivity
,DefaultActivity
,InstantActivity
,JobActivity
,ShellActivity
,TowActivity
,WebActivity
public interface Activity
The Interface Activity.Created: 2008. 03. 22 PM 5:48:09
-
-
Method Summary
Modifier and Type Method Description void
clearRaisedException()
Clears the exception that occurred during activity processing.boolean
containsBean(java.lang.Class<?> requiredType)
Return whether a bean with the specified object type is present.boolean
containsBean(java.lang.String id)
Return whether a bean with the specified id is present.void
executeAdvice(AspectAdviceRule aspectAdviceRule, boolean throwable)
Executes an aspect advice with a given rule.void
executeAdvice(java.util.List<AspectAdviceRule> aspectAdviceRuleList, boolean throwable)
Execute aspect advices with given rules.void
finish()
Finish the current activity.ActivityContext
getActivityContext()
Gets the activity context.ApplicationAdapter
getApplicationAdapter()
Gets the application adapter.<T> T
getAspectAdviceBean(java.lang.String aspectId)
Gets the aspect advice bean.<T> T
getBean(java.lang.Class<T> requiredType)
Return an instance of the bean that matches the given object type.<T> T
getBean(java.lang.Class<T> requiredType, java.lang.String id)
Return an instance of the bean that matches the given object type.<T> T
getBean(java.lang.String id)
Return an instance of the bean that matches the given id.<T> T
getBean(java.lang.String id, java.lang.Class<T> requiredType)
Return an instance of the bean that matches the given id.<T> T
getBeanForConfig(java.lang.Class<T> requiredType)
Return the bean instance that matches the specified object type.Response
getDeclaredResponse()
Returns the originally declared response.Environment
getEnvironment()
Returns the environment of the current activity context.<T extends Activity>
TgetOuterActivity()
ProcessResult
getProcessResult()
Returns the process result.java.lang.Object
getProcessResult(java.lang.String actionId)
Returns an action result for the specified action id from the process result, ornull
if the action does not exist.<T> T
getPrototypeScopeBean(BeanRule beanRule)
java.lang.Throwable
getRaisedException()
Returns an instance of the currently raised exception.RequestAdapter
getRequestAdapter()
Gets the request adapter.ResponseAdapter
getResponseAdapter()
Gets the response adapter.java.lang.Throwable
getRootCauseOfRaisedException()
Returns the innermost one of the chained (wrapped) exceptions.SessionAdapter
getSessionAdapter()
Gets the session adapter.<T> T
getSetting(java.lang.String settingName)
Gets the setting value in the translet scope.Translet
getTranslet()
Returns an instance of the current translet.void
handleException(java.util.List<ExceptionRule> exceptionRuleList)
Exception handling.boolean
isExceptionRaised()
Returns whether the exception was thrown.boolean
isIncluded()
Returns whether or not contained in other activity.boolean
isResponseReserved()
Returns whether the response is reserved.<T extends Activity>
TnewActivity()
Create a new inner activity.void
perform()
Performs the prepared activity.void
prepare(TransletRule transletRule)
Prepare for the activity.void
prepare(java.lang.String transletName)
Prepare for the activity.void
prepare(java.lang.String transletName, TransletRule transletRule)
Prepare for the activity.void
prepare(java.lang.String transletName, MethodType requestMethod)
Prepare for the activity.void
prepare(java.lang.String transletName, java.lang.String requestMethod)
Prepare for the activity.void
registerAspectRule(AspectRule aspectRule)
Register an aspect rule dynamically.void
registerSettingsAdviceRule(SettingsAdviceRule settingsAdviceRule)
Register a settings advice rule dynamically.void
setRaisedException(java.lang.Throwable raisedException)
Sets an instance of the currently raised exception.void
terminate()
Throws an ActivityTerminatedException to terminate the current activity.void
terminate(java.lang.String cause)
Throws an ActivityTerminatedException with the reason for terminating the current activity.
-
-
-
Method Detail
-
prepare
void prepare(java.lang.String transletName)
Prepare for the activity.- Parameters:
transletName
- the translet name
-
prepare
void prepare(TransletRule transletRule)
Prepare for the activity.- Parameters:
transletRule
- the translet rule
-
prepare
void prepare(java.lang.String transletName, TransletRule transletRule)
Prepare for the activity.- Parameters:
transletName
- the translet nametransletRule
- the translet rule
-
prepare
void prepare(java.lang.String transletName, java.lang.String requestMethod)
Prepare for the activity.- Parameters:
transletName
- the translet namerequestMethod
- the request method
-
prepare
void prepare(java.lang.String transletName, MethodType requestMethod)
Prepare for the activity.- Parameters:
transletName
- the translet namerequestMethod
- the request method
-
perform
void perform()
Performs the prepared activity.
-
finish
void finish()
Finish the current activity. It must be called to finish the activity.
-
terminate
void terminate()
Throws an ActivityTerminatedException to terminate the current activity.- Throws:
ActivityTerminatedException
- if an activity terminated without completion
-
terminate
void terminate(java.lang.String cause)
Throws 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, ornull
if 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
-
isIncluded
boolean isIncluded()
Returns whether or not contained in other activity.- Returns:
- true, if this activity is included in the other activity
-
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.
-
registerAspectRule
void registerAspectRule(AspectRule aspectRule)
Register an aspect rule dynamically.- Parameters:
aspectRule
- the aspect rule
-
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)
Execute aspect advices with given rules.- Parameters:
aspectAdviceRuleList
- the aspect advice rulesthrowable
- whether to raise an exception
-
executeAdvice
void executeAdvice(AspectAdviceRule aspectAdviceRule, boolean throwable)
Executes an aspect advice with a given rule.- Parameters:
aspectAdviceRule
- the aspect advice rulethrowable
- whether to raise an exception
-
handleException
void handleException(java.util.List<ExceptionRule> exceptionRuleList)
Exception handling.- Parameters:
exceptionRuleList
- the exception rule list
-
getSetting
<T> T getSetting(java.lang.String settingName)
Gets the setting value in the translet scope.- Type Parameters:
T
- the type of the value- Parameters:
settingName
- the setting name- Returns:
- the setting value
-
getAspectAdviceBean
<T> T getAspectAdviceBean(java.lang.String aspectId)
Gets the aspect advice bean.- Type Parameters:
T
- 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
-
newActivity
<T extends Activity> T newActivity()
Create a new inner activity.- Type Parameters:
T
- the type of the activity- Returns:
- the activity object
-
getOuterActivity
<T extends Activity> T getOuterActivity()
-
getBean
<T> T getBean(java.lang.String id)
Return an instance of the bean that matches the given id.- Type Parameters:
T
- the generic type- Parameters:
id
- the id of the bean to retrieve- Returns:
- an instance of the bean
-
getBean
<T> T getBean(java.lang.Class<T> requiredType)
Return an instance of the bean that matches the given object type.- Type Parameters:
T
- the generic type- Parameters:
requiredType
- the type the bean must match; can be an interface or superclass.null
is disallowed.- Returns:
- an instance of the bean
- Since:
- 1.3.1
-
getBean
<T> T getBean(java.lang.String id, java.lang.Class<T> requiredType)
Return an instance of the bean that matches the given id. If the bean is not of the required type then throw a BeanNotOfRequiredTypeException.- Type Parameters:
T
- the generic type- Parameters:
id
- the id of the bean to retrieverequiredType
- type the bean must match; can be an interface or superclass.null
is disallowed.- Returns:
- an instance of the bean
- Since:
- 1.3.1
-
getBean
<T> T getBean(java.lang.Class<T> requiredType, java.lang.String id)
Return an instance of the bean that matches the given object type. If the bean is not exists ,retrieve the bean with the specified id.- Type Parameters:
T
- the generic type- Parameters:
requiredType
- type the bean must match; can be an interface or superclass.null
is allowed.id
- the id of the bean to retrieve; if requiredType isnull
.- Returns:
- an instance of the bean
- Since:
- 2.0.0
-
getBeanForConfig
<T> T getBeanForConfig(java.lang.Class<T> requiredType)
Return the bean instance that matches the specified object type. If the bean is not of the required type then throw aBeanNotOfRequiredTypeException
.- Type Parameters:
T
- the generic type- Parameters:
requiredType
- type the bean must match; can be an interface or superclass.null
is disallowed.- Returns:
- an instance of the bean
- Since:
- 2.0.0
-
getPrototypeScopeBean
<T> T getPrototypeScopeBean(BeanRule beanRule)
-
containsBean
boolean containsBean(java.lang.String id)
Return 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<?> requiredType)
Return whether a bean with the specified object type is present.- Parameters:
requiredType
- the object type of the bean to query- Returns:
- whether a bean with the specified type is present
-
-