org.modeshape.jcr.federation.spi

## Interface PageWriter

- All Known Subinterfaces:
    DocumentWriter
  All Known Implementing Classes:
    FederatedDocumentWriter

      public interface PageWriter

  A type of document writer that can add paging information to documents. Typically, the operations exposed by this will be used by `Pageable` connectors.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static long` | `UNKNOWN_TOTAL_SIZE` A constant that should be used by `addPage(String, int, long, long)` and `addPage(String, String, long, long)` to signal that the number of children is either unknown or too large to compute.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `PageWriter` | `addChild(String id, Name name)` Add a child with the given id and name to the underlying document.
    `PageWriter` | `addChild(String id, String name)` Add a child with the given id and name to the underlying document.
    `PageWriter` | `addPage(String parentId, int nextPageOffset, long blockSize, long totalChildCount)` Create a reference to a separate page of children in its underlying document.
    `PageWriter` | `addPage(String parentId, String nextPageOffset, long blockSize, long totalChildCount)` Create a reference to a separate page of children in its underlying document.
    `EditableDocument` | `document()` Returns the underlying document.
    `PageWriter` | `removeChild(String id)` Remove a child from this document.
    `PageWriter` | `setChildren(LinkedHashMap<String,Name> children)` Set an ordered of (childId, childName) for the underlying document.
    `PageWriter` | `setChildren(List<? extends Document> children)` Set the list of children for the underlying document.

- - ### Field Detail

    - #### UNKNOWN_TOTAL_SIZE

          static final long UNKNOWN_TOTAL_SIZE

      A constant that should be used by `addPage(String, int, long, long)` and `addPage(String, String, long, long)` to signal that the number of children is either unknown or too large to compute.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### addChild

          PageWriter addChild(String id,
                            String name)

      Add a child with the given id and name to the underlying document.
      Parameters:
        `id` - the new child's id; may not be null
        `name` - the new child's name; may not be null
      Returns:
        this writer; never null

    - #### addChild

          PageWriter addChild(String id,
                            Name name)

      Add a child with the given id and name to the underlying document.
      Parameters:
        `id` - the new child's id; may not be null
        `name` - the new child's name; may not be null
      Returns:
        this writer; never null

    - #### removeChild

          PageWriter removeChild(String id)

      Remove a child from this document.
      Parameters:
        `id` - the identifier of the child
      Returns:
        this writer; never null

    - #### setChildren

          PageWriter setChildren(List<? extends Document> children)

      Set the list of children for the underlying document. If children previously existed, they will be replaced.
      Parameters:
        `children` - a list of `EditableDocument` instances each describing a single child; may not be null
      Returns:
        this writer; never null

    - #### setChildren

          PageWriter setChildren(LinkedHashMap<String,Name> children)

      Set an ordered of (childId, childName) for the underlying document. If children previously existed, they will be replaced.

      The passed map does not contain any explicit information about same name siblings, so a connector would need to handle that logic.

      Parameters:
        `children` - a map of (childId, childName) pairs; may not be null
      Returns:
        this writer; never null

    - #### addPage

          PageWriter addPage(String parentId,
                           String nextPageOffset,
                           long blockSize,
                           long totalChildCount)

      Create a reference to a separate page of children in its underlying document. The underlying document can be either the document of an external node, or the document of another page.
      Parameters:
        `parentId` - a `non-null` String representing the identifier of the parent (owning) document
        `nextPageOffset` - a `non-null` String representing the offset of the next page. The meaning of the offset isn't defined and it's up to each connector to define it.
        `blockSize` - an integer which indicates the size of the next block of children
        `totalChildCount` - an integer which indicates the total number of children; should be `UNKNOWN_TOTAL_SIZE` if the number of children is unknown, too large to compute efficiently, or to signal that the repository should use the `Connector.getChildReference(String, String)` method to find the child reference for a parent and a (supposed) child node.
      Returns:
        the current writer instance
      See Also:
        `Connector.getChildReference(String, String)`

    - #### addPage

          PageWriter addPage(String parentId,
                           int nextPageOffset,
                           long blockSize,
                           long totalChildCount)

      Create a reference to a separate page of children in its underlying document. The underlying document can be either the document of an external node, or the document of another page.
      Parameters:
        `parentId` - a `non-null` String representing the identifier of the parent (owning) document
        `nextPageOffset` - a `non-null` int representing a numeric offset of the next page.
        `blockSize` - an integer which indicates the size of the next block of children
        `totalChildCount` - an integer which indicates the total number of children; should be `UNKNOWN_TOTAL_SIZE` if the number of children is unknown, too large to compute efficiently, or to signal that the repository should use the `Connector.getChildReference(String, String)` method to find the child reference for a parent and a (supposed) child node.
      Returns:
        the current writer instance
      See Also:
        `Connector.getChildReference(String, String)`

    - #### document

          EditableDocument document()

      Returns the underlying document.
      Returns:
        an `EditableDocument` instance; never null

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.