| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.server.admin.client.ldap; |
| | |
| | | import org.opends.server.admin.ManagedObjectPathSerializer; |
| | | import org.opends.server.admin.OptionalRelationDefinition; |
| | | import org.opends.server.admin.RelationDefinition; |
| | | import org.opends.server.admin.SetRelationDefinition; |
| | | import org.opends.server.admin.SingletonRelationDefinition; |
| | | |
| | | |
| | |
| | | return builder.getInstance(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new LDAP name representing the specified managed object |
| | | * path and set relation. |
| | | * |
| | | * @param path |
| | | * The managed object path. |
| | | * @param relation |
| | | * The child set relation. |
| | | * @param profile |
| | | * The LDAP profile which should be used to construct LDAP |
| | | * names. |
| | | * @return Returns a new LDAP name representing the specified |
| | | * managed object path and set relation. |
| | | */ |
| | | public static LdapName create(ManagedObjectPath<?, ?> path, |
| | | SetRelationDefinition<?, ?> relation, LDAPProfile profile) { |
| | | LDAPNameBuilder builder = new LDAPNameBuilder(profile); |
| | | path.serialize(builder); |
| | | builder.appendManagedObjectPathElement(relation); |
| | | return builder.getInstance(); |
| | | } |
| | | |
| | | // The list of RDNs in big-endian order. |
| | | private final LinkedList<Rdn> rdns; |
| | | |
| | |
| | | InstantiableRelationDefinition<? super C, ? super S> r, |
| | | AbstractManagedObjectDefinition<C, S> d, String name) { |
| | | // Add the RDN sequence representing the relation. |
| | | appendManagedObjectPathElement((RelationDefinition<?, ?>) r); |
| | | appendManagedObjectPathElement(r); |
| | | |
| | | // Now add the single RDN representing the named instance. |
| | | String type = profile.getInstantiableRelationChildRDNType(r); |
| | | String type = profile.getRelationChildRDNType(r); |
| | | try { |
| | | Rdn rdn = new Rdn(type, name.trim()); |
| | | rdns.add(rdn); |
| | |
| | | OptionalRelationDefinition<? super C, ? super S> r, |
| | | AbstractManagedObjectDefinition<C, S> d) { |
| | | // Add the RDN sequence representing the relation. |
| | | appendManagedObjectPathElement((RelationDefinition<?, ?>) r); |
| | | appendManagedObjectPathElement(r); |
| | | } |
| | | |
| | | |
| | |
| | | SingletonRelationDefinition<? super C, ? super S> r, |
| | | AbstractManagedObjectDefinition<C, S> d) { |
| | | // Add the RDN sequence representing the relation. |
| | | appendManagedObjectPathElement((RelationDefinition<?, ?>) r); |
| | | appendManagedObjectPathElement(r); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public <C extends ConfigurationClient, S extends Configuration> |
| | | void appendManagedObjectPathElement( |
| | | SetRelationDefinition<? super C, ? super S> r, |
| | | AbstractManagedObjectDefinition<C, S> d) { |
| | | // Add the RDN sequence representing the relation. |
| | | appendManagedObjectPathElement(r); |
| | | |
| | | // Now add the single RDN representing the named instance. |
| | | String type = profile.getRelationChildRDNType(r); |
| | | try { |
| | | Rdn rdn = new Rdn(type, d.getName()); |
| | | rdns.add(rdn); |
| | | } catch (InvalidNameException e1) { |
| | | // Should not happen. |
| | | throw new RuntimeException(e1); |
| | | } |
| | | } |
| | | |
| | | |