public abstract class Client extends Object
Constructor and Description |
---|
Client() |
Modifier and Type | Method and Description |
---|---|
abstract void |
connect()
Establishes a connection.
|
abstract URI |
create(cz.cesnet.cloud.occi.core.Entity entity)
Creates a new resource on the server.
|
abstract boolean |
delete(String resourceType)
Deletes all resource of a certain resource type from the server.
|
abstract boolean |
delete(URI resourceIdentifier)
Deletes all resource of a certain resource type or specific resource from
the server.
|
abstract List<cz.cesnet.cloud.occi.core.Entity> |
describe()
Retrieves descriptions for all available resources.
|
abstract List<cz.cesnet.cloud.occi.core.Entity> |
describe(String resourceType)
Retrieves descriptions for available resources of a certain type.
|
abstract List<cz.cesnet.cloud.occi.core.Entity> |
describe(URI resourceIdentifier)
Retrieves descriptions for available resources specified by a type
identifier or resource identifier.
|
Authentication |
getAuthentication()
Returns client's authentication method.
|
URI |
getEndpoint()
Returns client's endpoint.
|
cz.cesnet.cloud.occi.Model |
getModel()
Returns model.
|
boolean |
isConnected()
Checks whether client is connected.
|
abstract List<URI> |
list()
Retrieves all available resources represented by resource locations
(URIs).
|
abstract List<URI> |
list(String resourceType)
Retrieves available resources of a certain type represented by resource
locations (URIs).
|
abstract List<URI> |
list(URI resourceIdentifier)
Retrieves available resources of a certain type represented by resource
locations (URIs).
|
abstract void |
refresh()
Refreshes the Model used inside the client.
|
void |
setAuthentication(Authentication authentication)
Sets client's authentication method.
|
void |
setConnected(boolean connected)
Sets whether client is connected or not.
|
void |
setEndpoint(URI endpoint)
Sets client's endpoint.
|
void |
setModel(cz.cesnet.cloud.occi.Model model)
Sets model.
|
abstract boolean |
trigger(String resourceType,
cz.cesnet.cloud.occi.core.ActionInstance action)
Triggers given action on a specified set of resources.
|
abstract boolean |
trigger(URI resourceIdentifier,
cz.cesnet.cloud.occi.core.ActionInstance action)
Triggers given action on a set of resources or on a specified resource.
|
abstract URI |
update(cz.cesnet.cloud.occi.core.Entity entity) |
public static final String MODEL_URI
public URI getEndpoint()
public void setEndpoint(URI endpoint)
endpoint
- client's endpointpublic cz.cesnet.cloud.occi.Model getModel()
public void setModel(cz.cesnet.cloud.occi.Model model)
model
- modelpublic boolean isConnected()
public void setConnected(boolean connected)
connected
- client's connection statuspublic Authentication getAuthentication()
public void setAuthentication(Authentication authentication)
authentication
- client's authentication methodpublic abstract List<URI> list() throws CommunicationException
Retrieves all available resources represented by resource locations (URIs).
Example:
List<URI> list = client.list();
CommunicationException
- when error occured during the
communication with serverpublic abstract List<URI> list(String resourceType) throws CommunicationException
Example:
List<URI> list = client.list("compute");
resourceType
- resource type in shortened format (e.g. "compute",
"storage", "network")CommunicationException
- when error occured during the
communication with serverpublic abstract List<URI> list(URI resourceIdentifier) throws CommunicationException
Example:
List<URI> list = client.list(URI.create("http://schemas.ogf.org/occi/infrastructure#network"));
resourceIdentifier
- full resource type identifierCommunicationException
- when error occured during the
communication with serverpublic abstract List<cz.cesnet.cloud.occi.core.Entity> describe() throws CommunicationException
Example:
List<Entity> list = client.describe();
CommunicationException
- when error occured during the
communication with serverpublic abstract List<cz.cesnet.cloud.occi.core.Entity> describe(String resourceType) throws CommunicationException
Example:
List<Entity> list = client.describe("compute");
resourceType
- resource type in shortened format (e.g. "compute",
"storage", "network")CommunicationException
- when error occured during the
communication with serverpublic abstract List<cz.cesnet.cloud.occi.core.Entity> describe(URI resourceIdentifier) throws CommunicationException
Example:
List<Entity> list = client.describe(URI.create("http://schemas.ogf.org/occi/infrastructure#network"));
...
list = client.describe(URI.create("https://remote.server.net/storage/123"));
resourceIdentifier
- either full resource type identifier or full
resource identifierCommunicationException
- when error occured during the
communication with serverpublic abstract URI create(cz.cesnet.cloud.occi.core.Entity entity) throws CommunicationException
Example:
Model model = client.getModel();
EntityBuilder entityBuilder = new EntityBuilder(model);
Compute compute = entityBuilder.getCompute();
compute.addMixin(model.findMixin("debian7", "os_tpl"));
compute.addMixin(model.findMixin("small", "resource_tpl"));
compute.setMemory(1024);
compute.setCores(4);
URI location = client.create(compute);
entity
- Creates a new resource on the server.CommunicationException
- when error occured during the
communication with serverpublic abstract URI update(cz.cesnet.cloud.occi.core.Entity entity) throws CommunicationException
CommunicationException
public abstract boolean delete(String resourceType) throws CommunicationException
Example:
boolean wasSuccessful = client.delete("compute");
resourceType
- resource type in shortened format (e.g. "compute",
"storage", "network")CommunicationException
- when error occured during the
communication with serverpublic abstract boolean delete(URI resourceIdentifier) throws CommunicationException
Example:
boolean wasSuccessful = client.delete(URI.create("http://schemas.ogf.org/occi/infrastructure#network"));
...
wasSuccessful = client.delete(URI.create("https://remote.server.net/storage/123"));
resourceIdentifier
- either full resource type identifier or full
resource identifierCommunicationException
- when error occured during the
communication with serverpublic abstract boolean trigger(String resourceType, cz.cesnet.cloud.occi.core.ActionInstance action) throws CommunicationException
Example:
Model model = client.getModel();
EntityBuilder entityBuilder = new EntityBuilder(model);
ActionInstance actionInstance = entityBuilder.getActionInstance("start");
boolean wasSuccessful = client.trigger("compute", actionInstance);
resourceType
- resource type in shortened format (e.g. "compute",
"storage", "network")action
- type of actionCommunicationException
- when error occured during the
communication with serverpublic abstract boolean trigger(URI resourceIdentifier, cz.cesnet.cloud.occi.core.ActionInstance action) throws CommunicationException
Example:
Model model = client.getModel();
EntityBuilder entityBuilder = new EntityBuilder(model);
ActionInstance actionInstance = entityBuilder.getActionInstance("start");
boolean wasSuccessful = client.trigger(URI.create("http://schemas.ogf.org/occi/infrastructure#network"), actionInstance);
...
wasSuccessful = client.trigger(URI.create("https://remote.server.net/compute/456"), actionInstance);
resourceIdentifier
- either full resource type identifier or full
resource identifieraction
- type of actionCommunicationException
- when error occured during the
communication with serverpublic abstract void refresh() throws CommunicationException
CommunicationException
- when error occured during the
communication with serverpublic abstract void connect() throws CommunicationException
CommunicationException
- when error occured during the
communication with serverCopyright © 2016. All Rights Reserved.