@SuppressWarnings({ "unchecked", "rawtypes" }) static void addClientModule(ApiMetadata apiMetadata, List<Module> modules) { // TODO: move this up if (apiMetadata instanceof HttpApiMetadata) { HttpApiMetadata api = HttpApiMetadata.class.cast(apiMetadata); modules.add(new HttpApiModule(api.getApi())); } else { modules.add(new RestModule()); // Minimally bind HttpClient so that Utils works. modules.add(new AbstractModule() { @Override public void configure() { bind(new TypeLiteral<Function<Invocation, Object>>() { }).to(InvokeHttpMethod.class); bindHttpApi(binder(), HttpClient.class); } }); } }
@Override protected void configure() { install(new SaxParserModule()); install(new GsonModule()); install(new SetCaller.Module()); install(new FactoryModuleBuilder().build(BindToJsonPayloadWrappedWith.Factory.class)); bind(new TypeLiteral<Function<HttpRequest, Function<HttpResponse, ?>>>() { }).to(TransformerForRequest.class); bind(new TypeLiteral<org.jclouds.Fallback<Object>>() { }).to(MapHttp4xxCodesToExceptions.class); bind(new TypeLiteral<Function<Invocation, HttpRequest>>() { }).to(RestAnnotationProcessor.class); bind(IdentityFunction.class).toInstance(IdentityFunction.INSTANCE); // this will help short circuit scenarios that can otherwise lock out users bind(new TypeLiteral<AtomicReference<AuthorizationException>>() { }).toInstance(authException); bind(new TypeLiteral<Function<Predicate<String>, Map<String, String>>>() { }).to(FilterStringsBoundToInjectorByName.class); bind(new TypeLiteral<Function<URI, Proxy>>() { }).to(ProxyForURI.class); installLocations(); } }
@Override protected void configure() { super.configure(); install(invocationModule); bindSyncToAsyncHttpApi(binder(), syncClientType.getRawType(), asyncClientType.getRawType()); bindErrorHandlers(); bindRetryHandlers(); }
protected void installLocations() { install(new LocationModule()); }
@Override protected void configure() { super.configure(); install(invocationModule); bindSyncToAsyncHttpApi(binder(), syncClientType.getRawType(), asyncClientType.getRawType()); bindErrorHandlers(); bindRetryHandlers(); }
protected void installLocations() { install(new LocationModule()); }
@Override protected void configure() { install(new SaxParserModule()); install(new GsonModule()); install(new SetCaller.Module()); install(new FactoryModuleBuilder().build(BindToJsonPayloadWrappedWith.Factory.class)); bind(new TypeLiteral<Function<HttpRequest, Function<HttpResponse, ?>>>() { }).to(TransformerForRequest.class); bind(new TypeLiteral<org.jclouds.Fallback<Object>>() { }).to(MapHttp4xxCodesToExceptions.class); bind(new TypeLiteral<Function<Invocation, HttpRequest>>() { }).to(RestAnnotationProcessor.class); bind(IdentityFunction.class).toInstance(IdentityFunction.INSTANCE); // this will help short circuit scenarios that can otherwise lock out users bind(new TypeLiteral<AtomicReference<AuthorizationException>>() { }).toInstance(authException); bind(new TypeLiteral<Function<Predicate<String>, Map<String, String>>>() { }).to(FilterStringsBoundToInjectorByName.class); bind(new TypeLiteral<Function<URI, Proxy>>() { }).to(ProxyForURI.class); installLocations(); } }
@SuppressWarnings({ "unchecked", "rawtypes" }) static void addClientModule(ApiMetadata apiMetadata, List<Module> modules) { // TODO: move this up if (apiMetadata instanceof HttpApiMetadata) { HttpApiMetadata api = HttpApiMetadata.class.cast(apiMetadata); modules.add(new HttpApiModule(api.getApi())); } else { modules.add(new RestModule()); // Minimally bind HttpClient so that Utils works. modules.add(new AbstractModule() { @Override public void configure() { bind(new TypeLiteral<Function<Invocation, Object>>() { }).to(InvokeHttpMethod.class); bindHttpApi(binder(), HttpClient.class); } }); } }
@Override protected void configure() { super.configure(); install(invocationModule); bindSyncToAsyncHttpApi(binder(), syncClientType.getRawType(), asyncClientType.getRawType()); bindErrorHandlers(); bindRetryHandlers(); }
protected void installLocations() { install(new LocationModule()); }
@Override protected void configure() { install(new SaxParserModule()); install(new GsonModule()); install(new SetCaller.Module()); install(new FactoryModuleBuilder().build(BindToJsonPayloadWrappedWith.Factory.class)); bind(new TypeLiteral<Function<HttpRequest, Function<HttpResponse, ?>>>() { }).to(TransformerForRequest.class); bind(new TypeLiteral<org.jclouds.Fallback<Object>>() { }).to(MapHttp4xxCodesToExceptions.class); bind(new TypeLiteral<Function<Invocation, HttpRequest>>() { }).to(RestAnnotationProcessor.class); bind(IdentityFunction.class).toInstance(IdentityFunction.INSTANCE); // this will help short circuit scenarios that can otherwise lock out users bind(new TypeLiteral<AtomicReference<AuthorizationException>>() { }).toInstance(authException); bind(new TypeLiteral<Function<Predicate<String>, Map<String, String>>>() { }).to(FilterStringsBoundToInjectorByName.class); bind(new TypeLiteral<Function<URI, Proxy>>() { }).to(ProxyForURI.class); installLocations(); } }
@SuppressWarnings({ "unchecked", "rawtypes" }) static void addClientModule(ApiMetadata apiMetadata, List<Module> modules) { // TODO: move this up if (apiMetadata instanceof HttpApiMetadata) { HttpApiMetadata api = HttpApiMetadata.class.cast(apiMetadata); modules.add(new HttpApiModule(api.getApi())); } else { modules.add(new RestModule()); // Minimally bind HttpClient so that Utils works. modules.add(new AbstractModule() { @Override public void configure() { bind(new TypeLiteral<Function<Invocation, Object>>() { }).to(InvokeHttpMethod.class); bindHttpApi(binder(), HttpClient.class); } }); } }
@Override protected void configure() { super.configure(); bind(new TypeLiteral<Function<Invocation, Object>>() { }).to(InvokeHttpMethod.class); bindHttpApi(binder(), api); bindHttpApi(binder(), HttpClient.class); bindErrorHandlers(); bindRetryHandlers(); }
protected void installLocations() { install(new LocationModule()); }
@Override protected void configure() { install(new SaxParserModule()); install(new GsonModule()); install(new SetCaller.Module()); install(new FactoryModuleBuilder().build(BindToJsonPayloadWrappedWith.Factory.class)); bind(new TypeLiteral<Function<HttpRequest, Function<HttpResponse, ?>>>() { }).to(TransformerForRequest.class); bind(new TypeLiteral<org.jclouds.Fallback<Object>>() { }).to(MapHttp4xxCodesToExceptions.class); bind(new TypeLiteral<Function<Invocation, HttpRequest>>() { }).to(RestAnnotationProcessor.class); bind(IdentityFunction.class).toInstance(IdentityFunction.INSTANCE); // this will help short circuit scenarios that can otherwise lock out users bind(new TypeLiteral<AtomicReference<AuthorizationException>>() { }).toInstance(authException); bind(new TypeLiteral<Function<Predicate<String>, Map<String, String>>>() { }).to(FilterStringsBoundToInjectorByName.class); bind(new TypeLiteral<Function<URI, Proxy>>() { }).to(ProxyForURI.class); installLocations(); } }
@SuppressWarnings({ "unchecked", "rawtypes" }) static void addClientModule(ApiMetadata apiMetadata, List<Module> modules) { // TODO: move this up if (apiMetadata instanceof HttpApiMetadata) { HttpApiMetadata api = HttpApiMetadata.class.cast(apiMetadata); modules.add(new HttpApiModule(api.getApi())); } else if (apiMetadata instanceof RestApiMetadata) { RestApiMetadata rest = RestApiMetadata.class.cast(apiMetadata); modules.add(new RestClientModule(typeToken(rest.getApi()), typeToken(rest.getAsyncApi()))); } else { modules.add(new RestModule()); modules.add(new SyncToAsyncHttpInvocationModule()); } }
@Override protected void configure() { super.configure(); bind(new TypeLiteral<Function<Invocation, Object>>() { }).to(InvokeHttpMethod.class); bindHttpApi(binder(), api); bindHttpApi(binder(), HttpClient.class); bindErrorHandlers(); bindRetryHandlers(); }
protected void installLocations() { install(new LocationModule()); }
@Override protected void configure() { install(new SaxParserModule()); install(new GsonModule()); install(new SetCaller.Module()); install(new FactoryModuleBuilder().build(BindToJsonPayloadWrappedWith.Factory.class)); bind(new TypeLiteral<Function<HttpRequest, Function<HttpResponse, ?>>>() { }).to(TransformerForRequest.class); bind(new TypeLiteral<org.jclouds.Fallback<Object>>() { }).to(MapHttp4xxCodesToExceptions.class); bind(new TypeLiteral<Function<Invocation, HttpRequest>>() { }).to(RestAnnotationProcessor.class); bind(IdentityFunction.class).toInstance(IdentityFunction.INSTANCE); // this will help short circuit scenarios that can otherwise lock out users bind(new TypeLiteral<AtomicReference<AuthorizationException>>() { }).toInstance(authException); bind(new TypeLiteral<Function<Predicate<String>, Map<String, String>>>() { }).to(FilterStringsBoundToInjectorByName.class); bind(new TypeLiteral<Function<URI, Proxy>>() { }).to(ProxyForURI.class); installLocations(); } }
@SuppressWarnings({ "unchecked", "rawtypes" }) static void addClientModule(ApiMetadata apiMetadata, List<Module> modules) { // TODO: move this up if (apiMetadata instanceof HttpApiMetadata) { HttpApiMetadata api = HttpApiMetadata.class.cast(apiMetadata); modules.add(new HttpApiModule(api.getApi())); } else if (apiMetadata instanceof RestApiMetadata) { RestApiMetadata rest = RestApiMetadata.class.cast(apiMetadata); modules.add(new RestClientModule(typeToken(rest.getApi()), typeToken(rest.getAsyncApi()))); } else { modules.add(new RestModule()); modules.add(new SyncToAsyncHttpInvocationModule()); } }