Project JXTA

net.jxta.codat
Class Codat

java.lang.Object
  extended by net.jxta.codat.Codat
Direct Known Subclasses:
Metadata

public class Codat
extends Object

Codats are container objects that can hold both data or code and are associated with a JXTA ID. The Codat class is offered as a standard way for applications and services to exchange any kind of contents via a common API and associate a unique JXTA id to these contents.

Codats are containers objects that are used to hold any kinds of objects or data. A codat can represent a file, a class file, the saved state of an application, a loadable C library. Codats are handled transparently by the JXTA platform, and are used as placeholders for any types of data. Codats hold Document that represent the data that they hold.

Codats are published in peer groups. A Codat can belong to only one peer group. Multiple copies of a codat can be made to be published in multiple peer groups.

Codats are uniquely identified via a unique CodatID. This Id is guaranteed to be unique within the JXTA world.

The core manipulates two main types of codats:

The JXTA platform defines Codat as the unit of information shared and exchanged within a JXTA group. All instances of Codats reside within a peer group. The PeerGroup content caching service provides storage and retrieval methods for codats using codatId as index.

See Also:
CodatID, Document, StructuredDocument, StructuredTextDocument

Field Summary
protected  Document doc
          A JXTA Document which contains the data held by this Codat.
protected  ID id
          Id of this Codat.
protected  ID metaId
          Codat Id of a Codat to which this Codat is related.
 
Constructor Summary
Codat(CodatID id, CodatID about, Document document)
          Makes a new Codat instance from an existing Codat, with a given CodatID and a document.
Codat(PeerGroupID groupID, ID about, Document document)
          Makes a new Codat with a new CodatId given a PeerGroupID and a document.
 
Method Summary
 ID getCodatID()
          Returns the CodatId associated with this Codat.
 Document getDocument()
          Returns the Document associated with this Codat.
 ID getMetaID()
          Returns Codat id of related codat associated with this metadata Codat.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

protected ID id
Id of this Codat. This is the "address" which may be used to refer to this Codat. see CodatID


metaId

protected ID metaId
Codat Id of a Codat to which this Codat is related. This may be the Codat Id of another codat in the same Peer Group or nullID


doc

protected Document doc
A JXTA Document which contains the data held by this Codat.

Constructor Detail

Codat

public Codat(PeerGroupID groupID,
             ID about,
             Document document)
      throws IOException
Makes a new Codat with a new CodatId given a PeerGroupID and a document.

Parameters:
groupID - PeerGroupID the group to which this codat will belong.
about - CodatId for which this Codat is metadata
document - Document held by this codat.
Throws:
IOException - if there is an error accessing the document.

Codat

public Codat(CodatID id,
             CodatID about,
             Document document)
Makes a new Codat instance from an existing Codat, with a given CodatID and a document.

Parameters:
id - CodatId of the new codat
about - CodatID for which this Codat is metadata
document - Document hold by this codat
Method Detail

getCodatID

public ID getCodatID()
Returns the CodatId associated with this Codat.

Returns:
CodateID associated with this codat

getMetaID

public ID getMetaID()
Returns Codat id of related codat associated with this metadata Codat.

Returns:
CodateID associated with this codat

getDocument

public Document getDocument()
Returns the Document associated with this Codat.

Returns:
Document associated with this Codat

JXTA J2SE