Media Authoring
with Java API

tv.amwa.maj.meta
Class TypeDefinitionOpaque

java.lang.Object
  extended by tv.amwa.maj.meta.MetaDefinition
      extended by tv.amwa.maj.meta.TypeDefinition
          extended by tv.amwa.maj.meta.TypeDefinitionIndirect
              extended by tv.amwa.maj.meta.TypeDefinitionOpaque
All Implemented Interfaces:
Serializable, DefinitionType, MetaDefinition, TypeDefinition, TypeDefinitionIndirect, TypeDefinitionOpaque, XMLSerializable, MAJCommon

@AAFClass(uuid1=218169601,
          uuid2=546,
          uuid3=0,
          uuid4={6,14,43,52,2,6,1,1},
          definedName="TypeDefinitionOpaque",
          description="The TypeDefinitionOpaque class defines a property type that has a value whose type is specified in each instance.")
public final class TypeDefinitionOpaque
extends TypeDefinitionIndirect
implements TypeDefinitionOpaque, Serializable, XMLSerializable, MAJCommon

Implements the definition of a property type that has a value whose type is specified in each instance.

THE COMMENTS FOR THIS CLASS ARE INCOMPLETE.

Author:
Richard Cartwright
See Also:
Serialized Form

Nested Class Summary
static class TypeDefinitionOpaque.OpaqueValue
           
static class TypeDefinitionOpaque.XMLHandler
           
 
Nested classes/interfaces inherited from class tv.amwa.maj.meta.TypeDefinitionIndirect
TypeDefinitionIndirect.IndirectValue
 
Field Summary
static TypeDefinitionOpaque Opaque
           
 
Fields inherited from class tv.amwa.maj.meta.TypeDefinitionIndirect
Indirect
 
Constructor Summary
TypeDefinitionOpaque(AUID identification, String typeName)
          Creates and initializes a new opaque type definition, which defines a property type that has a value whose type is specified in each instance.
 
Method Summary
 PropertyValue createValue(Object javaValue)
          Create a property value from the given Java object.
 PropertyValue createValueFromActualData(AUID actualTypeId, byte[] initData)
           
 PropertyValue createValueFromActualData(TypeDefinition type, byte[] initData)
          Creates and returns an indirect property value from the given type definition and serialized data.
 PropertyValue createValueFromActualValue(PropertyValue propertyValue)
          Creates and returns an indirect property value that contains the given actual property value.
 PropertyValue createValueFromHandle(byte[] initData)
          Creates and returns a new opaque property value from the given block of initial data.
 byte[] getActualData(PropertyValue opaqueProperty)
          Returns a copy of the actual data contained in the indirect property value.
 int getActualSize(PropertyValue opaqueProperty)
          Returns the size of the data held by the actual property value embedded within the given indirect property value.
 TypeDefinition getActualType(PropertyValue opaqueProperty)
          Returns the type definition of the property value embedded within the given property value.
 AUID getActualTypeID(PropertyValue opaqueProperty)
          Returns the type identifier of the actual data within the given opaque property value.
 PropertyValue getActualValue(PropertyValue opaqueProperty)
          Returns the actual property value embedded within the given indirect property value.
 byte[] getHandle(PropertyValue opaqueProperty)
          Read and return the given opaque property value without having to know its contents.
 TypeCategory getTypeCategory()
          Returns the type category to which this type definition belongs, which corresponds to its sub interface.
 void setDictionary(Dictionary dictionary)
           
 void setHandle(PropertyValue opaqueProperty, byte[] handle)
          Sets the value of the given opaque property value to the given unknown data.
 void setPropertiesFromInterface(TypeDefinitionOpaque castFrom)
           
 
Methods inherited from class tv.amwa.maj.meta.TypeDefinitionIndirect
appendXMLChildren, setPropertiesFromInterface
 
Methods inherited from class tv.amwa.maj.meta.TypeDefinition
setPropertiesFromInterface
 
