Interface DocumentDataProvider<S extends Source,​SH extends PageSegmentHandle>

    • Method Detail

      • createSourceHandle

        SH createSourceHandle​(S source)
        Creates a SourceHandle from a given Source. The information required to recover the document must be stored in the PageSegmentHandle. The web toolkit server will call the recover(Reader, PageSegmentHandle) method with a PageSegmentHandle. 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 - The Source 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 - The Reader to load the document.
        source - The Source 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 a Document identified by the given PageSegmentHandle. Sometimes, client applications may request Document 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 - The Reader to load the Document with
        handle - 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.