Media Authoring
with Java API

tv.amwa.maj.entity
Class ContentStorage

java.lang.Object
  extended by tv.amwa.maj.entity.InterchangeObject
      extended by tv.amwa.maj.entity.ContentStorage
All Implemented Interfaces:
Serializable, Cloneable, MAJCommon, ContentStorage, InterchangeObject, XMLSerializable

@AAFClass(uuid1=218169601,
          uuid2=257,
          uuid3=6144,
          uuid4={6,14,43,52,2,6,1,1},
          definedName="ContentStorage",
          description="The ContentStorage class has the Mob and EssenceData objects.")
public class ContentStorage
extends InterchangeObject
implements ContentStorage, Serializable, Cloneable, MAJCommon

Implements storage for content that has mob and essence data within it. An AAF file shall have exactly one content storage.

THE COMMENTS IN THIS CLASS ARE INCOMPLETE.

Author:
Richard Cartwright
See Also:
Serialized Form

Nested Class Summary
static class ContentStorage.EssenceDataXMLHandler
           
static class ContentStorage.MobsXMLHandler
           
static class ContentStorage.XMLHandler
           
 
Nested classes/interfaces inherited from class tv.amwa.maj.entity.InterchangeObject
InterchangeObject.InterchangeObjectXMLHandler
 
Field Summary
static String CONTENTSTORAGE_TAG
           
 
Constructor Summary
ContentStorage(Set<Mob> mobs, Set<EssenceData> essenceData)
          Creates and initializes a content storage object, which has the mob and essence data objects of an AAF persistent unit.
 
Method Summary
 void addEssenceData(EssenceData essenceData)
          Adds the given essence data item to the set of those stored in this content storage..
 void addMob(Mob mob)
          Adds the given mob to the set of mobs in this content storage.
 void appendXMLChildren(Node parent)
          Append child elements to the given parent node to serialize the value of an object to an XML fragment.
 ContentStorage clone()
          Creates a cloned copy of this entity.
 int countEssenceData()
          Returns the total number of essence data items in this content storage.
 int countMobs(MobKind mobKind)
          Find the number of matches for the given mob kind stored in this content storage.
 Set<EssenceData> enumEssenceData()
          Returns the complete set of essence data contained within this content storage object.
 boolean equals(Object o)
          Two content storage instances are equals if and only if their set of mobs are the same size and contains the same items and the set of essence data is the same size and contains the same items.
 Set<EssenceData> getEssenceData(CriteriaType mediaCriteria)
          Returns the set of essence data contained within this content storage object, filtered according to the media criteria provided.
 Set<Mob> getMobs(SearchCriteria searchCriteria)
          Returns a set of mobs from this content storage according to a given search criteria.
 int hashCode()
          Computes a hash code value based on the generated identifier for this class.
 boolean isEssenceDataPresent(MobID fileMobID)
          Returns true if essence data identified by the given mob id is contained in this content storage.
 EssenceData lookupEssenceData(MobID mobID)
          Looks up and returns an essence data item stored in this content storage that matches the given mob id.
 Mob lookupMob(MobID mobID)
          Returns the mob that matches the given mob id from the set of mobs in this content storage.
 void removeEssenceData(EssenceData essenceData)
          Removes the given essence data item from the set stored in this content storage.
 void removeMob(Mob mob)
          Removes the given mob from the set stored in this content storage.
 void setPropertiesFromInterface(ContentStorage castFrom)
           
 
Methods inherited from class tv.amwa.maj.entity.InterchangeObject
castFromInterface, countProperties, createOptionalPropertyValue, disableGenerationTracking, enableGenerationTracking, getDefinition, getGeneration, getGenerationAUID, getProperties, getPropertyValue, isGenerationTracked, isPropertyPresent, omitOpionalProperty, registerImplementation, setPropertiesFromInterface, setPropertyValue, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface tv.amwa.maj.iface.InterchangeObject
countProperties, createOptionalPropertyValue, disableGenerationTracking, enableGenerationTracking, getDefinition, getGeneration, getGenerationAUID, getProperties, getPropertyValue, isGenerationTracked, isPropertyPresent, omitOpionalProperty, setPropertyValue
 
Methods inherited from interface tv.amwa.maj.entity.MAJCommon
toString
 

Field Detail

CONTENTSTORAGE_TAG

public static final String CONTENTSTORAGE_TAG
See Also:
Constant Field Values
Constructor Detail

