public final class AMSetupUtils extends Object
Modifier and Type | Method and Description |
---|---|
static int |
getFirstUnusedPort(String hostname,
int start,
int increment)
Returns the next unused port on a given host.
|
static String |
getRandomString()
Creates a new secure random string.
|
static Map<String,String> |
getRemoteServerInfo(String serverUrl,
String userId,
String password)
Obtains misc config data from a remote OpenAM server:
OpendDJ admin port
config basedn
replication ready flag
OpenDJ replication port or OpenDJ suggested port
|
static InputStream |
getResourceAsStream(javax.servlet.ServletContext servletContext,
String file)
Gets the file contents as an
InputStream . |
static boolean |
isPortInUse(String hostname,
int port)
Checks whether the given host and port is currently under use.
|
static String |
readFile(javax.servlet.ServletContext servletContext,
String file)
Reads the contents of the provided
File . |
public static String readFile(javax.servlet.ServletContext servletContext, String file) throws IOException
File
.
The file is located using the provided ServletContext
.
servletContext
- The ServletContext
to use to find the file.file
- The File
to read.IOException
- If the file could not be found or read.public static String getRandomString()
public static int getFirstUnusedPort(String hostname, int start, int increment)
hostname
- The name of the host, (eg localhost).start
- The starting port number to check, (eg 389).increment
- The port number increments to check, (eg 1000).public static boolean isPortInUse(String hostname, int port)
hostname
- The name of the host, (eg localhost).port
- The port number to check.true
if in use, false
if not in use.public static Map<String,String> getRemoteServerInfo(String serverUrl, String userId, String password) throws ConfigurationException
serverUrl
- URL string representing the remote OpenAM server.userId
- The admin user id on remote server, (only amadmin).password
- The admin password.Map
of config parameters.ConfigurationException
- for the following error code:
public static InputStream getResourceAsStream(javax.servlet.ServletContext servletContext, String file)
InputStream
.servletContext
- The ServletContext
to use to find the file.file
- The File
to retrieve.InputStream
of the files contents.Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.