org.modeshape.jboss.subsystem

## Class AddressContext

- java.lang.Object
- - org.modeshape.jboss.subsystem.AddressContext

-     public class AddressContext
      extends Object

  A wrapper class over a `ModelNode` representing an active operation. Operations include adding/removing resources which are part of the ModeShape subsystem. This class can be used to retrieve ModeShape & server related information based on the `PathAddress` of the address of the current operation. The structure of the `PathAddress` varies based on the server mode (STANDALONE/DOMAIN)

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static AddressContext` | `forOperation(org.jboss.dmr.ModelNode operation)` Creates a new context instance which wraps the given operation.
    `String` | `lastPathElementValue()` Returns the value of the last path element from the address of wrapped operation.
    `String` | `repositoryName()` Returns the name of the ModeShape repository, based on the address of the wrapped operation.

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

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

- - ### Method Detail

    - #### repositoryName

          public String repositoryName()

      Returns the name of the ModeShape repository, based on the address of the wrapped operation.
      Returns:
        a `String` which is either the name of the repository or `null` if there is no repository segement in the address for the current operation.

    - #### lastPathElementValue

          public String lastPathElementValue()

      Returns the value of the last path element from the address of wrapped operation.
      Returns:
        the value of the last path element, never `null`

    - #### forOperation

          public static AddressContext forOperation(org.jboss.dmr.ModelNode operation)

      Creates a new context instance which wraps the given operation. The operation is expected to have a `ModelDescriptionConstants.OP_ADDR` attribute.
      Parameters:
        `operation` - a `ModelNode` instance, never null
      Returns:
        an `instance`, never `null`

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