Methods inherited from class tv.amwa.maj.meta.MetaDefinition
castFromInterface, deepEquals, equals, getAUID, getDescription, getIdentification, getName, hashCode, setDescription, setName, setPropertiesFromInterface, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface tv.amwa.maj.iface.MetaDefinition
getAUID, getDescription, getName, setDescription, setName
 
Methods inherited from interface tv.amwa.maj.io.xml.XMLSerializable
appendXMLChildren
 
Methods inherited from interface tv.amwa.maj.meta.MAJCommon
equals, hashCode, toString
 

Field Detail

Opaque

public static final TypeDefinitionOpaque Opaque
Constructor Detail

TypeDefinitionOpaque

public TypeDefinitionOpaque(AUID identification,
                            @AAFString
                            String typeName)
                     throws NullPointerException

Creates and initializes a new opaque type definition, which defines a property type that has a value whose type is specified in each instance.

Creating new and unregistered type definitions is not recommended as this may cause interoperability issues with other systems. The official registry of type definitions is available from SMPTE at SMPTE Metadata Registries And Related Items. The full range of data types documented in the AAF 1.1 object specification can be accessed by name and identification using either AAFFactory.typeDefinitionForName(String) or AAFFactory.typeDefinitionForIdentification(tv.amwa.maj.record.AUID) respectively.

Parameters:
identification - AUID used to identify this type.
typeName - Friendly name for the opaque type definition.
Throws:
NullPointerException - The identification argument is null.
Method Detail

setPropertiesFromInterface

public final void setPropertiesFromInterface(TypeDefinitionOpaque castFrom)
See Also:
MetaDefinition.setPropertiesFromInterface(tv.amwa.maj.iface.MetaDefinition)

createValueFromHandle

public final PropertyValue createValueFromHandle(byte[] initData)
                                          throws NullPointerException,
                                                 IllegalArgumentException
Description copied from interface: TypeDefinitionOpaque

Creates and returns a new opaque property value from the given block of initial data.

Specified by:
createValueFromHandle in interface TypeDefinitionOpaque
Parameters:
initData - Buffer containing the handle to use.
Returns:
Newly created opaque property value containing the given data.
Throws:
NullPointerException - The given initial data handle is null.
IllegalArgumentException - A handle must contain at least 16 bytes of data.
See Also:
TypeDefinitionOpaque.setHandle(PropertyValue, byte[]), TypeDefinitionOpaque.getHandle(PropertyValue), TypeDefinitionIndirect.createValueFromActualData(TypeDefinition, byte[]), TypeDefinitionIndirect.createValueFromActualValue(PropertyValue)

getActualTypeID

public final AUID getActualTypeID(PropertyValue opaqueProperty)
                           throws NullPointerException,
                                  IllegalPropertyValueException
Description copied from interface: TypeDefinitionOpaque

Returns the type identifier of the actual data within the given opaque property value. This method assumes that the type identifier is stored in the first 16 bytes of the opaque data.

Specified by:
getActualTypeID in interface TypeDefinitionOpaque
Parameters:
opaqueProperty - Property value as defined by this opaque type definition.
Returns:
Type identifier of the actual data within the given opaque property value.
Throws:
NullPointerException - The given opaque property definition is null.
IllegalPropertyValueException - The given property value is not defined by this opaque type definition.
See Also:
Dictionary.lookupKLVDataDefinition(AUID), Dictionary.lookupOpaqueTypeDefinition(AUID), TypeDefinitionIndirect.getActualType(PropertyValue)

getHandle

public final byte[] getHandle(PropertyValue opaqueProperty)
                       throws NullPointerException,
                              IllegalPropertyValueException
Description copied from interface: TypeDefinitionOpaque

Read and return the given opaque property value without having to know its contents. The returned buffer of data can be used later by a call to TypeDefinitionOpaque.setHandle(PropertyValue, byte[]).

