public class DelegatingResource extends ResourceProvider.ResourceProviderRegistry implements Resource
Resource implementation that simply delegates to another
Resource. Intended as a convenience class to allow overriding
of standard behaviors and also as a means to support a copy-on-write/publish-on-commit
semantic for the management resource tree.| Modifier and Type | Class and Description |
|---|---|
static interface |
DelegatingResource.ResourceDelegateProvider
Provides a delegate for use by a
DelegatingResource. |
Resource.Factory, Resource.NoSuchResourceException, Resource.ResourceEntry, Resource.Tools| Constructor and Description |
|---|
DelegatingResource(DelegatingResource.ResourceDelegateProvider delegateProvider)
Creates a new DelegatingResource with a possibly changing delegate.
|
DelegatingResource(Resource delegate)
Creates a new DelegatingResource with a fixed delegate.
|
| Modifier and Type | Method and Description |
|---|---|
Resource |
clone() |
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() |
boolean |
isRuntime() |
Resource |
navigate(PathAddress address)
Navigate the resource tree.
|
void |
registerChild(PathElement address,
int index,
Resource resource)
Register a child resource
|
void |
registerChild(PathElement address,
Resource resource)
Register a child resource.
|
protected void |
registerResourceProvider(String type,
ResourceProvider provider) |
Resource |
removeChild(PathElement address)
Remove a child resource.
|
Resource |
requireChild(PathElement element)
Get a single child of this resource with the given address.
|
void |
writeModel(org.jboss.dmr.ModelNode newModel)
Write the model.
|
public DelegatingResource(Resource delegate)
delegate - the delegate. Cannot be nullpublic DelegatingResource(DelegatingResource.ResourceDelegateProvider delegateProvider)
delegateProvider - provider of the delegate. Cannot be nullpublic Resource clone()
public Resource getChild(PathElement element)
Resourcenull.public Set<Resource.ResourceEntry> getChildren(String childType)
ResourcegetChildren in interface ResourcechildType - the child typepublic Set<String> getChildrenNames(String childType)
ResourcegetChildrenNames in interface ResourcechildType - the child typepublic Set<String> getChildTypes()
ResourcegetChildTypes in interface Resourcepublic org.jboss.dmr.ModelNode getModel()
Resourcepublic boolean hasChild(PathElement element)
ResourcePathElement has
a wildcard as value, it will determine whether this resource has any resources of a given type.public boolean hasChildren(String childType)
ResourcehasChildren in interface ResourcechildType - the child typetrue if there is any child of the given typepublic boolean isModelDefined()
ResourceisModelDefined in interface Resourcetrue if the local model is definedpublic Resource navigate(PathAddress address)
Resourcepublic void registerChild(PathElement address, Resource resource)
ResourceregisterChild in interface Resourceaddress - the addressresource - the resourcepublic void registerChild(PathElement address, int index, Resource resource)
ResourceregisterChild in interface Resourceaddress - the addressindex - the index at which to add the resource. Existing children with this index and higher will be shifted one uoresource - the resourcepublic Resource removeChild(PathElement address)
ResourceremoveChild in interface Resourceaddress - the addresspublic Resource requireChild(PathElement element)
ResourcerequireChild in interface Resourceelement - the path elementpublic void writeModel(org.jboss.dmr.ModelNode newModel)
ResourcewriteModel in interface ResourcenewModel - the new modelprotected void registerResourceProvider(String type, ResourceProvider provider)
registerResourceProvider in class ResourceProvider.ResourceProviderRegistrypublic Set<String> getOrderedChildTypes()
ResourcegetOrderedChildTypes in interface Resourcetrue if the order of the children matters. If there are no ordered
children and empty set is returned. This method should never return nullCopyright © 2015 JBoss by Red Hat. All rights reserved.