BootstrapCreator.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: BootstrapCreator.java,v 1.14 2009/08/03 23:32:54 veiming Exp $
*
* Portions Copyrighted 2011-2015 ForgeRock AS.
*/
/**
* This class is responsible for creating bootstrap file based on the
* information in <code>serverconfig.xml</code>.
*/
public class BootstrapCreator {
private static boolean isUnix =
"@DS_PROTO@://@DS_HOST@/@INSTANCE_NAME@" +
"?user=@DSAMEUSER_NAME@&pwd=@DSAMEUSER_PWD@" +
"&dsbasedn=@BASE_DN@" +
"&dsmgr=@BIND_DN@" +
"&dspwd=@BIND_PWD@" +
"&ver=1.0";
private BootstrapCreator() {
}
public static BootstrapCreator getInstance() {
return instance;
}
public static void updateBootstrap()
throws ConfigurationException {
try {
} catch (XMLException e) {
throw new ConfigurationException(e.getMessage());
} catch (SMSException e) {
throw new ConfigurationException(e.getMessage());
} catch (SSOException e) {
throw new ConfigurationException(e.getMessage());
}
}
public static void createBootstrap()
throws ConfigurationException {
try {
} catch (LDAPServiceException e) {
throw new ConfigurationException(e.getMessage());
}
}
throws ConfigurationException {
try {
// make bootstrap writable if it is not
f.setWritable(true);
}
// not exist means that the product is first configured.
// set permission to 400
if (!exist) {
if (isUnix) {
}
} else {
// make it not writable if it was previously not writable.
if (!writable) {
f.setWritable(false);
}
}
} catch (InterruptedException e) {
throw new ConfigurationException(e.getMessage());
} catch (IOException e) {
throw new ConfigurationException(e.getMessage());
}
}
/**
* Returns the bootstrap url.
*
* @param dsCfg instance of the <code>IDSConfigMgr</code> containing
* the connection information to the config store.
* @exception ConfigurationException if there is an error and cannot
* obtain the bootstrap URL. This may be due to connection error.
*/
throws ConfigurationException {
try {
sg = defaultGroup;
} else {
}
"ldap" : "ldaps";
"@DS_PROTO@", proto);
"UTF-8"));
}
} catch (IOException e) {
throw new ConfigurationException(e.getMessage());
}
return bootstrapStr;
}
}