org.ow2.weblab.content
Class ContentManager

java.lang.Object
  extended by org.ow2.weblab.content.ContentManager
Direct Known Subclasses:
FileContentManager, WebDAVContentManager

public abstract class ContentManager
extends java.lang.Object


Field Summary
static int BUFFER_SIZE
           
static java.lang.String CONTENT_MANAGER_IMPLEMENTATION
           
static java.lang.String CONTENT_MANAGER_PROPERTIES_FILE
           
protected static ContentManager instance
           
protected static org.apache.commons.logging.Log logger
           
 
Constructor Summary
ContentManager()
           
 
Method Summary
protected static void copyFile(java.io.File file, java.io.File newFile)
           
protected static java.lang.String getImplementationName()
           
static ContentManager getInstance()
           
protected static ContentManager getInstance(java.lang.String implClass)
           
protected static java.lang.String getPropertyValue(java.lang.String propertyValue, java.lang.String defaultValue)
          Uses this to automatically get a folder path.
protected abstract  java.io.File readContent(org.ow2.weblab.core.model.Resource res, java.net.URI destUri)
          Abstract method to implement : the class is only expected to save the content and return the URI of the save content.
 java.io.File readNativeContent(org.ow2.weblab.core.model.Resource res)
           
 java.io.File readNormalisedContent(org.ow2.weblab.core.model.Resource res)
           
protected abstract  java.net.URI saveContent(java.io.InputStream content, org.ow2.weblab.core.model.Resource res)
          Abstract method to implement : the class is only expected to save the content and return the URI of the save content.
 java.net.URI saveNativeContent(java.io.InputStream content, org.ow2.weblab.core.model.Resource res)
           
 java.net.URI saveNormalisedContent(java.io.InputStream content, org.ow2.weblab.core.model.Resource res)
           
protected static void writeStream(java.io.InputStream is, java.io.OutputStream os)
          Read input from input stream and write it to output stream until there is no more input from input stream.
 
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

CONTENT_MANAGER_IMPLEMENTATION

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

BUFFER_SIZE

public static int BUFFER_SIZE

logger

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

instance

protected static ContentManager instance
Constructor Detail

ContentManager

public ContentManager()
Method Detail

saveContent

protected abstract java.net.URI saveContent(java.io.InputStream content,
                                            org.ow2.weblab.core.model.Resource res)
                                     throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
Abstract method to implement : the class is only expected to save the content and return the URI of the save content.

Parameters:
content -
res -
Returns:
Throws:
org.ow2.weblab.core.extended.exception.WebLabCheckedException

readContent

protected abstract java.io.File readContent(org.ow2.weblab.core.model.Resource res,
                                            java.net.URI destUri)
                                     throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
Abstract method to implement : the class is only expected to save the content and return the URI of the save content.

Parameters:
res -
destUri -
Returns:
Throws:
org.ow2.weblab.core.extended.exception.WebLabCheckedException

saveNativeContent

public java.net.URI saveNativeContent(java.io.InputStream content,
                                      org.ow2.weblab.core.model.Resource res)
                               throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
Throws:
org.ow2.weblab.core.extended.exception.WebLabCheckedException

saveNormalisedContent

public java.net.URI saveNormalisedContent(java.io.InputStream content,
                                          org.ow2.weblab.core.model.Resource res)
                                   throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
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
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
Throws:
org.ow2.weblab.core.extended.exception.WebLabCheckedException

getImplementationName

protected static java.lang.String getImplementationName()

getInstance

protected static ContentManager getInstance(java.lang.String implClass)

getInstance

public static ContentManager getInstance()

getPropertyValue

protected static java.lang.String getPropertyValue(java.lang.String propertyValue,
                                                   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.
propertyValue - name of the key in the property file.
defaultValue - value returned if unable to get one.
Returns:
the path to the file repository folder.

writeStream

protected static void writeStream(java.io.InputStream is,
                                  java.io.OutputStream os)
                           throws java.io.IOException
Read input from input stream and write it to output stream until there is no more input from input stream.

Parameters:
is - input stream the input stream to read from.
os - output stream the output stream to write to.
buf - the byte array to use as a buffer
Throws:
java.io.IOException

copyFile

protected static void copyFile(java.io.File file,
                               java.io.File newFile)
                        throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
Parameters:
file - Input file
newFile - Output file
Throws:
org.ow2.weblab.core.extended.exception.WebLabCheckedException - If an IOException occurs.


Copyright © 2004-2011. All Rights Reserved.