Specified by:
getHandle in interface TypeDefinitionOpaque
Parameters:
opaqueProperty - Property value containing unknown data to be returned.
Returns:
Buffer of unknown data as contained within the given opaque property value.
Throws:
NullPointerException - The given opaque property value is null.
IllegalPropertyValueException - The given property value is not defined by this opaque type definition.
See Also:
TypeDefinitionOpaque.setHandle(PropertyValue, byte[]), TypeDefinitionIndirect.getActualData(PropertyValue), TypeDefinitionIndirect.getActualValue(PropertyValue)

setHandle

public final void setHandle(PropertyValue opaqueProperty,
                            byte[] handle)
                     throws NullPointerException,
                            IllegalPropertyValueException,
                            IllegalArgumentException
Description copied from interface: TypeDefinitionOpaque

Sets the value of the given opaque property value to the given unknown data. This data may have previously been retrieved by a call to TypeDefinitionOpaque.getHandle(PropertyValue).

Specified by:
setHandle in interface TypeDefinitionOpaque
Parameters:
opaqueProperty - Property value to set the unknown data value for.
handle - Data to set as the value of the given opaque property value.
Throws:
NullPointerException - One or more of the arguments is null.
IllegalPropertyValueException - The given property value is not defined by this opaque type definition.
IllegalArgumentException - A handle must contain at least 16 bytes of data.
See Also:
TypeDefinitionOpaque.getHandle(PropertyValue), TypeDefinitionOpaque.createValueFromHandle(byte[])

createValueFromActualData

public final PropertyValue createValueFromActualData(AUID actualTypeId,
                                                     byte[] initData)
                                              throws NullPointerException
Throws:
NullPointerException

createValueFromActualData

public final PropertyValue createValueFromActualData(TypeDefinition type,
                                                     byte[] initData)
                                              throws NullPointerException
Description copied from interface: TypeDefinitionIndirect

Creates and returns an indirect property value from the given type definition and serialized data.

Specified by:
createValueFromActualData in interface TypeDefinitionIndirect
Overrides:
createValueFromActualData in class TypeDefinitionIndirect
Parameters:
type - Type of the actual data to embed within the new indirect property value.
initData - Data to use to create the new indirect property value of the given type.
Returns:
New indirect property value created from the given type and data.
Throws:
NullPointerException - One or more of the arguments is null.
See Also:
TypeDefinitionIndirect.createValueFromActualData(tv.amwa.maj.iface.TypeDefinition, byte[])

getActualData

public final byte[] getActualData(PropertyValue opaqueProperty)
                           throws NullPointerException,
                                  IllegalPropertyValueException
Description copied from interface: TypeDefinitionIndirect

Returns a copy of the actual data contained in the indirect property value.

Specified by:
getActualData in interface TypeDefinitionIndirect
Overrides:
getActualData in class TypeDefinitionIndirect
Parameters:
opaqueProperty - Property value containing an actual value.
Returns:
Serialized contents of the actual property value.
Throws:
NullPointerException - The given indirect property value is null.
IllegalPropertyValueException - The given property value is not defined by an indirect type definition.
See Also:
TypeDefinitionIndirect.getActualData(tv.amwa.maj.iface.PropertyValue)

getActualSize

public final int getActualSize(PropertyValue opaqueProperty)
                        throws NullPointerException,
                               IllegalPropertyValueException
Description copied from interface: TypeDefinitionIndirect

Returns the size of the data held by the actual property value embedded within the given indirect property value.

Specified by:
getActualSize in interface TypeDefinitionIndirect
Overrides:
getActualSize in class TypeDefinitionIndirect
Parameters:
opaqueProperty - Property value containing an actual value.
Returns:
Size of the data represented by the actual property value.
Throws:
NullPointerException - The given indirect property value is null.
IllegalPropertyValueException - The given property value is not defined by an indirect type definition.
See Also:
TypeDefinitionIndirect.getActualSize(tv.amwa.maj.iface.PropertyValue)

setDictionary

public final void setDictionary(Dictionary dictionary)
                         throws NullPointerException
