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 boolean
containsBean(java.lang.Class<?> type)
Return whether a bean with the specified object type is present.boolean
containsBean(java.lang.Class<?> type, java.lang.String id)
Returns whether the bean corresponding to the specified object type and ID exists.boolean
containsBean(java.lang.String id)
Return whether a bean with the specified id is present.protected void
destroySessionManager()
<V> V
getBean(java.lang.Class<V> type)
Return an instance of the bean that matches the given object type.<V> V
getBean(java.lang.Class<V> type, java.lang.String id)
Return an instance of the bean that matches the given object type.<V> V
getBean(java.lang.String id)
Return an instance of the bean that matches the given id.Environment
getEnvironment()
Gets the environment.java.lang.String
getMessage(java.lang.String code, java.lang.Object[] args, java.lang.String defaultMessage, java.util.Locale locale)
Try to resolve the message.java.lang.String
getMessage(java.lang.String code, java.lang.Object[] args, java.util.Locale locale)
Try to resolve the message.protected void
initSessionManager()
boolean
isExposable(java.lang.String transletName)
Returns whether or not the translet can be exposed to the daemon service.SessionAdapter
newSessionAdapter()
Create and return a new session adapter from the embedded aspectran.void
release()
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:EmbeddedAspectran
Returns whether or not the translet can be exposed to the daemon service.- Specified by:
isExposable
in interfaceEmbeddedAspectran
- Overrides:
isExposable
in 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:EmbeddedAspectran
Stop the service and release all allocated resources.- Specified by:
release
in interfaceEmbeddedAspectran
-
newSessionAdapter
public SessionAdapter newSessionAdapter()
Description copied from interface:EmbeddedAspectran
Create and return a new session adapter from the embedded aspectran.- Specified by:
newSessionAdapter
in interfaceEmbeddedAspectran
- Returns:
- the session adapter
-
initSessionManager
protected void initSessionManager()
-
destroySessionManager
protected void destroySessionManager()
-
getEnvironment
public Environment getEnvironment()
Description copied from interface:EmbeddedAspectran
Gets the environment.- Specified by:
getEnvironment
in interfaceEmbeddedAspectran
- Returns:
- the environment
-
getBean
public <V> V getBean(java.lang.String id)
Description copied from interface:EmbeddedAspectran
Return an instance of the bean that matches the given id.- Specified by:
getBean
in 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:EmbeddedAspectran
Return an instance of the bean that matches the given object type.- Specified by:
getBean
in interfaceEmbeddedAspectran
- Type Parameters:
V
- the result type of the bean- Parameters:
type
- the type the bean must match; can be an interface or superclass.null
is 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:EmbeddedAspectran
Return an instance of the bean that matches the given object type.- Specified by:
getBean
in interfaceEmbeddedAspectran
- Type Parameters:
V
- the result type of the bean- Parameters:
type
- type the bean must match; can be an interface or superclass.null
is 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:EmbeddedAspectran
Return whether a bean with the specified id is present.- Specified by:
containsBean
in 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:EmbeddedAspectran
Return whether a bean with the specified object type is present.- Specified by:
containsBean
in 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:EmbeddedAspectran
Returns whether the bean corresponding to the specified object type and ID exists.- Specified by:
containsBean
in 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 NoSuchMessageException
Description copied from interface:EmbeddedAspectran
Try to resolve the message. Treat as an error if the message can't be found.- Specified by:
getMessage
in 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), ornull
if 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:EmbeddedAspectran
Try to resolve the message. Return default message if no message was found.- Specified by:
getMessage
in 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), ornull
if 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
-
-