use of com.sun.identity.setup.BootstrapData in project OpenAM by OpenRock.
the class ServiceBase method getBootfileContent.
private Map getBootfileContent(String path) throws IOException, UnsupportedEncodingException {
BootstrapData bootstrapData = new BootstrapData(path);
List list = bootstrapData.getData();
Map<String, String> mapQuery = null;
Map<String, Map> bootList = new HashMap();
String dsprotocol = "unknown";
for (Iterator<String> i = list.iterator(); i.hasNext(); ) {
String info = i.next();
if (info.startsWith(PROTOCOL_LDAPS)) {
info = "http://" + info.substring(8);
dsprotocol = "ldaps";
} else if (info.startsWith(PROTOCOL_LDAP)) {
info = "http://" + info.substring(7);
dsprotocol = "ldap";
}
URL url = new URL(info);
mapQuery = queryStringToMap(url.getQuery());
String instanceName = URLDecoder.decode(url.getPath(), "UTF-8");
if (instanceName.startsWith("/")) {
instanceName = instanceName.substring(1);
}
mapQuery.put(SERVER_INSTANCE, instanceName);
String dsHost = url.getHost();
String dsPort = Integer.toString(url.getPort());
mapQuery.put(DS_HOST, dsHost);
mapQuery.put(DS_PORT, dsPort);
mapQuery.put(DS_PROTOCOL, dsprotocol);
String key = dsHost + ":" + dsPort;
bootList.put(key, mapQuery);
}
return bootList;
}
use of com.sun.identity.setup.BootstrapData in project OpenAM by OpenRock.
the class InitializeSystem method load.
private void load(String basedir) throws FileNotFoundException, IOException, UnsupportedEncodingException, LDAPServiceException {
if (!basedir.endsWith(File.separator)) {
basedir = basedir + File.separator;
}
String amConfigProperties = basedir + SetupConstants.AMCONFIG_PROPERTIES;
File file = new File(amConfigProperties);
if (file.exists()) {
Properties prop = new Properties();
InputStream propIn = new FileInputStream(amConfigProperties);
try {
prop.load(propIn);
} finally {
propIn.close();
}
SystemProperties.initializeProperties(prop);
} else {
bData = new BootstrapData(basedir);
bData.initSMS(false);
AdminUtils.initialize();
SMSAuthModule.initialize();
rootsuffix = bData.getBaseDN();
instanceName = bData.getInstanceName();
}
}
use of com.sun.identity.setup.BootstrapData in project OpenAM by OpenRock.
the class UpgradeServiceUtils method setUserAndPassword.
private static void setUserAndPassword(IHttpServletRequest requestFromFile, String basedir) throws UpgradeException {
try {
BootstrapData bootStrap = new BootstrapData(basedir);
Map<String, String> data = bootStrap.getDataAsMap(0);
requestFromFile.addParameter(SetupConstants.CONFIG_VAR_DS_MGR_DN, data.get(BootstrapData.DS_MGR));
requestFromFile.addParameter(SetupConstants.CONFIG_VAR_DS_MGR_PWD, JCECrypt.decode(data.get(BootstrapData.DS_PWD)));
} catch (IOException ioe) {
DEBUG.error("Unable to load directory user/password from bootstrap file", ioe);
throw new UpgradeException("Unable to load bootstrap file: " + ioe.getMessage());
}
}
Aggregations