C
- The type of client managed object configuration that this path
references.S
- The type of server managed object configuration that this path
references.public final class ManagedObjectPath<C extends ConfigurationClient,S extends Configuration> extends Object
A path is made up of zero or more elements each of which represents a managed object. Managed objects are arranged hierarchically with the root configuration being the top-most managed object. Elements are ordered such that the root configuration managed object is the first element and subsequent elements representing managed objects further down the hierarchy.
A path can be encoded into a string representation using the
toString()
and toString(StringBuilder)
methods. Conversely,
this string representation can be parsed using the valueOf(String)
method.
The string representation of a managed object path is similar in principle to a UNIX file-system path and is defined as follows:
/
/
character
relation=
relation [+type=
definition
]
, where relation is the name of the relation and
definition is the name of the referenced managed object's definition
if required (usually this is implied by the relation itself)
relation=
relation
[+type=
definition]
+name=
name, where relation is the name of the relation and
definition is the name of the referenced managed object's definition
if required (usually this is implied by the relation itself), and name
is the name of the managed object instance
relation=
relation
[+type=
definition]
, where relation
is the name of the relation and definition is the name of the
referenced managed object's definition.
type
is not specified indicating that
the path identifies a connection handler called my handler which can
be any type of connection handler):
/relation=connection-handler+name=my handlerIf the identified connection handler must be an LDAP connection handler then the above path should include the
type
:
/relation=connection-handler+type=ldap-connection-handler+name=my handlerThe final example identifies the global configuration:
/relation=global-configuration
Modifier and Type | Method and Description |
---|---|
<C1 extends C,S1 extends S> |
asSubType(AbstractManagedObjectDefinition<C1,S1> nd)
Creates a new managed object path which has the same structure as this
path except that the final path element is associated with the specified
managed object definition.
|
<M extends ConfigurationClient,N extends Configuration> |
child(InstantiableRelationDefinition<? super M,? super N> r,
AbstractManagedObjectDefinition<M,N> d,
String name)
Creates a new child managed object path beneath the provided parent path
having the specified managed object definition.
|
<M extends ConfigurationClient,N extends Configuration> |
child(InstantiableRelationDefinition<M,N> r,
String name)
Creates a new child managed object path beneath the provided parent path
using the relation's child managed object definition.
|
<M extends ConfigurationClient,N extends Configuration> |
child(OptionalRelationDefinition<? super M,? super N> r,
AbstractManagedObjectDefinition<M,N> d)
Creates a new child managed object path beneath the provided parent path
having the specified managed object definition.
|
<M extends ConfigurationClient,N extends Configuration> |
child(OptionalRelationDefinition<M,N> r)
Creates a new child managed object path beneath the provided parent path
using the relation's child managed object definition.
|
<M extends ConfigurationClient,N extends Configuration> |
child(SetRelationDefinition<? super M,? super N> r,
AbstractManagedObjectDefinition<M,N> d)
Creates a new child managed object path beneath the provided parent path
having the specified managed object definition.
|
<M extends ConfigurationClient,N extends Configuration> |
child(SetRelationDefinition<M,N> r)
Creates a new child managed object path beneath the provided parent path
using the relation's child managed object definition.
|
<M extends ConfigurationClient,N extends Configuration> |
child(SetRelationDefinition<M,N> r,
String name)
Creates a new child managed object path beneath the provided parent path
having the managed object definition indicated by
name . |
<M extends ConfigurationClient,N extends Configuration> |
child(SingletonRelationDefinition<? super M,? super N> r,
AbstractManagedObjectDefinition<M,N> d)
Creates a new child managed object path beneath the provided parent path
having the specified managed object definition.
|
<M extends ConfigurationClient,N extends Configuration> |
child(SingletonRelationDefinition<M,N> r)
Creates a new child managed object path beneath the provided parent path
using the relation's child managed object definition.
|
static ManagedObjectPath<RootCfgClient,RootCfg> |
emptyPath()
Creates a new managed object path representing the configuration root.
|
boolean |
equals(Object obj) |
AbstractManagedObjectDefinition<C,S> |
getManagedObjectDefinition()
Get the definition of the managed object referred to by this path.
|
String |
getName()
Get the name of the managed object referred to by this path if
applicable.
|
RelationDefinition<? super C,? super S> |
getRelationDefinition()
Get the relation definition of the managed object referred to by this
path.
|
int |
hashCode() |
boolean |
isEmpty()
Determine whether this path contains any path elements.
|
boolean |
matches(ManagedObjectPath<?,?> other)
Determines whether this managed object path references the same location
as the provided managed object path.
|
ManagedObjectPath<?,?> |
parent()
Creates a new parent managed object path representing the immediate
parent of this path.
|
ManagedObjectPath<?,?> |
parent(int offset)
Creates a new parent managed object path the specified number of path
elements above this path.
|
ManagedObjectPath<C,S> |
rename(String newName)
Creates a new managed object path which has the same structure as this
path except that the final path element is renamed.
|
void |
serialize(ManagedObjectPathSerializer serializer)
Serialize this managed object path using the provided serialization
strategy.
|
int |
size()
Get the number of path elements in this managed object path.
|
Dn |
toDn()
Creates a DN representation of this managed object path.
|
String |
toString() |
void |
toString(StringBuilder builder)
Appends a string representation of this managed object path to the
provided string builder.
|
static ManagedObjectPath<?,?> |
valueOf(String s)
Returns a managed object path holding the value of the specified string.
|
public static ManagedObjectPath<RootCfgClient,RootCfg> emptyPath()
public static ManagedObjectPath<?,?> valueOf(String s)
s
- The string to be parsed.IllegalArgumentException
- If the string could not be parsed.public <C1 extends C,S1 extends S> ManagedObjectPath<C1,S1> asSubType(AbstractManagedObjectDefinition<C1,S1> nd)
C1
- The type of client managed object configuration that this path
will reference.S1
- The type of server managed object configuration that this path
will reference.nd
- The new managed object definition.public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<M,N> child(InstantiableRelationDefinition<? super M,? super N> r, AbstractManagedObjectDefinition<M,N> d, String name)
M
- The type of client managed object configuration that the child
path references.N
- The type of server managed object configuration that the child
path references.r
- The instantiable relation referencing the child.d
- The managed object definition associated with the child (must
be a sub-type of the relation).name
- The relative name of the child managed object.IllegalArgumentException
- If the provided name is empty or blank.public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<M,N> child(InstantiableRelationDefinition<M,N> r, String name)
M
- The type of client managed object configuration that the child
path references.N
- The type of server managed object configuration that the child
path references.r
- The instantiable relation referencing the child.name
- The relative name of the child managed object.IllegalArgumentException
- If the provided name is empty or blank.public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<M,N> child(OptionalRelationDefinition<? super M,? super N> r, AbstractManagedObjectDefinition<M,N> d)
M
- The type of client managed object configuration that the child
path references.N
- The type of server managed object configuration that the child
path references.r
- The optional relation referencing the child.d
- The managed object definition associated with the child (must
be a sub-type of the relation).public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<M,N> child(OptionalRelationDefinition<M,N> r)
M
- The type of client managed object configuration that the child
path references.N
- The type of server managed object configuration that the child
path references.r
- The optional relation referencing the child.public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<M,N> child(SingletonRelationDefinition<? super M,? super N> r, AbstractManagedObjectDefinition<M,N> d)
M
- The type of client managed object configuration that the child
path references.N
- The type of server managed object configuration that the child
path references.r
- The singleton relation referencing the child.d
- The managed object definition associated with the child (must
be a sub-type of the relation).public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<M,N> child(SingletonRelationDefinition<M,N> r)
M
- The type of client managed object configuration that the child
path references.N
- The type of server managed object configuration that the child
path references.r
- The singleton relation referencing the child.public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<M,N> child(SetRelationDefinition<? super M,? super N> r, AbstractManagedObjectDefinition<M,N> d)
M
- The type of client managed object configuration that the child
path references.N
- The type of server managed object configuration that the child
path references.r
- The set relation referencing the child.d
- The managed object definition associated with the child (must
be a sub-type of the relation).IllegalArgumentException
- If the provided name is empty or blank.public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<? extends M,? extends N> child(SetRelationDefinition<M,N> r, String name)
name
.M
- The type of client managed object configuration that the path
references.N
- The type of server managed object configuration that the path
references.r
- The set relation referencing the child.name
- The name of the managed object definition associated with the
child (must be a sub-type of the relation).IllegalArgumentException
- If the provided name is empty or blank or specifies a managed
object definition which is not a sub-type of the relation's
child definition.public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<M,N> child(SetRelationDefinition<M,N> r)
M
- The type of client managed object configuration that the child
path references.N
- The type of server managed object configuration that the child
path references.r
- The set relation referencing the child.IllegalArgumentException
- If the provided name is empty or blank.public AbstractManagedObjectDefinition<C,S> getManagedObjectDefinition()
When the path is empty, the RootCfgDefn
is returned.
RootCfgDefn
if the path is empty.public String getName()
If there path does not refer to an instantiable managed object
null
is returned.
null
if the managed object does not have a name.public RelationDefinition<? super C,? super S> getRelationDefinition()
When the path is empty, the null
is returned.
null
if the path is empty.public boolean isEmpty()
true
if this path does not contain any path
elements.public boolean matches(ManagedObjectPath<?,?> other)
This method differs from equals
in that it ignores sub-type
definitions.
other
- The managed object path to be compared.true
if this managed object path references
the same location as the provided managed object path.public ManagedObjectPath<?,?> parent()
parent(1)
.IllegalArgumentException
- If this path does not have a parent (i.e. it is the empty
path).public ManagedObjectPath<?,?> parent(int offset)
offset
- The number of path elements (0 - means no offset, 1 means the
parent, and 2 means the grand-parent).IllegalArgumentException
- If the offset is less than 0, or greater than the number of
path elements in this path.public ManagedObjectPath<C,S> rename(String newName)
newName
- The new name of the final path element.IllegalStateException
- If this managed object path is empty or if its final path
element does not comprise of an instantiable relation.public void serialize(ManagedObjectPathSerializer serializer)
The path elements will be passed to the serializer in big-endian order: starting from the root element and proceeding down to the leaf.
serializer
- The managed object path serialization strategy.public int size()
public Dn toDn()
public void toString(StringBuilder builder)
builder
- Append the string representation to this builder.toString()
Copyright 2010-2022 ForgeRock AS.