org.ow2.weblab.core.extended.factory
Class MediaUnitFactory

java.lang.Object
  extended by org.ow2.weblab.core.extended.factory.MediaUnitFactory

public class MediaUnitFactory
extends java.lang.Object

To create MediaUnits that are not Document we strongly encourage to use this class. It will enable the creation of a MediaUnit having an URI compliant with the WebLabRI recommendations.
Since a non-Document MediaUnit hasn't any sense without being attached to a Document, we only provide a method for creating MediaUnits that takes a Document in parameter. As a result, the created MediaUnit (instance of the class given in parameter) is added to the MediaUnit List of the Document.

Author:
Cassidian WebLab Team
Date:
2008-01-18

Field Summary
protected static java.util.Map<java.lang.String,java.util.Set<java.lang.String>> innerMap
          This data structure is not well adapted to manage WebLab Resource
protected static char SEPARATOR
          The separator char.
 
Method Summary
protected static void addAnnotation(Annotation annotation, Resource resource, Resource root)
           
protected static void addChild(MediaUnit mu, Resource parent, Resource root)
           
protected static void addDescriptor(LowLevelDescriptor descriptor, Resource parent, Resource root)
           
protected static void addSegment(Segment segment, MediaUnit parent, Resource root)
           
protected static void cleanMapping(java.lang.String uri)
           
static
<T extends MediaUnit>
T
createAndLinkMediaUnit(Resource res, java.lang.Class<T> muClass)
          Automatically set a valid WebLabRI to the created MediaUnit (an instance of muClass in parameter) using doc to generate an unique id.
protected static java.lang.String createUniqueURIFrom(Resource resource, boolean isChild, boolean isAnnotation)
           
protected static java.lang.String createUniqueURIin(java.util.Set<java.lang.String> uris, boolean isChild, boolean isAnnotation, java.lang.String parentUri)
           
protected static Resource findParent(MediaUnit mu, Resource resource)
           
protected static java.lang.String getUniqueWebLabRIFrom(Resource res, boolean isChild, boolean isAnnotation)
           
protected static java.util.Set<java.lang.String> listUri(Resource resource)
          List uris in the resource
protected static java.util.Set<java.lang.String> listUri(Resource resource, boolean force)
           
protected static void removeChild(MediaUnit mu, Resource parent, Resource root)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEPARATOR

protected static final char SEPARATOR
The separator char.

See Also:
Constant Field Values

innerMap

protected static final java.util.Map<java.lang.String,java.util.Set<java.lang.String>> innerMap
This data structure is not well adapted to manage WebLab Resource

Method Detail

createAndLinkMediaUnit

public static final <T extends MediaUnit> T createAndLinkMediaUnit(Resource res,
                                                                   java.lang.Class<T> muClass)
Automatically set a valid WebLabRI to the created MediaUnit (an instance of muClass in parameter) using doc to generate an unique id. Created MediaUnit will be added to the MediaUnit List ofdoc.

Type Parameters:
T - The subclass of MediaUnit to be created
Parameters:
res - the Resource that will contains the created MediaUnit
muClass - The class of the MediaUnit to be created
Returns:
a new instance of muClass with a valid WebLabRI and added to cu

cleanMapping

protected static void cleanMapping(java.lang.String uri)

listUri

protected static java.util.Set<java.lang.String> listUri(Resource resource)
List uris in the resource

Parameters:
resource - a resource
Returns:
a set of uri in this resource

listUri

protected static java.util.Set<java.lang.String> listUri(Resource resource,
                                                         boolean force)

createUniqueURIFrom

protected static java.lang.String createUniqueURIFrom(Resource resource,
                                                      boolean isChild,
                                                      boolean isAnnotation)

createUniqueURIin

protected static java.lang.String createUniqueURIin(java.util.Set<java.lang.String> uris,
                                                    boolean isChild,
                                                    boolean isAnnotation,
                                                    java.lang.String parentUri)

removeChild

protected static void removeChild(MediaUnit mu,
                                  Resource parent,
                                  Resource root)

addAnnotation

protected static void addAnnotation(Annotation annotation,
                                    Resource resource,
                                    Resource root)

addSegment

protected static void addSegment(Segment segment,
                                 MediaUnit parent,
                                 Resource root)

addDescriptor

protected static void addDescriptor(LowLevelDescriptor descriptor,
                                    Resource parent,
                                    Resource root)

addChild

protected static void addChild(MediaUnit mu,
                               Resource parent,
                               Resource root)

findParent

protected static Resource findParent(MediaUnit mu,
                                     Resource resource)

getUniqueWebLabRIFrom

protected static final java.lang.String getUniqueWebLabRIFrom(Resource res,
                                                              boolean isChild,
                                                              boolean isAnnotation)
Parameters:
res - The Resource to be used to create WebLabRI
Returns:
The String to be used as URI by the MediaUnit created


Copyright © 2004-2010. All Rights Reserved.