public final class SDK
extends java.lang.Object
This is the main entry point to the SDK. Users will retrieve the singleton SDK object before
doing anything. Depending on user's requirements all other objects can be created from the
SDK either directly or indirectly. For example one way of using it would be to obtain a
a top level Server object for the cluster user is interested in connecting to. User
can then use the retrieved Server object to query for all known projects and then instantiate
a Project object. Alternately the Project can be created directly from the
SDK as long as the proper Uri is used.
In general to retrieve an entity from the SDK context use an Uri. To retrieve and entity from its parent entity use the entity name.
Uri| Modifier and Type | Class and Description |
|---|---|
static class |
SDK.AccessMode
Enumeration of access mode types.
|
| Modifier and Type | Field and Description |
|---|---|
static boolean |
g_sslProviderInstalled |
| Modifier and Type | Method and Description |
|---|---|
Dispatcher |
createDispatcher(java.lang.String name)
Created a
Dispatcher object. |
Publisher |
createPublisher(Uri uri,
Credentials creds)
Returns a
Publisher that can be used to publish data to the specified project. |
Publisher |
createPublisher(Uri uri,
Credentials creds,
PublisherOptions options)
Returns a
Publisher that can be used to publish data to the specified project. |
Selector |
createSelector(java.lang.String name)
Create a custom Selector.
|
Subscriber |
createSubscriber(Uri uri,
Credentials creds)
Returns a new
Subscriber with default options. |
Subscriber |
createSubscriber(Uri uri,
Credentials creds,
SubscriberOptions options)
Returnes a new
Subscriber with the specified options. |
Updater |
createUpdater(java.lang.String name,
int period)
Create a custom Updater.
|
Dispatcher |
getDefaultDispatcher()
Retrieve the default SDK Dispatcher.
|
Selector |
getDefaultSelector()
Retrieve the default
Selector object that can be used to acces entities
in SDK.AccessMode.SELECT access mode. |
Updater |
getDefaultUpdater()
Retrieve the default SDK updater object.
|
static SDK |
getInstance()
Retrieve the one and only SDK object.
|
Project |
getProject(java.lang.String host,
int commandPort,
Credentials creds)
Returns a project object for a standalone project (one that has been started manually on the command line).
|
Project |
getProject(java.lang.String host,
int commandPort,
java.lang.String gatewayHost,
int gatewyPort,
Credentials creds,
ProjectOptions options)
Returns a project object for a standalone project (one that has been started manually on the command line).
|
Project |
getProject(Uri uri,
Credentials creds)
Retrieves a
Project object corresponding to the project refered to by the uri. |
Project |
getProject(Uri uri,
Credentials creds,
ProjectOptions options)
Retrieves a
Project object corresponding to the server project refered to by the uri using the
specified options. |
Server |
getServer(Uri cUri,
Credentials creds)
Creates a Server object with default options.
|
Server |
getServer(Uri cUri,
Credentials creds,
ServerOptions options)
Retrieves a
Server object representing a running instance of a server manager. |
Server[] |
getServers()
Retrieve an array
Server objects currently open. |
static java.lang.String |
getSessionId(Uri server,
Credentials creds)
Logs in to the server using the provided credentials and returns a valid session id.
|
boolean |
isStarted()
Determine if a
start() call has been made. |
static void |
logoffSession(java.lang.String sessionId)
Deregister the specified session id that has previously been retrieved using
getSessionId(Uri, Credentials) |
void |
setTraceStream(java.io.PrintStream out) |
void |
start()
Initializes the SDK for operation which includes steps such as starting internal threads.
|
void |
stop()
Decreases start count for the SDK.
|
public static final SDK getInstance()
public static java.lang.String getSessionId(Uri server, Credentials creds) throws javax.security.auth.login.LoginException, java.io.IOException
logoffSession(String)server - the cluster to connect tocreds - credentials to usejava.io.IOExceptionjavax.security.auth.login.LoginExceptionpublic static void logoffSession(java.lang.String sessionId)
throws ServerErrorException,
java.io.IOException
getSessionId(Uri, Credentials)sessionId - id previously retrieved using getSessionId(Uri, Credentials)java.io.IOExceptionServerErrorExceptionpublic Server getServer(Uri cUri, Credentials creds)
Server object instance
even if the Uri used to create the server is same.cUri - uri repsenting one or more cluster managers.creds - credentials to use for authenticationpublic Server getServer(Uri cUri, Credentials creds, ServerOptions options)
Server object representing a running instance of a server manager.
The Uri is checked for correctness but not validity, that is a connection is not
established. Each call creates a distinct Server object instance.cUri - a Uri representing a cluster managercreds - a Credentials object containing the authentication and security detailsoptions - ServerOptions if a server with non default options is requiredpublic Project getProject(java.lang.String host, int commandPort, Credentials creds) throws java.io.IOException, EntityNotFoundException, ServerErrorException
host - the host project is running oncommandPort - command and control port the project is listening oncreds - credentials to useProjectEntityNotFoundExceptionjava.io.IOExceptionServerErrorExceptionpublic Project getProject(java.lang.String host, int commandPort, java.lang.String gatewayHost, int gatewyPort, Credentials creds, ProjectOptions options) throws java.io.IOException, EntityNotFoundException, ServerErrorException
host - commandPort - gatewayHost - ignored for nowgatewyPort - ingored for nowcreds - ProjectEntityNotFoundExceptionjava.io.IOExceptionServerErrorExceptionpublic Project getProject(Uri uri, Credentials creds) throws EntityNotFoundException, java.io.IOException, javax.security.auth.login.LoginException, ServerErrorException
Project object corresponding to the project refered to by the uri. Used default project
options. This call creates a new Server object internally. The Server is created in the SDK.AccessMode.DIRECT
access mode.
If the intention is to create a project for a specific Server instance, then use Server.getProject(String, String) call
for that instance.
uri - a project uri.creds - credentials for authenticationProjectEntityNotFoundExceptionjava.io.IOExceptionjavax.security.auth.login.LoginExceptionServerErrorExceptionpublic Project getProject(Uri uri, Credentials creds, ProjectOptions options) throws EntityNotFoundException, java.io.IOException, javax.security.auth.login.LoginException, ServerErrorException
Project object corresponding to the server project refered to by the uri using the
specified options. This call creates a new Server object internally. The server is created in
SDK.AccessMode.DIRECT access mode.
If the the intention is to create a project for a specific Server instance, then use
Server.getProject(String, String, ProjectOptions) call for that instance.
uri - a project uri.creds - credentials for authenticationoptions - ProjectOptions to use to create the ProjectProjectEntityNotFoundExceptionjava.io.IOExceptionjavax.security.auth.login.LoginExceptionServerErrorExceptionpublic Subscriber createSubscriber(Uri uri, Credentials creds) throws EntityNotFoundException, java.io.IOException, javax.security.auth.login.LoginException, ServerErrorException
Subscriber with default options. Internally calls #getSubscriber(Uri, Credentials, SubscriberOptions)
with default SubscriberOptions.
Internally this call creates a new Server, Project hierarchy all in SDK.AccessMode.DIRECT access modes. If the intention is to create a subscriber for a
particular Project instance, use Project.createSubscriber() for that instance.
uri - A valid project Uricreds - authentication credentialsSubscriberjava.io.IOExceptionEntityNotFoundExceptionjavax.security.auth.login.LoginExceptionServerErrorExceptionpublic Subscriber createSubscriber(Uri uri, Credentials creds, SubscriberOptions options) throws EntityNotFoundException, java.io.IOException, javax.security.auth.login.LoginException, ServerErrorException
Subscriber with the specified options. If the parent project and servers do not already exist they
are created internally with default options.
Internally this call creates a new Server, Project hierarchy all in SDK.AccessMode.DIRECT access modes. If the intention is to create a subscriber for a
particular Project instance, use Project.createSubscriber(SubscriberOptions) for that instance.
uri - a valid Project uricreds - authentication credentialsoptions - the options to use to create the subscriberSubscriberjava.io.IOExceptionEntityNotFoundExceptionjavax.security.auth.login.LoginExceptionServerErrorExceptionpublic Publisher createPublisher(Uri uri, Credentials creds) throws EntityNotFoundException, java.io.IOException, javax.security.auth.login.LoginException, ServerErrorException
Publisher that can be used to publish data to the specified project. Uses default options.
Internally this call creates a new Server, Project hierarchy specific for this publisher all in SDK.AccessMode.DIRECT access modes. If the intentention is
to create a publisher for a specific Project instance, use Project.createPublisher() for that
instance.
uri - a valid Project uricreds - authentication credentialsPublisherEntityNotFoundExceptionjava.io.IOExceptionjavax.security.auth.login.LoginExceptionServerErrorExceptionpublic Publisher createPublisher(Uri uri, Credentials creds, PublisherOptions options) throws EntityNotFoundException, java.io.IOException, javax.security.auth.login.LoginException, ServerErrorException
Publisher that can be used to publish data to the specified project. Uses the specified options.
Internally this call creates a new Server, Project hierarchy specific for this publisher all in SDK.AccessMode.DIRECT access modes. If the intentention is
to create a publisher for a specific Project instance, use Project.createPublisher(PublisherOptions) for that
instance.
uri - a valid Project uricreds - authentication credentialsoptions - options to use to create the publisherPublisherEntityNotFoundExceptionjava.io.IOExceptionjavax.security.auth.login.LoginExceptionServerErrorExceptionpublic Dispatcher getDefaultDispatcher()
Dispatcherpublic Dispatcher createDispatcher(java.lang.String name)
Dispatcher object. Not implemented in R5.name - string to assign as name to the custom DispatcherDispatcherpublic Updater getDefaultUpdater()
Updaterpublic Updater createUpdater(java.lang.String name, int period)
name - string to assign as a name to the custom Updaterperiod - the update period in millisecondsUpdaterpublic Selector getDefaultSelector()
Selector object that can be used to acces entities
in SDK.AccessMode.SELECT access mode.Selectorpublic Selector createSelector(java.lang.String name)
name - Selectorpublic void start()
throws java.io.IOException
stop() calls.java.io.IOExceptionpublic void stop()
public Server[] getServers()
Server objects currently open.Server objectspublic boolean isStarted()
start() call has been made.public void setTraceStream(java.io.PrintStream out)