org.iids.aos.agent
Class AgentArchive

java.lang.Object
  extended by org.iids.aos.agent.AgentArchive
All Implemented Interfaces:
java.io.Serializable

public class AgentArchive
extends java.lang.Object
implements java.io.Serializable

AgentArcive class, contains pre-made segments and (some) agent info to make it easier to import/export agent code and data segments.

The archive can either be read from or exported to a file/byte[]. This agent archive can in principle contain all the (meta) information required to create and run an agent, though if code segments are missing, or there is no active code segment identified, this is not possible. In other words, an archive need not contain the information for a "complete" running agent.

Author:
rjtimmmer
See Also:
Serialized Form

Constructor Summary
AgentArchive()
          Create a new (empty) agent archive.
AgentArchive(byte[] source)
          Import agent archive from a byte array.
AgentArchive(java.io.File source)
          Import agent archive from a file.
AgentArchive(java.io.InputStream in)
          Import agent archive from input stream.
 
Method Summary
 void deleteCodeSegment(AgentCodeSegment seg)
           
 void deleteDataSegment(AgentDataSegment seg)
           
 void exportArchive(java.lang.String path)
           
 AgentCodeSegment getDefaultCodeSegment()
           
 AgentCodeSegment[] listCodeSegments()
           
 AgentDataSegment[] listDataSegments()
           
 byte[] readCode(AgentCodeSegment seg)
           
 byte[] readCode(java.lang.String description, java.lang.String subtype)
           
 byte[] readData(AgentDataSegment seg)
           
 byte[] readData(java.lang.String description, java.lang.String subtype)
           
 void setDefaultCodeSegment(AgentCodeSegment active)
           
 void setDefaultCodeSegment(java.lang.String description, java.lang.String subtype)
           
 void writeCode(AgentCodeSegment seg, byte[] code)
           
 void writeCode(java.lang.String description, java.lang.String subtype, byte[] code)
           
 void writeData(AgentDataSegment seg, byte[] data)
           
 void writeData(java.lang.String description, java.lang.String subtype, byte[] data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentArchive

public AgentArchive()
Create a new (empty) agent archive.


AgentArchive

public AgentArchive(java.io.File source)
             throws AgentArchiveException
Import agent archive from a file.

Parameters:
source - AgentArchive file to import.
Throws:
AgentArchiveException

AgentArchive

public AgentArchive(byte[] source)
             throws AgentArchiveException
Import agent archive from a byte array.

Parameters:
source - AgentArchive file to import.
Throws:
AgentArchiveException

AgentArchive

public AgentArchive(java.io.InputStream in)
             throws AgentArchiveException
Import agent archive from input stream.

Parameters:
in - InputStream to read archive from.
Throws:
AgentArchiveException
Method Detail

exportArchive

public void exportArchive(java.lang.String path)
                   throws AgentArchiveException
Throws:
AgentArchiveException

writeCode

public void writeCode(AgentCodeSegment seg,
                      byte[] code)

writeCode

public void writeCode(java.lang.String description,
                      java.lang.String subtype,
                      byte[] code)

writeData

public void writeData(AgentDataSegment seg,
                      byte[] data)

writeData

public void writeData(java.lang.String description,
                      java.lang.String subtype,
                      byte[] data)

readCode

public byte[] readCode(AgentCodeSegment seg)
                throws SegmentUnknownException
Throws:
SegmentUnknownException

readCode

public byte[] readCode(java.lang.String description,
                       java.lang.String subtype)
                throws SegmentUnknownException
Throws:
SegmentUnknownException

readData

public byte[] readData(AgentDataSegment seg)
                throws SegmentUnknownException
Throws:
SegmentUnknownException

readData

public byte[] readData(java.lang.String description,
                       java.lang.String subtype)
                throws SegmentUnknownException
Throws:
SegmentUnknownException

setDefaultCodeSegment

public void setDefaultCodeSegment(AgentCodeSegment active)

setDefaultCodeSegment

public void setDefaultCodeSegment(java.lang.String description,
                                  java.lang.String subtype)

getDefaultCodeSegment

public AgentCodeSegment getDefaultCodeSegment()
                                       throws SegmentUnknownException
Throws:
SegmentUnknownException

listCodeSegments

public AgentCodeSegment[] listCodeSegments()

listDataSegments

public AgentDataSegment[] listDataSegments()

deleteCodeSegment

public void deleteCodeSegment(AgentCodeSegment seg)
                       throws SegmentUnknownException
Throws:
SegmentUnknownException

deleteDataSegment

public void deleteDataSegment(AgentDataSegment seg)
                       throws SegmentUnknownException
Throws:
SegmentUnknownException


Copyright © 2003, 2004 IIDS Group. All Rights Reserved.