BootstrapData.java revision cfba646ddfa9d543f0c40e4c7788c65b4a24b34d
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2008 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: BootstrapData.java,v 1.16 2009/05/05 21:24:47 veiming Exp $
*
* Portions Copyrighted 2010-2015 ForgeRock AS.
*/
public class BootstrapData {
private String dsuserbasedn;
private String dsameUserPwd;
private String instanceName;
/**
* Creates an instance of this class
*
* @param basedir Base Directory of the installation.
* @throws IOException if cannot read the file.
*/
throws IOException {
}
throws UnsupportedEncodingException {
}
/**
* Returns list of bootstrap data.
*
* @return list of bootstrap data.
*/
return data;
}
public String getInstanceName() {
return instanceName;
}
public String getUserBaseDN() {
return dsuserbasedn;
}
return dsbasedn;
}
public String getDsameUserPassword() {
return dsameUserPwd;
}
/**
* Gets attributes in a given row as a <code>Map</code>.
* @param idx row (starting with 0)
* @return Map of attributes
*/
{
// need to do this because URL class does not understand ldap://
dsprotocol = "ldaps";
} else
dsprotocol = "ldap";
}
return mapQuery;
}
if (startDS) {
if (AMSetupServlet.isOpenDJUpgraded()) {
try {
} catch (UpgradeException ue) {
}
}
} else {
}
}
private Properties getBootstrapProperties() {
try {
);
dsbasedn);
// Replace DSAMEUSER
}
} catch (IOException e) {
//ignore because bootstrapConfig.properties is always bundled.
e.printStackTrace();
}
return prop;
}
if (odsDirFile.exists()) {
if (!EmbeddedOpenDS.isStarted()) {
try {
//ignore, it maybe started.
}
}
}
}
throws LDAPServiceException {
try {
} finally {
try {
} catch (IOException e) {
//ignore
}
}
}
}
/**
* Returns server configuration XML. It is generated from bootstrap file.
* @param bCrypt <code>true</code> to decrypt the password with default key
* and encrypt it with the key defined in
* <code>AMConfig.properties</code>.
* @return server configuration XML.
* @throws UnsupportedEncodingException if XML encoding is incorrect.
* @throws MalformedURLException if bootstrap URL is not well formed.
*/
boolean first = true;
int counter = 1;
boolean ldaps = false;
// need to do this because URL class does not understand ldap://
ldaps = true;
} else
}
if (first) {
first = false;
}
}
serverBuff.toString());
}
private String getServerConfigXMLUserBlob(
boolean ldaps,
boolean bCrypt
) throws UnsupportedEncodingException {
if (bCrypt) {
}
// Check if dsameuser is set
} else {
// Obtain user base dn from dsamaeUser
}
}
if (ldaps) {
} else {
}
return template;
}
throws UnsupportedEncodingException {
while (st.hasMoreTokens()) {
}
return map;
}
private String getServerConfigXMLServerBlob(
boolean ldaps,
boolean bCrypt
) throws UnsupportedEncodingException {
if (bCrypt) {
}
if (ldaps) {
} else {
}
dsport);
return template;
}
throws UnsupportedEncodingException {
if (ldaps) {
} else {
}
dshost);
dsport);
return template;
}
boolean legacy
) throws IOException {
}
}
throws UnsupportedEncodingException
{
if (legacy) {
}
// remove ://
return url;
}
throws IOException
{
try {
}
}
}
} finally {
try {
}
}
}
}
private static final String BOOTSTRAP_SERVER_START_TAG =
"<iPlanetDataAccessLayer>";
private static final String BOOTSTRAP_SERVER_END_TAG =
"</iPlanetDataAccessLayer>";
private static final String BOOTSTRAP_SERVER_CONFIG_USER =
"<ServerGroup name=\"default\" minConnPool=\"1\" maxConnPool=\"1\">" +
"<User name=\"User1\" type=\"admin\">" +
"</User>" +
"</ServerGroup>";
private static final String BOOTSTRAP_SERVER_CONFIG_LDAP_SVR =
"<ServerGroup name=\"sms\" " +
"minConnPool=\"1\" maxConnPool=\"10\">" +
"@SERVER_ENTRY@" +
"<User name=\"User2\" type=\"admin\">" +
"</User>" +
"</ServerGroup>";
private static final String BOOTSTRAP_SERVER_CONFIG_LDAP_SVR_ENTRY =
}