Search in sources :

Example 1 with PreComputedJsonpProvider

use of org.talend.sdk.component.runtime.manager.json.PreComputedJsonpProvider in project component-runtime by Talend.

the class ComponentManager method containerServices.

protected void containerServices(final Container container, final Map<Class<?>, Object> services) {
    // note: we can move it to manager instances at some point
    final JsonProvider jsonpProvider = new PreComputedJsonpProvider(container.getId(), this.jsonpProvider, jsonpParserFactory, jsonpWriterFactory, jsonpBuilderFactory, jsonpGeneratorFactory, jsonpReaderFactory);
    services.put(JsonProvider.class, jsonpProvider);
    services.put(JsonBuilderFactory.class, javaProxyEnricherFactory.asSerializable(container.getLoader(), container.getId(), JsonBuilderFactory.class.getName(), jsonpBuilderFactory));
    services.put(JsonParserFactory.class, javaProxyEnricherFactory.asSerializable(container.getLoader(), container.getId(), JsonParserFactory.class.getName(), jsonpParserFactory));
    services.put(JsonReaderFactory.class, javaProxyEnricherFactory.asSerializable(container.getLoader(), container.getId(), JsonReaderFactory.class.getName(), jsonpReaderFactory));
    services.put(JsonWriterFactory.class, javaProxyEnricherFactory.asSerializable(container.getLoader(), container.getId(), JsonWriterFactory.class.getName(), jsonpWriterFactory));
    services.put(JsonGeneratorFactory.class, javaProxyEnricherFactory.asSerializable(container.getLoader(), container.getId(), JsonGeneratorFactory.class.getName(), jsonpGeneratorFactory));
    final Jsonb jsonb = jsonbProvider.create().withProvider(// reuses the same memory buffering
    jsonpProvider).withConfig(new JsonbConfig().setProperty("johnzon.cdi.activated", false)).build();
    final Jsonb serializableJsonb = Jsonb.class.cast(javaProxyEnricherFactory.asSerializable(container.getLoader(), container.getId(), Jsonb.class.getName(), jsonb));
    services.put(Jsonb.class, serializableJsonb);
    // not JSON services
    services.put(HttpClientFactory.class, new HttpClientFactoryImpl(container.getId(), reflections, serializableJsonb, services));
    services.put(LocalCache.class, new LocalCacheService(container.getId()));
    services.put(LocalConfiguration.class, new LocalConfigurationService(createRawLocalConfigurations(), container.getId()));
    services.put(ProxyGenerator.class, proxyGenerator);
    services.put(Resolver.class, new ResolverImpl(container.getId(), container.getLocalDependencyRelativeResolver()));
}
Also used : LocalConfigurationService(org.talend.sdk.component.runtime.manager.service.LocalConfigurationService) PreComputedJsonpProvider(org.talend.sdk.component.runtime.manager.json.PreComputedJsonpProvider) Jsonb(javax.json.bind.Jsonb) JsonbConfig(javax.json.bind.JsonbConfig) HttpClientFactoryImpl(org.talend.sdk.component.runtime.manager.service.HttpClientFactoryImpl) LocalCacheService(org.talend.sdk.component.runtime.manager.service.LocalCacheService) ResolverImpl(org.talend.sdk.component.runtime.manager.service.ResolverImpl) JsonProvider(javax.json.spi.JsonProvider)

Aggregations

Jsonb (javax.json.bind.Jsonb)1 JsonbConfig (javax.json.bind.JsonbConfig)1 JsonProvider (javax.json.spi.JsonProvider)1 PreComputedJsonpProvider (org.talend.sdk.component.runtime.manager.json.PreComputedJsonpProvider)1 HttpClientFactoryImpl (org.talend.sdk.component.runtime.manager.service.HttpClientFactoryImpl)1 LocalCacheService (org.talend.sdk.component.runtime.manager.service.LocalCacheService)1 LocalConfigurationService (org.talend.sdk.component.runtime.manager.service.LocalConfigurationService)1 ResolverImpl (org.talend.sdk.component.runtime.manager.service.ResolverImpl)1