Package org.bonitasoft.engine.api.impl
Class ServerAPIImpl
- java.lang.Object
-
- org.bonitasoft.engine.api.impl.ServerAPIImpl
-
- All Implemented Interfaces:
java.io.Serializable,java.rmi.Remote,org.bonitasoft.engine.api.internal.ServerAPI
public class ServerAPIImpl extends java.lang.Object implements org.bonitasoft.engine.api.internal.ServerAPIThis class is in charge of calling APIs while adding behavior:- It sets the classloader to the one from platform or tenant
- When the method is NOT annotated with
NoSessionRequired, it verifies that the given session is valid, is on the right scope (tenant or platform), and renew it - When the method is NOT annotated with
CustomTransactions, it opens a transaction - When the method is deprecated, it print a warning
- When the method or class is annotated with
AvailableWhenTenantIsPaused, it verifies the tenant is paused - When the method or class is annotated with
AvailableWhenTenantIsPausedand onlyAvailableWhenPaused is set to true, it verifies the tenant is running - When the method is NOT annotated with
AvailableOnStoppedNode, it verifies the platform is running
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classServerAPIImpl.SessionType
-
Constructor Summary
Constructors Constructor Description ServerAPIImpl()ServerAPIImpl(boolean cleanSession)ServerAPIImpl(APIAccessResolver accessResolver)For Test Mock usage
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckMethodAccessibility(java.lang.Object apiImpl, java.lang.String apiInterfaceName, java.lang.reflect.Method method, org.bonitasoft.engine.session.Session session, boolean isAlreadyInTransaction)protected java.lang.ObjectinvokeAPI(java.lang.reflect.Method method, java.lang.Object apiImpl, java.lang.Object... parametersValues)protected java.lang.ObjectinvokeAPIInTransaction(java.lang.Object[] parametersValues, java.lang.Object apiImpl, java.lang.reflect.Method method, org.bonitasoft.engine.session.Session session, java.lang.String apiInterfaceName)java.lang.ObjectinvokeMethod(java.util.Map<java.lang.String,java.io.Serializable> options, java.lang.String apiInterfaceName, java.lang.String methodName, java.util.List<java.lang.String> classNameParameters, java.lang.Object[] parametersValues)protected booleanisTenantPaused(long tenantId, org.bonitasoft.engine.session.Session session, boolean isAlreadyInTransaction)protected org.bonitasoft.engine.exception.BonitaRuntimeExceptionwrapThrowable(java.lang.Throwable cause)
-
-
-
Constructor Detail
-
ServerAPIImpl
public ServerAPIImpl(boolean cleanSession)
-
ServerAPIImpl
public ServerAPIImpl()
-
ServerAPIImpl
public ServerAPIImpl(APIAccessResolver accessResolver)
For Test Mock usage
-
-
Method Detail
-
invokeMethod
public java.lang.Object invokeMethod(java.util.Map<java.lang.String,java.io.Serializable> options, java.lang.String apiInterfaceName, java.lang.String methodName, java.util.List<java.lang.String> classNameParameters, java.lang.Object[] parametersValues) throws org.bonitasoft.engine.api.internal.ServerWrappedException- Specified by:
invokeMethodin interfaceorg.bonitasoft.engine.api.internal.ServerAPI- Throws:
org.bonitasoft.engine.api.internal.ServerWrappedException
-
wrapThrowable
protected org.bonitasoft.engine.exception.BonitaRuntimeException wrapThrowable(java.lang.Throwable cause)
-
checkMethodAccessibility
protected void checkMethodAccessibility(java.lang.Object apiImpl, java.lang.String apiInterfaceName, java.lang.reflect.Method method, org.bonitasoft.engine.session.Session session, boolean isAlreadyInTransaction)
-
isTenantPaused
protected boolean isTenantPaused(long tenantId, org.bonitasoft.engine.session.Session session, boolean isAlreadyInTransaction)- Parameters:
tenantId- the ID of the tenant to checksession- the session to userisAlreadyInTransaction- if the request is made in a transaction- Returns:
- true if the tenant is available, false otherwise (if the tenant is paused)
-
invokeAPIInTransaction
protected java.lang.Object invokeAPIInTransaction(java.lang.Object[] parametersValues, java.lang.Object apiImpl, java.lang.reflect.Method method, org.bonitasoft.engine.session.Session session, java.lang.String apiInterfaceName) throws java.lang.Throwable- Throws:
java.lang.Throwable
-
invokeAPI
protected java.lang.Object invokeAPI(java.lang.reflect.Method method, java.lang.Object apiImpl, java.lang.Object... parametersValues) throws java.lang.Throwable- Throws:
java.lang.Throwable
-
-