All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jelastic.api.development.Applications Maven / Gradle / Ivy

The newest version!
package com.jelastic.api.development;

import java.util.Map;
import java.util.HashMap;
import java.util.List;
import com.jelastic.api.AbstractService;
import com.jelastic.api.Callback;
import com.jelastic.api.client.annotation.JelasticModuleName;
import com.jelastic.api.core.utils.Transport;
import com.jelastic.api.development.response.ApplicationHostsResponse;

/**
* @name Jelastic API Client
* @version 8.11.2
* @copyright Jelastic, Inc.
**/


@JelasticModuleName(name="jelastic")
public class Applications extends AbstractService {

  public static String SERVICE_PATH = "development/applications/";
  private String serviceUrl = SERVER_URL + SERVICE_PATH;
  private String appid = null;
  private String session = null;
  private String client_source = null;

  public Applications(){}

  public Applications(Map _params){
     this((String)_params.get("appid"), (String)_params.get("session"), (String)_params.get("serviceUrl"));
     String serverUrl = (String) _params.get("serverUrl");
     if (serverUrl != null) setServerUrl(serverUrl);
  }

  public Applications(String appid, String session, String serviceUrl){
     if (appid != null) this.appid = appid;
     if (session != null) this.session = session;
     if (serviceUrl != null) this.serviceUrl = serviceUrl;
  }

  public Applications(String appid, String session){
     this(appid, session, null);
  }

  public Applications(String appid){
     this(appid, null, null);
  }

  public String getAppid(){
     return appid;
  }

  public Applications setAppid(String appid){
     this.appid = appid;
     return this;
  }

  public String getSession(){
     return session;
  }

  public Applications setSession(String session){
     this.session = session;
     return this;
  }

  public String getServiceUrl(){
     return serviceUrl;
  }

  public Applications setServiceUrl(String serviceUrl){
     this.serviceUrl = serviceUrl;
     return this;
  }

  public String getServerUrl(){
     return serviceUrl;
  }

  public Applications setServerUrl(String serverUrl){
     this.serviceUrl = serverUrl + SERVICE_PATH;
     return this;
  }

  public Applications setClientSource(String client_source){
     this.client_source = client_source;
     return this;
  }

  public String getClientSource(){
     return client_source ;
  }

  public ApplicationHostsResponse getAppHosts(String appid){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("client_source", client_source);
      return (ApplicationHostsResponse) _call(appid, serviceUrl + "rest/getapphosts", _params, ApplicationHostsResponse.class);
  }

  public ApplicationHostsResponse getAppHosts(String appid, Map headers){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("client_source", client_source);
      return (ApplicationHostsResponse) _call(appid, serviceUrl + "rest/getapphosts", _params, headers, ApplicationHostsResponse.class);
  }

  public Applications getAppHosts(final String appid, final Callback callback){
      new Thread(() -> {
              ApplicationHostsResponse response = getAppHosts(appid);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public Applications getAppHosts(final String appid, final Map headers, final Callback callback){
      new Thread(() -> {
              ApplicationHostsResponse response = getAppHosts(appid);
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public ApplicationHostsResponse getAppHosts(){
      Map _params = new HashMap();
      _params.put("appid", appid);
      _params.put("client_source", client_source);
      return (ApplicationHostsResponse) _call(appid, serviceUrl + "rest/getapphosts", _params, ApplicationHostsResponse.class);
  }

  public Applications getAppHosts(final Callback callback){
      new Thread(() -> {
              ApplicationHostsResponse response = getAppHosts();
              callback.fire(response);
      }, "callback").start();
      return this;
  }

  public ApplicationHostsResponse getAppHosts(Map _params){
      if (!_params.containsKey("appid")) _params.put("appid", appid);
      if (!_params.containsKey("session")) _params.put("session", session);
      if (!_params.containsKey("client_source")) _params.put("client_source", client_source);
      return (ApplicationHostsResponse) _call(appid, serviceUrl + "rest/getapphosts", _params, ApplicationHostsResponse.class);
  }

  public ApplicationHostsResponse getAppHosts(Map _params, Map headers){
      if (!_params.containsKey("appid")) _params.put("appid", appid);
      if (!_params.containsKey("session")) _params.put("session", session);
      if (!_params.containsKey("client_source")) _params.put("client_source", client_source);
      return (ApplicationHostsResponse) _call(appid, serviceUrl + "rest/getapphosts", _params, headers, ApplicationHostsResponse.class);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy