org.ow2.weblab.content.api
Class ContentManager

java.lang.Object
  extended by org.ow2.weblab.content.api.ContentManager

public class ContentManager
extends java.lang.Object


Field Summary
static java.lang.String CONTENT_MANAGER_PROPERTIES_FILE
           
protected static ContentManager instance
           
protected  org.apache.commons.logging.Log logger
           
protected  ContentReader reader
           
static java.lang.String READER_DEFAULT_IMPLEMENTATION
           
static java.lang.String READER_IMPLEMENTATION
           
protected  ContentWriter writer
           
static java.lang.String WRITER_DEFAULT_IMPLEMENTATION
           
static java.lang.String WRITER_IMPLEMENTATION
           
 
Method Summary
static ContentManager getInstance()
          Default starting method to get the ContentManager instance.
static java.lang.String getPropertyValue(java.lang.String propertyPath, java.lang.String propertyKey, java.lang.String defaultValue)
          Uses this to automatically get a folder path.
 ContentReader getReader()
          Accessor to the internally used content reader.
 ContentWriter getWriter()
          Accessor to the internally used content writer.
 java.io.File readNativeContent(org.ow2.weblab.core.model.Resource res)
          Read annotation on the input resource and get access to its native content through a JAVA file.
 java.io.File readNormalisedContent(org.ow2.weblab.core.model.Resource res)
          Read annotation on the input resource and get access to its normalised content through a JAVA file.
 java.net.URI writeNativeContent(java.io.InputStream content, org.ow2.weblab.core.model.Resource res)
          Write the input stream to the content manager and annotate the WebLab resource to link it to the native content
 java.net.URI writeNormalisedContent(java.io.InputStream content, org.ow2.weblab.core.model.Resource res)
          Write the input stream to the content manager and annotate the WebLab resource to link it to the normalised content
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTENT_MANAGER_PROPERTIES_FILE

public static final java.lang.String CONTENT_MANAGER_PROPERTIES_FILE
See Also:
Constant Field Values

READER_IMPLEMENTATION

public static final java.lang.String READER_IMPLEMENTATION
See Also:
Constant Field Values

READER_DEFAULT_IMPLEMENTATION

public static final java.lang.String READER_DEFAULT_IMPLEMENTATION
See Also:
Constant Field Values

WRITER_IMPLEMENTATION

public static final java.lang.String WRITER_IMPLEMENTATION
See Also:
Constant Field Values

WRITER_DEFAULT_IMPLEMENTATION

public static final java.lang.String WRITER_DEFAULT_IMPLEMENTATION
See Also:
Constant Field Values

instance

protected static ContentManager instance

logger

protected final org.apache.commons.logging.Log logger

writer

protected final ContentWriter writer

reader

protected final ContentReader reader
Method Detail

getInstance

public static ContentManager getInstance()
Default starting method to get the ContentManager instance.

Returns:
the ContentManager instance

getPropertyValue

public static java.lang.String getPropertyValue(java.lang.String propertyPath,
                                                java.lang.String propertyKey,
                                                java.lang.String defaultValue)
Uses this to automatically get a folder path. Load it from a property file.

Parameters:
propertyPath - path to the property file.
propertyKey - name of the key in the property file.
defaultValue - value returned if unable to get one.
Returns:
the path to the file repository folder.

writeNativeContent

public java.net.URI writeNativeContent(java.io.InputStream content,
                                       org.ow2.weblab.core.model.Resource res)
                                throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
Write the input stream to the content manager and annotate the WebLab resource to link it to the native content

Parameters:
res - standard WebLab Resource
content - an InputStream which could be consumed to get the raw content
Returns:
the URI of the content (for information)
Throws:
org.ow2.weblab.core.extended.exception.WebLabCheckedException

writeNormalisedContent

public java.net.URI writeNormalisedContent(java.io.InputStream content,
                                           org.ow2.weblab.core.model.Resource res)
                                    throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
Write the input stream to the content manager and annotate the WebLab resource to link it to the normalised content

Parameters:
res - standard WebLab Resource
content - an InputStream which could be consumed to get the raw content
Returns:
the URI of the content (for information)
Throws:
org.ow2.weblab.core.extended.exception.WebLabCheckedException

readNativeContent

public java.io.File readNativeContent(org.ow2.weblab.core.model.Resource res)
                               throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
Read annotation on the input resource and get access to its native content through a JAVA file. Only read access are guaranted on the returned File

Parameters:
a - standard WebLab Resource
Returns:
a java File object with read rights
Throws:
org.ow2.weblab.core.extended.exception.WebLabCheckedException

readNormalisedContent

public java.io.File readNormalisedContent(org.ow2.weblab.core.model.Resource res)
                                   throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
Read annotation on the input resource and get access to its normalised content through a JAVA file. Only read access are guaranted on the returned File

Parameters:
a - standard WebLab Resource
Returns:
a java File object with read rights
Throws:
org.ow2.weblab.core.extended.exception.WebLabCheckedException

getReader

public ContentReader getReader()
Accessor to the internally used content reader. Reserved to advanced user, those who need to read other content than WebLab normalised and native content.

Returns:
the internally used content writer.

getWriter

public ContentWriter getWriter()
Accessor to the internally used content writer. Reserved to advanced user, those who need to write other content than WebLab normalised and native content.

Returns:
the internally used content writer.


Copyright © 2004-2011. All Rights Reserved.