ContentStorage

public ContentStorage(Set<Mob> mobs,
                      Set<EssenceData> essenceData)
               throws NullPointerException

Creates and initializes a content storage object, which has the mob and essence data objects of an AAF persistent unit. An AAF persistent unit shall have exactly one content storage object.

Parameters:
mobs - Set of all mobs to place into the new content storage.
essenceData - Set of all essence data objects to place into the new content storage.
Throws:
NullPointerException - One or both of the sets are null. Use empty sets to indicate no mobs or essence data items are in storage.
Method Detail

setPropertiesFromInterface

public final void setPropertiesFromInterface(ContentStorage castFrom)
See Also:
InterchangeObject.setPropertiesFromInterface(tv.amwa.maj.iface.InterchangeObject)

addEssenceData

public void addEssenceData(EssenceData essenceData)
                    throws DuplicateMobIDException,
                           NullPointerException
Description copied from interface: ContentStorage

Adds the given essence data item to the set of those stored in this content storage..

Specified by:
addEssenceData in interface ContentStorage
Parameters:
essenceData - Essence data object to add to those stored in this content storage.
Throws:
DuplicateMobIDException - The given mob has already been added. The validation is done by comparing mob ids, which should be unique amongst all essence data in a content storage unit.
NullPointerException - The given essence data item is null.
See Also:
EssenceData.getFileMobID()

addMob

public void addMob(Mob mob)
            throws NullPointerException,
                   DuplicateMobIDException
Description copied from interface: ContentStorage

Adds the given mob to the set of mobs in this content storage.

Specified by:
addMob in interface ContentStorage
Parameters:
mob - Mob to add to this content storage.
Throws:
NullPointerException - The given mob is null.
DuplicateMobIDException - The given mob is already contained in this content storage.

countEssenceData

public int countEssenceData()
Description copied from interface: ContentStorage

Returns the total number of essence data items in this content storage.

Specified by:
countEssenceData in interface ContentStorage
Returns:
Total number of essence data items.

countMobs

public int countMobs(MobKind mobKind)
              throws NullPointerException
Description copied from interface: ContentStorage

Find the number of matches for the given mob kind stored in this content storage.

Specified by:
countMobs in interface ContentStorage
Parameters:
mobKind - The kind of mob to count.
Returns:
Total number of mobs of the given mob kind stored in this content storage.
Throws:
NullPointerException - The given mob kind is null.

enumEssenceData

public Set<EssenceData> enumEssenceData()
Description copied from interface: ContentStorage

Returns the complete set of essence data contained within this content storage object.

Calling this method produces the same result as calling getEssenceData(CriteriaType.AnyRepresentation).

Specified by:
enumEssenceData in interface ContentStorage
Returns:
Shallow copy of the set of essence data stored in this content storage.
See Also:
Header.enumEssenceData()

getEssenceData

@AAFProperty(uuid1=100729092,
             uuid2=1282,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="EssenceData",
             typeName="StrongReferenceSet of EssenceData",
             optional=true,
             uniqueIdentifier=false,
             pid=6402)
public Set<EssenceData> getEssenceData(CriteriaType mediaCriteria)
                                throws NullPointerException
Description copied from interface: ContentStorage

Returns the set of essence data contained within this content storage object, filtered according to the media criteria provided.

If the mediaCriteria is set to CriteriaType.AnyRepresentation, all essence data is returned.

Specified by:
getEssenceData in interface ContentStorage
Parameters:
mediaCriteria - Criteria to use to select the required essence data.
Returns:
Shallow copy of the set of essence stored in the content storage object.
Throws:
NullPointerException
See Also:
ContentStorage.enumEssenceData(), Header.getEssenceData(CriteriaType)

lookupEssenceData

public EssenceData lookupEssenceData(MobID mobID)
                              throws NullPointerException,
                                     MobNotFoundException
Description copied from interface: ContentStorage

Looks up and returns an essence data item stored in this content storage that matches the given mob id.

Specified by:
lookupEssenceData in interface ContentStorage
Parameters:
mobID - The mob id identifying the essence data stored in this content storage.
Returns:
Essence data stored in this content storage with the given mob id.
Throws:
NullPointerException - The given essece data mob id is null.
MobNotFoundException - The requested essence data was not found stored in this content storage.

getMobs

