Replaced uses of ConnectionUtils.getHost() and getPort() by ConnectionWrapper.getHostPort()
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns the port number used in the provided InitialLdapContext. |
| | | * @param ctx the context to analyze. |
| | | * @return the port number used in the provided InitialLdapContext. |
| | | */ |
| | | public static int getPort(InitialLdapContext ctx) |
| | | { |
| | | HostPort hp = getHostPort(ctx); |
| | | return hp != null ? hp.getPort() : -1; |
| | | } |
| | | |
| | | /** |
| | | * Returns the host port representation of the server to which this |
| | | * context is connected. |
| | | * @param ctx the context to analyze. |
| | |
| | | |
| | | import org.opends.admin.ads.ADSContext; |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.opends.admin.ads.util.ConnectionWrapper; |
| | | import org.opends.guitools.controlpanel.datamodel.CustomSearchResult; |
| | | import org.opends.guitools.controlpanel.datamodel.ServerDescriptor; |
| | | import org.opends.guitools.controlpanel.event.BrowserEvent; |
| | |
| | | import org.opends.server.types.HostPort; |
| | | import org.opends.server.types.LDAPURL; |
| | | |
| | | import static org.opends.admin.ads.util.ConnectionUtils.getPort; |
| | | import static org.opends.admin.ads.util.ConnectionUtils.isSSL; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | | /** |
| | |
| | | private int displayFlags; |
| | | private String displayAttribute; |
| | | private final boolean showAttributeName; |
| | | private ConnectionWrapper connConfig; |
| | | private InitialLdapContext ctxConfiguration; |
| | | private InitialLdapContext ctxUserData; |
| | | private boolean followReferrals; |
| | |
| | | */ |
| | | public void setConnections( |
| | | ServerDescriptor server, |
| | | InitialLdapContext ctxConfiguration, |
| | | ConnectionWrapper ctxConfiguration, |
| | | InitialLdapContext ctxUserData) throws NamingException { |
| | | String rootNodeName; |
| | | if (ctxConfiguration != null) |
| | | { |
| | | this.ctxConfiguration = ctxConfiguration; |
| | | this.connConfig = ctxConfiguration; |
| | | this.ctxConfiguration = connConfig.getLdapContext(); |
| | | this.ctxUserData = ctxUserData; |
| | | |
| | | this.ctxConfiguration.setRequestControls(getConfigurationRequestControls()); |
| | | this.ctxUserData.setRequestControls(getRequestControls()); |
| | | rootNodeName = new HostPort(server.getHostname(), getPort(ctxConfiguration)).toString(); |
| | | rootNodeName = new HostPort(server.getHostname(), connConfig.getHostPort().getPort()).toString(); |
| | | } |
| | | else { |
| | | rootNodeName = ""; |
| | |
| | | */ |
| | | LDAPURL findUrlForLocalEntry(BasicNode node) { |
| | | if (node == rootNode) { |
| | | return LDAPConnectionPool.makeLDAPUrl(ctxConfiguration, ""); |
| | | return LDAPConnectionPool.makeLDAPUrl(connConfig.getHostPort(), "", isSSL(ctxConfiguration)); |
| | | } |
| | | final BasicNode parent = (BasicNode) node.getParent(); |
| | | if (parent != null) |
| | |
| | | final LDAPURL parentUrl = findUrlForDisplayedEntry(parent); |
| | | return LDAPConnectionPool.makeLDAPUrl(parentUrl, node.getDN()); |
| | | } |
| | | return LDAPConnectionPool.makeLDAPUrl(ctxConfiguration, node.getDN()); |
| | | return LDAPConnectionPool.makeLDAPUrl(connConfig.getHostPort(), node.getDN(), isSSL(ctxConfiguration)); |
| | | } |
| | | |
| | | |
| | |
| | | import javax.naming.ldap.InitialLdapContext; |
| | | import javax.net.ssl.KeyManager; |
| | | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.admin.ads.util.ApplicationTrustManager; |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.opends.guitools.controlpanel.event.ReferralAuthenticationListener; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.HostPort; |
| | | import org.opends.server.types.LDAPURL; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | |
| | | import com.forgerock.opendj.cli.CliConstants; |
| | | |
| | |
| | | } |
| | | |
| | | private LDAPURL makeLDAPUrl(InitialLdapContext ctx) { |
| | | return makeLDAPUrl(ctx, ""); |
| | | return makeLDAPUrl(ConnectionUtils.getHostPort(ctx), "", isSSL(ctx)); |
| | | } |
| | | |
| | | /** |
| | | * Make an url from the specified arguments. |
| | | * @param ctx the connection to the server. |
| | | * @param hostPort the host name and port of the server. |
| | | * @param dn the base DN of the URL. |
| | | * @param isSSL whether the connection uses SSL |
| | | * @return an LDAP URL from the specified arguments. |
| | | */ |
| | | public static LDAPURL makeLDAPUrl(InitialLdapContext ctx, String dn) { |
| | | HostPort hostPort = ConnectionUtils.getHostPort(ctx); |
| | | public static LDAPURL makeLDAPUrl(HostPort hostPort, String dn, boolean isSSL) |
| | | { |
| | | return new LDAPURL( |
| | | isSSL(ctx) ? "ldaps" : LDAPURL.DEFAULT_SCHEME, |
| | | isSSL ? "ldaps" : LDAPURL.DEFAULT_SCHEME, |
| | | hostPort.getHost(), |
| | | hostPort.getPort(), |
| | | dn, |
| | |
| | | InitialLdapContext ctx = connWrapper.getLdapContext(); |
| | | lastWorkingBindDN = ConnectionUtils.getBindDN(ctx); |
| | | lastWorkingBindPwd = ConnectionUtils.getBindPassword(ctx); |
| | | lastRemoteHostName = ConnectionUtils.getHostName(ctx); |
| | | lastRemoteHostName = connWrapper.getHostPort().getHost(); |
| | | lastRemoteAdministrationURL = ConnectionUtils.getLdapUrl(ctx); |
| | | } |
| | | } |
| | |
| | | |
| | | if (getConnection() != null) |
| | | { |
| | | adminPort2 = ConnectionUtils.getPort(getConnection().getLdapContext()); |
| | | adminPort2 = getConnection().getHostPort().getPort(); |
| | | } |
| | | return adminPort1 == adminPort2; |
| | | } |
| | |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.admin.ads.util.ApplicationTrustManager; |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.opends.guitools.controlpanel.browser.BrowserController; |
| | |
| | | import org.opends.quicksetup.ui.CertificateDialog; |
| | | import org.opends.quicksetup.util.UIKeyStore; |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.opends.server.types.SearchFilter; |
| | |
| | | { |
| | | try |
| | | { |
| | | ControlPanelInfo info = getInfo(); |
| | | controller.setConnections( |
| | | getInfo().getServerDescriptor(), getInfo().getConnection().getLdapContext(), |
| | | getInfo().getUserDataDirContext()); |
| | | info.getServerDescriptor(), info.getConnection(), info.getUserDataDirContext()); |
| | | applyButtonClicked(); |
| | | } |
| | | catch (NamingException ne) |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.opends.admin.ads.util.ConnectionWrapper; |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor; |
| | |
| | | args.add("--hostName"); |
| | | args.add(getInfo().getServerDescriptor().getHostname()); |
| | | args.add("--port"); |
| | | args.add(String.valueOf(ConnectionUtils.getPort(getInfo().getConnection().getLdapContext()))); |
| | | args.add(String.valueOf(getInfo().getConnection().getHostPort().getPort())); |
| | | for (DN baseDN : replicatedBaseDNs) |
| | | { |
| | | args.add("--baseDN"); |
| | |
| | | ERROR_READING_TOPOLOGY_CACHE, tce); |
| | | } |
| | | |
| | | addToSets(serverDesc1, uData.getServer1(), ctx1.getLdapContext(), twoReplServers, usedReplicationServerIds); |
| | | addToSets(serverDesc2, uData.getServer2(), ctx2.getLdapContext(), twoReplServers, usedReplicationServerIds); |
| | | addToSets(serverDesc1, uData.getServer1(), ctx1, twoReplServers, usedReplicationServerIds); |
| | | addToSets(serverDesc2, uData.getServer2(), ctx2, twoReplServers, usedReplicationServerIds); |
| | | |
| | | for (String baseDN : uData.getBaseDNs()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private void addToSets(ServerDescriptor serverDesc, EnableReplicationServerData serverData, InitialLdapContext ctx, |
| | | private void addToSets(ServerDescriptor serverDesc, EnableReplicationServerData serverData, ConnectionWrapper conn, |
| | | final Set<String> twoReplServers, final Set<Integer> usedReplicationServerIds) |
| | | { |
| | | if (serverDesc.isReplicationServer()) |
| | |
| | | } |
| | | else if (serverData.configureReplicationServer()) |
| | | { |
| | | twoReplServers.add(getReplicationServer(getHostName(ctx), serverData.getReplicationPort())); |
| | | twoReplServers.add(getReplicationServer(conn.getHostPort().getHost(), serverData.getReplicationPort())); |
| | | } |
| | | } |
| | | |
| | |
| | | Collection<ReplicaDescriptor> replicas = getReplicas(ctxDomain.getLdapContext()); |
| | | int replicationPort = getReplicationPort(ctxOther); |
| | | boolean isReplicationServerConfigured = replicationPort != -1; |
| | | String replicationServer = getReplicationServer(getHostName(ctxOther.getLdapContext()), replicationPort); |
| | | String replicationServer = getReplicationServer(ctxOther.getHostPort().getHost(), replicationPort); |
| | | for (ReplicaDescriptor replica : replicas) |
| | | { |
| | | if (!isReplicationServerConfigured) |
| | |
| | | { |
| | | int replicationPort1 = getReplicationPort(ctx1); |
| | | boolean isReplicationServer1Configured = replicationPort1 != -1; |
| | | String replicationServer1 = getReplicationServer(getHostName(ctx1.getLdapContext()), replicationPort1); |
| | | String replicationServer1 = getReplicationServer(ctx1.getHostPort().getHost(), replicationPort1); |
| | | |
| | | int replicationPort2 = getReplicationPort(ctx2); |
| | | boolean isReplicationServer2Configured = replicationPort2 != -1; |
| | | String replicationServer2 = getReplicationServer(getHostName(ctx2.getLdapContext()), replicationPort2); |
| | | String replicationServer2 = getReplicationServer(ctx2.getHostPort().getHost(), replicationPort2); |
| | | |
| | | TopologyCache cache1 = isReplicationServer1Configured ? createTopologyCache(ctx1) : null; |
| | | TopologyCache cache2 = isReplicationServer2Configured ? createTopologyCache(ctx2) : null; |