Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2011-2013 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 APIs in Bonita BPM Community Edition.

Author(s):
Matthieu Chaffotte
Elias Ricken de Medeiros
 
 public final class TenantAPIAccessor {
 
         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 EJB2ServerAPI(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);
         }
     }

    
Refreshes the way the engine client communicates to the engine server.

 
     public static void refresh() {
         APITypeManager.refresh();
     }
 
     private static <T> T getAPI(final Class<T> clazzfinal APISession sessionthrows BonitaHomeNotSetExceptionServerAPIExceptionUnknownAPITypeException {
         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 BonitaHomeNotSetExceptionServerAPIExceptionUnknownAPITypeException {
         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(LoginAPI.class);
     }
 
         return getAPI(IdentityAPI.classsession);
     }
 
         return getAPI(ProcessAPI.classsession);
     }
 
        return getAPI(CommandAPI.classsession);
    }
        return getAPI(ProfileAPI.classsession);
    }
        return getAPI(ThemeAPI.classsession);
    }
New to GrepCode? Check out our FAQ X