|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.iids.aos.systemservices.communicator.KernelClient
public class KernelClient
KernelClient is an AOSapi wrapper class that allows creations of KernelClients, either XML-RPC or SUN-RPC based. This class extends the AOSapi with some extra functions.
| Nested Class Summary | |
|---|---|
static class |
KernelClient.KernelClientUninitializedException
|
| Nested classes/interfaces inherited from interface org.iids.aos.kernel.AOSapi |
|---|
AOSapi.AcceptResult, AOSapi.ConnectResult, AOSapi.CreateRoleResult, AOSapi.PrepareWaitACResult, AOSapi.SecSuites, AOSapi.WaitACResult |
| Field Summary |
|---|
| Fields inherited from interface org.iids.aos.kernel.AOSapi |
|---|
ACTP_TLS_PROTOCOL_VERSION, MUX_TLS_PROTOCOL_VERSION, SCID_AUTH_ALGO, SCID_AUTH_KEYSIZE, SCID_CERT_SIGN_ALGO, SCID_DIGEST_ALGO, SCID_DIGEST_ALGO_BITLENGTH, SEGMENT_CERT_SUBTYPE, SEGMENT_DIGEST_ALGO, SEGMENT_DIGEST_ALGO_BITLENGTH, SEGMENT_SIGN_SUBTYPE, SEGMENT_TOC_SUBTYPE, SIGN_TOC_ALGO, SIGN_TOC_CERTTYPE, XDR_ENCODING_CHARSET |
| Constructor Summary | |
|---|---|
KernelClient(Cookie cookie)
|
|
KernelClient(Cookie cookie,
KernelConfigParser.KernelConfigParseResult config)
Creates a kernel client using a dedicated config file. |
|
KernelClient(KernelImpl ki)
|
|
| Method Summary | |
|---|---|
AOSapi.AcceptResult |
accept(Cookie cookie,
int listenPort,
boolean blocking)
Returns the next permitted connection waiting at a listen endpoint. |
void |
close()
|
void |
closeConnection(Cookie cookie,
int connectionID)
Closes a connection. |
void |
closeListenEndpoint(Cookie cookie,
int listenPort)
Destroys a listen endpoint and closes any pending connections that have arrived at the listen endpoint. |
AOSapi.ConnectResult |
connect(Cookie cookie,
Endpoint listenEndpoint,
java.lang.String[] secSuites)
Establishes a connection by connecting to a remote listen endpoint. |
int |
createAgentContainer(Cookie cookie)
Creates an empty agent container. |
Endpoint |
createListenEndpoint(Cookie cookie,
int listenPort,
java.lang.String[] secSuites)
Creates a listen endpoint. |
AOSapi.CreateRoleResult |
createRole(Cookie cookie,
RoleBitmap bitmap)
Creates a new role. |
int |
createSegment(Cookie cookie,
int acid,
int segmentType,
byte[] subtype,
byte[] description)
Creates a new empty segment and TOC entry in the given agent container, using the given parameters. |
void |
deleteAgentContainer(Cookie cookie,
int acid)
Deletes an agent container. |
void |
deleteRole(Cookie cookie,
Cookie childCookie)
Deletes an existing role and all kernel resources owned by that role (Agent containers, connection ports, listen ports, other roles etc.) |
void |
deleteSegment(Cookie cookie,
int acid,
int segID)
Removes the given segment from the given agent container. |
void |
finalizeAgentContainer(Cookie cookie,
int acid)
Finalizes an agent container: (a) computes checksums of the container's segments and signs the container using the AOS kernel's private key, and (b) writes the TOC, signature and AOS kernel's key certificate to the agent container's finalization segments. |
static KernelClient |
getLocalKernelClient()
Get an immediate reference to the kernel using KernelClient, instead of one using XML/Sun rpc based clients. |
static int |
getMaxMsgSize()
|
int |
getParam(Cookie cookie,
java.lang.String parameterName)
Returns the value of an AOS parameter, a positive integer |
void |
makePersistent(Cookie cookie,
int acid,
int segID)
Marks the given segment of the given agent container as persistent. |
byte[] |
peek(Cookie cookie,
int connectionID,
int max,
boolean blocking)
As receive() but leaves the data that was read in the connection. |
AOSapi.PrepareWaitACResult |
prepareWaitAgentContainer(Cookie cookie,
java.lang.String[] secSuites)
Prepares an incoming agent container shipment. |
byte[] |
readSegment(Cookie cookie,
int acid,
int segID,
int offset,
int length)
Read the contents of a segment in the kernel. |
TOCEntry[] |
readTOC(Cookie cookie,
int acid,
int offset,
int n)
Read the TOC from a container in the kernel. |
byte[] |
receive(Cookie cookie,
int connectionID,
int max,
boolean blocking)
Reads available data from a connection up to a specified maximum. |
byte[] |
receiveExactly(Cookie cookie,
int connectionID,
int msgLength)
Receive an exact amount of data from the connection specified. |
byte[] |
receiveMessage(Cookie cookie,
int connectionID)
Receive a Message, which is simply an array of bytes, and which should have been sent on the other side by sendMessage() or sendMessages(). |
java.util.List<byte[]> |
receiveMessages(Cookie cookie,
int connectionID)
Receive Messages, each of which is simply an array of bytes, and which should have been sent on the other side by sendMessage() or sendMessages(). |
void |
reenableRole(Cookie cookie)
Used to reset the role so that it can be used again. |
SelectSets |
select(Cookie cookie,
SelectSets sets,
boolean block)
Cf. |
int |
send(Cookie cookie,
int connectionID,
byte[] buffer)
Writes data to a connection. |
int |
sendExactly(Cookie cookie,
int connectionID,
byte[] buf)
Send an exact amount of data over the connection specified. |
int |
sendMessage(Cookie cookie,
int connectionID,
byte[] buf)
Send a Message, which is simply an array of bytes, and which can be received on the other side by using receiveMessage(). |
int |
sendMessages(Cookie cookie,
int connectionID,
java.util.Collection<byte[]> msgs)
Send multiple Messages, each of which is simply an array of bytes, and which can be received on the other side by using receiveMessage(). |
static void |
setConfig(KernelConfigParser.KernelConfigParseResult kconfig)
Set the default config file to be used. |
void |
shipAgentContainer(Cookie cookie,
int acid,
Endpoint dest,
java.lang.String[] secSuites,
TransactionID tid)
Ships a finalized agent container to a remote AOS kernel. |
AOSapi.WaitACResult |
waitAgentContainer(Cookie cookie,
TransactionID[] tids,
int blockTime)
Waits for completion of an incoming agent container shipment with any of the given transaction ID. |
int |
writeSegment(Cookie cookie,
int acid,
int segID,
int offset,
byte[] frombuf)
Write the contents into a segment in the kernel. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public KernelClient(KernelImpl ki)
public KernelClient(Cookie cookie)
throws CommunicatorException,
KernelClient.KernelClientUninitializedException
CommunicatorException
KernelClient.KernelClientUninitializedException
public KernelClient(Cookie cookie,
KernelConfigParser.KernelConfigParseResult config)
throws CommunicatorException,
KernelClient.KernelClientUninitializedException
CommunicatorException
KernelClient.KernelClientUninitializedException| Method Detail |
|---|
public static KernelClient getLocalKernelClient()
public static void setConfig(KernelConfigParser.KernelConfigParseResult kconfig)
KernelClient(Cookie) will use this default config.
Clients requiring an alternate configuration can still use this
by using KernelClient(Cookie, KernelConfigParser.KernelConfigParseResult).
public void close()
public static int getMaxMsgSize()
public AOSapi.CreateRoleResult createRole(Cookie cookie,
RoleBitmap bitmap)
throws KernelException
AOSapi
createRole in interface AOSapicookie - caller cookiebitmap - the role bitmap for the new role
UnknownRoleException - if the caller is unknown
KernelException
public void deleteRole(Cookie cookie,
Cookie childCookie)
throws KernelException
AOSapi
deleteRole in interface AOSapicookie - caller cookie, must correspond to the parent role that
created this rolechildCookie - cookie of the role to be deleted
KernelException
public int createAgentContainer(Cookie cookie)
throws KernelException
AOSapi
createAgentContainer in interface AOSapicookie - caller cookie
KernelException
public void deleteAgentContainer(Cookie cookie,
int acid)
throws KernelException
AOSapi
deleteAgentContainer in interface AOSapicookie - caller cookieacid - agent container to delete
KernelException
public int createSegment(Cookie cookie,
int acid,
int segmentType,
byte[] subtype,
byte[] description)
throws KernelException
AOSapi
createSegment in interface AOSapicookie - caller cookieacid - agent container to create a segment insegmentType - see XDR documentation of TOC_ENTRYsubtype - see XDR documentation of TOC_ENTRYdescription - see XDR documentation of TOC_ENTRY
KernelException
public void deleteSegment(Cookie cookie,
int acid,
int segID)
throws KernelException
AOSapi
deleteSegment in interface AOSapicookie - caller cookieacid - agent container to delete segment fromsegID - segment to delete
KernelException
public TOCEntry[] readTOC(Cookie cookie,
int acid,
int offset,
int n)
throws KernelException
readTOC in interface AOSapicookie - cookie used to communicate with the kernelacid - agentcontainer IDoffset - offset within TOC of segmentn - number of TOC-entries to read
KernelException - if something went wrong while reading the TOC
public byte[] readSegment(Cookie cookie,
int acid,
int segID,
int offset,
int length)
throws KernelException
readSegment in interface AOSapicookie - cookie used to communicate with the kernelacid - agentcontainer IDsegID - segment IDoffset - offset within segment IDlength - number of bytes to read
KernelException - if something went wrong while reading segments
public int writeSegment(Cookie cookie,
int acid,
int segID,
int offset,
byte[] frombuf)
throws KernelException
writeSegment in interface AOSapicookie - cookie used to communicate with the kernelacid - agentcontainer IDsegID - segment IDoffset - offset within segment to write datafrombuf - buffer containing data to write
KernelException - if something went wrong while writing segments
public void makePersistent(Cookie cookie,
int acid,
int segID)
throws KernelException
AOSapi
makePersistent in interface AOSapicookie - caller cookieacid - agent container whose segment to make persistentsegID - segment to make persistent
KernelException
public void finalizeAgentContainer(Cookie cookie,
int acid)
throws KernelException
AOSapi
finalizeAgentContainer in interface AOSapicookie - caller cookieacid - agent container to finalize
KernelException
public void shipAgentContainer(Cookie cookie,
int acid,
Endpoint dest,
java.lang.String[] secSuites,
TransactionID tid)
throws KernelException
AOSapi
shipAgentContainer in interface AOSapicookie - caller cookieacid - agent container to shipdest - the listen endpoint that the remote
kernel uses for incoming agent container
shipments (note: dest.port currently unused)secSuites - a series of cipher suites acceptable to the caller,
null or empty is equivalent to ALL_SEC_SUITES, as ACTP
requires authentication.tid - the transaction ID for this shipment,
created by the remote AOS kernel
KernelException
public AOSapi.PrepareWaitACResult prepareWaitAgentContainer(Cookie cookie,
java.lang.String[] secSuites)
throws KernelException
AOSapi
prepareWaitAgentContainer in interface AOSapicookie - caller cookiesecSuites - a series of cipher suites acceptable to the caller,
null or empty is equivalent to ALL_SEC_SUITES, as ACTP
requires authentication.
KernelException
public AOSapi.WaitACResult waitAgentContainer(Cookie cookie,
TransactionID[] tids,
int blockTime)
AOSapi
waitAgentContainer in interface AOSapicookie - caller cookietids - TransactionIDs for the AC shipment. All exceptions
occuring will include the tid of the transaction that met
the error.blockTime - time in seconds in which the kernel will wait for an ACT
to be initiated. blockTime 0 means ``poll''.
public Endpoint createListenEndpoint(Cookie cookie,
int listenPort,
java.lang.String[] secSuites)
throws KernelException
AOSapi
createListenEndpoint in interface AOSapicookie - caller cookielistenPort - the listen port number to use, or 0 to let the AOS
kernel pick onesecSuites - a series of cipher suites acceptable to the caller, or
null or empty to leave unspecified. Kernel will then
selected appropriate suites.
KernelException
public void closeListenEndpoint(Cookie cookie,
int listenPort)
throws KernelException
AOSapi
closeListenEndpoint in interface AOSapicookie - caller cookielistenPort - the listen port number
KernelException
public AOSapi.AcceptResult accept(Cookie cookie,
int listenPort,
boolean blocking)
throws KernelException
AOSapi
accept in interface AOSapicookie - caller cookielistenPort - the listen port numberblocking - whether to allow this method to block
KernelException
public AOSapi.ConnectResult connect(Cookie cookie,
Endpoint listenEndpoint,
java.lang.String[] secSuites)
throws KernelException
AOSapi
connect in interface AOSapicookie - caller cookielistenEndpoint - the address of the remote listen endpointsecSuites - a series of cipher suites acceptable to the
caller, or null or empty to leave unspecified
KernelException
public void closeConnection(Cookie cookie,
int connectionID)
throws KernelException
AOSapi
closeConnection in interface AOSapicookie - caller cookieconnectionID - the connection to close
KernelException
public int send(Cookie cookie,
int connectionID,
byte[] buffer)
throws KernelException
AOSapi
send in interface AOSapicookie - caller cookieconnectionID - the connection to write tobuffer - the buffer that holds the data
KernelException
public byte[] receive(Cookie cookie,
int connectionID,
int max,
boolean blocking)
throws KernelException
AOSapi
receive in interface AOSapicookie - caller cookieconnectionID - the connection to readmax - maximum number of bytes to readblocking - whether to allow this method to block
KernelException
public byte[] peek(Cookie cookie,
int connectionID,
int max,
boolean blocking)
throws KernelException
AOSapi
peek in interface AOSapiKernelException
public SelectSets select(Cookie cookie,
SelectSets sets,
boolean block)
throws KernelException
AOSapi
select in interface AOSapicookie - caller cookiesets - set of three sets: readSet, writeSet, exceptSet
readSet : set of local descriptors to check for data/connection
availability
writeSet set of local descriptors to check for writability
exceptSet set of local descriptors to check for exceptionsblock - whether to block or not
KernelException
public int getParam(Cookie cookie,
java.lang.String parameterName)
throws KernelException
AOSapi
getParam in interface AOSapicookie - caller cookieparameterName - the name of the AOS parameter
KernelException
public void reenableRole(Cookie cookie)
throws KernelException
AOSapi
reenableRole in interface AOSapicookie - caller cookie
KernelException
public byte[] receiveExactly(Cookie cookie,
int connectionID,
int msgLength)
throws KernelException
KernelException
public int sendExactly(Cookie cookie,
int connectionID,
byte[] buf)
throws KernelException
KernelException
public int sendMessage(Cookie cookie,
int connectionID,
byte[] buf)
throws KernelException
KernelException
public int sendMessages(Cookie cookie,
int connectionID,
java.util.Collection<byte[]> msgs)
throws KernelException
KernelException
public byte[] receiveMessage(Cookie cookie,
int connectionID)
throws KernelException
KernelException
public java.util.List<byte[]> receiveMessages(Cookie cookie,
int connectionID)
throws KernelException
KernelException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||