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 classResource.Factorystatic classResource.NoSuchResourceExceptionANoSuchElementExceptionvariant that can be thrown byrequireChild(PathElement)andnavigate(PathAddress)implementations to indicate a client error when invoking a management operation.static interfaceResource.ResourceEntrystatic classResource.Tools
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Resourceclone()Creates and returns a copy of this resource.ResourcegetChild(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.ModelNodegetModel()Get the local model.Set<String>getOrderedChildTypes()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.booleanisModelDefined()Determine whether the model of this resource is defined.booleanisProxy()Gets whether operations against this resource will be proxied to a remote process.booleanisRuntime()Gets whether this resource only exists in the runtime and has no representation in the persistent configuration model.Resourcenavigate(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.ResourceremoveChild(PathElement address)Remove a child resource.ResourcerequireChild(PathElement element)Get a single child of this resource with the given address.default ResourceshallowCopy()Creates 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 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:
trueif the local model is defined
-
hasChild
boolean hasChild(PathElement element)
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
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,
nullif 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:
trueif 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:
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
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 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
-
-