Main.java revision 8af80418ba1ec431c8027fa9668e5678658d3611
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: Main.java,v 1.11 2010/01/14 23:38:25 veiming Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Portions Copyrighted 2010-2011 ForgeRock AS
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ResourceBundle bundle = ResourceBundle.getBundle(System.getProperty(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SETUP_PROPERTIES_FILE, DEFAULT_PROPERTIES_FILE));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ((System.getProperty(PRINT_HELP) != null) &&
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (System.getProperty(CHECK_VERSION) != null) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (System.getProperty(CHECK_VERSION).equals(YES)) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster boolean loadConfig = (System.getProperty(CONFIG_LOAD) != null) &&
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String configPath = System.getProperty(AMCONFIG_PATH);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String currentDir = System.getProperty("user.dir");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ((configPath == null) || (configPath.length() == 0)) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster configPath = SetupUtils.getUserInput(bundle.getString(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster currentOS + QUESTION), System.getProperty("user.home")
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "message.error.dir.absolute"));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ((debugPath == null) || (debugPath.length() == 0)) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debugPath = SetupUtils.getUserInput(bundle.getString(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "message.error.dir.absolute"));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "message.error.debug.dir.not.writable"));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ((logPath == null) || (logPath.length() == 0)) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster logPath = SetupUtils.getUserInput(bundle.getString(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "message.error.dir.absolute"));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "message.error.log.dir.not.writable"));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String toolsHome = new File(".").getCanonicalPath();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ((debugPath == null) || (debugPath.length() == 0)) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ((logPath == null) || (logPath.length() == 0)) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster configProp = Bootstrap.load(configPath, false);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println(bundle.getString("message.error.dir"));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster boolean created = path.exists() || path.mkdirs();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "message.error.debug.dir.not.writable"));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "message.error.log.dir.not.writable"));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster configPath.substring(0, configPath.length() - 1));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster configProp.setProperty(CURRENT_PLATFORM, currentOS);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SetupUtils.evaluateBundleValues(bundle, configProp);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SetupUtils.copyAndFilterScripts(bundle, configProp);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster bundle.getString("message.info.debug.dir"), p));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster " " + SystemProperties.get("com.iplanet.am.version"));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println(bundle.getString("message.error.copy"));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private static boolean isWriteable(String file) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster boolean exist = false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster boolean writable = false;