Package org.jboss.as.controller
Class PathAddress
- java.lang.Object
-
- org.jboss.as.controller.PathAddress
-
- All Implemented Interfaces:
Iterable<PathElement>
public class PathAddress extends Object implements Iterable<PathElement>
A path address for an operation.- Author:
- Brian Stansberry, David M. Lloyd
-
-
Field Summary
Fields Modifier and Type Field Description static PathAddressEMPTY_ADDRESSAn empty address.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description PathAddressappend(String key)PathAddressappend(String key, String value)PathAddressappend(List<PathElement> additionalElements)Create a new path address by appending more elements to the end of this address.PathAddressappend(PathAddress address)Create a new path address by appending more elements to the end of this address.PathAddressappend(PathElement... additionalElements)Create a new path address by appending more elements to the end of this address.booleanequals(Object other)Determine whether this object is equal to another.booleanequals(PathAddress other)Determine whether this object is equal to another.PathElementgetElement(int index)Gets the element at the given index.PathElementgetLastElement()Gets the last element in the address.PathAddressgetParent()inthashCode()booleanisMultiTarget()Check whether this address applies to multiple targets.ListIterator<PathElement>iterator()Iterate over the elements of this path address.booleanmatches(PathAddress address)Check if this path matches the address path.org.jboss.dmr.ModelNodenavigate(org.jboss.dmr.ModelNode model, boolean create)Deprecated.manipulating a deep DMR node tree via PathAddress is no longer how the management layer works internally, so this method has become legacy cruft.static PathAddressparseCLIStyleAddress(String address)static PathAddresspathAddress(String key, String value)static PathAddresspathAddress(List<PathElement> elements)static PathAddresspathAddress(PathAddress parent, PathElement... elements)static PathAddresspathAddress(PathElement... elements)static PathAddresspathAddress(org.jboss.dmr.ModelNode node)Creates a PathAddress from the given ModelNode address.org.jboss.dmr.ModelNoderemove(org.jboss.dmr.ModelNode model)Deprecated.manipulating a deep DMR node tree via PathAddress is no longer how the management layer works internally, so this method has become legacy cruft.intsize()Get the size of this path, in elements.PathAddresssubAddress(int start)Get a portion of this address using segments starting atstart(inclusive).PathAddresssubAddress(int start, int end)Get a portion of this address using segments betweenstart(inclusive) andend(exclusive).StringtoCLIStyleString()StringtoHttpStyleString()org.jboss.dmr.ModelNodetoModelNode()Convert this path address to its model node representation.StringtoPathStyleString()StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
EMPTY_ADDRESS
public static final PathAddress EMPTY_ADDRESS
An empty address.
-
-
Method Detail
-
pathAddress
public static PathAddress pathAddress(org.jboss.dmr.ModelNode node)
Creates a PathAddress from the given ModelNode address. The given node is expected to be an address node.- Parameters:
node- the node (cannot benull)- Returns:
- the update identifier
-
pathAddress
public static PathAddress pathAddress(List<PathElement> elements)
-
pathAddress
public static PathAddress pathAddress(PathElement... elements)
-
pathAddress
public static PathAddress pathAddress(String key, String value)
-
pathAddress
public static PathAddress pathAddress(PathAddress parent, PathElement... elements)
-
parseCLIStyleAddress
public static PathAddress parseCLIStyleAddress(String address) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
getElement
public PathElement getElement(int index)
Gets the element at the given index.- Parameters:
index- the index- Returns:
- the element
- Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= size())
-
getLastElement
public PathElement getLastElement()
Gets the last element in the address.- Returns:
- the element, or
nullifsize()is zero.
-
subAddress
public PathAddress subAddress(int start)
Get a portion of this address using segments starting atstart(inclusive).- Parameters:
start- the start index- Returns:
- the partial address
-
subAddress
public PathAddress subAddress(int start, int end)
Get a portion of this address using segments betweenstart(inclusive) andend(exclusive).- Parameters:
start- the start indexend- the end index- Returns:
- the partial address
-
append
public PathAddress append(List<PathElement> additionalElements)
Create a new path address by appending more elements to the end of this address.- Parameters:
additionalElements- the elements to append- Returns:
- the new path address
-
append
public PathAddress append(PathElement... additionalElements)
Create a new path address by appending more elements to the end of this address.- Parameters:
additionalElements- the elements to append- Returns:
- the new path address
-
append
public PathAddress append(PathAddress address)
Create a new path address by appending more elements to the end of this address.- Parameters:
address- the address to append- Returns:
- the new path address
-
append
public PathAddress append(String key, String value)
-
append
public PathAddress append(String key)
-
navigate
@Deprecated public org.jboss.dmr.ModelNode navigate(org.jboss.dmr.ModelNode model, boolean create) throws NoSuchElementException
Deprecated.manipulating a deep DMR node tree via PathAddress is no longer how the management layer works internally, so this method has become legacy cruft. Management operation handlers should obtain aResourcefrom theOperationContextand use theResourceAPI to access child resourcesNavigate to this address in the given model node.- Parameters:
model- the model nodecreate-trueto create the last part of the node if it does not exist- Returns:
- the submodel
- Throws:
NoSuchElementException- if the model contains no such element
-
remove
@Deprecated public org.jboss.dmr.ModelNode remove(org.jboss.dmr.ModelNode model) throws NoSuchElementException
Deprecated.manipulating a deep DMR node tree via PathAddress is no longer how the management layer works internally, so this method has become legacy cruft. Management operation handlers would useOperationContext.removeResource(PathAddress)to remove resources.Navigate to, and remove, this address in the given model node.- Parameters:
model- the model node- Returns:
- the submodel
- Throws:
NoSuchElementException- if the model contains no such element
-
toModelNode
public org.jboss.dmr.ModelNode toModelNode()
Convert this path address to its model node representation.- Returns:
- the model node list of properties
-
isMultiTarget
public boolean isMultiTarget()
Check whether this address applies to multiple targets.- Returns:
trueif the address can apply to multiple targets,falseotherwise
-
size
public int size()
Get the size of this path, in elements.- Returns:
- the size
-
iterator
public ListIterator<PathElement> iterator()
Iterate over the elements of this path address.- Specified by:
iteratorin interfaceIterable<PathElement>- Returns:
- the iterator
-
getParent
public PathAddress getParent()
-
equals
public boolean equals(Object other)
Determine whether this object is equal to another.
-
equals
public boolean equals(PathAddress other)
Determine whether this object is equal to another.- Parameters:
other- the other object- Returns:
trueif they are equal,falseotherwise
-
toCLIStyleString
public String toCLIStyleString()
-
toHttpStyleString
public String toHttpStyleString()
-
toPathStyleString
public String toPathStyleString()
-
matches
public boolean matches(PathAddress address)
Check if this path matches the address path. An address matches this address if its path elements match or are valid multi targets for this path elements. Addresses that are equal are matching.- Parameters:
address- The path to check against this path. If null, this method returns false.- Returns:
- true if the provided path matches, false otherwise.
-
-