Enterprise Information Portal APIs

com.ibm.mm.viewer
Class CMBStreamingDocServices

java.lang.Object
  |
  +--com.ibm.mm.viewer.CMBStreamingDocServices
All Implemented Interfaces:
CMBViewerConstants, java.io.Serializable

public class CMBStreamingDocServices
extends java.lang.Object
implements CMBViewerConstants, java.io.Serializable

CMBStreamingDocServices is very similar to the CMBDocumentServices bean (and is, in fact, used by CMBDocumentServices). It's interfaces are based on streams rather than a reference to a CMBItem or other non-visual beans. This class may be used without need for a connection to a federated database or content server, such as in a stand-alone file viewer.

Since:
7.1
See Also:
CMBDocumentServices, Serialized Form

Fields inherited from interface com.ibm.mm.viewer.CMBViewerConstants
DEFAULT_PAGE_NUMBER, ROTATE_0, ROTATE_180, ROTATE_270, ROTATE_90
 
Constructor Summary
CMBStreamingDocServices(CMBStreamingDocServicesCallbacks callbacks, java.util.Properties engineProperties)
          Constructs CMBStreamingDocServices.
 
Method Summary
 void dropAllDocuments()
          Terminates processing of all documents.
 void dropDocument(CMBDocument document)
          Terminates processing of a document.
protected  void finalize()
          Overridden to cause all documents and engines to be dropped, freeing resources.
 java.util.Properties getConversionProperties()
          Returns the conversion properties.
 CMBDocument getDocumentFromHandle(java.lang.Object hItem)
           
 CMBDocument[] getDocuments()
          Returns the documents being processed.
 CMBDocument getDocuments(int index)
          Returns a particular document being processed.
 java.lang.Object getItemHandle(CMBDocument document)
          Returns the handle related to a document.
 java.lang.String[] getPreferredFormats()
          Returns the preferred formats for converted documents.
 java.lang.String[] getPreferredPageFormats()
          Returns the preferred page formats for converted pages of documents.
 CMBDocument loadDocument(java.io.InputStream firstPart, int firstPartSize, int numberOfParts, java.lang.String docMimeType, java.lang.String firstPartMimeType, java.io.InputStream annotations, java.io.InputStream resources)
          Loads a document into document services.
 CMBDocument loadDocument(java.io.InputStream firstPart, int numberOfParts, java.lang.String docMimeType, java.lang.String firstPartMimeType, java.io.InputStream annotations, java.io.InputStream resources)
          Loads a document into document services.
 void setConversionProperties(java.util.Properties properties)
          Sets the conversion properties.
 void setItemHandle(CMBDocument document, java.lang.Object itemHandle)
          Sets a handle to a document.
 void setPreferredFormats(java.lang.String[] formats)
          Sets the preferred formats for converted documents, in the order of most preferred to least preferred.
 void setPreferredPageFormats(java.lang.String[] pageFormats)
          Sets the preferred page formats for converted pages of documents, in the order of most preferred to least preferred.
 void terminate()
          Terminates all the engines.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CMBStreamingDocServices

public CMBStreamingDocServices(CMBStreamingDocServicesCallbacks callbacks,
                               java.util.Properties engineProperties)
Constructs CMBStreamingDocServices.
Parameters:
callbacks - implementation of CMBStreamingDocServicesCallbacks with methods that are called to retrieve additional document parts.
engineProperties - properties object defining the engines classes and their properties. See CMBDocumentServices for details.
Method Detail

getDocuments

public CMBDocument[] getDocuments()
Returns the documents being processed.

getDocuments

public CMBDocument getDocuments(int index)
                         throws java.lang.ArrayIndexOutOfBoundsException
Returns a particular document being processed.

getPreferredFormats

public java.lang.String[] getPreferredFormats()
Returns the preferred formats for converted documents. The default is text/html, application/pdf, text/plain.

setPreferredFormats

public void setPreferredFormats(java.lang.String[] formats)
Sets the preferred formats for converted documents, in the order of most preferred to least preferred.
Parameters:
formats - the MIME types for the preferred formats.

