com.wewebu.ow.server.servlets
Class OwMultifileDownload.OwFolderArchiveEntry

java.lang.Object
  extended by com.wewebu.ow.server.servlets.OwMultifileDownload.OwFolderArchiveEntry
All Implemented Interfaces:
OwMultifileDownload.OwContentArchiveEntry
Enclosing class:
OwMultifileDownload

protected class OwMultifileDownload.OwFolderArchiveEntry
extends Object
implements OwMultifileDownload.OwContentArchiveEntry

A folder archive entry. A folder can contain multiple entries under the same name. The name-conflicting entries are indexed when the folder is zipped.


Constructor Summary
OwMultifileDownload.OwFolderArchiveEntry()
           
 
Method Summary
 void addChild(String childName_p, OwMultifileDownload.OwContentArchiveEntry entry_p)
          Add new child entry to current folder entry.
 int fileCount()
           
 boolean isSingleFileEntry()
           
 void serveSingleFileOn(javax.servlet.http.HttpServletRequest request_p, javax.servlet.http.HttpServletResponse response_p, String fileName_p)
          Serializes the content on the response output stream of the HttpServletResponse parameter as a single file ID this entry is a single-file-entry
 void zipIt(org.apache.tools.zip.ZipOutputStream zipOutputStream_p, String path_p)
          Adds the content represented by this archive entry to the specified ZipOutputStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OwMultifileDownload.OwFolderArchiveEntry

public OwMultifileDownload.OwFolderArchiveEntry()
Method Detail

addChild

public void addChild(String childName_p,
                     OwMultifileDownload.OwContentArchiveEntry entry_p)
Add new child entry to current folder entry. If it is called twice with the same child name, the archive entry will be added as additional content to the child entry.

Parameters:
childName_p - the name under which the entry will be added
entry_p - the entry to add

fileCount

public int fileCount()
Specified by:
fileCount in interface OwMultifileDownload.OwContentArchiveEntry
Returns:
the number of files contained by this folder and all its sub entries

isSingleFileEntry

public boolean isSingleFileEntry()
Returns:
true if the entries hierarchy represented by this folder contains one and only one file

serveSingleFileOn

public void serveSingleFileOn(javax.servlet.http.HttpServletRequest request_p,
                              javax.servlet.http.HttpServletResponse response_p,
                              String fileName_p)
                       throws OwInvalidOperationException
Serializes the content on the response output stream of the HttpServletResponse parameter as a single file ID this entry is a single-file-entry

Specified by:
serveSingleFileOn in interface OwMultifileDownload.OwContentArchiveEntry
Parameters:
response_p - the HTTP response to serialize the content on
fileName_p - the name under which the content should be serialized
request_p - HttpServletRequest
Throws:
OwInvalidOperationException - if the response serialization is not possible (for example because this entry contains multiple files)

zipIt

public void zipIt(org.apache.tools.zip.ZipOutputStream zipOutputStream_p,
                  String path_p)
           throws Exception
Description copied from interface: OwMultifileDownload.OwContentArchiveEntry
Adds the content represented by this archive entry to the specified ZipOutputStream

Specified by:
zipIt in interface OwMultifileDownload.OwContentArchiveEntry
Parameters:
zipOutputStream_p - the ZipOutputStream to serialize the content on
path_p - the path under which the content should be serialized on the ZipOutputStream
Throws:
Exception - if an error occurs during ZIP serialization (content access related errors should not be treated locally and logged)


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.