Package com.aspectran.embed.service
Interface EmbeddedAspectran
-
- All Known Implementing Classes:
AbstractEmbeddedAspectran
,DefaultEmbeddedAspectran
public interface EmbeddedAspectran
The Interface EmbeddedAspectran.Created: 2017. 10. 28.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract 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.<V> V
execute(InstantAction<V> instantAction)
Executes an instant activity.<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.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.java.lang.String
render(java.lang.String templateId)
Renders the template without the supplied variables.java.lang.String
render(java.lang.String templateId, ParameterMap parameterMap)
Renders the template with the given parameters.java.lang.String
render(java.lang.String templateId, ParameterMap parameterMap, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Renders the template with the given parameters and attributes.java.lang.String
render(java.lang.String templateId, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Renders the template with the given attributes.static EmbeddedAspectran
run(AspectranConfig aspectranConfig)
Creates and starts a newDefaultEmbeddedAspectran
.static EmbeddedAspectran
run(java.io.File aspectranConfigFile)
Creates and starts a newDefaultEmbeddedAspectran
.static EmbeddedAspectran
run(java.io.Reader configFileReader)
Creates and starts a newDefaultEmbeddedAspectran
.static EmbeddedAspectran
run(java.lang.String aspectranConfigFile)
Creates and starts a newDefaultEmbeddedAspectran
.Translet
translate(java.lang.String name)
Executes the translet.Translet
translate(java.lang.String name, ParameterMap parameterMap)
Executes the translet with the given parameters.Translet
translate(java.lang.String name, ParameterMap parameterMap, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Executes the translet with the given parameters and attributes.Translet
translate(java.lang.String name, MethodType method)
Executes the translet without the supplied variables.Translet
translate(java.lang.String name, MethodType method, ParameterMap parameterMap)
Executes the translet with the given parameters.Translet
translate(java.lang.String name, MethodType method, ParameterMap parameterMap, java.util.Map<java.lang.String,java.lang.Object> attributeMap, java.lang.String body)
Executes the translet with the given parameters and attributes.Translet
translate(java.lang.String name, MethodType method, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Executes the translet with the given attributes.Translet
translate(java.lang.String name, java.lang.String body)
Executes the translet.Translet
translate(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Executes the translet with the given parameters.
-
-
-
Method Detail
-
isExposable
boolean isExposable(java.lang.String transletName)
Returns whether or not the translet can be exposed to the daemon service.- Parameters:
transletName
- the name of the translet to check- Returns:
- true if the translet can be exposed; false otherwise
-
newSessionAdapter
SessionAdapter newSessionAdapter()
Create and return a new session adapter from the embedded aspectran.- Returns:
- the session adapter
-
execute
<V> V execute(InstantAction<V> instantAction)
Executes an instant activity.- Parameters:
instantAction
- the instant action- Returns:
- An object that is the result of performing an instant activity
- Since:
- 6.5.1
-
translate
Translet translate(java.lang.String name)
Executes the translet.- Parameters:
name
- the translet name- Returns:
- the
Translet
object
-
translate
Translet translate(java.lang.String name, java.lang.String body)
Executes the translet.- Parameters:
name
- the translet namebody
- the request body- Returns:
- the
Translet
object
-
translate
Translet translate(java.lang.String name, ParameterMap parameterMap)
Executes the translet with the given parameters.- Parameters:
name
- the translet nameparameterMap
- the parameter map- Returns:
- the
Translet
object
-
translate
Translet translate(java.lang.String name, ParameterMap parameterMap, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Executes the translet with the given parameters and attributes.- Parameters:
name
- the translet nameparameterMap
- the parameter mapattributeMap
- the attribute map- Returns:
- the
Translet
object
-
translate
Translet translate(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Executes the translet with the given parameters.- Parameters:
name
- the translet nameattributeMap
- the attribute map- Returns:
- the
Translet
object
-
translate
Translet translate(java.lang.String name, MethodType method)
Executes the translet without the supplied variables.- Parameters:
name
- the translet namemethod
- the request method- Returns:
- the
Translet
object
-
translate
Translet translate(java.lang.String name, MethodType method, ParameterMap parameterMap)
Executes the translet with the given parameters.- Parameters:
name
- the translet namemethod
- the request methodparameterMap
- the parameter map- Returns:
- the
Translet
object
-
translate
Translet translate(java.lang.String name, MethodType method, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Executes the translet with the given attributes.- Parameters:
name
- the translet namemethod
- the request methodattributeMap
- the attribute map- Returns:
- the
Translet
object
-
translate
Translet translate(java.lang.String name, MethodType method, ParameterMap parameterMap, java.util.Map<java.lang.String,java.lang.Object> attributeMap, java.lang.String body)
Executes the translet with the given parameters and attributes.- Parameters:
name
- the translet namemethod
- the request methodparameterMap
- the parameter mapattributeMap
- the attribute mapbody
- the request body- Returns:
- the
Translet
object
-
render
java.lang.String render(java.lang.String templateId)
Renders the template without the supplied variables.- Parameters:
templateId
- the template id- Returns:
- the output string of the template
-
render
java.lang.String render(java.lang.String templateId, ParameterMap parameterMap)
Renders the template with the given parameters.- Parameters:
templateId
- the template idparameterMap
- the parameter map- Returns:
- the output string of the template
-
render
java.lang.String render(java.lang.String templateId, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Renders the template with the given attributes.- Parameters:
templateId
- the template idattributeMap
- the attribute map- Returns:
- the output string of the template
-
render
java.lang.String render(java.lang.String templateId, ParameterMap parameterMap, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Renders the template with the given parameters and attributes.- Parameters:
templateId
- the template idparameterMap
- the parameter mapattributeMap
- the attribute map- Returns:
- the output string of the template
-
getEnvironment
Environment getEnvironment()
Gets the environment.- Returns:
- the environment
-
getBean
<V> V getBean(java.lang.String id)
Return an instance of the bean that matches the given id.- 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
<V> V getBean(java.lang.Class<V> type)
Return an instance of the bean that matches the given object type.- 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
- Since:
- 1.3.1
-
getBean
<V> V getBean(java.lang.Class<V> type, java.lang.String id)
Return an instance of the bean that matches the given object type.- 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
- Since:
- 2.0.0
-
containsBean
boolean containsBean(java.lang.String id)
Return whether a bean with the specified id is present.- Parameters:
id
- the id of the bean to query- Returns:
- whether a bean with the specified id is present
-
containsBean
boolean containsBean(java.lang.Class<?> type)
Return whether a bean with the specified object type is present.- Parameters:
type
- the object type of the bean to query- Returns:
- whether a bean with the specified type is present
-
containsBean
boolean containsBean(java.lang.Class<?> type, java.lang.String id)
Returns whether the bean corresponding to the specified object type and ID exists.- 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
java.lang.String getMessage(java.lang.String code, java.lang.Object[] args, java.util.Locale locale) throws NoSuchMessageException
Try to resolve the message. Treat as an error if the message can't be found.- 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
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. Return default message if no message was found.- 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
-
release
void release()
Stop the service and release all allocated resources.
-
run
static EmbeddedAspectran run(java.lang.String aspectranConfigFile)
Creates and starts a newDefaultEmbeddedAspectran
.- Parameters:
aspectranConfigFile
- the aspectran configuration file- Returns:
- the instance of
EmbeddedAspectran
-
run
static EmbeddedAspectran run(java.io.File aspectranConfigFile)
Creates and starts a newDefaultEmbeddedAspectran
.- Parameters:
aspectranConfigFile
- the aspectran configuration file- Returns:
- the instance of
EmbeddedAspectran
-
run
static EmbeddedAspectran run(java.io.Reader configFileReader)
Creates and starts a newDefaultEmbeddedAspectran
.- Parameters:
configFileReader
- the aspectran configuration file reader- Returns:
- the instance of
EmbeddedAspectran
-
run
static EmbeddedAspectran run(AspectranConfig aspectranConfig)
Creates and starts a newDefaultEmbeddedAspectran
.- Parameters:
aspectranConfig
- the parameters for aspectran configuration- Returns:
- the instance of
EmbeddedAspectran
-
-