/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.taverna.mobile.data.remote;

import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.simplexml.SimpleXmlConverterFactory;


public class BaseApiManager {


    public static final String MY_EXPERIMENT_END_POINT = "http://www.myexperiment.org/";

    public static final String TAVERNA_PLAYER_END_POINT = "http://139.59.28.12:3000/";

    /******** Helper class that sets up a new services *******/

    private <T> T createApi(Class<T> clazz, String ENDPOINT) {

        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(ENDPOINT)
                .addConverterFactory(SimpleXmlConverterFactory.create())
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .client(new TavernaOkHttpClient().getTavernaOkHttpClient())
                .build();

        return retrofit.create(clazz);
    }

    public TavernaService getTavernaApi() {
        return createApi(TavernaService.class, MY_EXPERIMENT_END_POINT);
    }

    public  TavernaPlayerService getTavernaPlayerApi(){
        return createApi(TavernaPlayerService.class, TAVERNA_PLAYER_END_POINT);
    }
}
@@ -934,16 +934,70 @@
 actory;%0A
+import retrofit2.converter.gson.GsonConverterFactory;%0A
 import r
@@ -1319,16 +1319,49 @@
 ervices 
+with simplexml converter factory 
 *******/
@@ -1382,24 +1382,33 @@
 %3CT%3E T create
+SimpleXML
 Api(Class%3CT%3E
@@ -1809,32 +1809,570 @@
 (clazz);%0A    %7D%0A%0A
+    /******** Helper class that sets up a new services with gson converter factory *******/%0A%0A    private %3CT%3E T createJsonApi(Class%3CT%3E clazz, String ENDPOINT) %7B%0A%0A        Retrofit retrofit = new Retrofit.Builder()%0A                .baseUrl(ENDPOINT)%0A                .addConverterFactory(GsonConverterFactory.create())%0A                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())%0A                .client(new TavernaOkHttpClient().getTavernaOkHttpClient())%0A                .build();%0A%0A        return retrofit.create(clazz);%0A    %7D%0A%0A
     public Taver
@@ -2412,32 +2412,41 @@
    return create
+SimpleXML
 Api(TavernaServi
@@ -2565,16 +2565,20 @@
 n create
+Json
 Api(Tave

add multiple converter