Class LocalServiceChannelImpl
- java.lang.Object
-
- com.anaptecs.jeaf.core.servicechannel.base.AbstractServiceChannel
-
- com.anaptecs.jeaf.core.servicechannel.unmanaged.LocalServiceChannelImpl
-
- All Implemented Interfaces:
com.anaptecs.jeaf.core.servicechannel.api.ServiceChannel
public class LocalServiceChannelImpl extends AbstractServiceChannel
Class provides a base implementation for a local service channel. Local here means that all services that are accessible via this service channel are expected to be executed within the same VM. This service channel can be used in classic JSE environments as well as inside a Web Container. However it's not intended to be used inside an EJB Container. The implementation of this base class does not support transactions, but this can easily be added by subclasses. Instances of this class are state less and support multi threading.- Author:
- JEAF Development Team
-
-
Field Summary
-
Fields inherited from class com.anaptecs.jeaf.core.servicechannel.base.AbstractServiceChannel
lifecycleManager
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
LocalServiceChannelImpl(com.anaptecs.jeaf.core.servicechannel.api.LifecycleManager pLifecycleManager)
Initialize object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.anaptecs.jeaf.xfun.api.health.HealthCheckResult
checkService(java.lang.Class<? extends com.anaptecs.jeaf.core.api.Service> pServiceClass, com.anaptecs.jeaf.xfun.api.health.CheckLevel pCheckLevel)
Method checks the state of the passed service.protected com.anaptecs.jeaf.core.api.ServiceInvocationContext
createServiceInvocationContext(java.lang.Class<? extends com.anaptecs.jeaf.core.api.Service> pTargetServiceClass, com.anaptecs.jeaf.core.api.Component pComponent, com.anaptecs.jeaf.xfun.api.info.ApplicationInfo pInvokingApplication, com.anaptecs.jeaf.core.api.SessionContext pSessionContext)
Method creates a new instance of a service invocation context object.protected com.anaptecs.jeaf.core.api.TxContext
createTxContext()
Method creates a new instance of a transaction context object.java.io.Serializable
executeCommandTxMandatory(com.anaptecs.jeaf.core.servicechannel.api.Command pCommand)
Method executes the passed command.java.io.Serializable
executeCommandTxNever(com.anaptecs.jeaf.core.servicechannel.api.Command pCommand)
Method executes the passed command.java.io.Serializable
executeCommandTxNotSupported(com.anaptecs.jeaf.core.servicechannel.api.Command pCommand)
Method executes the passed command.java.io.Serializable
executeCommandTxRequired(com.anaptecs.jeaf.core.servicechannel.api.Command pCommand)
Method executes the passed command.java.io.Serializable
executeCommandTxRequiresNew(com.anaptecs.jeaf.core.servicechannel.api.Command pCommand)
Method executes the passed command.java.io.Serializable
executeCommandTxSupports(com.anaptecs.jeaf.core.servicechannel.api.Command pCommand)
Method executes the passed command.protected void
releasingTxContext(com.anaptecs.jeaf.core.api.TxContext pTxContext)
Method will be called whenever a previously created transaction context is about to be released.-
Methods inherited from class com.anaptecs.jeaf.core.servicechannel.base.AbstractServiceChannel
invokeService, performServiceCheck
-
-
-
-
Constructor Detail
-
LocalServiceChannelImpl
protected LocalServiceChannelImpl(com.anaptecs.jeaf.core.servicechannel.api.LifecycleManager pLifecycleManager)
Initialize object. Currently no actions are performed.- Parameters:
pLifecycleManager
- Lifecycle manager to which this service channel belongs to. The parameter must not be null.
-
-
Method Detail
-
createServiceInvocationContext
protected final com.anaptecs.jeaf.core.api.ServiceInvocationContext createServiceInvocationContext(java.lang.Class<? extends com.anaptecs.jeaf.core.api.Service> pTargetServiceClass, com.anaptecs.jeaf.core.api.Component pComponent, com.anaptecs.jeaf.xfun.api.info.ApplicationInfo pInvokingApplication, com.anaptecs.jeaf.core.api.SessionContext pSessionContext)
Method creates a new instance of a service invocation context object. Depending on the current context the method will either return a newRootServiceInvovationContextImpl
orServiceInvocationContextImpl
object.- Specified by:
createServiceInvocationContext
in classAbstractServiceChannel
- Parameters:
pTargetServiceClass
- Class object of service interface that is called. The parameter must not be null.pComponent
- Component to which the represented service call belongs to. The parameter must not be null.pInvokingApplication
- Information about the invoking application. The parameter must not be null.pSessionContext
- Session Context to which the current service invocation belongs to.- Returns:
ServiceInvocationContext
Created service invocation context object. The method never returns null.- See Also:
AbstractServiceChannel#createServiceInvocationContext()
-
createTxContext
protected com.anaptecs.jeaf.core.api.TxContext createTxContext()
Method creates a new instance of a transaction context object. The method has to return a new instance for every call. There must not be any kind of pooling of invocation context objects.- Specified by:
createTxContext
in classAbstractServiceChannel
- Returns:
TxContext
Created transaction context object. The method must not return null.- See Also:
AbstractServiceChannel.createTxContext()
-
releasingTxContext
protected void releasingTxContext(com.anaptecs.jeaf.core.api.TxContext pTxContext)
Method will be called whenever a previously created transaction context is about to be released. This means depending on the transactions state that is will either be committed or rolled back (seeTxContext.getRollbackOnly()
). It depends on the concrete implementation of the service channel, whether actions have to performed or not. The method will be called before the transaction context will be released and become invalid. This class only provides an empty implementation.- Specified by:
releasingTxContext
in classAbstractServiceChannel
- Parameters:
pTxContext
- Transaction context that will be released. The parameter is never used since this service channel implementation does not support transactions.
-
executeCommandTxNotSupported
public final java.io.Serializable executeCommandTxNotSupported(com.anaptecs.jeaf.core.servicechannel.api.Command pCommand) throws com.anaptecs.jeaf.xfun.api.errorhandling.ApplicationException, com.anaptecs.jeaf.xfun.api.errorhandling.SystemException
Method executes the passed command. For this implementation of a service channel this means that a local (in VM) method call will be performed. This method call through the service channel should be executed with transaction behavior NOT_SUPPORTED. However this service channel implementation currently does not support transactions.- Parameters:
pCommand
- Command object that should be executed. The command objects contains all parameters that are required to perform the corresponding service call. The parameter must not be null.- Returns:
- Serializable Result of the command execution. Since JEAF supports distributed environments all results must be serializable.
- Throws:
com.anaptecs.jeaf.xfun.api.errorhandling.ApplicationException
- Services may throw an ApplicationException in order to indicate an application specific problem.The current transaction will not be automatically rolled back.com.anaptecs.jeaf.xfun.api.errorhandling.SystemException
- Service may throw a SystemException in order to indicate technical problems. In the case of an system exception the current transaction will be rolled back.- See Also:
ServiceChannel.executeCommandTxNotSupported(Command)
-
executeCommandTxSupports
public final java.io.Serializable executeCommandTxSupports(com.anaptecs.jeaf.core.servicechannel.api.Command pCommand) throws com.anaptecs.jeaf.xfun.api.errorhandling.ApplicationException, com.anaptecs.jeaf.xfun.api.errorhandling.SystemException
Method executes the passed command. For this implementation of a service channel this means that a local (in VM) method call will be performed. This method call through the service channel should be executed with transaction behavior SUPPORTS. However this service channel implementation currently does not support transactions.- Parameters:
pCommand
- Command object that should be executed. The command objects contains all parameters that are required to perform the corresponding service call. The parameter must not be null.- Returns:
- Serializable Result of the command execution. Since JEAF supports distributed environments all results must be serializable.
- Throws:
com.anaptecs.jeaf.xfun.api.errorhandling.ApplicationException
- Services may throw an ApplicationException in order to indicate an application specific problem.The current transaction will not be automatically rolled back.com.anaptecs.jeaf.xfun.api.errorhandling.SystemException
- Service may throw a SystemException in order to indicate technical problems. In the case of an system exception the current transaction will be rolled back.- See Also:
ServiceChannel.executeCommandTxSupports(Command)
-
executeCommandTxRequired
public final java.io.Serializable executeCommandTxRequired(com.anaptecs.jeaf.core.servicechannel.api.Command pCommand) throws com.anaptecs.jeaf.xfun.api.errorhandling.ApplicationException, com.anaptecs.jeaf.xfun.api.errorhandling.SystemException
Method executes the passed command. For this implementation of a service channel this means that a local (in VM) method call will be performed. This method call through the service channel should be executed with transaction behavior REQUIRED. However this service channel implementation currently does not support transactions.- Parameters:
pCommand
- Command object that should be executed. The command objects contains all parameters that are required to perform the corresponding service call. The parameter must not be null.- Returns:
- Serializable Result of the command execution. Since JEAF supports distributed environments all results must be serializable.
- Throws:
com.anaptecs.jeaf.xfun.api.errorhandling.ApplicationException
- Services may throw an ApplicationException in order to indicate an application specific problem.The current transaction will not be automatically rolled back.com.anaptecs.jeaf.xfun.api.errorhandling.SystemException
- Service may throw a SystemException in order to indicate technical problems. In the case of an system exception the current transaction will be rolled back.- See Also:
ServiceChannel.executeCommandTxRequired(Command)
-
executeCommandTxRequiresNew
public final java.io.Serializable executeCommandTxRequiresNew(com.anaptecs.jeaf.core.servicechannel.api.Command pCommand) throws com.anaptecs.jeaf.xfun.api.errorhandling.ApplicationException, com.anaptecs.jeaf.xfun.api.errorhandling.SystemException
Method executes the passed command. For this implementation of a service channel this means that a local (in VM) method call will be performed. This method call through the service channel should be executed with transaction behavior REQUIRES_NEW. However this service channel implementation currently does not support transactions.- Parameters:
pCommand
- Command object that should be executed. The command objects contains all parameters that are required to perform the corresponding service call. The parameter must not be null.- Returns:
- Serializable Result of the command execution. Since JEAF supports distributed environments all results must be serializable.
- Throws:
com.anaptecs.jeaf.xfun.api.errorhandling.ApplicationException
- Services may throw an ApplicationException in order to indicate an application specific problem.The current transaction will not be automatically rolled back.com.anaptecs.jeaf.xfun.api.errorhandling.SystemException
- Service may throw a SystemException in order to indicate technical problems. In the case of an system exception the current transaction will be rolled back.- See Also:
ServiceChannel.executeCommandTxRequiresNew(Command)
-
executeCommandTxMandatory
public final java.io.Serializable executeCommandTxMandatory(com.anaptecs.jeaf.core.servicechannel.api.Command pCommand) throws com.anaptecs.jeaf.xfun.api.errorhandling.ApplicationException, com.anaptecs.jeaf.xfun.api.errorhandling.SystemException
Method executes the passed command. For this implementation of a service channel this means that a local (in VM) method call will be performed. This method call through the service channel should be executed with transaction behavior MANDATORY. However this service channel implementation currently does not support transactions.- Parameters:
pCommand
- Command object that should be executed. The command objects contains all parameters that are required to perform the corresponding service call. The parameter must not be null.- Returns:
- Serializable Result of the command execution. Since JEAF supports distributed environments all results must be serializable.
- Throws:
com.anaptecs.jeaf.xfun.api.errorhandling.ApplicationException
- Services may throw an ApplicationException in order to indicate an application specific problem.The current transaction will not be automatically rolled back.com.anaptecs.jeaf.xfun.api.errorhandling.SystemException
- Service may throw a SystemException in order to indicate technical problems. In the case of an system exception the current transaction will be rolled back.- See Also:
ServiceChannel.executeCommandTxMandatory(Command)
-
executeCommandTxNever
public final java.io.Serializable executeCommandTxNever(com.anaptecs.jeaf.core.servicechannel.api.Command pCommand) throws com.anaptecs.jeaf.xfun.api.errorhandling.ApplicationException, com.anaptecs.jeaf.xfun.api.errorhandling.SystemException
Method executes the passed command. For this implementation of a service channel this means that a local (in VM) method call will be performed. This method call through the service channel should be executed with transaction behavior NEVER. However this service channel implementation currently does not support transactions.- Parameters:
pCommand
- Command object that should be executed. The command objects contains all parameters that are required to perform the corresponding service call. The parameter must not be null.- Returns:
- Serializable Result of the command execution. Since JEAF supports distributed environments all results must be serializable.
- Throws:
com.anaptecs.jeaf.xfun.api.errorhandling.ApplicationException
- Services may throw an ApplicationException in order to indicate an application specific problem.The current transaction will not be automatically rolled back.com.anaptecs.jeaf.xfun.api.errorhandling.SystemException
- Service may throw a SystemException in order to indicate technical problems. In the case of an system exception the current transaction will be rolled back.- See Also:
ServiceChannel.executeCommandTxNever(Command)
-
checkService
public final com.anaptecs.jeaf.xfun.api.health.HealthCheckResult checkService(java.lang.Class<? extends com.anaptecs.jeaf.core.api.Service> pServiceClass, com.anaptecs.jeaf.xfun.api.health.CheckLevel pCheckLevel)
Method checks the state of the passed service. Method checks the current state of the service implementation that provides the passed service interface. This method call through the service channel should be executed with transaction behavior REQUIRES_NEW. However this service channel implementation currently does not support transactions.- Parameters:
pService
- Service whose state should be checked. The parameter must not be null.pCheckLevel
- Level of check that should be performed. The parameter must not be null.- Returns:
HealthCheckResult
Object describing the result of the check. The method may return null. This means that the service does not implement any checks.
-
-