getPreferredPageFormats

public java.lang.String[] getPreferredPageFormats()
Returns the preferred page formats for converted pages of documents. The default is text/html, image/gif, image/jpeg.

setPreferredPageFormats

public void setPreferredPageFormats(java.lang.String[] pageFormats)
Sets the preferred page formats for converted pages of documents, in the order of most preferred to least preferred.
Parameters:
formats - the MIME types for the preferred formats.

getConversionProperties

public java.util.Properties getConversionProperties()
Returns the conversion properties. This defines how document formats are converted. By default, all documents types are converted to pages.
See Also:
setConversionProperties

setConversionProperties

public void setConversionProperties(java.util.Properties properties)
Sets the conversion properties. This defines how documents are converted. Conversion occurs when the write() methods on CMBDocument and CMBPage are used. It has the following format:
=document|page|none
mimetype is the MIME content type for the documents. The value is defined:
document
Convert the entire document to one of the preferred formats. Separate document pages will not be available. If conversion to a preferred format is not possible, CMBDocument.write() will return the document unconverted.
page
Convert pages of the document to one of the preferred page formats. If the document can be parsed and individual pages can be converted, they will be made available (through CMBDocument.getPages()). If pages cannot be converted, document conversion will still be available. If even that is not possible, CMBDocument.write() will return the document unconverted.
none
Do not provide any conversion of the document type. No document pages are available, and CMBDocument.write() returns the document unconverted.
By default, all document types are converted to pages.

loadDocument

public CMBDocument loadDocument(java.io.InputStream firstPart,
                                int numberOfParts,
                                java.lang.String docMimeType,
                                java.lang.String firstPartMimeType,
                                java.io.InputStream annotations,
                                java.io.InputStream resources)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException,
                                java.lang.IllegalAccessException,
                                java.lang.InstantiationException
Loads a document into document services.
Parameters:
firstPart - a stream containing the first part of the document.
numberOfParts - the number of parts of the document.
docMimeType - the MIME content type of the document.
firstPartMimeType - the MIME content type of the first part of the document.
annotations - a stream containing annotations for the document pages.
resources - a stream containing resources for the document.

loadDocument

public CMBDocument loadDocument(java.io.InputStream firstPart,
                                int firstPartSize,
                                int numberOfParts,
                                java.lang.String docMimeType,
                                java.lang.String firstPartMimeType,
                                java.io.InputStream annotations,
                                java.io.InputStream resources)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException,
                                java.lang.IllegalAccessException,
                                java.lang.InstantiationException
Loads a document into document services.
Parameters:
firstPart - a stream containing the first part of the document.
firstPartSize - the size of the firstPart stream.
numberOfParts - the number of parts of the document
docMimeType - the MIME content type of the document
firstPartMimeType - the MIME content type of the first part of the document.
annotations - a stream containing annotations for the document pages.
resources - a stream containing resources for the document.

dropDocument

public void dropDocument(CMBDocument document)
Terminates processing of a document.
Parameters:
document - the document being terminated.

dropAllDocuments

public void dropAllDocuments()
Terminates processing of all documents.

setItemHandle

public void setItemHandle(CMBDocument document,
                          java.lang.Object itemHandle)
Sets a handle to a document. The handle can refer to any object.
Parameters:
document - the document whose handle is being set.
itemHandle - the value for the handle.

getItemHandle

public java.lang.Object getItemHandle(CMBDocument document)
Returns the handle related to a document.
Parameters:
document - the document whose handle is being retrieved.

getDocumentFromHandle

public CMBDocument getDocumentFromHandle(java.lang.Object hItem)

terminate

public void terminate()
Terminates all the engines. Also drops all documents, so There is no need to call dropAllDocuments beforehand

finalize

protected void finalize()
                 throws java.lang.Throwable
Overridden to cause all documents and engines to be dropped, freeing resources.
Overrides:
finalize in class java.lang.Object

EIP JavaBeans

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.