Package com.aspectran.embed.service
Class DefaultEmbeddedAspectran
- java.lang.Object
-
- com.aspectran.core.service.AbstractServiceController
-
- com.aspectran.core.service.AbstractCoreService
-
- com.aspectran.core.service.AspectranCoreService
-
- com.aspectran.embed.service.DefaultEmbeddedAspectran
-
- All Implemented Interfaces:
CoreService
,ServiceController
,EmbeddedAspectran
public class DefaultEmbeddedAspectran 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 DefaultEmbeddedAspectran()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterContextLoaded()
This method is executed immediately after the ActivityContext is loaded.void
beforeContextDestroy()
This method executed just before the ActivityContext is destroyed.protected static DefaultEmbeddedAspectran
create(AspectranConfig aspectranConfig)
Returns a new instance ofDefaultEmbeddedAspectran
.SessionAdapter
newSessionAdapter()
Create and return a new session adapter from the embedded aspectran.void
release()
Stop the service and release all allocated resources.java.lang.String
template(java.lang.String templateId)
Evaluates the template without any provided variables.java.lang.String
template(java.lang.String templateId, ParameterMap parameterMap)
Evaluates the template with a set of parameters.java.lang.String
template(java.lang.String templateId, ParameterMap parameterMap, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Evaluates the template with a set of parameters and attributes.java.lang.String
template(java.lang.String templateId, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Evaluate the template with a set of parameters.Translet
translate(java.lang.String name)
Executes the translet.Translet
translate(java.lang.String name, ParameterMap parameterMap)
Executes the translet.Translet
translate(java.lang.String name, ParameterMap parameterMap, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Executes the translet.Translet
translate(java.lang.String name, MethodType method)
Executes the translet.Translet
translate(java.lang.String name, MethodType method, ParameterMap parameterMap)
Executes the translet.Translet
translate(java.lang.String name, MethodType method, ParameterMap parameterMap, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Executes the translet.Translet
translate(java.lang.String name, MethodType method, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Executes the translet.Translet
translate(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Executes the translet.-
Methods inherited from class com.aspectran.core.service.AspectranCoreService
doPause, doPause, doResume, doStart, doStop
-
Methods inherited from class com.aspectran.core.service.AbstractCoreService
destroyActivityContext, determineBasePath, getActivityContext, getApplicationAdapter, getAspectranClassLoader, getAspectranConfig, getBasePath, getSchedulerService, getServiceController, isDerived, isExposable, isHardReload, isLateStart, joinDerivedService, loadActivityContext, prepare, setActivityContext, setBasePath, setExposals
-
Methods inherited from class com.aspectran.core.service.AbstractServiceController
clearDerivedService, getLock, getServiceName, isActive, isBusy, joinDerivedService, pause, pause, restart, restart, resume, setServiceStateListener, start, stop
-
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.service.CoreService
getActivityContext, getApplicationAdapter, getAspectranClassLoader, getAspectranConfig, getBasePath, getServiceController, isHardReload, isLateStart, joinDerivedService
-
-
-
-
Method Detail
-
afterContextLoaded
public void afterContextLoaded() throws java.lang.Exception
Description copied from class:AspectranCoreService
This method is executed immediately after the ActivityContext is loaded.- Overrides:
afterContextLoaded
in classAspectranCoreService
- Throws:
java.lang.Exception
- if an error occurs
-
beforeContextDestroy
public void beforeContextDestroy()
Description copied from class:AspectranCoreService
This method executed just before the ActivityContext is destroyed.- Overrides:
beforeContextDestroy
in classAspectranCoreService
-
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
-
translate
public Translet translate(java.lang.String name)
Executes the translet.- Specified by:
translate
in interfaceEmbeddedAspectran
- Parameters:
name
- the translet name- Returns:
- the
Translet
object
-
translate
public Translet translate(java.lang.String name, ParameterMap parameterMap)
Executes the translet.- Specified by:
translate
in interfaceEmbeddedAspectran
- Parameters:
name
- the translet nameparameterMap
- the parameter map- Returns:
- the
Translet
object
-
translate
public Translet translate(java.lang.String name, ParameterMap parameterMap, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Executes the translet.- Specified by:
translate
in interfaceEmbeddedAspectran
- Parameters:
name
- the translet nameparameterMap
- the parameter mapattributeMap
- the attribute map- Returns:
- the
Translet
object
-
translate
public Translet translate(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Executes the translet.- Specified by:
translate
in interfaceEmbeddedAspectran
- Parameters:
name
- the translet nameattributeMap
- the attribute map- Returns:
- the
Translet
object
-
translate
public Translet translate(java.lang.String name, MethodType method)
Executes the translet.- Specified by:
translate
in interfaceEmbeddedAspectran
- Parameters:
name
- the translet namemethod
- the request method- Returns:
- the
Translet
object
-
translate
public Translet translate(java.lang.String name, MethodType method, ParameterMap parameterMap)
Executes the translet.- Specified by:
translate
in interfaceEmbeddedAspectran
- Parameters:
name
- the translet namemethod
- the request methodparameterMap
- the parameter map- Returns:
- the
Translet
object
-
translate
public Translet translate(java.lang.String name, MethodType method, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Executes the translet.- Specified by:
translate
in interfaceEmbeddedAspectran
- Parameters:
name
- the translet namemethod
- the request methodattributeMap
- the attribute map- Returns:
- the
Translet
object
-
translate
public Translet translate(java.lang.String name, MethodType method, ParameterMap parameterMap, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Executes the translet.- Specified by:
translate
in interfaceEmbeddedAspectran
- Parameters:
name
- the translet namemethod
- the request methodparameterMap
- the parameter mapattributeMap
- the attribute map- Returns:
- the
Translet
object
-
template
public java.lang.String template(java.lang.String templateId)
Evaluates the template without any provided variables.- Specified by:
template
in interfaceEmbeddedAspectran
- Parameters:
templateId
- the template id- Returns:
- the output string of the template
-
template
public java.lang.String template(java.lang.String templateId, ParameterMap parameterMap)
Evaluates the template with a set of parameters.- Specified by:
template
in interfaceEmbeddedAspectran
- Parameters:
templateId
- the template idparameterMap
- the parameter map- Returns:
- the output string of the template
-
template
public java.lang.String template(java.lang.String templateId, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Evaluate the template with a set of parameters.- Specified by:
template
in interfaceEmbeddedAspectran
- Parameters:
templateId
- the template idattributeMap
- the attribute map- Returns:
- the output string of the template
-
template
public java.lang.String template(java.lang.String templateId, ParameterMap parameterMap, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Evaluates the template with a set of parameters and attributes.- Specified by:
template
in interfaceEmbeddedAspectran
- Parameters:
templateId
- the template idparameterMap
- the parameter mapattributeMap
- the attribute map- Returns:
- the output string of the template
-
release
public void release()
Description copied from interface:EmbeddedAspectran
Stop the service and release all allocated resources.- Specified by:
release
in interfaceEmbeddedAspectran
-
create
protected static DefaultEmbeddedAspectran create(AspectranConfig aspectranConfig)
Returns a new instance ofDefaultEmbeddedAspectran
.- Parameters:
aspectranConfig
- the parameters for aspectran configuration- Returns:
- the instance of
DefaultEmbeddedAspectran
-
-