Package com.aspectran.core.activity
Class AbstractActivity
- java.lang.Object
-
- com.aspectran.core.activity.AbstractActivity
-
- All Implemented Interfaces:
Activity
,BeanRegistry
- Direct Known Subclasses:
AdviceActivity
,DefaultActivity
public abstract class AbstractActivity extends java.lang.Object implements Activity
The Class AbstractActivity.Created: 2008. 03. 22 PM 5:48:09
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractActivity(ActivityContext context)
Instantiates a new abstract activity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
backupCurrentActivity()
Backups the current activity.void
clearRaisedException()
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.ActivityContext
getActivityContext()
Gets the activity context.ApplicationAdapter
getApplicationAdapter()
Gets the application adapter.<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
getConfigBean(java.lang.Class<T> classType)
Return the bean instance that matches the specified object type.protected Activity
getCurrentActivity()
Gets the current activity.Environment
getEnvironment()
Returns the environment of the current activity context.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.boolean
isExceptionRaised()
Returns whether the exception was thrown.boolean
isIncluded()
Returns whether or not contained in other activity.protected void
removeCurrentActivity()
Removes the current activity.protected void
saveCurrentActivity()
Saves the current activity.void
setIncluded(boolean included)
Sets whether this activity is included in other activity.void
setRaisedException(java.lang.Throwable raisedException)
Sets an instance of the currently raised exception.protected void
setRequestAdapter(RequestAdapter requestAdapter)
Sets the request adapter.protected void
setResponseAdapter(ResponseAdapter responseAdapter)
Sets the response adapter.protected void
setSessionAdapter(SessionAdapter sessionAdapter)
Sets the session adapter.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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.aspectran.core.activity.Activity
executeAdvice, executeAdvice, finish, getAspectAdviceBean, getDeclaredResponse, getProcessResult, getProcessResult, getSetting, getTranslet, handleException, isResponseReserved, newActivity, perform, prepare, prepare, prepare, prepare, prepare, registerAspectRule, registerSettingsAdviceRule
-
-
-
-
Constructor Detail
-
AbstractActivity
protected AbstractActivity(ActivityContext context)
Instantiates a new abstract activity.- Parameters:
context
- the activity context
-
-
Method Detail
-
getActivityContext
public ActivityContext getActivityContext()
Description copied from interface:Activity
Gets the activity context.- Specified by:
getActivityContext
in interfaceActivity
- Returns:
- the activity context
-
getEnvironment
public Environment getEnvironment()
Description copied from interface:Activity
Returns the environment of the current activity context.- Specified by:
getEnvironment
in interfaceActivity
- Returns:
- the environment
-
getCurrentActivity
protected Activity getCurrentActivity()
Gets the current activity.- Returns:
- the current activity
-
saveCurrentActivity
protected void saveCurrentActivity()
Saves the current activity.
-
backupCurrentActivity
protected void backupCurrentActivity()
Backups the current activity.
-
removeCurrentActivity
protected void removeCurrentActivity()
Removes the current activity.
-
isIncluded
public boolean isIncluded()
Description copied from interface:Activity
Returns whether or not contained in other activity.- Specified by:
isIncluded
in interfaceActivity
- Returns:
- true, if this activity is included in the other activity
-
setIncluded
public void setIncluded(boolean included)
Sets whether this activity is included in other activity.- Parameters:
included
- whether or not included in other activity
-
getApplicationAdapter
public ApplicationAdapter getApplicationAdapter()
Description copied from interface:Activity
Gets the application adapter.- Specified by:
getApplicationAdapter
in interfaceActivity
- Returns:
- the application adapter
-
getSessionAdapter
public SessionAdapter getSessionAdapter()
Description copied from interface:Activity
Gets the session adapter.- Specified by:
getSessionAdapter
in interfaceActivity
- Returns:
- the session adapter
-
setSessionAdapter
protected void setSessionAdapter(SessionAdapter sessionAdapter)
Sets the session adapter.- Parameters:
sessionAdapter
- the new session adapter
-
getRequestAdapter
public RequestAdapter getRequestAdapter()
Description copied from interface:Activity
Gets the request adapter.- Specified by:
getRequestAdapter
in interfaceActivity
- Returns:
- the request adapter
-
setRequestAdapter
protected void setRequestAdapter(RequestAdapter requestAdapter)
Sets the request adapter.- Parameters:
requestAdapter
- the new request adapter
-
getResponseAdapter
public ResponseAdapter getResponseAdapter()
Description copied from interface:Activity
Gets the response adapter.- Specified by:
getResponseAdapter
in interfaceActivity
- Returns:
- the response adapter
-
setResponseAdapter
protected void setResponseAdapter(ResponseAdapter responseAdapter)
Sets the response adapter.- Parameters:
responseAdapter
- the new response adapter
-
isExceptionRaised
public boolean isExceptionRaised()
Description copied from interface:Activity
Returns whether the exception was thrown.- Specified by:
isExceptionRaised
in interfaceActivity
- Returns:
- true, if is exception raised
-
getRaisedException
public java.lang.Throwable getRaisedException()
Description copied from interface:Activity
Returns an instance of the currently raised exception.- Specified by:
getRaisedException
in interfaceActivity
- Returns:
- an instance of the currently raised exception
-
getRootCauseOfRaisedException
public java.lang.Throwable getRootCauseOfRaisedException()
Description copied from interface:Activity
Returns the innermost one of the chained (wrapped) exceptions.- Specified by:
getRootCauseOfRaisedException
in interfaceActivity
- Returns:
- the innermost one of the chained (wrapped) exceptions
-
setRaisedException
public void setRaisedException(java.lang.Throwable raisedException)
Description copied from interface:Activity
Sets an instance of the currently raised exception.- Specified by:
setRaisedException
in interfaceActivity
- Parameters:
raisedException
- an instance of the currently raised exception
-
clearRaisedException
public void clearRaisedException()
- Specified by:
clearRaisedException
in interfaceActivity
-
getBean
public <T> T getBean(java.lang.String id)
Description copied from interface:BeanRegistry
Return an instance of the bean that matches the given id.- Specified by:
getBean
in interfaceBeanRegistry
- Type Parameters:
T
- the generic type- Parameters:
id
- the id of the bean to retrieve- Returns:
- an instance of the bean
-
getBean
public <T> T getBean(java.lang.Class<T> requiredType)
Description copied from interface:BeanRegistry
Return an instance of the bean that matches the given object type.- Specified by:
getBean
in interfaceBeanRegistry
- 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
-
getBean
public <T> T getBean(java.lang.String id, java.lang.Class<T> requiredType)
Description copied from interface:BeanRegistry
Return an instance of the bean that matches the given id. If the bean is not of the required type then throw a BeanNotOfRequiredTypeException.- Specified by:
getBean
in interfaceBeanRegistry
- 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
-
getBean
public <T> T getBean(java.lang.Class<T> requiredType, java.lang.String id)
Description copied from interface:BeanRegistry
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.- Specified by:
getBean
in interfaceBeanRegistry
- 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
-
getConfigBean
public <T> T getConfigBean(java.lang.Class<T> classType)
Description copied from interface:BeanRegistry
Return the bean instance that matches the specified object type. If the bean is not of the required type then throw aBeanNotOfRequiredTypeException
.- Specified by:
getConfigBean
in interfaceBeanRegistry
- Type Parameters:
T
- the generic type- Parameters:
classType
- type the bean must match; can be an interface or superclass.null
is disallowed.- Returns:
- an instance of the bean
-
containsBean
public boolean containsBean(java.lang.String id)
Description copied from interface:BeanRegistry
Return whether a bean with the specified id is present.- Specified by:
containsBean
in interfaceBeanRegistry
- Parameters:
id
- the id of the bean to query- Returns:
- whether a bean with the specified id is present
-
containsBean
public boolean containsBean(java.lang.Class<?> requiredType)
Description copied from interface:BeanRegistry
Return whether a bean with the specified object type is present.- Specified by:
containsBean
in interfaceBeanRegistry
- Parameters:
requiredType
- the object type of the bean to query- Returns:
- whether a bean with the specified type is present
-
terminate
public void terminate()
Description copied from interface:Activity
Throws an ActivityTerminatedException to terminate the current activity.
-
-