Document classes

Document classes describe the basic document and its capabilities.


Classes derived from TAbstractDocument

Three classes (TDocument, TDocumentState, TDocumentPresenter) provide the structure defining a basic document. TAbstractDocument defines the interface that the TDocumentSurrogate class inherits.

TDocument is the most important class in the document family of classes. A document is an instantiation of the TDocument class, and its behavior and knowledge are defined by this class.

TDocumentState retains persistent state information about the basic document. Persistent information continues to exist between the opening and closing of the document. All documents have some persistent state information associated with them. At a minimum this would be a unique identifier, any client-defined data, and any attached document attributes.

Typically, you derive a TDocumentState class for every different type of document. You then add any persistent state information that you want retained.

TDocumentPresenter defines how the information in the document is rendered to the enduser. The document state creates a default presenter and provides streaming operators to stream the document state in and out of the document store.

TDocumentReference provides a lightweight document handle that persists after document closure. It is much less expensive in computational terms to keep a reference to a document than to keep the document open. A document reference provides a means to run and access a document after its creation and closure. Because the document reference is unique, you can create a TDocumentSurrogate and manipulate a given document directly. Derive a subclass from the surrogate to provide access to content-specific data.

TDocumentSurrogate provides clients with a stand-in for a document. The surrogate provides access to a document whether the document is running in a local or remote server process. Use surrogates to pass on and receive functors and notification connections to a document.

TDocumentSurrogate has at least some of the interface provided by the real instance of the document. How much of the interface the surrogate shares with the source document is determined by the creator of the surrogate. If necessary, you could have a surrogate present the complete interface of a document. A surrogate defines the subset of the document interface that can be accessed remotely.

NOTE An important difference between surrogates and their corresponding objects is that surrogates use call-by-value semantics whereas real objects generally use call-by-reference semantics when getting and retrieving data.

As long as at least one surrogate of a document exists, the document will remain active. A document is active when a document session is running. The CommonPoint application system streams in a document from storage when it becomes active.

TDocumentException handles the errors generated by objects in the Basic Document framework. Refer to the more general discussion in "Storing information" on page 10.

Process control classes within the document family

The above classes define the structure of a basic document and provide a means of addressing the document and its contents. The following classes provide a means of managing both the document and its associated processes.

TDocumentRegistry maintains a registry of all documents currently active. Document surrogates go through the document registry to start and stop document server processes.

TDocumentSession is responsible for creating and managing the runtime environment needed by a document server process. Before a document can be opened, your application must start a document session.

Each document is normally run in a separate document server process (so that it has its own address space) managed by a document session.

TDocumentFunctor is an object that acts as if it were a function. All surrogate methods are implemented with functors, allowing them to be applied easily whether the document is a local or a remote one.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker