Class ServerAPIImpl

java.lang.Object
org.bonitasoft.engine.api.impl.ServerAPIImpl
All Implemented Interfaces:
Serializable, Remote, org.bonitasoft.engine.api.internal.ServerAPI

public class ServerAPIImpl extends Object implements 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 AvailableInMaintenanceMode and 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:
  • Constructor Details

    • ServerAPIImpl

      public ServerAPIImpl(boolean cleanSession)
    • ServerAPIImpl

      public ServerAPIImpl()
    • ServerAPIImpl

      public ServerAPIImpl(APIAccessResolver accessResolver)
      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:
      invokeMethod in interface org.bonitasoft.engine.api.internal.ServerAPI
      Throws:
      org.bonitasoft.engine.api.internal.ServerWrappedException
    • wrapThrowable

      protected org.bonitasoft.engine.exception.BonitaRuntimeException wrapThrowable(Throwable cause)
    • checkMethodAccessibility

      protected void checkMethodAccessibility(Object apiImpl, String apiInterfaceName, Method method, org.bonitasoft.engine.session.Session session, boolean isAlreadyInTransaction)
    • isMaintenanceModeEnabled

      protected boolean isMaintenanceModeEnabled(org.bonitasoft.engine.session.Session session, boolean isAlreadyInTransaction)
      Parameters:
      session - the session to user
      isAlreadyInTransaction - 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