|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.iids.aos.kernel.ac.AgentContainer
public class AgentContainer
Defines the agent container and takes care of its on-disk representation and provides synchronisation for all items contained in an agent container.
| Field Summary | |
|---|---|
static java.lang.String |
FINALIZED_FILENAME
|
static java.lang.String |
OWNER_FILENAME
|
static int |
SEGMENT_ID_MAX_SPECIAL
|
static int |
SEGMENT_ID_MIN_SPECIAL
|
| Constructor Summary | |
|---|---|
AgentContainer(int acid,
java.io.File agentContainersDir)
Creates an agent container object for a new agent container object. |
|
| Method Summary | |
|---|---|
static void |
checkFinalized(java.io.File acFile,
java.lang.String expectedSCID,
boolean verifyChecksum)
Check a finalized AC received from a remote kernel. |
void |
checkOwnerIs(Role r)
Check if the owner is the expected owner |
void |
checkReceipt(java.security.Signature sig,
byte[] sigBytes)
|
void |
createFromFile(java.io.File acFile,
boolean verifyChecksums)
Create an agentcontainer from a file containing a finalized AC received from a remote kernel |
int |
createSegment(int segmentType,
byte[] subtype,
byte[] description)
|
void |
delete()
Deletes this agent container's state. |
void |
deleteSegment(int segmentID)
The semantics follow AOSapi.deleteSegment(). |
void |
finalizeAgentContainer(boolean sign,
java.security.PrivateKey privateKey,
byte[] certificate)
The semantics follow AOSapi.finalizeAgentContainer(). |
int |
getACID()
Returns this agent container's agent container ID. |
java.io.File |
getFinalizedFile()
Used by JUnit and Arno |
long |
getFinalizedLength()
Returns the length of the finalized agent container last finalized by finalizeAgentContainer(), or -1 if finalizeAgentContainer() has not yet been called. |
Role |
getOwner()
|
SegmentInfo |
getSegmentInfo(int segID)
Requests the TOC entry for segment 'segID'. |
boolean |
isFinalized()
|
void |
makePersistent(int segmentID)
The semantics follow AOSapi.makePersistent(). |
void |
marshalFinalizedState(java.io.OutputStream outs,
int startOffset,
int endOffset)
Writes the agent container last finalized by finalizeAgentContainer() to a virtual connection. |
byte[] |
readSegment(int segmentID,
int offset,
int length)
The semantics follow AOSapi.readSegment(). |
TOCEntry[] |
readTOC(int offset,
int n)
The semantics follow AOSapi.readTOC(). |
TOC_ENTRY[] |
readXDRTOC(int offset,
int n)
|
void |
setOwner(Role r)
|
int |
tocSize()
Returns the number of TOC entries in this agent container. |
int |
writeSegment(int segmentID,
int offset,
int length,
byte[] bytes)
The semantics follow AOSapi.writeSegment(). |
int |
writeSegment(int segmentID,
int offset,
int length,
byte[] bytes,
boolean sync)
With sync capability |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int SEGMENT_ID_MIN_SPECIAL
public static final int SEGMENT_ID_MAX_SPECIAL
public static final java.lang.String FINALIZED_FILENAME
public static final java.lang.String OWNER_FILENAME
| Constructor Detail |
|---|
public AgentContainer(int acid,
java.io.File agentContainersDir)
throws InputOutputException
acid - agent container ID of this objectagentContainersDir - the directory in which agent containers are
stored
InputOutputException| Method Detail |
|---|
public int getACID()
public void delete()
throws InputOutputException
InputOutputException
public int createSegment(int segmentType,
byte[] subtype,
byte[] description)
throws KernelException
KernelException
public void deleteSegment(int segmentID)
throws UnknownSegmentIDException,
PersistentSegmentException,
InputOutputException,
AccessDeniedException
UnknownSegmentIDException
PersistentSegmentException
InputOutputException
AccessDeniedExceptionpublic int tocSize()
public SegmentInfo getSegmentInfo(int segID)
public TOC_ENTRY[] readXDRTOC(int offset,
int n)
public TOCEntry[] readTOC(int offset,
int n)
public byte[] readSegment(int segmentID,
int offset,
int length)
throws KernelException
KernelException
public int writeSegment(int segmentID,
int offset,
int length,
byte[] bytes)
throws KernelException
KernelException
public int writeSegment(int segmentID,
int offset,
int length,
byte[] bytes,
boolean sync)
throws KernelException
KernelException
public void makePersistent(int segmentID)
throws UnknownSegmentIDException,
AccessDeniedException
UnknownSegmentIDException
AccessDeniedException
public void finalizeAgentContainer(boolean sign,
java.security.PrivateKey privateKey,
byte[] certificate)
throws KernelException
sign - whether to sign or not (performance measurements)privateKey - the private key to use for signingcertificate - the X509 public key certicate corresponding to
privateKey in PEM format
KernelExceptionpublic boolean isFinalized()
public long getFinalizedLength()
public void marshalFinalizedState(java.io.OutputStream outs,
int startOffset,
int endOffset)
throws java.io.IOException
java.io.IOExceptionpublic java.io.File getFinalizedFile()
public static void checkFinalized(java.io.File acFile,
java.lang.String expectedSCID,
boolean verifyChecksum)
throws ACTPACFormatException,
ACTPACVerifyException,
InputOutputException
acFile - The file containing the data received from the
remote kernel.expectedSCID - The SCID of the expected sender
which must be the signer of the ACverifyChecksum - If true also check if the checksums match to the
corresponding TOC entry. Otherwise it is assumed
to be checked somewhere else (createFromFile). It
is questionable whether we need to verify the
checksums here, as this requires a complete unzip\
of the agent container, something which is also
done when extracting the AC.
ACTPACFormatException
ACTPACVerifyException
InputOutputException
public void checkReceipt(java.security.Signature sig,
byte[] sigBytes)
throws ACTPReceiptException
ACTPReceiptException
public void createFromFile(java.io.File acFile,
boolean verifyChecksums)
throws KernelException
acFile - The file containing the finalized ACverifyChecksums - If the checksums are to be verified. It is more
efficient to do that here than instead of in the
checkFinalized method, as this method extracts
the zip contents anyway.
ACTPACFormatException - When the file's format is incorrect.
InputOutputException - Problems reading file from disk.
KernelException
public void checkOwnerIs(Role r)
throws AccessDeniedException
r - the expected role
AccessDeniedException - if the AC is not owned by the expected owner
public void setOwner(Role r)
throws KernelException
setOwner in interface KernelResourceKernelExceptionpublic Role getOwner()
getOwner in interface KernelResource
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||