See: Description
Package | Description |
---|---|
com.revo.deployr.client |
Defines interfaces for the core entities managed by DeployR Java client library.
|
com.revo.deployr.client.about |
Defines classes describing the core entities managed by the DeployR Java client library.
|
com.revo.deployr.client.api |
Defines API interfaces on the core entities managed by DeployR Java client library.
|
com.revo.deployr.client.auth |
Defines base authentication interface for DeployR-enabled client applications.
|
com.revo.deployr.client.auth.basic |
Defines basic authentication token for DeployR-enabled client applications.
|
com.revo.deployr.client.data |
Defines interfaces for R object encodings as DeployR Data (RData).
|
com.revo.deployr.client.factory |
Defines convenience factory classes for DeployR-enabled client applications.
|
com.revo.deployr.client.params |
Defines parameter options for DeployR API calls.
|
This library provides a simple API for integrating DeployR authenticated, asynchronous and anonymous services into Java applications.
The basic usage pattern for authenticated services, working with R projects is as follows:
1. Create a client connection to DeployR:
RClient
rClient = RClientFactory.createClient(deployrUrl);
2. Login on the connection:
RUser
rUser = rClient.login(new RBasicAuthentication("testuser", "TESTUSER_PASSWORD"));
3. Create a project:
RProject
rProject = rUser.createProject("Test Project", "Brief description.");
4. Execute R code on the project:
RProjectExecution
rExecution = rProject.executeCode("x <- c(1:10); plot(x,x);");
5. Optionally, save the project:
RProjectDetails
rProjectDetails = rProject.save();
6. Close the project:
rProject.close();
7. Logout and release all resources on the connection:
rClient.release();
The basic usage pattern for asynchronous services, working with jobs is as follows:
1. Create a client connection to DeployR:
RClient
rClient = RClientFactory.createClient(deployrUrl);
2. Login on the connection:
RUser
rUser = rClient.login(new RBasicAuthentication("testuser", "TESTUSER_PASSWORD"));
3. Submit job for background execution:
RJob
rJob = rUser.submitJobCode("Test Job", "Brief description of job.", "x <-
c(1:10); plot(x,x);")
4. Query the status of job:
RJobDetails
rJobDetails = rJob.query()
5. When job status is completed, retrieve result as a project:
if(rJobDetails.status.equals(RJob.COMPLETED)) {
RProject
jProject = rUser.getProject(rJobDetails.project)
}
6. Logout and release all resources on the connection:
rClient.release();
The basic usage pattern for anonymous services, executing published R scripts is as follows:
1. Create a client connection to DeployR:
RClient
rClient = RClientFactory.createClient(deployrUrl);
2. Execute a published R Script anonymously:
RScriptExecution
rExecution = rClient.executeScript(scriptName, scriptDirectory,
scriptAuthor, scriptVersion, scriptExecuteOptions);
3. Retrieve any R Script workspace objects on the response:
List<RData
> workspaceObjects = rExecution.about().workspaceObjects;
4. Retrieve any R Script plot results on the response:
List<RProjectResult
> results = rExecution.about().results;
5. Retrieve any R Script file artifacts on the response:
List<RProjectFile
> artifacts = rExecution.about().artifacts;
6. Logout and release all resources on the connection:
rClient.release();
Once a client connection has been established it can be used to submit any number of API calls up until the point
where the connection is released or timed-out. Each client connection behaves as if all calls on the connection are
made within the context of a single HTTP session on the server.