From 97f7d39cf58d120fc84c99c20bdb36ae35476ab3 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 04 Apr 2016 13:38:35 +0000
Subject: [PATCH] Use HostPort throughout
---
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/AuthenticationData.java | 37 ++++++++++++++++++++-----------------
1 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/AuthenticationData.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/AuthenticationData.java
index c37864c..2914aad 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/AuthenticationData.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/AuthenticationData.java
@@ -12,27 +12,23 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2016 ForgeRock AS.
*/
-
package org.opends.quicksetup.installer;
+import org.opends.server.types.HostPort;
+
/**
* This class is used to provide a data model for the different parameters used
* to connect to a server that we want to replicate contents with.
*
* @see DataReplicationOptions
- *
*/
public class AuthenticationData
{
- private String hostName;
-
- private int port;
-
+ private HostPort hostPort = new HostPort(null, 0);
private String dn;
-
private String pwd;
-
private boolean useSecureConnection;
/**
@@ -41,7 +37,7 @@
*/
public void setPort(int port)
{
- this.port = port;
+ hostPort = new HostPort(hostPort.getHost(), port);
}
/**
@@ -50,7 +46,7 @@
*/
public int getPort()
{
- return port;
+ return getHostPort().getPort();
}
/**
@@ -90,21 +86,21 @@
}
/**
- * Returns the host name to connect to.
- * @return the host name to connect to.
+ * Returns the host name and port to connect to.
+ * @return the host name and port to connect to.
*/
- public String getHostName()
+ public HostPort getHostPort()
{
- return hostName;
+ return hostPort;
}
/**
* Sets the host name to connect to.
- * @param hostName the host name to connect to.
+ * @param hostport the host name and port to connect to.
*/
- public void setHostName(String hostName)
+ public void setHostPort(HostPort hostport)
{
- this.hostName = hostName;
+ this.hostPort = hostport;
}
/**
@@ -125,4 +121,11 @@
{
this.useSecureConnection = useSecureConnection;
}
+
+ String getLdapUrl()
+ {
+ HostPort hostPort = getHostPort();
+ String scheme = useSecureConnection() ? "ldaps" : "ldap";
+ return scheme + "://" + hostPort.getHost() + ":" + hostPort.getPort();
+ }
}
--
Gitblit v1.10.0