Throws:
NullPointerException

getActualType

public final TypeDefinition getActualType(PropertyValue opaqueProperty)
                                   throws NullPointerException,
                                          IllegalPropertyValueException,
                                          TypeNotFoundException
Description copied from interface: TypeDefinitionIndirect

Returns the type definition of the property value embedded within the given property value. This is effectively TypeDefinitionIndirect.getActualValue(PropertyValue) followed by PropertyValue.getType().

Specified by:
getActualType in interface TypeDefinitionIndirect
Overrides:
getActualType in class TypeDefinitionIndirect
Parameters:
opaqueProperty - Property value containing an actual property value to determine the type of.
Returns:
Type definition of the actual property value in the given indirect property value.
Throws:
NullPointerException - The given indirect property value is null.
IllegalPropertyValueException - The given property value is not defined by an indirect type definition.
TypeNotFoundException - For opaque type definitions, a type matching the values key cannot be found.
See Also:
TypeDefinitionIndirect.getActualType(tv.amwa.maj.iface.PropertyValue)

getActualValue

public final PropertyValue getActualValue(PropertyValue opaqueProperty)
                                   throws NullPointerException,
                                          IllegalPropertyValueException,
                                          TypeNotFoundException,
                                          ClassCastException
Description copied from interface: TypeDefinitionIndirect

Returns the actual property value embedded within the given indirect property value.

Specified by:
getActualValue in interface TypeDefinitionIndirect
Overrides:
getActualValue in class TypeDefinitionIndirect
Parameters:
opaqueProperty - Property value containing the embedded actual value to return.
Returns:
Actual value from within the given indirect property value.
Throws:
NullPointerException - The given indirect property value is null.
IllegalPropertyValueException - The given property value is not defined by an indirect type definition.
TypeNotFoundException - For opaque properties, the type attached to the value cannot be resolved.
ClassCastException
See Also:
TypeDefinitionIndirect.getActualValue(tv.amwa.maj.iface.PropertyValue)

createValueFromActualValue

public final PropertyValue createValueFromActualValue(PropertyValue propertyValue)
                                               throws NullPointerException,
                                                      NotSerializableException
Description copied from interface: TypeDefinitionIndirect

Creates and returns an indirect property value that contains the given actual property value.

Specified by:
createValueFromActualValue in interface TypeDefinitionIndirect
Overrides:
createValueFromActualValue in class TypeDefinitionIndirect
Parameters:
propertyValue - Actual value to embed into the new indirect property value.
Returns:
Newly created indirect property value embedding the given actual property value.
Throws:
NullPointerException - The given original property value is null.
NotSerializableException - For creating opaque type values, the given property value cannot be serialized to a stream of opaque bytes.
See Also:
TypeDefinitionIndirect.createValueFromActualValue(tv.amwa.maj.iface.PropertyValue)

createValue

public final PropertyValue createValue(Object javaValue)
                                throws ClassCastException
Description copied from class: TypeDefinition

Create a property value from the given Java object. If the type of the object is not compatible with this type definition, a ClassCastException is thrown.

Specified by:
createValue in interface TypeDefinition
Overrides:
createValue in class TypeDefinitionIndirect
Parameters:
javaValue - Java object to use to create a property value of this type.
Returns:
Property value representing the given value.
Throws:
ClassCastException - The given object cannot be cast to a property value with this type definition.
See Also:
TypeDefinition.createValue(java.lang.Object)

getTypeCategory

public final TypeCategory getTypeCategory()
Description copied from interface: TypeDefinition

Returns the type category to which this type definition belongs, which corresponds to its sub interface. For example, TypeCategory.Int is returned for a TypeDefinitionInteger.

Specified by:
getTypeCategory in interface TypeDefinition
Overrides:
getTypeCategory in class TypeDefinitionIndirect
Returns:
Type category to which the type definition belongs.
See Also:
TypeDefinition.getTypeCategory()

Media Authoring
with Java API

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