Package org.jboss.as.controller.registry
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Resource.Factory
static class
Resource.NoSuchResourceException
ANoSuchElementException
variant that can be thrown byrequireChild(PathElement)
andnavigate(PathAddress)
implementations to indicate a client error when invoking a management operation.static interface
Resource.ResourceEntry
static class
Resource.Tools
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Resource
clone()
Creates and returns a copy of this resource.Resource
getChild(PathElement element)
Get a single child of this resource with the given address.Set<Resource.ResourceEntry>
getChildren(String childType)
Get the children for a given type.Set<String>
getChildrenNames(String childType)
Get the children names for a given type.Set<String>
getChildTypes()
Get a list of registered child types for this resource.org.jboss.dmr.ModelNode
getModel()
Get the local model.Set<String>
getOrderedChildTypes()
Return the child types for which the order matters.boolean
hasChild(PathElement element)
Determine whether this resource has a child with the given address.boolean
hasChildren(String childType)
Determine whether this resource has any child of a given type.boolean
isModelDefined()
Determine whether the model of this resource is defined.boolean
isProxy()
Gets whether operations against this resource will be proxied to a remote process.boolean
isRuntime()
Gets whether this resource only exists in the runtime and has no representation in the persistent configuration model.Resource
navigate(PathAddress address)
Navigate the resource tree.void
registerChild(PathElement address, int index, Resource resource)
Register a child resourcevoid
registerChild(PathElement address, Resource resource)
Register a child resource.Resource
removeChild(PathElement address)
Remove a child resource.Resource
requireChild(PathElement element)
Get a single child of this resource with the given address.default Resource
shallowCopy()
Creates a shallow copy of this resource, which will only have placeholder resources for immediate children.void
writeModel(org.jboss.dmr.ModelNode newModel)
Write the model.
-
-
-
Method Detail
-
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 thePathElement
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 returnnull
.- 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
-
navigate
Resource navigate(PathAddress address)
Navigate the resource tree.- Parameters:
address
- the address- Returns:
- the resource
- Throws:
Resource.NoSuchResourceException
- if any resource in the path does not exist
-
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 addressresource
- the resource- Throws:
IllegalStateException
- for a duplicate entry
-
registerChild
void registerChild(PathElement address, int index, Resource resource)
Register a child resource- Parameters:
address
- the addressindex
- the index at which to add the resource. Existing children with this index and higher will be shifted one uoresource
- 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 returnnull
-
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 emptymodel
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
-
-