private static <T> T getAPI(final Class<T> clazz, final APISession session) { final ServerAPI serverAPI = getServerAPI(); final ClientInterceptor sessionInterceptor = new ClientInterceptor(clazz.getName(), serverAPI, session); return (T) Proxy.newProxyInstance(APIAccessor.class.getClassLoader(), new Class[] { clazz }, sessionInterceptor); }
static <T> T getAPI(final Class<T> clazz) throws BonitaHomeNotSetException, ServerAPIException, UnknownAPITypeException { final ServerAPI serverAPI = getServerAPI(); final ClientInterceptor sessionInterceptor = new ClientInterceptor(clazz.getName(), serverAPI); return (T) Proxy.newProxyInstance(APIAccessor.class.getClassLoader(), new Class[] { clazz }, sessionInterceptor); }
private static <T> T getAPI(final Class<T> clazz) throws BonitaHomeNotSetException, ServerAPIException, UnknownAPITypeException { final ServerAPI serverAPI = getServerAPI(); final ClientInterceptor sessionInterceptor = new ClientInterceptor(clazz.getName(), serverAPI); return (T) Proxy.newProxyInstance(APIAccessor.class.getClassLoader(), new Class[] { clazz }, sessionInterceptor); }
private static <T> T getAPI(final Class<T> clazz) throws BonitaHomeNotSetException, ServerAPIException, UnknownAPITypeException { final ServerAPI serverAPI = getServerAPI(); final ClientInterceptor sessionInterceptor = new ClientInterceptor(clazz.getName(), serverAPI); return (T) Proxy.newProxyInstance(APIAccessor.class.getClassLoader(), new Class[] { clazz }, sessionInterceptor); }
static <T> T getAPI(final Class<T> clazz, final PlatformSession session) throws BonitaHomeNotSetException, ServerAPIException, UnknownAPITypeException { final ServerAPI serverAPI = getServerAPI(); final ClientInterceptor sessionInterceptor = new ClientInterceptor(clazz.getName(), serverAPI, session); return (T) Proxy.newProxyInstance(APIAccessor.class.getClassLoader(), new Class[] { clazz }, sessionInterceptor); }
static <T> T getAPI(final Class<T> clazz, final PlatformSession session) throws BonitaHomeNotSetException, ServerAPIException, UnknownAPITypeException { final ServerAPI serverAPI = getServerAPI(); final ClientInterceptor sessionInterceptor = new ClientInterceptor(clazz.getName(), serverAPI, session); return (T) Proxy.newProxyInstance(APIAccessor.class.getClassLoader(), new Class[] { clazz }, sessionInterceptor); }
private static <T> T getAPI(final Class<T> clazz, final APISession session) { final ServerAPI serverAPI = getServerAPI(); final ClientInterceptor sessionInterceptor = new ClientInterceptor(clazz.getName(), serverAPI, session); return (T) Proxy.newProxyInstance(APIAccessor.class.getClassLoader(), new Class[] { clazz }, sessionInterceptor); }
private static <T> T getAPI(final Class<T> clazz, final APISession session) throws BonitaHomeNotSetException, ServerAPIException, UnknownAPITypeException { final ServerAPI serverAPI = getServerAPI(); final ClientInterceptor sessionInterceptor = new ClientInterceptor(clazz.getName(), serverAPI, session); return (T) Proxy.newProxyInstance(APIAccessor.class.getClassLoader(), new Class[] { clazz }, sessionInterceptor); }
private static <T> T getAPI(final Class<T> clazz, final APISession session) throws BonitaHomeNotSetException, ServerAPIException, UnknownAPITypeException { final ServerAPI serverAPI = getServerAPI(); final ClientInterceptor sessionInterceptor = new ClientInterceptor(clazz.getName(), serverAPI, session); return (T) Proxy.newProxyInstance(APIAccessor.class.getClassLoader(), new Class[] { clazz }, sessionInterceptor); }
static <T> T getAPI(final Class<T> clazz) throws BonitaHomeNotSetException, ServerAPIException, UnknownAPITypeException { final ServerAPI serverAPI = getServerAPI(); final ClientInterceptor sessionInterceptor = new ClientInterceptor(clazz.getName(), serverAPI); return (T) Proxy.newProxyInstance(APIAccessor.class.getClassLoader(), new Class[] { clazz }, sessionInterceptor); }
protected <T> T getAPI(final Class<T> apiClass) { ensureSessionExists(); try { final ClientInterceptor clientInterceptor = new ClientInterceptor(apiClass.getName(), getServerAPI(), session); @SuppressWarnings("unchecked") final T api = (T) Proxy.newProxyInstance(APIAccessor.class.getClassLoader(), new Class[] { apiClass }, clientInterceptor); return api; } catch (ServerAPIException | UnknownAPITypeException e) { throw new IllegalStateException(e.getMessage(), e); } }
protected <T> T getAPI(final Class<T> apiClass) { ensureSessionExists(); try { final ClientInterceptor clientInterceptor = new ClientInterceptor(apiClass.getName(), getServerAPI(), session); @SuppressWarnings("unchecked") final T api = (T) Proxy.newProxyInstance(APIAccessor.class.getClassLoader(), new Class[] { apiClass }, clientInterceptor); return api; } catch (ServerAPIException | UnknownAPITypeException e) { throw new IllegalStateException(e.getMessage(), e); } }
/** * This methods serves the purpose to remove confusion between getAPI() when a session is mandatory, and this one, where no session is needed to access the * API class. * * @param apiClass the API to retrieve * @param <T> The type of the API, extending {@link org.bonitasoft.engine.api.LoginAPI} * @return the retrieved API * @throws IllegalStateException if the API cannot be retrieved. */ protected <T extends LoginAPI> T getLoginAPI(Class<T> apiClass) { try { final ClientInterceptor interceptor = new ClientInterceptor(apiClass.getName(), getServerAPI()); @SuppressWarnings("unchecked") final T api = (T) Proxy.newProxyInstance(APIAccessor.class.getClassLoader(), new Class[] { apiClass }, interceptor); return api; } catch (ServerAPIException | UnknownAPITypeException e) { throw new IllegalStateException(e.getMessage(), e); } }
/** * This methods serves the purpose to remove confusion between getAPI() when a session is mandatory, and this one, where no session is needed to access the * API class. * * @param apiClass the API to retrieve * @param <T> The type of the API, extending {@link org.bonitasoft.engine.api.LoginAPI} * @return the retrieved API * @throws IllegalStateException if the API cannot be retrieved. */ protected <T extends LoginAPI> T getLoginAPI(Class<T> apiClass) { try { final ClientInterceptor interceptor = new ClientInterceptor(apiClass.getName(), getServerAPI()); @SuppressWarnings("unchecked") final T api = (T) Proxy.newProxyInstance(APIAccessor.class.getClassLoader(), new Class[] { apiClass }, interceptor); return api; } catch (ServerAPIException | UnknownAPITypeException e) { throw new IllegalStateException(e.getMessage(), e); } }