org.modeshape.jcr.spi.federation

## Class ReadOnlyConnector

- java.lang.Object
- - org.modeshape.jcr.spi.federation.Connector
  - - org.modeshape.jcr.spi.federation.ReadOnlyConnector

- Direct Known Subclasses:
    GitConnector, JdbcMetadataConnector

      public abstract class ReadOnlyConnector
      extends Connector

  A specialized abstract `Connector` class that is readable and can never update content. The connector always throws `DocumentStoreException`s whenever it is asked to `store`, `update`, or `remove` documents. Thus, do not subclass if your custom connector can sometimes modify content.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.modeshape.jcr.spi.federation.Connector

      `Connector.ExtraProperties`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReadOnlyConnector()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isReadonly()` Indicates if the connector instance has been configured in read-only mode.
    `String` | `newDocumentId(String parentId, Name newDocumentName, Name newDocumentPrimaryType)` Generates an identifier which will be assigned when a new document (aka. child) is created under an existing document (aka.parent).
    `boolean` | `removeDocument(String id)` Removes the document with the given id.
    `void` | `storeDocument(Document document)` Stores the given document.
    `void` | `updateDocument(DocumentChanges documentChanges)` Updates a document using the provided changes.

    - ### Methods inherited from class org.modeshape.jcr.spi.federation.Connector

      `checkFieldNotNull, extraPropertiesFor, extraPropertiesStore, factories, getBinaryValue, getCacheTtlSeconds, getChildReference, getContext, getDocumentById, getDocumentId, getDocumentPathsById, getEnvironment, getLogger, getMimeTypeDetector, getRepositoryName, getSourceName, getTransactionManager, hasDocument, initialize, isQueryable, log, nameFrom, nameFrom, nameFrom, newChildReference, newConnectorChangedSet, newDocument, newPageDocument, pathFactory, pathFrom, pathFrom, propertyFactory, readDocument, setExtraPropertiesStore, shutdown, translator, writeDocument`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ReadOnlyConnector

          public ReadOnlyConnector()

  - ### Method Detail

    - #### removeDocument

          public final boolean removeDocument(String id)

      Description copied from class: `Connector`
      Removes the document with the given id.
      Specified by:
        `removeDocument` in class `Connector`
      Parameters:
        `id` - a `non-null` string.
      Returns:
        true if the document was removed, or false if there was no document with the given id

    - #### storeDocument

          public final void storeDocument(Document document)

      Description copied from class: `Connector`
      Stores the given document.
      Specified by:
        `storeDocument` in class `Connector`
      Parameters:
        `document` - a `non-null` `Document` instance.

    - #### updateDocument

          public final void updateDocument(DocumentChanges documentChanges)

      Description copied from class: `Connector`
      Updates a document using the provided changes.
      Specified by:
        `updateDocument` in class `Connector`
      Parameters:
        `documentChanges` - a `non-null` `DocumentChanges` object which contains granular information about all the changes.

    - #### newDocumentId

          public String newDocumentId(String parentId,
                             Name newDocumentName,
                             Name newDocumentPrimaryType)

      Description copied from class: `Connector`
      Generates an identifier which will be assigned when a new document (aka. child) is created under an existing document (aka.parent). This method should be implemented only by connectors which support writing.
      Specified by:
        `newDocumentId` in class `Connector`
      Parameters:
        `parentId` - a `non-null` `String` which represents the identifier of the parent under which the new document will be created.
        `newDocumentName` - a `non-null` `Name` which represents the name that will be given to the child document
        `newDocumentPrimaryType` - a `non-null` `Name` which represents the child document's primary type.
      Returns:
        either a `non-null` `String` which will be assigned as the new identifier, or `null` which means that no "special" id format is required. In this last case, the repository will auto-generate a random id.

    - #### isReadonly

          public boolean isReadonly()

      Description copied from class: `Connector`
      Indicates if the connector instance has been configured in read-only mode.
      Specified by:
        `isReadonly` in class `Connector`
      Returns:
        `true` if the connector has been configured in read-only mode, false otherwise.

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