Class EnvelopeVersion

java.lang.Object
i5.las2peer.persistency.EnvelopeVersion
All Implemented Interfaces:
XmlAble, java.io.Serializable

public class EnvelopeVersion
extends java.lang.Object
implements java.io.Serializable, XmlAble
See Also:
Serialized Form
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static long LATEST_VERSION
    freshly created local instance, can be considered as null
    static long MAX_UPDATE_CYCLES
    The following constant is used for practical purposes to prohibit some otherwise almost infinite loops.
    static long NULL_VERSION
    freshly created local instance, can be considered as null
    static long START_VERSION
    first version, that reaches the network
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected EnvelopeVersion​(EnvelopeVersion previousVersion, java.io.Serializable content)
    Creates an continuous version instance for the given Envelope.
    protected EnvelopeVersion​(EnvelopeVersion previousVersion, java.io.Serializable content, java.util.Collection<?> readers)
    Creates an continuous version instance for the given Envelope.
    protected EnvelopeVersion​(java.lang.String identifier, long version, java.security.PublicKey authorPubKey, java.io.Serializable content, java.util.Collection<?> readers, java.util.Set<java.lang.String> readerGroups)
    Creates an envelope with the given identifier, version, content and readable by the given reader list.
    protected EnvelopeVersion​(java.lang.String identifier, java.security.PublicKey authorPubKey, java.io.Serializable content, java.util.Collection<?> readers)
    Creates a new version of an Envelope.
  • Method Summary

    Modifier and Type Method Description
    static EnvelopeVersion createFromXml​(java.lang.String xml)
    factory for generating an envelope from the given XML String representation
    static EnvelopeVersion createFromXml​(org.w3c.dom.Element rootElement)
    factory for generating an envelope from the given XML String representation
    static java.lang.String getAgentIdentifier​(java.lang.String agentId)  
    java.security.PublicKey getAuthorPublicKey()
    Gets the authors public key of this envelope.
    java.io.Serializable getContent()  
    java.io.Serializable getContent​(AgentContext context)  
    java.lang.String getIdentifier()
    Gets the identifier for this envelope.
    java.util.Set<java.lang.String> getReaderGroupIds()  
    java.util.HashMap<java.security.PublicKey,​byte[]> getReaderKeys()  
    long getVersion()
    Gets the version of this envelope.
    boolean isEncrypted()  
    java.lang.String toString()  
    java.lang.String toXmlString()
    Returns a XML representation of this object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • LATEST_VERSION

      public static final long LATEST_VERSION
      freshly created local instance, can be considered as null
      See Also:
      Constant Field Values
    • NULL_VERSION

      public static final long NULL_VERSION
      freshly created local instance, can be considered as null
      See Also:
      Constant Field Values
    • START_VERSION

      public static final long START_VERSION
      first version, that reaches the network
      See Also:
      Constant Field Values
    • MAX_UPDATE_CYCLES

      public static final long MAX_UPDATE_CYCLES
      The following constant is used for practical purposes to prohibit some otherwise almost infinite loops. It describes the maximum number of write cycles to an envelope (identifier). Its value may be set to any value from 1 (not useful at all!) up to Long.MAX_VALUE (some parts will take almost forever).
      See Also:
      Constant Field Values
  • Constructor Details

    • EnvelopeVersion

      protected EnvelopeVersion​(java.lang.String identifier, java.security.PublicKey authorPubKey, java.io.Serializable content, java.util.Collection<?> readers) throws java.lang.IllegalArgumentException, SerializationException, CryptoException
      Creates a new version of an Envelope. The envelope uses by default the start version number.
      Parameters:
      identifier - An unique identifier for the envelope.
      authorPubKey - The authors public key. Validated on store operation.
      content - The updated content that should be stored.
      readers - An arbitrary number of Agents, who are allowed to read the content.
      Throws:
      java.lang.IllegalArgumentException - If the given identifier is null, the version number is below the start version number or too high.
      SerializationException - If a problem occurs with object serialization.
      CryptoException - If an cryptographic issue occurs.
    • EnvelopeVersion

      protected EnvelopeVersion​(EnvelopeVersion previousVersion, java.io.Serializable content) throws java.lang.IllegalArgumentException, SerializationException, CryptoException
      Creates an continuous version instance for the given Envelope. This method copies the reader list from the previous envelope instance.
      Parameters:
      previousVersion - The previous version of the envelope that should be updated.
      content - The updated content that should be stored.
      Throws:
      java.lang.IllegalArgumentException - If the given identifier is null, the version number is below the start version number or too high.
      SerializationException - If a problem occurs with object serialization.
      CryptoException - If an cryptographic issue occurs.
    • EnvelopeVersion

      protected EnvelopeVersion​(EnvelopeVersion previousVersion, java.io.Serializable content, java.util.Collection<?> readers) throws java.lang.IllegalArgumentException, SerializationException, CryptoException
      Creates an continuous version instance for the given Envelope.
      Parameters:
      previousVersion - The previous version of the envelope that should be updated.
      content - The updated content that should be stored.
      readers - An arbitrary number of Agents, who are allowed to read the content.
      Throws:
      java.lang.IllegalArgumentException - If the given identifier is null, the version number is below the start version number or too high.
      SerializationException - If a problem occurs with object serialization.
      CryptoException - If an cryptographic issue occurs.
    • EnvelopeVersion

      protected EnvelopeVersion​(java.lang.String identifier, long version, java.security.PublicKey authorPubKey, java.io.Serializable content, java.util.Collection<?> readers, java.util.Set<java.lang.String> readerGroups) throws java.lang.IllegalArgumentException, SerializationException, CryptoException
      Creates an envelope with the given identifier, version, content and readable by the given reader list.
      Parameters:
      identifier - An unique identifier for the envelope.
      version - The version number for this envelope.
      authorPubKey - The authors public key for this envelope.
      content - The actual content that should be stored.
      readers - An arbitrary number of Agents, who are allowed to read the content.
      readerGroups - A set of group agent id's with read access.
      Throws:
      java.lang.IllegalArgumentException - If the given identifier is null, the version number is below the start version number or too high.
      SerializationException - If a problem occurs with object serialization.
      CryptoException - If an cryptographic issue occurs.
  • Method Details