Class 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.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 annotated with AvailableWhenTenantIsPaused, it verifies the tenant is paused
    • When the method or class is annotated with AvailableWhenTenantIsPaused and 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void checkMethodAccessibility​(java.lang.Object apiImpl, java.lang.String apiInterfaceName, java.lang.reflect.Method method, org.bonitasoft.engine.session.Session session, boolean isAlreadyInTransaction)  
      protected java.lang.Object invokeAPI​(java.lang.reflect.Method method, java.lang.Object apiImpl, java.lang.Object... parametersValues)  
      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)  
      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)  
      protected boolean isTenantPaused​(long tenantId, org.bonitasoft.engine.session.Session session, boolean isAlreadyInTransaction)  
      protected org.bonitasoft.engine.exception.BonitaRuntimeException wrapThrowable​(java.lang.Throwable cause)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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:
        invokeMethod in interface org.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 check
        session - the session to user
        isAlreadyInTransaction - 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