public abstract class AbstractModelResource extends ResourceProvider.ResourceProviderRegistry implements Resource
Resource
implementation.
Concurrency note: this class is *not* thread safe
Resource.Factory, Resource.NoSuchResourceException, Resource.ResourceEntry, Resource.Tools
Modifier | Constructor and Description |
---|---|
protected |
AbstractModelResource() |
protected |
AbstractModelResource(boolean runtimeOnly) |
protected |
AbstractModelResource(boolean runtimeOnly,
Set<String> orderedChildTypes) |
protected |
AbstractModelResource(boolean runtimeOnly,
String... orderedChildTypes) |
Modifier and Type | Method and Description |
---|---|
abstract Resource |
clone() |
protected void |
cloneProviders(AbstractModelResource clone) |
Resource |
getChild(PathElement address)
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.
|
protected ResourceProvider |
getOrCreateProvider(String type) |
Set<String> |
getOrderedChildTypes()
Return the child types for which the order matters.
|
protected ResourceProvider |
getProvider(String type) |
boolean |
hasChild(PathElement address)
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 |
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 address)
Get a single child of this resource with the given address.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getModel, isModelDefined, writeModel
protected AbstractModelResource()
protected AbstractModelResource(boolean runtimeOnly)
protected AbstractModelResource(boolean runtimeOnly, String... orderedChildTypes)
public Resource getChild(PathElement address)
Resource
null
.public boolean hasChild(PathElement address)
Resource
PathElement
has
a wildcard as value, it will determine whether this resource has any resources of a given type.public Resource requireChild(PathElement address)
Resource
requireChild
in interface Resource
address
- the path elementpublic boolean hasChildren(String childType)
Resource
hasChildren
in interface Resource
childType
- the child typetrue
if there is any child of the given typepublic Resource navigate(PathAddress address)
Resource
public Set<String> getChildrenNames(String childType)
Resource
getChildrenNames
in interface Resource
childType
- the child typepublic Set<String> getChildTypes()
Resource
getChildTypes
in interface Resource
public Set<Resource.ResourceEntry> getChildren(String childType)
Resource
getChildren
in interface Resource
childType
- the child typepublic void registerChild(PathElement address, Resource resource)
Resource
registerChild
in interface Resource
address
- the addressresource
- the resourcepublic void registerChild(PathElement address, int index, Resource resource)
Resource
registerChild
in interface Resource
address
- 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)
Resource
removeChild
in interface Resource
address
- the addresspublic Set<String> getOrderedChildTypes()
Resource
getOrderedChildTypes
in interface Resource
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
protected void registerResourceProvider(String type, ResourceProvider provider)
registerResourceProvider
in class ResourceProvider.ResourceProviderRegistry
protected final ResourceProvider getProvider(String type)
protected ResourceProvider getOrCreateProvider(String type)
public abstract Resource clone()
protected void cloneProviders(AbstractModelResource clone)
Copyright © 2023 JBoss by Red Hat. All rights reserved.