@AAFProperty(uuid1=100729092,
             uuid2=1281,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="Mobs",
             typeName="StrongReferenceSet of Mob",
             optional=false,
             uniqueIdentifier=false,
             pid=6401)
public Set<Mob> getMobs(SearchCriteria searchCriteria)
Description copied from interface: ContentStorage

Returns a set of mobs from this content storage according to a given search criteria. If the search criteria is null then all of the mobs in storage are returned.

Specified by:
getMobs in interface ContentStorage
Parameters:
searchCriteria - Search criteria to filter the set of stored mobs of this content storage with.
Returns:
Shallow copy of the set of all the mobs matching the given search criteria.
See Also:
SearchCriteria, Header.getMobs(SearchCriteria)

isEssenceDataPresent

public boolean isEssenceDataPresent(MobID fileMobID)
                             throws NullPointerException
Description copied from interface: ContentStorage

Returns true if essence data identified by the given mob id is contained in this content storage.

Specified by:
isEssenceDataPresent in interface ContentStorage
Parameters:
fileMobID - Identifier of the essence data to check for within this content storage.
Returns:
True if the essence data is found in this content storage.
Throws:
NullPointerException - One or more of the arguments in null.

lookupMob

public Mob lookupMob(MobID mobID)
              throws NullPointerException,
                     MobNotFoundException
Description copied from interface: ContentStorage

Returns the mob that matches the given mob id from the set of mobs in this content storage.

Specified by:
lookupMob in interface ContentStorage
Parameters:
mobID - The identifier of the mob to find in this content storage.
Returns:
Mob with the given identifier from this content storage.
Throws:
NullPointerException - The given mob identifier is null.
MobNotFoundException - The requested mob is not stored in this content storage.

removeEssenceData

public void removeEssenceData(EssenceData essenceData)
                       throws NullPointerException,
                              EssenceNotFoundException
Description copied from interface: ContentStorage

Removes the given essence data item from the set stored in this content storage.

Specified by:
removeEssenceData in interface ContentStorage
Parameters:
essenceData - Essence data to remove from this content storage.
Throws:
NullPointerException - The given essence data item is null.
EssenceNotFoundException - The given essence data item is not currently contained in this content storage.

removeMob

public void removeMob(Mob mob)
               throws NullPointerException,
                      MobNotFoundException
Description copied from interface: ContentStorage

Removes the given mob from the set stored in this content storage.

Specified by:
removeMob in interface ContentStorage
Parameters:
mob - Mob to remove from this content storage.
Throws:
NullPointerException - The given mob to remove is null.
MobNotFoundException - The given mob is not current contained in this content storage.

hashCode

public int hashCode()

Computes a hash code value based on the generated identifier for this class.

Specified by:
hashCode in interface MAJCommon
Overrides:
hashCode in class Object
Returns:
Hash code value for this interchange object.
See Also:
Object.hashCode()

equals

public boolean equals(Object o)

Two content storage instances are equals if and only if their set of mobs are the same size and contains the same items and the set of essence data is the same size and contains the same items. Equality is checked through the use of mob ids only.

Specified by:
equals in interface MAJCommon
Overrides:
equals in class Object
Parameters:
o - Object to test for equality with.
Returns:
Is the given object equals to this value?
See Also:
Object.equals(java.lang.Object)

clone

public ContentStorage clone()
Description copied from interface: MAJCommon

Creates a cloned copy of this entity. The clone will be initialized to have the same value as this value but exists independently from then on. Changes to this value will not effect the clone and changes to the clone will not effect this. MAJ API clones are true deep clones with no shared references to areas of memory within the original.

This method does not throw a CloneNotSupportedException as all entity values must implement the Cloneable interface. If a cloning error does occur, a null value will be returned but this is very unlikely to happen.

Specified by:
clone in interface MAJCommon
Overrides:
clone in class Object
Returns:
Independent clone of this value, which is a deep copy.
See Also:
Object.clone()

appendXMLChildren

public void appendXMLChildren(Node parent)
Description copied from interface: XMLSerializable

Append child elements to the given parent node to serialize the value of an object to an XML fragment. Methods of the XMLBuilder class are provided to help with this process.

Specified by:
appendXMLChildren in interface XMLSerializable
Overrides:
appendXMLChildren in class InterchangeObject
Parameters:
parent - XML parent element to append child nodes to.

Media Authoring
with Java API

(c) 2007-2008 Richard Cartwright, all rights reserved. Subject to the terms of the AAF SDK Public Source License.