Package com.aspectran.embed.service
Class AbstractEmbeddedAspectran
- java.lang.Object
-
- com.aspectran.core.service.AbstractServiceController
-
- com.aspectran.core.service.AbstractCoreService
-
- com.aspectran.core.service.AspectranCoreService
-
- com.aspectran.embed.service.AbstractEmbeddedAspectran
-
- All Implemented Interfaces:
CoreService,ServiceController,EmbeddedAspectran
- Direct Known Subclasses:
DefaultEmbeddedAspectran
public abstract class AbstractEmbeddedAspectran extends AspectranCoreService implements EmbeddedAspectran
Provides an interface that can be used by embedding Aspectran in Java applications.- Since:
- 3.0.0
-
-
Constructor Summary
Constructors Constructor Description AbstractEmbeddedAspectran()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsBean(java.lang.Class<?> type)Return 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)Return whether a bean with the specified id is present.protected voiddestroySessionManager()<V> VgetBean(java.lang.Class<V> type)Return an instance of the bean that matches the given object type.<V> VgetBean(java.lang.Class<V> type, java.lang.String id)Return an instance of the bean that matches the given object type.<V> VgetBean(java.lang.String id)Return an instance of the bean that matches the given id.EnvironmentgetEnvironment()Gets the environment.java.lang.StringgetMessage(java.lang.String code, java.lang.Object[] args, java.lang.String defaultMessage, java.util.Locale locale)Try to resolve the message.java.lang.StringgetMessage(java.lang.String code, java.lang.Object[] args, java.util.Locale locale)Try to resolve the message.protected voidinitSessionManager()booleanisExposable(java.lang.String transletName)Returns whether or not the translet can be exposed to the daemon service.SessionAdapternewSessionAdapter()Create and return a new session adapter from the embedded aspectran.voidrelease()Stop the service and release all allocated resources.-
Methods inherited from class com.aspectran.core.service.AspectranCoreService
afterContextLoaded, beforeContextDestroy, doPause, doPause, doResume, doStart, doStop
-
Methods inherited from class com.aspectran.core.service.AbstractCoreService
destroyActivityContext, determineBasePath, getActivityContext, getAspectranClassLoader, getAspectranConfig, getBasePath, getDefaultActivity, getSchedulerService, getServiceController, isDerived, isHardReload, isLateStart, joinDerivedService, leaveFromRootService, loadActivityContext, prepare, setActivityContext, setBasePath, setExposals, withdrawDerivedService
-
Methods inherited from class com.aspectran.core.service.AbstractServiceController
clearDerivedService, getLock, getServiceName, isActive, isBusy, joinDerivedService, pause, pause, restart, restart, resume, setServiceStateListener, start, stop, withdrawDerivedService
-
-
-
-
Method Detail
-
isExposable
public boolean isExposable(java.lang.String transletName)
Description copied from interface:EmbeddedAspectranReturns whether or not the translet can be exposed to the daemon service.- Specified by:
isExposablein interfaceEmbeddedAspectran- Overrides:
isExposablein classAbstractCoreService- Parameters:
transletName- the name of the translet to check- Returns:
- true if the translet can be exposed; false otherwise
-
release
public void release()
Description copied from interface:EmbeddedAspectranStop the service and release all allocated resources.- Specified by:
releasein interfaceEmbeddedAspectran
-
newSessionAdapter
public SessionAdapter newSessionAdapter()
Description copied from interface:EmbeddedAspectranCreate and return a new session adapter from the embedded aspectran.- Specified by:
newSessionAdapterin interfaceEmbeddedAspectran- Returns:
- the session adapter
-
initSessionManager
protected void initSessionManager()
-
destroySessionManager
protected void destroySessionManager()
-
getEnvironment
public Environment getEnvironment()
Description copied from interface:EmbeddedAspectranGets the environment.- Specified by:
getEnvironmentin interfaceEmbeddedAspectran- Returns:
- the environment
-
getBean
public <V> V getBean(java.lang.String id)
Description copied from interface:EmbeddedAspectranReturn an instance of the bean that matches the given id.- Specified by:
getBeanin interfaceEmbeddedAspectran- 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
public <V> V getBean(java.lang.Class<V> type)
Description copied from interface:EmbeddedAspectranReturn an instance of the bean that matches the given object type.- Specified by:
getBeanin interfaceEmbeddedAspectran- 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
-
getBean
public <V> V getBean(java.lang.Class<V> type, java.lang.String id)Description copied from interface:EmbeddedAspectranReturn an instance of the bean that matches the given object type.- Specified by:
getBeanin interfaceEmbeddedAspectran- 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
-
containsBean
public boolean containsBean(java.lang.String id)
Description copied from interface:EmbeddedAspectranReturn whether a bean with the specified id is present.- Specified by:
containsBeanin interfaceEmbeddedAspectran- 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<?> type)
Description copied from interface:EmbeddedAspectranReturn whether a bean with the specified object type is present.- Specified by:
containsBeanin interfaceEmbeddedAspectran- Parameters:
type- the object type of the bean to query- Returns:
- whether a bean with the specified type is present
-
containsBean
public boolean containsBean(java.lang.Class<?> type, java.lang.String id)Description copied from interface:EmbeddedAspectranReturns whether the bean corresponding to the specified object type and ID exists.- Specified by:
containsBeanin interfaceEmbeddedAspectran- 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
-
getMessage
public java.lang.String getMessage(java.lang.String code, java.lang.Object[] args, java.util.Locale locale) throws NoSuchMessageExceptionDescription copied from interface:EmbeddedAspectranTry to resolve the message. Treat as an error if the message can't be found.- Specified by:
getMessagein interfaceEmbeddedAspectran- Parameters:
code- the code to lookup up, such as 'calculator.noRateSet'args- Array of arguments that will be filled in for params within the message (params look like "{0}", "{1,date}", "{2,time}" within a message), ornullif none.locale- the Locale in which to do the lookup- Returns:
- the resolved message
- Throws:
NoSuchMessageException- if the message wasn't found- See Also:
MessageFormat
-
getMessage
public java.lang.String getMessage(java.lang.String code, java.lang.Object[] args, java.lang.String defaultMessage, java.util.Locale locale)Description copied from interface:EmbeddedAspectranTry to resolve the message. Return default message if no message was found.- Specified by:
getMessagein interfaceEmbeddedAspectran- Parameters:
code- the code to lookup up, such as 'calculator.noRateSet'. Users of this class are encouraged to base message names on the relevant fully qualified class name, thus avoiding conflict and ensuring maximum clarity.args- array of arguments that will be filled in for params within the message (params look like "{0}", "{1,date}", "{2,time}" within a message), ornullif none.defaultMessage- String to return if the lookup failslocale- the Locale in which to do the lookup- Returns:
- the resolved message if the lookup was successful; otherwise the default message passed as a parameter
- See Also:
MessageFormat
-
-