Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2015 BonitaSoft S.A. BonitaSoft, 32 rue Gustave Eiffel - 38000 Grenoble This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation version 2.1 of the License. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
 package org.bonitasoft.engine.api;
 
 import java.util.Map;
 
Accessor class that retrieve Platform APIs

All APIs given by this class are relevant to the platform only.

Author(s):
Matthieu Chaffotte
 
 public class PlatformAPIAccessor {
 
         try {
             final ApiAccessType apiType = APITypeManager.getAPIType();
             Map<StringStringparameters = null;
             switch (apiType) {
                 case :
                     return LocalServerAPIFactory.getServerAPI();
                 case :
                     parameters = APITypeManager.getAPITypeParameters();
                     return new EJB3ServerAPI(parameters);
                 case :
                     parameters = APITypeManager.getAPITypeParameters();
                     return new HTTPServerAPI(parameters);
                 case :
                     parameters = APITypeManager.getAPITypeParameters();
                     return new TCPServerAPI(parameters);
                 default:
                     throw new UnknownAPITypeException("Unsupported API Type: " + apiType);
             }
         } catch (IOException e) {
             throw new ServerAPIException(e);
         }
     }

    
Reload the configuration of the Bonita home from the file system It allows to change in runtime the Bonita engine your client application uses
 
     public static void refresh() {
         APITypeManager.refresh();
     }

    
 
         return getAPI(PlatformLoginAPI.class);
     }
 
     private static <T> T getAPI(final Class<T> clazzfinal PlatformSession sessionthrows BonitaHomeNotSetExceptionServerAPIException,
             UnknownAPITypeException {
         final ServerAPI serverAPI = getServerAPI();
         final ClientInterceptor sessionInterceptor = new ClientInterceptor(clazz.getName(), serverAPIsession);
         return (T) Proxy.newProxyInstance(APIAccessor.class.getClassLoader(), new Class[] { clazz }, sessionInterceptor);
     }
 
     private static <T> T getAPI(final Class<T> clazzthrows BonitaHomeNotSetExceptionServerAPIException,
             UnknownAPITypeException {
         final ServerAPI serverAPI = getServerAPI();
         final ClientInterceptor sessionInterceptor = new ClientInterceptor(clazz.getName(), serverAPI);
         return (T) Proxy.newProxyInstance(APIAccessor.class.getClassLoader(), new Class[] { clazz }, sessionInterceptor);
     }

    
        return getAPI(PlatformAPI.classsession);
    }

    
            UnknownAPITypeException {
        return getAPI(PlatformCommandAPI.classsession);
    }
New to GrepCode? Check out our FAQ X