public interface

DocumentAccessProvider

com.priint.comet.renderer.io.DocumentAccessProvider
Known Indirect Subclasses

Class Overview

DocumentAccessProvider interface

Purpose of DocumentAccessProvider implementations is to handle all aspects of accessing document data in the client application and make it available to renderer processing the document referred by this DocumentAccessProvider.

Summary

Public Methods
abstract void afterClose(OpenedDocument document, long fileSystemPropagationDelayMillis, long fileSystemPropagationProbeMillis)

Cleans up after document processing has finished

Called, after a document has been closed by the renderer.

abstract void beforeOpen(OpenedDocument document)

Prepares the document for processing with a renderer

Called before document is opened by a renderer.

abstract void fetchResource(String localPath)
abstract Class<? extends DocumentType> getDocumentType()

Gets the type of the document referred by this DocumentAccessProvider

Gets the type of the document referred by this DocumentAccessProvider, e.g.

abstract Path getLocalPath()

Gets the local path of the document referred by this DocumentAccessProvider.

abstract String getResolvedPath()

Gets the path as passed to the renderer

Gets the document path as passed to the renderer.

abstract void putResource(String localPath)

Makes document resources available for the renderer

Makes document resources available for the renderer.

Public Methods

public abstract void afterClose (OpenedDocument document, long fileSystemPropagationDelayMillis, long fileSystemPropagationProbeMillis)

Cleans up after document processing has finished

Called, after a document has been closed by the renderer.
This method should execute cleanup tasks, after document processing has finished, e.g.

  • remove temporary files
  • download file data from a network drive

Parameters
document document that has just been closed
fileSystemPropagationDelayMillis how long (in millis) should this procedure wait at most for files to become available to it
fileSystemPropagationProbeMillis how often (in millis) should any IO operations be retried
Throws
RendererException if cleaning up after closing fails

public abstract void beforeOpen (OpenedDocument document)

Prepares the document for processing with a renderer

Called before document is opened by a renderer.
This method should prepare a document for processing with a renderer, e.g.

  • copy the document file to a temporary file
  • read data from a InputStream and write to a regular file
  • upload file to a network drive accessible for the renderer
or similar.

Parameters
document TODO
Throws
RendererException if preparing the document fails. If any exception is thrown during beforeOpen, rendering this document is aborted.

public abstract void fetchResource (String localPath)

public abstract Class<? extends DocumentType> getDocumentType ()

Gets the type of the document referred by this DocumentAccessProvider

Gets the type of the document referred by this DocumentAccessProvider, e.g. com.priint.comet.renderer.pdf.W2MLDocumentType.class The type is required to determine an appropriate renderer implementation to process this document.

public abstract Path getLocalPath ()

Gets the local path of the document referred by this DocumentAccessProvider.

Gets the local path of the document referred by this DocumentAccessProvider.
Some operations require saving and reading from resources related to a document. For example, meta data of a document (xml files describing the structure, previews of document spreads etc.) are expected to be found in a folder named <document full path>/<document name>.meta getLocalPath() is used as the base prefix for all resource paths related to the document referred by this DocumentAccessProvider.

Note:
Document resources, such as the meta data archive, are usually generated by the renderer at getResolvedPath() + suffix.
If this path is resolvable and accessible for the client JVM, the getLocalPath implementation should just be

Returns
  • path resolvable and accessible for local file access

public abstract String getResolvedPath ()

Gets the path as passed to the renderer

Gets the document path as passed to the renderer.
Depending on the implementation, this can be a temporary file path, a path on a remote file system or similar.

The path returned must be resolvable for the renderer processing this document

Returns
  • path resolvable for the renderer processing this document

public abstract void putResource (String localPath)

Makes document resources available for the renderer

Makes document resources available for the renderer.
Typically, this will copy resources "beside" the original document to a destination "beside" the document prepared for renderer processing.

The naming convention for document resource directories is very strict: path, name and extender of the actual document plus localPath Example: the meta data folder of document C:\Userdata\documents\mydoc.indd is expected to be found at C:\Userdata\documents\mydoc.indd.meta