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 -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsBean
(Class<?> type) Return whether a bean with the specified object type is present.boolean
containsBean
(Class<?> type, String id) Returns whether the bean corresponding to the specified object type and ID exists.boolean
containsBean
(String id) Return whether a bean with the specified id is present.protected void
protected void
Gets the application adapter.<V> V
Return an instance of the bean that matches the given object type.<V> V
Return an instance of the bean that matches the given object type.<V> V
Return an instance of the bean that matches the given id.Gets the environment.getMessage
(String code, Object[] args, String defaultMessage, Locale locale) Try to resolve the message.getMessage
(String code, Object[] args, Locale locale) Try to resolve the message.boolean
isExposable
(String transletName) Returns whether the translet can be exposed to the daemon service.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, buildActivityContext, configure, configure, destroyActivityContext, doPause, doPause, doResume, doStart, doStop, start, stop
Methods inherited from class com.aspectran.core.service.AbstractCoreService
checkDirectoryStructure, createSchedulerService, getActivityContext, getActivityContextBuilder, getAltClassLoader, getAspectranConfig, getBasePath, getDefaultActivity, getSchedulerService, getServiceClassLoader, getServiceController, hasActivityContextBuilder, hasServiceClassLoader, isDerived, isHardReload, isLateStart, joinDerivedService, leaveFromRootService, setActivityContext, setActivityContextBuilder, setAltClassLoader, setAspectranConfig, setBasePath, setServiceClassLoader, withdrawDerivedService
Methods inherited from class com.aspectran.core.service.AbstractServiceController
clearDerivedService, getLock, getRootService, getServiceName, isActive, isBusy, joinDerivedService, pause, pause, restart, restart, resume, setExposals, setRootService, setServiceStateListener, withdrawDerivedService
-
Constructor Details
-
AbstractEmbeddedAspectran
public AbstractEmbeddedAspectran()
-
-
Method Details
-
isExposable
Description copied from interface:EmbeddedAspectran
Returns whether the translet can be exposed to the daemon service.- Specified by:
isExposable
in interfaceEmbeddedAspectran
- Overrides:
isExposable
in classAbstractServiceController
- Parameters:
transletName
- the name of the translet to check- Returns:
- true if the translet can be exposed; false otherwise
-
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
-
createSessionManager
protected void createSessionManager() -
destroySessionManager
protected void destroySessionManager() -
getEnvironment
Description copied from interface:EmbeddedAspectran
Gets the environment.- Specified by:
getEnvironment
in interfaceEmbeddedAspectran
- Returns:
- the environment
-
getApplicationAdapter
Description copied from interface:EmbeddedAspectran
Gets the application adapter.- Specified by:
getApplicationAdapter
in interfaceEmbeddedAspectran
- Returns:
- the application adapter
-
release
public void release()Description copied from interface:EmbeddedAspectran
Stop the service and release all allocated resources.- Specified by:
release
in interfaceEmbeddedAspectran
-
getBean
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 type of bean object retrieved- Parameters:
id
- the id of the bean to retrieve- Returns:
- an instance of the bean
-
getBean
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 type of bean object retrieved- Parameters:
type
- the type the bean must match; can be an interface or superclass.null
is disallowed.- Returns:
- an instance of the bean
-
getBean
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 type of bean object retrieved- 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
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
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
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
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:
-
getMessage
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:
-