Search in sources :

Example 1 with ActilityAdminService

use of lora.ns.actility.rest.ActilityAdminService in project cumulocity-lora by SoftwareAG.

the class ActilityConnector method init.

@Override
protected void init() {
    HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
    interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
    OkHttpClient dxClient = new OkHttpClient.Builder().addInterceptor(new DXAdminJWTInterceptor(properties.getProperty("username"), properties.getProperty("password"))).addInterceptor(interceptor).build();
    String url = properties.getProperty("url");
    OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
    Retrofit core = new Retrofit.Builder().client(dxClient).baseUrl(url + "/thingpark/dx/core/latest/api/").addConverterFactory(JacksonConverterFactory.create()).build();
    Retrofit admin = new Retrofit.Builder().baseUrl(url + "/iot-flow/v1/").client(client).addConverterFactory(JacksonConverterFactory.create()).build();
    actilityCoreService = core.create(ActilityCoreService.class);
    actilityAdminService = admin.create(ActilityAdminService.class);
}
Also used : Retrofit(retrofit2.Retrofit) OkHttpClient(okhttp3.OkHttpClient) ActilityAdminService(lora.ns.actility.rest.ActilityAdminService) ActilityCoreService(lora.ns.actility.rest.ActilityCoreService) HttpLoggingInterceptor(okhttp3.logging.HttpLoggingInterceptor)

Aggregations

ActilityAdminService (lora.ns.actility.rest.ActilityAdminService)1 ActilityCoreService (lora.ns.actility.rest.ActilityCoreService)1 OkHttpClient (okhttp3.OkHttpClient)1 HttpLoggingInterceptor (okhttp3.logging.HttpLoggingInterceptor)1 Retrofit (retrofit2.Retrofit)1