org.apache.lenya.cms.publication
Class ResourceWrapper

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.lenya.cms.publication.ResourceWrapper
All Implemented Interfaces:
org.apache.avalon.framework.logger.LogEnabled

public class ResourceWrapper
extends org.apache.avalon.framework.logger.AbstractLogEnabled

Wrapper to handle resource documents.


Constructor Summary
ResourceWrapper(org.apache.lenya.cms.publication.Document document, org.apache.avalon.framework.service.ServiceManager manager, org.apache.avalon.framework.logger.Logger logger)
           
 
Method Summary
protected  void addResourceMeta(java.lang.String fileName, java.lang.String mimeType, java.io.InputStream stream, org.apache.lenya.cms.metadata.MetaData customMeta)
           
static boolean canReadMimeType(java.lang.String mimeType)
          Checks if a mime type denotes an image.
protected  org.apache.lenya.cms.publication.Document getDocument()
           
 void write(java.io.InputStream inputStream, java.lang.String mimeType, java.lang.String fileName, long fileSize)
          Writes the content of the resource.
 void write(org.apache.cocoon.servlet.multipart.Part file)
           
 void write(java.lang.String sourceUri)
          Writes the content of the resource from a source.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceWrapper

public ResourceWrapper(org.apache.lenya.cms.publication.Document document,
                       org.apache.avalon.framework.service.ServiceManager manager,
                       org.apache.avalon.framework.logger.Logger logger)
Parameters:
document - The document to wrap.
manager - The service manager.
logger - The logger.
Method Detail

getDocument

protected org.apache.lenya.cms.publication.Document getDocument()

write

public void write(org.apache.cocoon.servlet.multipart.Part file)
           throws java.io.IOException,
                  org.apache.lenya.cms.metadata.MetaDataException,
                  org.apache.avalon.framework.service.ServiceException,
                  org.apache.lenya.cms.repository.RepositoryException,
                  org.apache.lenya.cms.publication.DocumentException
Parameters:
file - The part to write.
Throws:
java.io.IOException
org.apache.lenya.cms.metadata.MetaDataException
org.apache.avalon.framework.service.ServiceException
org.apache.lenya.cms.repository.RepositoryException
DocumentException

write

public void write(java.lang.String sourceUri)
           throws org.apache.avalon.framework.service.ServiceException,
                  java.net.MalformedURLException,
                  java.io.IOException,
                  org.apache.lenya.cms.repository.RepositoryException,
                  org.apache.lenya.cms.publication.DocumentException,
                  org.apache.lenya.cms.metadata.MetaDataException
Writes the content of the resource from a source.

Parameters:
sourceUri - The source URI.
Throws:
org.apache.avalon.framework.service.ServiceException
java.net.MalformedURLException
java.io.IOException
org.apache.lenya.cms.repository.RepositoryException
DocumentException
org.apache.lenya.cms.metadata.MetaDataException

write

public void write(java.io.InputStream inputStream,
                  java.lang.String mimeType,
                  java.lang.String fileName,
                  long fileSize)
           throws java.io.IOException,
                  org.apache.lenya.cms.metadata.MetaDataException,
                  org.apache.avalon.framework.service.ServiceException,
                  java.net.MalformedURLException,
                  org.apache.lenya.cms.repository.RepositoryException,
                  org.apache.lenya.cms.publication.DocumentException
Writes the content of the resource.

Parameters:
inputStream - The input stream providing the content.
mimeType - The mime type.
fileName - The file name.
fileSize - The file size.
Throws:
java.io.IOException
org.apache.lenya.cms.metadata.MetaDataException
org.apache.avalon.framework.service.ServiceException
java.net.MalformedURLException
org.apache.lenya.cms.repository.RepositoryException
DocumentException

addResourceMeta

protected void addResourceMeta(java.lang.String fileName,
                               java.lang.String mimeType,
                               java.io.InputStream stream,
                               org.apache.lenya.cms.metadata.MetaData customMeta)
                        throws org.apache.lenya.cms.metadata.MetaDataException,
                               java.io.IOException
Throws:
org.apache.lenya.cms.metadata.MetaDataException
java.io.IOException

canReadMimeType

public static boolean canReadMimeType(java.lang.String mimeType)
Checks if a mime type denotes an image.

Parameters:
mimeType - The mime type.
Returns:
A boolean value.


Copyright $ Apache Software Foundation. All Rights Reserved.