Search in sources :

Example 1 with RMRestClient

use of org.ow2.proactive_grid_cloud_portal.rm.client.RMRestClient in project scheduling by ow2-proactive.

the class RMNodeClient method init.

@Override
public void init(ConnectionInfo connectionInfo) throws Exception {
    HttpClient client = new HttpClientBuilder().insecure(connectionInfo.isInsecure()).useSystemProperties().build();
    RMRestClient restApiClient = new RMRestClient(connectionInfo.getUrl(), new ApacheHttpClient4Engine(client));
    this.rm = restApiClient.getRm();
    this.connectionInfo = connectionInfo;
    try {
        String sid = rm.rmConnect(connectionInfo.getLogin(), connectionInfo.getPassword());
        setSession(sid);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : RMRestClient(org.ow2.proactive_grid_cloud_portal.rm.client.RMRestClient) HttpClient(org.apache.http.client.HttpClient) ApacheHttpClient4Engine(org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine) HttpClientBuilder(org.ow2.proactive.http.HttpClientBuilder) PermissionRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException) NotConnectedException(org.ow2.proactive.scheduler.common.exception.NotConnectedException) IOException(java.io.IOException) RestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.RestException) RMNodeException(org.ow2.proactive.resourcemanager.exception.RMNodeException)

Example 2 with RMRestClient

use of org.ow2.proactive_grid_cloud_portal.rm.client.RMRestClient in project scheduling by ow2-proactive.

the class RMClientExample method main.

public static void main(String[] args) throws LoginException, KeyException, RMException {
    System.out.println("Hello from example.");
    RMRestClient client = new RMRestClient("http://localhost:8080/rest/", null);
    RMRestInterface rm = client.getRm();
    String sessionId = rm.rmConnect("admin", "admin");
    System.out.println(sessionId);
}
Also used : RMRestInterface(org.ow2.proactive_grid_cloud_portal.common.RMRestInterface)

Aggregations

IOException (java.io.IOException)1 HttpClient (org.apache.http.client.HttpClient)1 ApacheHttpClient4Engine (org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine)1 HttpClientBuilder (org.ow2.proactive.http.HttpClientBuilder)1 RMNodeException (org.ow2.proactive.resourcemanager.exception.RMNodeException)1 NotConnectedException (org.ow2.proactive.scheduler.common.exception.NotConnectedException)1 RMRestInterface (org.ow2.proactive_grid_cloud_portal.common.RMRestInterface)1 RMRestClient (org.ow2.proactive_grid_cloud_portal.rm.client.RMRestClient)1 PermissionRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException)1 RestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.RestException)1