public class RemoteCoreProxy extends java.lang.Object implements ICore
This class acts as a proxy for a realization of ICore that is running on an entirely different machine. It uses the Jersey Client to connect to the remote client across an HTTP or HTTPS connection. It is a simple wrapper and provides not additional functionality beyond that of ICore with the exception of being able to connect and disconnect from a server.
The hostname and port must be set before the call to connect() is made. If they are not called, the connection will fail.
There are two connect() operations on this class. The first, with no arguments, is part of the ICore interface and will attempt to connect to the server without authentication. The second, which has a username and a password as arguments, will connect to the server using HTTP basic authentication of an SSL connection.
The exact mechanism by which the HTTPS connection is made and utilized is not modeled here. It is sufficient to say that ICE 2.0 uses the Jersey Client.
Constructor and Description |
---|
RemoteCoreProxy()
The Constructor.
|
Modifier and Type | Method and Description |
---|---|
FormStatus |
cancelItemProcess(int itemId,
java.lang.String actionName)
(non-Javadoc)
|
java.lang.String |
connect()
(non-Javadoc)
|
java.lang.String |
connect(java.lang.String username,
java.lang.String password)
This operation connects to the ICE Core using Basic authentication over
HTTPS.
|
java.lang.String |
createItem(java.lang.String itemType)
(non-Javadoc)
|
void |
deleteItem(java.lang.String itemId)
(non-Javadoc)
|
void |
disconnect(int uniqueClientId)
(non-Javadoc)
|
ICEList<java.lang.String> |
getAvailableItemTypes()
(non-Javadoc)
|
Form |
getFileSystem(int uniqueClientID)
(non-Javadoc)
|
java.lang.String |
getHost()
This operation returns the hostname of the server to which the core is
connected or, if it is not connected, it returns null.
|
Form |
getItem(int itemId)
(non-Javadoc)
|
java.util.ArrayList<Identifiable> |
getItemList()
(non-Javadoc)
|
java.io.File |
getItemOutputFile(int id)
(non-Javadoc)
|
FormStatus |
getItemStatus(java.lang.Integer id)
(non-Javadoc)
|
int |
getPort()
This operation returns the port number on which the the proxy has made
its connection or, if it is not connected, it returns -1.
|
void |
importFile(java.net.URI file)
(non-Javadoc)
|
java.lang.String |
importFileAsItem(java.net.URI file,
java.lang.String itemType)
This operation directs the core to import a file into its workspace and
load that file as an input for the specified Item type.
|
java.lang.String |
postUpdateMessage(java.lang.String message)
This operation posts a message containing an update to the ICE Item
designated in the body of the message.
|
FormStatus |
processItem(int itemId,
java.lang.String actionName,
int uniqueClientId)
(non-Javadoc)
|
void |
registerCompositeItem(ICompositeItemBuilder builder)
(non-Javadoc)
|
void |
registerItem(ItemBuilder itemBuilder)
(non-Javadoc)
|
void |
setHost(java.lang.String hostname)
This operation sets the hostname of the server to which the
RemoteCoreProxy should connect.
|
void |
setPort(int port)
This operation sets the port on which the RemoteCoreProxy should connect.
|
void |
unregisterItem(ItemBuilder itemBuilder)
(non-Javadoc)
|
FormStatus |
updateItem(Form form,
int uniqueClientId)
(non-Javadoc)
|
public java.lang.String getHost()
This operation returns the hostname of the server to which the core is connected or, if it is not connected, it returns null.
The hostname
public int getPort()
This operation returns the port number on which the the proxy has made its connection or, if it is not connected, it returns -1.
The port number
public void setHost(java.lang.String hostname)
This operation sets the hostname of the server to which the RemoteCoreProxy should connect.
hostname
- The hostname.
public void setPort(int port)
This operation sets the port on which the RemoteCoreProxy should connect. The port is only set if it is greater than zero.
port
- The port number.
public java.lang.String connect(java.lang.String username, java.lang.String password)
This operation connects to the ICE Core using Basic authentication over HTTPS.
username
- The users' name.
password
- The users' password.
The client id as specified by ICore.connect().
public java.lang.String connect()
connect
in interface ICore
ICore.connect()
public void disconnect(int uniqueClientId)
disconnect
in interface ICore
uniqueClientId
- The unique client identification number of the client that
would like to disconnect.ICore.disconnect(int uniqueClientId)
public Form getFileSystem(int uniqueClientID)
getFileSystem
in interface ICore
uniqueClientID
- The unique ID of the Client calling the operation.ICore.getFileSystem(int uniqueClientID)
public void registerItem(ItemBuilder itemBuilder)
registerItem
in interface ICore
itemBuilder
- An instance of ItemBuilder for a particular Item that is
available to the Core.ICore.registerItem(ItemBuilder itemBuilder)
public void registerCompositeItem(ICompositeItemBuilder builder)
registerCompositeItem
in interface ICore
builder
- The ICompositeItemBuilder that will build the composite Item.ICore.registerCompositeItem(ICompositeItemBuilder builder)
public void unregisterItem(ItemBuilder itemBuilder)
unregisterItem
in interface ICore
itemBuilder
- An instance of ItemBuilder for a particular Item that is now
unavailable to the Core.ICore.unregisterItem(ItemBuilder itemBuilder)
public java.lang.String createItem(java.lang.String itemType)
createItem
in interface ICore
itemType
- The type of Item to create.ICore.createItem(String itemType)
public void deleteItem(java.lang.String itemId)
deleteItem
in interface ICore
itemId
- The identification number of the Item that should be deleted
given as a String. It is safe to parse this string as an
integer.ICore.deleteItem(String itemId)
public FormStatus getItemStatus(java.lang.Integer id)
getItemStatus
in interface ICore
id
- The identification number of the Item that should be checked.ICore.getItemStatus(Integer id)
public Form getItem(int itemId)
getItem
in interface ICore
itemId
- The identification number of the Item that should be
retrieved.ICore.getItem(int itemId)
public ICEList<java.lang.String> getAvailableItemTypes()
getAvailableItemTypes
in interface ICore
ICore.getAvailableItemTypes()
public FormStatus updateItem(Form form, int uniqueClientId)
updateItem
in interface ICore
form
- The Form that carries new information for an Item.uniqueClientId
- The unique client id the IClient that is making the update
request.ICore.updateItem(Form form, int uniqueClientId)
public FormStatus processItem(int itemId, java.lang.String actionName, int uniqueClientId)
processItem
in interface ICore
itemId
- The item id for the Item that should be processed with the
specified action.actionName
- The action that should be performed on the Item.uniqueClientId
- The unique identification number of the client making the
request.ICore.processItem(int itemId, String actionName, int uniqueClientId)
public java.util.ArrayList<Identifiable> getItemList()
getItemList
in interface ICore
ICore.getItemList()
public java.io.File getItemOutputFile(int id)
getItemOutputFile
in interface ICore
id
- The id of the Item.ICore.getItemOutputFile(int id)
public FormStatus cancelItemProcess(int itemId, java.lang.String actionName)
cancelItemProcess
in interface ICore
itemId
- The id of the Item whose process should be canceled.actionName
- The name of the action that should be canceled for the
specified Item.ICore.cancelItemProcess(int itemId, String actionName)
public void importFile(java.net.URI file)
importFile
in interface ICore
file
- The file that should be imported. Nothing will happen if this
argument is null.ICore.importFile(URI file)
public java.lang.String importFileAsItem(java.net.URI file, java.lang.String itemType)
ICore
importFileAsItem
in interface ICore
file
- The file that should be imported. Nothing will happen if this
argument is null.itemType
- The type of Item to create.public java.lang.String postUpdateMessage(java.lang.String message)
ICore
postUpdateMessage
in interface ICore
message
- The message that should be passed on to the specified Item.
This string must be in JSON and conform to the message format
of the ICE Updater.