public class Instance extends Element
Constructor and Description |
---|
Instance() |
Modifier and Type | Method and Description |
---|---|
ActiveVersion |
getActiveVersion()
Gets information about the IBM Streams Installation that was used to
start this instance
|
java.lang.String |
getApplicationConsoleURL()
Streams application console URL.
|
long |
getCreationTime()
Gets the time in milliseconds when this instance was created
|
java.lang.String |
getCreationUser()
Gets the user ID that created this instance
|
Domain |
getDomain()
Get the Streams domain for this instance.
|
java.lang.String |
getHealth()
Gets the summarized status of jobs in this instance
|
java.lang.String |
getId()
Gets the IBM Streams unique identifier for this instance
|
Job |
getJob(java.lang.String jobId)
Gets the
Job for a given jobId in this instance |
java.util.List<Job> |
getJobs()
Gets a list of
jobs that this instance knows about |
java.lang.String |
getOwner()
Gets the user ID that represents the owner of this instance
|
java.util.List<ProcessingElement> |
getPes()
Gets a list of
processing elements for this instance. |
java.lang.String |
getProductVersion()
Gets the product version, please note that this is null for Streams version < 5.2
|
java.util.List<ResourceAllocation> |
getResourceAllocations()
Gets a list of
resource allocations for this instance. |
java.lang.String |
getResourceType()
Identifies the REST resource type
|
long |
getStartTime()
Gets the time in milliseconds when the instance was started.
|
java.lang.String |
getStatus()
Gets the status of the instance
|
boolean |
isProductVersionAtLeast(int major,
int minor)
Tests if the instance has a minimum major.minor product version.
|
static Instance |
ofEndpoint(java.lang.String endpoint,
java.lang.String name,
java.lang.String userName,
java.lang.String password,
boolean verify)
Connect to a Cloud Pak for Data IBM Streams instance.
|
static Instance |
ofEndpoint(java.lang.String endpoint,
java.lang.String name,
java.lang.String userName,
java.lang.String password)
Connect to a Cloud Pak for Data IBM Streams instance.
|
Result<Job,com.google.gson.JsonObject> |
submitJob(java.io.File bundle,
com.google.gson.JsonObject jco)
Submit a Streams bundle to run on the Streaming Analytics Service.
|
ApplicationBundle |
uploadBundle(java.io.File bundle)
Upload a Streams application bundle (sab) to the instance.
|
getStreamsConnection, refresh, toString
public static Instance ofEndpoint(java.lang.String endpoint, java.lang.String name, java.lang.String userName, java.lang.String password) throws java.io.IOException
This call is equivalent to ofEndpoint(String, String, String, String, boolean)
passing true
for verify.
Two configurations are supported:
The endpoint defaults to the environment variable CP4D_URL
.
An example is @{code https://cp4d_server:31843}.
The Streams service name is passed in as name, defaulting to the
environment variables STREAMS_INSTANCE_ID
.
The endpoint defaults to the environment variable STREAMS_REST_URL
.
An example is https://streams_sws_service:34679
.
No service name is specified thus name should be null
.
endpoint
- Endpoint defining the Streams instance.name
- Streams instance name for a integrated configuration. This
value is ignored for a standalone configuration.userName
- User name, if null
defaults to environment variable STREAMS_USERNAME
if set,
otherwise the operating user identifier.password
- Password, if null
defaults to environment variable STREAMS_PASSWORD
.java.io.IOException
- Error connecting to instance.public static Instance ofEndpoint(java.lang.String endpoint, java.lang.String name, java.lang.String userName, java.lang.String password, boolean verify) throws java.io.IOException
Two configurations are supported:
The endpoint defaults to the environment variable CP4D_URL
.
An example is @{code https://cp4d_server:31843}.
The Streams service name is passed in as name, defaulting to the
environment variables STREAMS_INSTANCE_ID
.
The endpoint defaults to the environment variable STREAMS_REST_URL
.
An example is https://streams_sws_service:34679
.
No service name is specified thus name should be null
.
endpoint
- Endpoint defining the Streams instance.name
- Streams instance name for a integrated configuration. This
value is ignored for a standalone configuration.userName
- User name, if null
defaults to environment variable STREAMS_USERNAME
if set,
otherwise the operating user identifier.password
- Password, if null
defaults to environment variable STREAMS_PASSWORD
.java.io.IOException
- Error connecting to instance.public java.util.List<Job> getJobs() throws java.io.IOException
jobs
that this instance knows aboutIBM Streams Jobs
java.io.IOException
public java.util.List<ProcessingElement> getPes() throws java.io.IOException
processing elements
for this instance.Processing Elements
java.io.IOException
public java.util.List<ResourceAllocation> getResourceAllocations() throws java.io.IOException
resource allocations
for this instance.resource allocations
java.io.IOException
public Job getJob(java.lang.String jobId) throws java.io.IOException
Job
for a given jobId in this instancejobId
- String identifying the jobJob
java.io.IOException
public ActiveVersion getActiveVersion()
ActiveVersion
. Please note that Streams version >= 5.x does not have this element.public java.lang.String getProductVersion()
public boolean isProductVersionAtLeast(int major, int minor)
major
- The minimum major versionminor
- the minimum minor versionpublic long getCreationTime()
public java.lang.String getCreationUser()
public java.lang.String getHealth()
public java.lang.String getId()
public java.lang.String getOwner()
public java.lang.String getResourceType()
public long getStartTime()
public java.lang.String getStatus()
public java.lang.String getApplicationConsoleURL()
public Domain getDomain() throws java.io.IOException
java.io.IOException
- Error communicating with REST api.public ApplicationBundle uploadBundle(java.io.File bundle) throws java.io.IOException
ApplicationBundle
.
ApplicationBundle
represents the local file bundle
tied to this
instance. The returned object may still be used for job submission.bundle
- path to a Streams application bundle (sab file) containing
the application to be uploadedjava.io.IOException
- Error uploading the bundle.public Result<Job,com.google.gson.JsonObject> submitJob(java.io.File bundle, com.google.gson.JsonObject jco) throws java.io.IOException
The returned Result
instance has:
Result.getId()
returning the job identifier or null
if
a job was not created..Result.getElement()
returning a Job
instance for the submitted job or null
if
a job was not created.Result.getRawResult()
return the raw JSON response.bundle
- A streams application bundlejco
- Job configuration overlay in JSON format.java.io.IOException
- Error communicating with the service.