Package org.bonitasoft.engine.api.impl
Class ServerAPIImpl
java.lang.Object
org.bonitasoft.engine.api.impl.ServerAPIImpl
- All Implemented Interfaces:
Serializable,Remote,org.bonitasoft.engine.api.internal.ServerAPI
This 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 NOT annotated with
AvailableInMaintenanceMode, it verifies the maintenance mode is disabled - When the method or class is annotated with
AvailableInMaintenanceModeand onlyAvailableInMaintenanceMode is set to true, it verifies the maintenance mode is enabled - When the method is NOT annotated with
AvailableOnStoppedNode, it verifies the platform is running
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionServerAPIImpl(boolean cleanSession) ServerAPIImpl(APIAccessResolver accessResolver) For Test Mock usage -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckMethodAccessibility(Object apiImpl, String apiInterfaceName, Method method, org.bonitasoft.engine.session.Session session, boolean isAlreadyInTransaction) protected Objectprotected ObjectinvokeAPIInTransaction(Object[] parametersValues, Object apiImpl, Method method, org.bonitasoft.engine.session.Session session, String apiInterfaceName) invokeMethod(Map<String, Serializable> options, String apiInterfaceName, String methodName, List<String> classNameParameters, Object[] parametersValues) protected booleanisMaintenanceModeEnabled(org.bonitasoft.engine.session.Session session, boolean isAlreadyInTransaction) protected org.bonitasoft.engine.exception.BonitaRuntimeExceptionwrapThrowable(Throwable cause)
-
Constructor Details
-
ServerAPIImpl
public ServerAPIImpl(boolean cleanSession) -
ServerAPIImpl
public ServerAPIImpl() -
ServerAPIImpl
For Test Mock usage
-
-
Method Details
-
invokeMethod
public Object invokeMethod(Map<String, Serializable> options, String apiInterfaceName, String methodName, List<String> classNameParameters, 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
-
checkMethodAccessibility
-
isMaintenanceModeEnabled
protected boolean isMaintenanceModeEnabled(org.bonitasoft.engine.session.Session session, boolean isAlreadyInTransaction) - Parameters:
session- the session to userisAlreadyInTransaction- if the request is made in a transaction- Returns:
- true if the maintenance mode is enabled, false otherwise
-
invokeAPIInTransaction
protected Object invokeAPIInTransaction(Object[] parametersValues, Object apiImpl, Method method, org.bonitasoft.engine.session.Session session, String apiInterfaceName) throws Throwable - Throws:
Throwable
-
invokeAPI
protected Object invokeAPI(Method method, Object apiImpl, Object... parametersValues) throws Throwable - Throws:
Throwable
-