Package com.levigo.jadice.web.server
Interface DocumentDataProvider<S extends Source,SH extends PageSegmentHandle>
- Type Parameters:
S
- TheSource
defining where the document data comes fromSH
- ThePageSegmentHandle
handles.
- All Known Subinterfaces:
UriBasedDocumentDataProvider
- All Known Implementing Classes:
AbstractDocumentDataProvider
,ClassPathDocumentDataProvider
,ClassPathWithAnnoAndPermissionDocumentDataProvider
,ClassPathWithAnnoDocumentDataProvider
,ClassPathWithRenderControlsDocumentDataProvider
,CompositeDocumentDataProvider
,DDPWithAnnoPermissions
,DemoUploadSchemeDocumentDataProvider
,DocumentUploadRepositoryDataProvider
,ServerBasedDnDDataProvider
,SimpleDocumentDataProvider
,UrlRelativeDataProvider
public interface DocumentDataProvider<S extends Source,SH extends PageSegmentHandle>
A provider for reading documents based on
Source
s. Implementations of this class have to
be registered using
DocumentDataProviderRegistry.registerProvider(Class, Class, DocumentDataProvider)
which
will enable the jadice webtoolkit engine to correctly load the appropriate
DocumentDataProvider
implementation for a given Source
.-
Method Summary
Modifier and TypeMethodDescriptioncreateSourceHandle
(S source) Creates a SourceHandle from a given Source.void
Reads a part of the document to load.void
Partially recovers aDocument
identified by the givenPageSegmentHandle
.
-
Method Details
-
createSourceHandle
Creates a SourceHandle from a given Source. The information required to recover the document must be stored in thePageSegmentHandle
. The web toolkit server will call therecover(Reader, PageSegmentHandle)
method with aPageSegmentHandle
. Typical scenarios include garbage-collected documents, a server restart, or moving a request to another server for load-balancing or fail-over purposes.- Parameters:
source
- TheSource
the Handle should be created from.- Returns:
- The
PageSegmentHandle
to recover the document stream.
-
read
void read(com.levigo.jadice.document.read.Reader reader, S source) throws com.levigo.jadice.document.JadiceException, IOException Reads a part of the document to load. This will be used to initially load the document when a client initiates displaying a document. Please note, that the read method will be called only once during a server-side document read lifecycle. Subsequent reads will trigger the recover method, not a read.- Parameters:
reader
- TheReader
to load the document.source
- TheSource
to read the document from, including a unique identifier.- Throws:
com.levigo.jadice.document.JadiceException
- Any rendering exceptions reported by the Jadice core.IOException
- Other exceptions while reading the document.
-
recover
void recover(com.levigo.jadice.document.read.Reader reader, SH handle) throws RecoverFailedException, com.levigo.jadice.document.JadiceException Partially recovers aDocument
identified by the givenPageSegmentHandle
. Sometimes, client applications may requestDocument
instances that have either been removed from cache, garbage-collected due to long inactivity or in consequence of a server switch. This method will be used for subsequent document reads.- Parameters:
reader
- TheReader
to load the Document withhandle
- The information specifying which Document to recover- Throws:
RecoverFailedException
- Thrown if the document cannot be recovered.com.levigo.jadice.document.JadiceException
- Any rendering exceptions reported by the Jadice core.
-