Interface Resource

All Superinterfaces:
Cloneable
All Known Subinterfaces:
Resource.ResourceEntry
All Known Implementing Classes:
AbstractModelResource, DelegatingResource, ExtensionResource, PlaceholderResource, PlaceholderResource.PlaceholderResourceEntry

public interface Resource extends Cloneable
An addressable resource in the management model, representing a local model and child resources.

Instances of this class are not thread-safe and need to be synchronized externally.

Author:
Emanuel Muckenhuber
  • Method Details

    • getModel

      org.jboss.dmr.ModelNode getModel()
      Get the local model.
      Returns:
      the model
    • writeModel

      void writeModel(org.jboss.dmr.ModelNode newModel)
      Write the model.
      Parameters:
      newModel - the new model
    • isModelDefined

      boolean isModelDefined()
      Determine whether the model of this resource is defined.
      Returns:
      true if the local model is defined
    • hasChild

      boolean hasChild(PathElement element)
      Determine whether this resource has a child with the given address. In case the PathElement has a wildcard as value, it will determine whether this resource has any resources of a given type.
      Parameters:
      element - the path element
      Returns:
      true if there is child with the given address
    • getChild

      Resource getChild(PathElement element)
      Get a single child of this resource with the given address. If no such child exists this will return null.
      Parameters:
      element - the path element
      Returns:
      the resource, null if there is no such child resource
    • requireChild

      Resource requireChild(PathElement element)
      Get a single child of this resource with the given address. If no such child exists a, an exception is thrown.
      Parameters:
      element - the path element
      Returns:
      the resource
      Throws:
      Resource.NoSuchResourceException - if the child does not exist
    • hasChildren

      boolean hasChildren(String childType)
      Determine whether this resource has any child of a given type.
      Parameters:
      childType - the child type
      Returns:
      true if there is any child of the given type
    • getChildTypes

      Set<String> getChildTypes()
      Get a list of registered child types for this resource.
      Returns:
      the registered child types
    • getChildrenNames

      Set<String> getChildrenNames(String childType)
      Get the children names for a given type.
      Parameters:
      childType - the child type
      Returns:
      the names of registered child resources
    • getChildren

      Set<Resource.ResourceEntry> getChildren(String childType)
      Get the children for a given type.
      Parameters:
      childType - the child type
      Returns:
      the registered children
    • registerChild

      void registerChild(PathElement address, Resource resource)
      Register a child resource.
      Parameters:
      address - the address
      resource - the resource
      Throws:
      IllegalStateException - for a duplicate entry
    • registerChild

      void registerChild(PathElement address, int index, Resource resource)
      Register a child resource
      Parameters:
      address - the address
      index - the index at which to add the resource. Existing children with this index and higher will be shifted one uo
      resource - the resource
      Throws:
      IllegalStateException - for a duplicate entry or if the resource does not support ordered children
    • removeChild

      Resource removeChild(PathElement address)
      Remove a child resource.
      Parameters:
      address - the address
      Returns:
      the resource
    • getOrderedChildTypes

      Set<String> getOrderedChildTypes()
      Return the child types for which the order matters.
      Returns:
      true if the order of the children matters. If there are no ordered children and empty set is returned. This method should never return null
    • isRuntime

      boolean isRuntime()
      Gets whether this resource only exists in the runtime and has no representation in the persistent configuration model.
      Returns:
      true if the resource has no representation in the persistent configuration model; false otherwise
    • isProxy

      boolean isProxy()
      Gets whether operations against this resource will be proxied to a remote process.
      Returns:
      true if this resource represents a remote resource; false otherwise
    • clone

      Resource clone()
      Creates and returns a copy of this resource.
      Returns:
      the clone. Will not return null
    • shallowCopy

      default Resource shallowCopy()
      Creates a shallow copy of this resource, which will only have placeholder resources for immediate children. Those placeholder resources will return an empty model and will not themselves have any children. Their presence, however, allows the caller to see what immediate children exist under the target resource.
      Returns:
      the shallow copy. Will not return null