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
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 ClassesModifier and TypeInterfaceDescriptionstatic classstatic classANoSuchElementExceptionvariant that can be thrown byrequireChild(PathElement)andnavigate(PathAddress)implementations to indicate a client error when invoking a management operation.static interfacestatic class -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates and returns a copy of this resource.getChild(PathElement element) Get a single child of this resource with the given address.getChildren(String childType) Get the children for a given type.getChildrenNames(String childType) Get the children names for a given type.Get a list of registered child types for this resource.org.jboss.dmr.ModelNodegetModel()Get the local model.Return the child types for which the order matters.booleanhasChild(PathElement element) Determine whether this resource has a child with the given address.booleanhasChildren(String childType) Determine whether this resource has any child of a given type.booleanDetermine whether the model of this resource is defined.booleanisProxy()Gets whether operations against this resource will be proxied to a remote process.booleanGets whether this resource only exists in the runtime and has no representation in the persistent configuration model.navigate(PathAddress address) Navigate the resource tree.voidregisterChild(PathElement address, int index, Resource resource) Register a child resourcevoidregisterChild(PathElement address, Resource resource) Register a child resource.removeChild(PathElement address) Remove a child resource.requireChild(PathElement element) Get a single child of this resource with the given address.default ResourceCreates a shallow copy of this resource, which will only have placeholder resources for immediate children.voidwriteModel(org.jboss.dmr.ModelNode newModel) Write the model.
-
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:
trueif the local model is defined
-
hasChild
Determine whether this resource has a child with the given address. In case thePathElementhas a wildcard as value, it will determine whether this resource has any resources of a given type.- Parameters:
element- the path element- Returns:
trueif there is child with the given address
-
getChild
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,
nullif there is no such child resource
-
requireChild
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
Determine whether this resource has any child of a given type.- Parameters:
childType- the child type- Returns:
trueif there is any child of the given type
-
getChildTypes
Get a list of registered child types for this resource.- Returns:
- the registered child types
-
getChildrenNames
Get the children names for a given type.- Parameters:
childType- the child type- Returns:
- the names of registered child resources
-
getChildren
Get the children for a given type.- Parameters:
childType- the child type- Returns:
- the registered children
-
registerChild
Register a child resource.- Parameters:
address- the addressresource- the resource- Throws:
IllegalStateException- for a duplicate entry
-
registerChild
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
Remove a child resource.- Parameters:
address- the address- Returns:
- the resource
-
getOrderedChildTypes
Return the child types for which the order matters.- Returns:
trueif 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:
trueif the resource has no representation in the persistent configuration model;falseotherwise
-
isProxy
boolean isProxy()Gets whether operations against this resource will be proxied to a remote process.- Returns:
trueif this resource represents a remote resource;falseotherwise
-
clone
Resource clone()Creates and returns a copy of this resource.- Returns:
- the clone. Will not return
null
-
shallowCopy
Creates a shallow copy of this resource, which will only have placeholder resources for immediate children. Those placeholder resources will return an emptymodeland 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
-