org.modeshape.jcr.api

## Interface Session

- All Superinterfaces:
    Session

      public interface Session
      extends Session

  A specialization of the standard JCR `Session` interface that returns the ModeShape-specific extension interfaces from `getWorkspace()`, `getRepository()`, and `getValueFactory()`.

- - ### Field Summary

    - ### Fields inherited from interface javax.jcr.Session

      `ACTION_ADD_NODE, ACTION_READ, ACTION_REMOVE, ACTION_SET_PROPERTY`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `decode(String localName)` Evaluate a local name and replace any characters that were previously `encoded`.
    `String` | `encode(String localName)` Evaluate a local name and replace any characters that are not allowed within the local names of nodes and properties.
    `Repository` | `getRepository()`
    `ValueFactory` | `getValueFactory()`
    `Workspace` | `getWorkspace()`
    `boolean` | `sequence(String sequencerName, Property inputProperty, Node outputNode)` Sequence the specified property using the named sequencer, and place the generated output at the specified location using this session.

    - ### Methods inherited from interface javax.jcr.Session

      `addLockToken, checkPermission, exportDocumentView, exportDocumentView, exportSystemView, exportSystemView, getAccessControlManager, getAttribute, getAttributeNames, getImportContentHandler, getItem, getLockTokens, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, getNode, getNodeByIdentifier, getNodeByUUID, getProperty, getRetentionManager, getRootNode, getUserID, hasCapability, hasPendingChanges, hasPermission, impersonate, importXML, isLive, itemExists, logout, move, nodeExists, propertyExists, refresh, removeItem, removeLockToken, save, setNamespacePrefix`

- - ### Method Detail

    - #### getWorkspace

          Workspace getWorkspace()

      Specified by:
        `getWorkspace` in interface `Session`

    - #### getRepository

          Repository getRepository()

      Specified by:
        `getRepository` in interface `Session`

    - #### getValueFactory

          ValueFactory getValueFactory()
                                       throws RepositoryException

      Specified by:
        `getValueFactory` in interface `Session`
      Throws:
        `RepositoryException`

    - #### sequence

          boolean sequence(String sequencerName,
                         Property inputProperty,
                         Node outputNode)
                           throws RepositoryException

      Sequence the specified property using the named sequencer, and place the generated output at the specified location using this session. The output nodes will be transient within the current session, so this session will need to be saved to persist the output.

      It is suggested that this method be used on inputs that the sequencer is not configured to process automatically, otherwise ModeShape will also sequence the same property. If your application is to only manually sequence, simply configure each sequencer without a path expression or with a path expression that will never apply to the manually-sequenced nodes.

      Parameters:
        `sequencerName` - the name of the configured sequencer that should be executed
        `inputProperty` - the property that was changed and that should be used as the input; never null
        `outputNode` - the node that represents the output for the derived information; never null, and will either be `new` if the output is being placed outside of the selected node, or will not be new when the output is to be placed on the selected input node
      Returns:
        true if the sequencer did generate output; false if the sequencer could not process the specified content or if `sequencerName` is null or does not match a configured sequencer
      Throws:
        `RepositoryException` - if there was a problem with the sequencer

    - #### encode

          String encode(String localName)

      Evaluate a local name and replace any characters that are not allowed within the local names of nodes and properties. Such characters include '/', ':', '[', ']', '*', and '|', since these are all important to the rules for qualified names and paths. When such characters are to be used within a local name, the application must escape them using this method before the local name is used.
      Parameters:
        `localName` - the local name to be encoded; can be `null` or empty
      Returns:
        the supplied local name if it contains no illegal characters, or the encoded form of the supplied local name with all illegal characters replaced, or `null` if the input was `null`
      See Also:
        `Session.move(String, String)`, `Node.addNode(String)`, `Node.addNode(String, String)`

    - #### decode

          String decode(String localName)

      Evaluate a local name and replace any characters that were previously `encoded`.
      Parameters:
        `localName` - the local name to be decoded; can be `null` or empty
      Returns:
        the supplied local name if it contains no encoded characters, or the decoded form of the supplied local name with all encoded characters replaced, or `null` if the input was `null`
      See Also:
        `encode(String)`

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