Class ManagedObjectPath<C extends ConfigurationClient,S extends Configuration>
- Type Parameters:
C
- The type of client managed object configuration that this path references.S
- The type of server managed object configuration that this path references.
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:
- the root element is represented by the string
/
- subordinate elements are arranged in big-endian order separated by a
forward slash
/
character - an element representing a managed object associated with a one-to-one
(singleton) or one-to-zero-or-one (optional) relation has the form
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) - an element representing a managed object associated with a one-to-many
(instantiable) relation has the form
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 - an element representing a managed object associated with a one-to-many
(set) relation has the form
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
-
Method Summary
Modifier and TypeMethodDescription<C1 extends C,
S1 extends S>
ManagedObjectPath<C1,S1> 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>
ManagedObjectPath<M,N> 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>
ManagedObjectPath<M,N> 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>
ManagedObjectPath<M,N> 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>
ManagedObjectPath<M,N> 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>
ManagedObjectPath<M,N> 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>
ManagedObjectPath<M,N> 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>
ManagedObjectPath<? extends M,? extends N> 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 byname
.<M extends ConfigurationClient,
N extends Configuration>
ManagedObjectPath<M,N> 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>
ManagedObjectPath<M,N> 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> Creates a new managed object path representing the configuration root.boolean
Get the definition of the managed object referred to by this path.getName()
Get the name of the managed object referred to by this path if applicable.RelationDefinition<? super C,
? super S> 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.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.toDn()
Creates a DN representation of this managed object path.toString()
void
toString
(StringBuilder builder) Appends a string representation of this managed object path to the provided string builder.static ManagedObjectPath<?,
?> Returns a managed object path holding the value of the specified string.
-
Method Details
-
emptyPath
Creates a new managed object path representing the configuration root.- Returns:
- Returns a new managed object path representing the configuration root.
-
valueOf
Returns a managed object path holding the value of the specified string.- Parameters:
s
- The string to be parsed.- Returns:
- Returns a managed object path holding the value of the specified string.
- Throws:
IllegalArgumentException
- If the string could not be parsed.
-
asSubType
public <C1 extends C,S1 extends S> ManagedObjectPath<C1,S1> 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.- Type Parameters:
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.- Parameters:
nd
- The new managed object definition.- Returns:
- Returns 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.
-
child
public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<M,N> 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.- Type Parameters:
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.- Parameters:
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.- Returns:
- Returns a new child managed object path beneath the provided parent path.
- Throws:
IllegalArgumentException
- If the provided name is empty or blank.
-
child
public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<M,N> 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.- Type Parameters:
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.- Parameters:
r
- The instantiable relation referencing the child.name
- The relative name of the child managed object.- Returns:
- Returns a new child managed object path beneath the provided parent path.
- Throws:
IllegalArgumentException
- If the provided name is empty or blank.
-
child
public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<M,N> 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.- Type Parameters:
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.- Parameters:
r
- The optional relation referencing the child.d
- The managed object definition associated with the child (must be a sub-type of the relation).- Returns:
- Returns a new child managed object path beneath the provided parent path.
-
child
public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<M,N> 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.- Type Parameters:
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.- Parameters:
r
- The optional relation referencing the child.- Returns:
- Returns a new child managed object path beneath the provided parent path.
-
child
public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<M,N> 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.- Type Parameters:
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.- Parameters:
r
- The singleton relation referencing the child.d
- The managed object definition associated with the child (must be a sub-type of the relation).- Returns:
- Returns a new child managed object path beneath the provided parent path.
-
child
public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<M,N> 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.- Type Parameters:
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.- Parameters:
r
- The singleton relation referencing the child.- Returns:
- Returns a new child managed object path beneath the provided parent path.
-
child
public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<M,N> 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.- Type Parameters:
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.- Parameters:
r
- The set relation referencing the child.d
- The managed object definition associated with the child (must be a sub-type of the relation).- Returns:
- Returns a new child managed object path beneath the provided parent path.
- Throws:
IllegalArgumentException
- If the provided name is empty or blank.
-
child
public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<? extends M,? extends N> 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 byname
.- Type Parameters:
M
- The type of client managed object configuration that the path references.N
- The type of server managed object configuration that the path references.- Parameters:
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).- Returns:
- Returns a new child managed object path beneath the provided parent path.
- Throws:
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.
-
child
public <M extends ConfigurationClient,N extends Configuration> ManagedObjectPath<M,N> 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.- Type Parameters:
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.- Parameters:
r
- The set relation referencing the child.- Returns:
- Returns a new child managed object path beneath the provided parent path.
- Throws:
IllegalArgumentException
- If the provided name is empty or blank.
-
equals
-
getManagedObjectDefinition
Get the definition of the managed object referred to by this path.When the path is empty, the
RootCfgDefn
is returned.- Returns:
- Returns the definition of the managed object referred to by this
path, or the
RootCfgDefn
if the path is empty.
-
getName
Get the name of the managed object referred to by this path if applicable.If there path does not refer to an instantiable managed object
null
is returned.- Returns:
- Returns the name of the managed object referred to by this path,
or
null
if the managed object does not have a name.
-
getRelationDefinition
Get the relation definition of the managed object referred to by this path.When the path is empty, the
null
is returned.- Returns:
- Returns the relation definition of the managed object referred to
by this path, or the
null
if the path is empty.
-
hashCode
public int hashCode() -
isEmpty
public boolean isEmpty()Determine whether this path contains any path elements.- Returns:
- Returns
true
if this path does not contain any path elements.
-
matches
Determines whether this managed object path references the same location as the provided managed object path.This method differs from
equals
in that it ignores sub-type definitions.- Parameters:
other
- The managed object path to be compared.- Returns:
- Returns
true
if this managed object path references the same location as the provided managed object path.
-
parent
Creates a new parent managed object path representing the immediate parent of this path. This method is a short-hand forparent(1)
.- Returns:
- Returns a new parent managed object path representing the immediate parent of this path.
- Throws:
IllegalArgumentException
- If this path does not have a parent (i.e. it is the empty path).
-
parent
Creates a new parent managed object path the specified number of path elements above this path.- Parameters:
offset
- The number of path elements (0 - means no offset, 1 means the parent, and 2 means the grand-parent).- Returns:
- Returns a new parent managed object path the specified number of path elements above this path.
- Throws:
IllegalArgumentException
- If the offset is less than 0, or greater than the number of path elements in this path.
-
rename
Creates a new managed object path which has the same structure as this path except that the final path element is renamed. The final path element must comprise of an instantiable relation.- Parameters:
newName
- The new name of the final path element.- Returns:
- Returns a new managed object path which has the same structure as this path except that the final path element is renamed.
- Throws:
IllegalStateException
- If this managed object path is empty or if its final path element does not comprise of an instantiable relation.
-
serialize
Serialize this managed object path using the provided serialization strategy.The path elements will be passed to the serializer in big-endian order: starting from the root element and proceeding down to the leaf.
- Parameters:
serializer
- The managed object path serialization strategy.
-
size
public int size()Get the number of path elements in this managed object path.- Returns:
- Returns the number of path elements (0 - means no offset, 1 means the parent, and 2 means the grand-parent).
-
toDn
Creates a DN representation of this managed object path.- Returns:
- Returns a DN representation of this managed object path.
-
toString
-
toString
Appends a string representation of this managed object path to the provided string builder.- Parameters:
builder
- Append the string representation to this builder.- See Also:
-