| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2015 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.admin.ads; |
| | | |
| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.admin.ads.ADSContextException.ErrorType; |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.opends.admin.ads.util.ConnectionWrapper; |
| | | import org.opends.quicksetup.Constants; |
| | | import org.opends.server.schema.SchemaConstants; |
| | | |
| | |
| | | |
| | | /** The context used to retrieve information. */ |
| | | private final InitialLdapContext dirContext; |
| | | private final ConnectionWrapper connectionWrapper; |
| | | |
| | | /** |
| | | * Constructor of the ADSContext. |
| | | * |
| | | * @param dirContext |
| | | * the DirContext that must be used to retrieve information. |
| | | * @param connectionWrapper |
| | | * provide connection either via JNDI or Ldap Connection |
| | | */ |
| | | public ADSContext(InitialLdapContext dirContext) |
| | | public ADSContext(ConnectionWrapper connectionWrapper) |
| | | { |
| | | this.dirContext = dirContext; |
| | | this.connectionWrapper = connectionWrapper; |
| | | this.dirContext = connectionWrapper.getLdapContext(); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns the connection used to retrieve information by this ADSContext. |
| | | * |
| | | * @return the connection |
| | | */ |
| | | public ConnectionWrapper getConnection() |
| | | { |
| | | return connectionWrapper; |
| | | } |
| | | |
| | | /** |
| | | * Method called to register a server in the ADS. |
| | | * |
| | | * @param serverProperties |
| | |
| | | { |
| | | ben = getDefaultBackendName(); |
| | | } |
| | | helper.createAdministrationSuffix(getDirContext(), ben); |
| | | helper.createAdministrationSuffix(connectionWrapper, ben); |
| | | } |
| | | |
| | | /** |