Package com.levigo.jadice.web.server
Interface DocumentDataProvider<S extends Source,SH extends PageSegmentHandle>
- Type Parameters:
S- TheSourcedefining where the document data comes fromSH- ThePageSegmentHandlehandles.
- All Known Subinterfaces:
UriBasedDocumentDataProvider
- All Known Implementing Classes:
AbstractDocumentDataProvider,ClassPathDocumentDataProvider,ClassPathWithAnnoAndPermissionDocumentDataProvider,ClassPathWithAnnoDocumentDataProvider,ClassPathWithRenderControlsDocumentDataProvider,CompositeDocumentDataProvider,DDPWithAnnoPermissions,DemoUploadSchemeDocumentDataProvider,DocumentUploadRepositoryDataProvider,SimpleDocumentDataProvider,UrlRelativeDataProvider
public interface DocumentDataProvider<S extends Source,SH extends PageSegmentHandle>
A provider for reading documents based on
Sources. 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.voidReads a part of the document to load.voidPartially recovers aDocumentidentified 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- TheSourcethe Handle should be created from.- Returns:
- The
PageSegmentHandleto 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- TheReaderto load the document.source- TheSourceto 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 aDocumentidentified by the givenPageSegmentHandle. Sometimes, client applications may requestDocumentinstances 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- TheReaderto 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.
-