Class SimpleDocumentDataProvider<S extends Source,SH extends PageSegmentHandle>
java.lang.Object
com.levigo.jadice.web.demo.common.server.dataprovider.SimpleDocumentDataProvider<S,SH>
- Type Parameters:
S
- theSource
class to handleSH
- thePageSegmentHandle
class to handle
- All Implemented Interfaces:
DocumentDataProvider<S,
SH>
- Direct Known Subclasses:
ClassPathDocumentDataProvider
,ClassPathWithAnnoAndPermissionDocumentDataProvider
,DocumentUploadRepositoryDataProvider
,SplitFileUploadDocumentDataProvider
,UrlRelativeDataProvider
@Component
public abstract class SimpleDocumentDataProvider<S extends Source,SH extends PageSegmentHandle>
extends Object
implements DocumentDataProvider<S,SH>
Simple version of an
DocumentDataProvider
that uses Provider
s to read and recover-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract org.jadice.util.base.Provider<InputStream,
IOException> getRecoveryStream
(SH sourceHandle) Creates theProvider
out of a oldPageSegmentHandle
abstract org.jadice.util.base.Provider<InputStream,
IOException> Creates theProvider
out of aSource
void
Reads a part of the document to load.void
Partially recovers aDocument
identified by the givenPageSegmentHandle
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.levigo.jadice.web.server.DocumentDataProvider
createSourceHandle
-
Constructor Details
-
SimpleDocumentDataProvider
public SimpleDocumentDataProvider()
-
-
Method Details
-
getStream
Creates theProvider
out of aSource
- Parameters:
source
- the Data to read the Document- Returns:
- the
Provider
to read the Document matching to the source
-
getRecoveryStream
public abstract org.jadice.util.base.Provider<InputStream,IOException> getRecoveryStream(SH sourceHandle) throws RecoverFailedException Creates theProvider
out of a oldPageSegmentHandle
- Parameters:
sourceHandle
- the handle to recover the Stream- Returns:
- the
Provider
to read the Document matching to the handle - Throws:
RecoverFailedException
- thrown when the document can't be recovered
-
read
public void read(com.levigo.jadice.document.read.Reader reader, S source) throws com.levigo.jadice.document.JadiceException, IOException Description copied from interface:DocumentDataProvider
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.- Specified by:
read
in interfaceDocumentDataProvider<S extends Source,
SH extends PageSegmentHandle> - 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
public void recover(com.levigo.jadice.document.read.Reader reader, SH handle) throws RecoverFailedException, com.levigo.jadice.document.JadiceException Description copied from interface:DocumentDataProvider
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.- Specified by:
recover
in interfaceDocumentDataProvider<S extends Source,
SH extends PageSegmentHandle> - 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.
-