0001: package com.sun.portal.fabric.upgrade;
0002:
0003: import com.sun.portal.fabric.tasks.JESAS81Impl;
0004: import com.sun.portal.fabric.tasks.JESWS7Impl;
0005: import com.sun.portal.fabric.tasks.BEAWL8Impl;
0006: import com.sun.portal.fabric.tasks.IBMWAS5Impl;
0007:
0008: import com.sun.portal.fabric.tasks.ValidationException;
0009: import com.sun.portal.fabric.util.ExecuteUtil;
0010: import com.sun.portal.fabric.util.FileUtil;
0011:
0012: import com.sun.portal.admin.common.InstanceAttributes;
0013:
0014: import com.sun.portal.fabric.tasks.WebContainer;
0015:
0016: import com.sun.portal.log.common.PortalLogger;
0017:
0018: import java.util.*;
0019: import java.util.logging.*;
0020: import java.io.*;
0021: import java.net.*;
0022:
0023: import org.jdom.*;
0024: import org.jdom.output.XMLOutputter;
0025: import org.jdom.input.SAXBuilder;
0026:
0027: public class PSUpgrade implements PortalServerUpgrade {
0028: private static String PS_BASEDIR = null;
0029: private String PS_CONFIG_DIR;
0030: private String PS_VAR_DIR;
0031: private String PS_JDKDIR;
0032: private String PS_DEPLOY_TYPE;
0033: private String IDSAME_BASEDIR;
0034: private String PS_DEPLOY_URI;
0035: private String PS_DS_HOST;
0036: private static String PS_DS_DIRMGR_DN;
0037: private String PS_DS_PORT;
0038: private String PS_SERVER_PROTOCOL;
0039: private String HOST_NAME;
0040: private String HOST_NAME_PORT;
0041:
0042: //AMConfig related properties.
0043: private String ADMIN_DN = null;
0044: private String ROOT_DN = null;
0045: private String ORG_DN = null;
0046: private String SCHEMA_DN = "cn=schema";
0047: private String PEOPLE_DN = null;
0048:
0049: private static boolean PORTAL_INSTALLED;
0050: private static boolean SRA_INSTALLED;
0051: private static boolean GATEWAY_INSTALLED;
0052: private static boolean NETLET_PROXY_INSTALLED;
0053: private static boolean REWRITER_PROXY_INSTALLED;
0054:
0055: // Start - L10N Code change
0056:
0057: private static boolean PORTAL_L10N_INSTALLED;
0058: private static boolean SRA_L10N_INSTALLED;
0059: private static boolean GATEWAY_L10N_INSTALLED;
0060: private static boolean NETLET_PROXY_L10N_INSTALLED;
0061: private static boolean REWRITER_PROXY_L10N_INSTALLED;
0062:
0063: // Finish - L10N Code change
0064:
0065: private String PS_INSTALL_SCRIPT_LOCATION;
0066: private String PS_PROTOCOL;
0067: private String PS_PRODUCT_DIR;
0068: private String AM_BASEDIR;
0069: private String RWP_SELF_SIGNED_CERT;
0070: private String NLP_PROTOCOL;
0071: private String GW_SERVER_PROTOCOL;
0072: private String GW_IDSAME_ORG_DN;
0073: private String GW_CREATE_IS_INSTANCE;
0074: private String GW_BASEDIR;
0075: private String GW_GATEWAY_PROFILE;
0076: private String START_GATEWAY;
0077: private String GW_IP;
0078: private String GW_SELF_SIGNED_CERT;
0079: private String GW_IDSAME_PASSWORD_KEY;
0080: private String GW_DEPLOY_URI;
0081: private String GW_PORT;
0082: private String GW_CERT_INFO;
0083: private String GW_PROTOCOL;
0084: private String GW_HOST;
0085: private String NLP_IP;
0086: private String NLP_CERT_INFO;
0087: private String NLP_IDSAME_PASSWORD_KEY;
0088: private String NLP_GATEWAY_PROFILE;
0089: private String NLP_BASEDIR;
0090: private String NLP_SELF_SIGNED_CERT;
0091: private String NLP_PORT;
0092: private String START_NETLETPROXY;
0093: private String NLP_HOST;
0094: private String RWP_PROTOCOL;
0095: private String RWP_IP;
0096: private String CERT_INFO;
0097: private String RWP_IDSAME_PASSWORD_KEY;
0098: private String RWP_GATEWAY_PROFILE;
0099: private String RWP_BASEDIR;
0100: private String RWP_PORT;
0101: private String START_REWRITERPROXY;
0102: private String RWP_HOST;
0103: private String PS_ETC_DIR;
0104: private String SRA_GW_PROTOCOL;
0105: private String SRA_SERVER_DOMAIN;
0106: private String GW_DOMAIN;
0107: private String SRA_ASSIGN_SERVICE;
0108: private String SRA_USE_WEBPROXY;
0109: private String SRA_GATEWAY_PROFILE;
0110: private String SRA_GW_PORT;
0111: private String PS_DEPLOY_INSTANCE;
0112: private String PS_DEPLOY_INSTANCE_DIR;
0113: private String PS_IDSAME_AMSERVER;
0114: private String PS_DEPLOY_JDK_DIR;
0115: private String PS_DEPLOY_ADMIN_PROTOCOL;
0116: private String PS_DEPLOY_ADMIN_PORT;
0117: private String PS_DEPLOY_PRODUCT_DIR;
0118: private String PS_DEPLOY_NODE;
0119: private String PS_DEPLOY_PROJECT_DIR;
0120: private String PS_DEPLOY_VIRTUAL_HOST;
0121: private String PS_JDK_DIR;
0122: private String PS_DEPLOY_ADMIN_HOST;
0123: private String PS_DEPLOY_ADMIN;
0124: private String LOAD_BALANCER_URL;
0125: private String PS_DEPLOY_DOMAIN;
0126: private String AM_PRODUCT_DIR;
0127: private String AM_CONFIG_DIR;
0128: private String AM_VAR_DIR;
0129: private String PS_DEPLOY_DOCROOT;
0130: private String PS_DEPLOY_CELL;
0131: private String PS_DEPLOY_DIR;
0132: private String PS_AMCONSOLE;
0133: private File upgradePropFile;
0134: private File upgradeAntFile;
0135: private String upgradeAntFilePathStr;
0136: private String upgradePropFilePathStr;
0137: private Properties AMConfigProps;
0138: private Properties psInstallationProps;
0139: private Properties amInstallationProps;
0140: private static String DS_DIRMGR_PASSWORD = null;
0141: private static String IDSAME_ADMIN_PASSWORD = null;
0142: private static String IDSAME_LDAP_USER_PASSWORD = null;
0143: private static String CERT_DB_PASSWORD = "password";
0144: private static String WEB_CONTAINER_ADMIN_PASSWORD = "";
0145: private static String SRA_LOG_USER_PASSWORD = null;
0146: private static String WEB_CONTAINER_MASTER_PASSWORD = "";
0147: private static File silentJESInstall = null;
0148: private String PS_70_PRODUCT_DIR = null;
0149: private String PS_PRODUCT_DIR_OLD = null;
0150: private String PS_70_DATA_DIR = null;
0151: private String PS_70_CONFIG_DIR = null;
0152: private String PS_DATA_DIR_OLD = null;
0153: private String PS_CONFIG_DIR_OLD = null;
0154: private String PORTAL_INSTANCE_ID = null;
0155:
0156: private static File configFile = null;
0157: private static String configFilePath = null;
0158: private String PS_DEPLOY_MANAGED_SERVER = null;
0159: private static boolean DEBUG = false;
0160: private String wcAdminPasswordFilePath = "";
0161: static String fs = File.separator;
0162:
0163: private static Logger log = null;
0164: private static Logger logger = null;
0165: private static ExecuteUtil execUtil = null;
0166:
0167: private static FileHandler fh = null;
0168: private static String AM_SPECIAL_USER_DN = null;
0169: private static String AM_LDAP_USER_DN = null;
0170: private static String PS_PRODUCT_VERSION = null;
0171: public static String RESOURCE_DIR = null;
0172: private boolean linuxOS = false;
0173: private boolean sunOS = false;
0174: private static String PS_DS_SSL_ENABLED = null;
0175: public String[] RESOURCE_DIRS;
0176: private Properties wcAttributes;
0177: private static String WEB_CONTAINER_DEPLOY_PRODUCT_DIR = "";
0178: private String WEB_CONTAINER_PRODUCT_DIR;
0179: private static final String LOGFILE = fs + "var" + fs + "sadm" + fs
0180: + "install" + fs + "logs" + fs
0181: + "Sun_Java_System_Portal_Server_upgrade.log";
0182: private String amadminPasswordFilePath = null;
0183: private String[] platformConfs;
0184:
0185: //For test automation.
0186: static boolean testRunMode = false;
0187: //Run only Access Manager changes portion of upgrade steps in test mode.
0188: static boolean testRunModeAM = false;
0189: //Run only DP changes portion of upgrade steps in test mode.
0190: static boolean testRunModeDP = false;
0191: //Run only classpath changes portion of upgrade steps in test mode.
0192: static boolean testRunModeCP = false;
0193: //Run complete upgrade steps in test mode.
0194: static boolean testRunModeAll = false;
0195: static boolean testRunModeInstall = false;
0196:
0197: static {
0198: try {
0199: logger = PortalLogger.getLogger("PSUpgrade.class");
0200: //TODO: Make it OS independent log location.
0201: //File psupgradeTmpDir= new File(UpgradeConstants.SOLARIS_TMP_DIR);
0202: //psupgradeTmpDir.mkdirs();
0203:
0204: fh = new FileHandler(LOGFILE, true);
0205: fh.setFormatter(new SimpleFormatter());
0206:
0207: Handler[] logHandlers = logger.getHandlers();
0208: for (int i = 0; i < logHandlers.length; i++) {
0209: logHandlers[i].close();
0210: logger.removeHandler(logHandlers[i]);
0211: }
0212:
0213: logger.setUseParentHandlers(false);
0214: logger.addHandler(fh);
0215:
0216: UpgradeUtils.setLogger(logger);
0217: execUtil = new ExecuteUtil();
0218: UpgradeUtils.setExecUtil(execUtil);
0219:
0220: } catch (IOException e) {
0221: System.out.println(e);
0222: }
0223: }
0224:
0225: public PSUpgrade(String version) {
0226: PS_PRODUCT_VERSION = version;
0227: RESOURCE_DIR = UpgradeUtils.getResourceDir(version);
0228: RESOURCE_DIRS = UpgradeUtils.getResourceDirs(version);
0229: //Set the OS.
0230: String OSStr = System.getProperty("os.name");
0231: logger.log(Level.INFO, "PSFB_CSPFUP0001", OSStr);
0232: linuxOS = (OSStr.indexOf("Linux") != -1) ? true : false;
0233: sunOS = (OSStr.indexOf("SunOS") != -1) ? true : false;
0234: logger
0235: .log(Level.INFO, "PSFB_CSPFUP0002", String
0236: .valueOf(sunOS));
0237: logger.log(Level.INFO, "PSFB_CSPFUP0003", String
0238: .valueOf(linuxOS));
0239:
0240: psInstallationProps = new Properties();
0241: amInstallationProps = new Properties();
0242: wcAttributes = new Properties();
0243: }
0244:
0245: public static void main(String[] args) {
0246:
0247: String passwordsfile = null;
0248: File passwordFile = null;
0249: int exitCode = 0;
0250: //Specific upgrade operations exit code.
0251: int specificExitCode = 0;
0252:
0253: //Is the expected arguments provided?. Check it otherwise quit.
0254: if (args.length < 1) {
0255: //TODO: Log a message?
0256: logger.log(Level.SEVERE, "PSFB_CSPFUP0004");
0257: System.out
0258: .println("Usuage: ./psupgrade -pf <passwd_file> -test <all,dp,cp,am>");
0259: System.exit(0);
0260: } else if (args.length == 2 || args.length == 4) {
0261: if (args[0].equals("-pf")) {
0262: passwordsfile = args[1];
0263:
0264: }
0265: passwordFile = new File(passwordsfile);
0266: if (!passwordFile.exists()) {
0267: //TODO: Log a message?
0268: logger.log(Level.SEVERE, "PSFB_CSPFUP0005");
0269: System.out
0270: .println("Usage: java -jar upgrade.jar <file>");
0271: System.exit(0);
0272: }
0273: }
0274: //Test automation stuff continue.
0275: if (args.length == 4 && args[2].equals("-test")) {
0276: //For now, test automation, let the pwd file itself be sraIntsancList;
0277: //So that it is not asked interactively.
0278: testRunMode = true;
0279:
0280: if (args[3].indexOf("am") != -1)
0281: testRunModeAM = true;
0282: if (args[3].indexOf("cp") != -1)
0283: testRunModeCP = true;
0284: if (args[3].indexOf("dp") != -1)
0285: testRunModeDP = true;
0286: if (args[3].indexOf("all") != -1)
0287: testRunModeAll = true;
0288:
0289: }
0290:
0291: //TODO: Find version first and invoke appropriate Upgrade Impl class.
0292: String PSVersion = UpgradeUtils.getPortalServerVersion();
0293: if (PSVersion == null) {
0294: logger.log(Level.SEVERE, "PSFB_CSPFUP0006");
0295: System.out
0296: .println("Failed to initialize. Could not detect version of Portal Server installation.\n Possibly Portal Server is not installed on this system!! ");
0297: UpgradeUtils.removeLogHandler();
0298: exitCode = UpgradeConstants.UPGRADE_INIT_ERROR_EXIT_CODE;
0299: System.exit(exitCode);
0300: }
0301: PortalServerUpgrade psu = PSUpgradeFactory
0302: .getPSUpgradeImplInstance(PSVersion);
0303:
0304: //These Passwords can perhaps be asked in the psupgrade script itself.
0305: //Initialise the Upgrade engine.
0306: try {
0307: psu.init(passwordFile);
0308: } catch (UpgradeException e) {
0309: logger.log(Level.SEVERE, "PSFB_CSPFUP0007", e);
0310: //Removed UpgradeConstants.SOLARIS_TMP_DIR+File.separator BUG ID 6410789
0311: System.out.println("Failed to initialize. Check log file "
0312: + LOGFILE + " for details");
0313: //+ UpgradeConstants.SOLARIS_TMP_DIR+File.separator
0314: exitCode = UpgradeConstants.UPGRADE_INIT_ERROR_EXIT_CODE;
0315: System.exit(exitCode);
0316:
0317: }
0318:
0319: //Check if debug option is set.
0320: if (UpgradeUtils.hasCommandOption(args, "-debug") == true
0321: || testRunMode == true)
0322: DEBUG = true;
0323:
0324: //Delete the password file for security resons. We have the passwords stored internally now.
0325: if (DEBUG == false)
0326: passwordFile.delete();
0327:
0328: //This method can make sure that we manipulate the new bits before invoking the ps configuration.
0329: //TODO:Also make sure the required servers are running.
0330: try {
0331: System.out.println("Performing Pre Upgrade operations:");
0332: System.out.println("---------------------------------");
0333: psu.preupgrade();
0334: } catch (UpgradeException e) {
0335: logger.log(Level.SEVERE, "PSFB_CSPFUP0010", e);
0336: //Removed UpgradeConstants.SOLARIS_TMP_DIR+File.separator BUG ID 6410789
0337: System.out.println("Failed to initialize. Check log file "
0338: + LOGFILE + " for details");
0339: //+ UpgradeConstants.SOLARIS_TMP_DIR+File.separator+LOGFILE+" for details");
0340: psu.destroy();
0341: //Set the exit code.
0342: exitCode = UpgradeConstants.PRE_UPGRADE_ERROR_EXIT_CODE;
0343: specificExitCode = UpgradeUtils.getExitCode();
0344: if (specificExitCode != -1) {
0345: //New exit code will be a 4 digit value and starting with 1. Example 1102.
0346: exitCode = new Integer(exitCode + "" + specificExitCode)
0347: .intValue();
0348: logger.log(Level.INFO, "Exit Code: " + exitCode);
0349:
0350: }
0351: System.exit(UpgradeConstants.PRE_UPGRADE_ERROR_EXIT_CODE);
0352: //Setting exit code is complete.
0353: }
0354:
0355: try {
0356: System.out.println("Performing Upgrade operations:");
0357: System.out.println("-----------------------------");
0358: psu.upgrade();
0359: } catch (UpgradeException e) {
0360: logger.log(Level.SEVERE, "PSFB_CSPFUP0011", e);
0361: //Removed UpgradeConstants.SOLARIS_TMP_DIR+File.separator BUG ID 6410789
0362: System.out
0363: .println("Failed to complete Upgrade steps. Check log file "
0364: + LOGFILE + " for details");
0365: //+ UpgradeConstants.SOLARIS_TMP_DIR+File.separator+LOGFILE+" for details");
0366: psu.destroy();
0367:
0368: //Set the exit code.
0369: exitCode = UpgradeConstants.IN_UPGRADE_ERROR_EXIT_CODE;
0370: specificExitCode = UpgradeUtils.getExitCode();
0371: if (specificExitCode != -1) {
0372: //New exit code will be a 4 digit value and starting with 2. Example 2102.
0373: exitCode = new Integer(exitCode + "" + specificExitCode)
0374: .intValue();
0375: logger.log(Level.INFO, "Exit Code: " + exitCode);
0376: }
0377: System.exit(UpgradeConstants.IN_UPGRADE_ERROR_EXIT_CODE);
0378: //Setting exit code is complete.
0379: }
0380:
0381: try {
0382: System.out.println("Performing Post Upgrade operations:");
0383: System.out.println("----------------------------------");
0384:
0385: psu.postupgrade();
0386: } catch (UpgradeException e) {
0387: logger.log(Level.SEVERE, "PSFB_CSPFUP0012", e);
0388: //Removed UpgradeConstants.SOLARIS_TMP_DIR+File.separator BUG ID 6410789
0389: System.out
0390: .println("Failed to complete Post Upgrade steps. Check log file "
0391: + LOGFILE + " for details");
0392: //+ UpgradeConstants.SOLARIS_TMP_DIR+File.separator+LOGFILE+" for details");
0393: psu.destroy();
0394: //Set the exit code.
0395: exitCode = UpgradeConstants.POST_UPGRADE_ERROR_EXIT_CODE;
0396: specificExitCode = UpgradeUtils.getExitCode();
0397: if (specificExitCode != -1) {
0398: //New exit code will be a 4 digit value and starting with 3. Example 3302.
0399: exitCode = new Integer(exitCode + "" + specificExitCode)
0400: .intValue();
0401: logger.log(Level.INFO, "Exit Code: " + exitCode);
0402: }
0403: System.exit(UpgradeConstants.POST_UPGRADE_ERROR_EXIT_CODE);
0404: //Setting exit code is complete.
0405: }
0406:
0407: psu.destroy();
0408:
0409: }
0410:
0411: /*
0412: * Inserts the correct location for psconfig.xsd schema file.
0413: */
0414: void setPSConfigSchemaLocation(File f) {
0415: FileUtil.replaceTokenInFile(f, "PSCONFIG_XSD", "file://"
0416: + PS_70_PRODUCT_DIR + fs + "lib" + fs + "psconfig.xsd");
0417: }
0418:
0419: /*
0420: * Remove uninstalled components from psconfig.xml
0421: */
0422: boolean removeUninstalledComponents(File f) {
0423: Document doc = null;
0424: Element elem = null, comp = null;
0425: try {
0426: SAXBuilder builder = new SAXBuilder();
0427: doc = builder.build(f);
0428: elem = doc.getRootElement();
0429: } catch (Exception e) {
0430: }
0431:
0432: Element ComponentsToConfigure = elem.getChild("Configure")
0433: .getChild("PortalConfiguration").getChild(
0434: "ComponentsToConfigure");
0435: Element PortalConfiguration = elem.getChild("Configure")
0436: .getChild("PortalConfiguration");
0437: Element PortalServer = elem.getChild("Configure").getChild(
0438: "PortalConfiguration").getChild("PortalServer");
0439: Element PortalServerInstance = elem.getChild("Configure")
0440: .getChild("PortalConfiguration").getChild(
0441: "PortalServer").getChild("Instance");
0442: Element SearchServer = elem.getChild("Configure").getChild(
0443: "PortalConfiguration").getChild("SearchServer");
0444: List list = null;
0445: Iterator it = null;
0446:
0447: if (NETLET_PROXY_INSTALLED == false) {
0448: list = ComponentsToConfigure.getChildren();
0449: it = list.iterator();
0450: while (it.hasNext()) {
0451: comp = (Element) it.next();
0452: if (comp.getText().equals("netletproxy")) {
0453: ComponentsToConfigure.removeContent(comp);
0454: break;
0455: }
0456: }
0457: }
0458:
0459: if (SRA_INSTALLED == false) {
0460: list = ComponentsToConfigure.getChildren();
0461: it = list.iterator();
0462: while (it.hasNext()) {
0463: comp = (Element) it.next();
0464: if (comp.getText().equals("sracore")) {
0465: ComponentsToConfigure.removeContent(comp);
0466: break;
0467: }
0468: }
0469: }
0470:
0471: if (GATEWAY_INSTALLED == false) {
0472: list = ComponentsToConfigure.getChildren();
0473: it = list.iterator();
0474: while (it.hasNext()) {
0475: comp = (Element) it.next();
0476: // System.out.println(comp.getText());
0477: if (comp.getText().equals("gateway")) {
0478: ComponentsToConfigure.removeContent(comp);
0479: break;
0480: }
0481: }
0482: }
0483:
0484: if (PORTAL_INSTALLED == false) {
0485: list = ComponentsToConfigure.getChildren();
0486: it = list.iterator();
0487: while (it.hasNext()) {
0488: comp = (Element) it.next();
0489: //TODO: Log this System.out.println(comp.getText());
0490: if (comp.getText().equals("portalserver")) {
0491: ComponentsToConfigure.removeContent(comp);
0492: break;
0493: }
0494: }
0495: //Remove Portal Server and Search Server elements when Portal Server is not installed.
0496: PortalServer.removeContent(PortalServerInstance);
0497: PortalConfiguration.removeContent(SearchServer);
0498: }
0499:
0500: if (REWRITER_PROXY_INSTALLED == false) {
0501: list = ComponentsToConfigure.getChildren();
0502: it = list.iterator();
0503: while (it.hasNext()) {
0504: comp = (Element) it.next();
0505: //TODO: Log this System.out.println(comp.getText());
0506: if (comp.getText().equals("rewriterproxy")) {
0507: ComponentsToConfigure.removeContent(comp);
0508: break;
0509: }
0510: }
0511: }
0512:
0513: try {
0514: XMLOutputter serializer = new XMLOutputter();
0515: serializer.output(doc, new FileWriter(f));
0516: } catch (IOException e) {
0517: System.out.println(e);
0518: }
0519: return false;
0520: }
0521:
0522: private void initPasswords(File passwordFilename)
0523: throws UpgradeException {
0524:
0525: try {
0526: psInstallationProps.load(new FileInputStream(
0527: passwordFilename));
0528:
0529: IDSAME_ADMIN_PASSWORD = (String) psInstallationProps
0530: .get(UpgradeConstants.IDSAME_ADMIN_PASSWORD_STR);
0531: DS_DIRMGR_PASSWORD = (String) psInstallationProps
0532: .get(UpgradeConstants.DS_DIRMGR_PASSWORD_STR);
0533: IDSAME_LDAP_USER_PASSWORD = (String) psInstallationProps
0534: .get(UpgradeConstants.IDSAME_LDAP_USER_PASSWORD_STR);
0535: WEB_CONTAINER_ADMIN_PASSWORD = (String) psInstallationProps
0536: .get(UpgradeConstants.WEB_CONTAINER_ADMIN_PASSWORD_STR);
0537: WEB_CONTAINER_MASTER_PASSWORD = (String) psInstallationProps
0538: .get(UpgradeConstants.WEB_CONTAINER_MASTER_PASSWORD_STR);
0539: CERT_DB_PASSWORD = (String) psInstallationProps
0540: .get(UpgradeConstants.CERT_DB_PASSWORD_STR);
0541: SRA_LOG_USER_PASSWORD = (String) psInstallationProps
0542: .get(UpgradeConstants.SRA_LOG_USER_PASSWORD_STR);
0543:
0544: } catch (IOException e) {
0545: logger.log(Level.SEVERE, "PSFB_CSPFUP0013", e);
0546: throw new UpgradeException(
0547: "Unable to create passwords file", e);
0548:
0549: }
0550:
0551: }
0552:
0553: private void initAMConfigDetails() throws UpgradeException {
0554:
0555: AMConfigProps = new Properties();
0556: String AMSDKDir = "SUNWam";
0557: if (linuxOS == true)
0558: AMSDKDir = "sun" + fs + "identity";
0559: String AMConfileFile = null;
0560:
0561: try {
0562: AMConfileFile = AM_CONFIG_DIR + fs + "opt" + fs + AMSDKDir
0563: + fs + "config" + fs + "AMConfig.properties";
0564: AMConfigProps.load(new FileInputStream(AMConfileFile));
0565: } catch (IOException e) {
0566: throw new UpgradeException(
0567: "Trying to load"
0568: + AMConfileFile
0569: + ". Could not fetch values from AMConfig.properties\n.",
0570: e);
0571:
0572: }
0573: PS_DS_HOST = AMConfigProps
0574: .getProperty(UpgradeConstants.DS_HOST);
0575: PS_DS_PORT = AMConfigProps
0576: .getProperty(UpgradeConstants.DS_PORT);
0577: PS_DS_SSL_ENABLED = AMConfigProps
0578: .getProperty(UpgradeConstants.DS_SSL_ENABLED);
0579:
0580: //PS_AM_HOST=AMConfigProps.getProperty(UpgradeConstants.AM_HOST);
0581: //PS_AM_PORT=AMConfigProps.getProperty(UpgradeConstants.AM_PORT);
0582:
0583: ADMIN_DN = AMConfigProps
0584: .getProperty(UpgradeConstants.AM_ADMIN_DN);
0585: ROOT_DN = AMConfigProps.getProperty(UpgradeConstants.ROOT_DN);
0586: ORG_DN = AMConfigProps
0587: .getProperty(UpgradeConstants.DEFAULT_ORG);
0588: if (!ORG_DN.equals(ROOT_DN))
0589: ORG_DN = ORG_DN + "," + ROOT_DN;
0590:
0591: PEOPLE_DN = "ou=People," + ORG_DN;
0592: String userDNs = AMConfigProps
0593: .getProperty(UpgradeConstants.AM_SPECIAL_USER_DN);
0594: if (userDNs == null)
0595: userDNs = "cn=dsameuser,ou=DSAME Users," + ORG_DN;//JES2 Access Manager does not have special users exposed in AMConfig file.
0596: int index = userDNs.indexOf("|");
0597: AM_SPECIAL_USER_DN = (index < 0) ? userDNs : userDNs.substring(
0598: 0, index);
0599: AM_LDAP_USER_DN = AM_SPECIAL_USER_DN.replaceFirst("dsameuser",
0600: "amldapuser");
0601: }
0602:
0603: public Properties SetwcAttributes(Properties psInstallationProps) {
0604: //This function sets web container attributes.same as wcAttributes in PSUpgrade70_71_Impl.java
0605: Properties tempwcattr = new Properties();
0606: Properties tempPsDeployType = new Properties();
0607: String PS_PORTAL_ID = "Upgraded";
0608: String PS_INSTANCE_ID = "Upgraded";
0609:
0610: PS_DEPLOY_TYPE = psInstallationProps.getProperty("DEPLOY_TYPE");
0611: tempPsDeployType.setProperty("version", psInstallationProps
0612: .getProperty("PS_PRODUCT_VERSION"));
0613: tempPsDeployType.setProperty("deployType", PS_DEPLOY_TYPE);
0614: tempPsDeployType.setProperty("upgradeOnWS70",
0615: psInstallationProps.getProperty("upgradeOnWS70",
0616: "false"));
0617:
0618: tempwcattr.setProperty(InstanceAttributes.WEB_CONTAINER_TYPE,
0619: UpgradeUtils.getWebContainerType(tempPsDeployType));
0620:
0621: tempwcattr.setProperty(InstanceAttributes.SCHEME, PS_PROTOCOL);
0622: tempwcattr.setProperty(InstanceAttributes.HOST, HOST_NAME);
0623: tempwcattr.setProperty(InstanceAttributes.PORT, HOST_NAME_PORT);
0624: tempwcattr.setProperty(
0625: InstanceAttributes.WEB_CONTAINER_INSTANCE,
0626: PS_DEPLOY_INSTANCE);
0627: tempwcattr.setProperty(
0628: InstanceAttributes.WEB_CONTAINER_JDK_DIR,
0629: PS_DEPLOY_JDK_DIR);
0630: tempwcattr.setProperty(
0631: InstanceAttributes.WEB_CONTAINER_ADMIN_PORT,
0632: PS_DEPLOY_ADMIN_PORT);
0633: tempwcattr.setProperty(
0634: InstanceAttributes.WEB_CONTAINER_ADMIN_SCHEME,
0635: PS_DEPLOY_ADMIN_PROTOCOL);
0636: tempwcattr.setProperty(
0637: InstanceAttributes.WEB_CONTAINER_INSTALL_DIR,
0638: PS_DEPLOY_PRODUCT_DIR);
0639: tempwcattr.setProperty(
0640: InstanceAttributes.WEB_CONTAINER_ADMIN_HOST,
0641: PS_DEPLOY_ADMIN_HOST);
0642: tempwcattr.setProperty(
0643: InstanceAttributes.WEB_CONTAINER_ADMIN_UID,
0644: PS_DEPLOY_ADMIN);
0645: tempwcattr.setProperty(
0646: InstanceAttributes.WEB_CONTAINER_DOC_ROOT,
0647: PS_DEPLOY_DOCROOT);
0648: tempwcattr.setProperty(
0649: InstanceAttributes.WEB_CONTAINER_MASTER_PASSWORD,
0650: WEB_CONTAINER_MASTER_PASSWORD);
0651: tempwcattr.setProperty(
0652: InstanceAttributes.WEB_CONTAINER_ADMIN_PASSWORD,
0653: WEB_CONTAINER_ADMIN_PASSWORD);
0654: tempwcattr.setProperty(
0655: InstanceAttributes.WEB_CONTAINER_INSTANCE_DIR,
0656: PS_DEPLOY_INSTANCE_DIR);
0657: tempwcattr.setProperty(InstanceAttributes.WEB_CONTAINER_DOMAIN,
0658: PS_DEPLOY_DOMAIN);
0659: tempwcattr.setProperty(
0660: InstanceAttributes.WEB_CONTAINER_MANAGED_SERVER,
0661: PS_DEPLOY_MANAGED_SERVER);
0662: tempwcattr.setProperty(
0663: InstanceAttributes.WEB_CONTAINER_DEPLOY_NODE,
0664: PS_DEPLOY_NODE);
0665: tempwcattr.setProperty(
0666: InstanceAttributes.WEB_CONTAINER_DEPLOY_CELL,
0667: PS_DEPLOY_CELL);
0668:
0669: //Is this correct value??. ( com.sun.portal.domain.id == PS_DEPLOY_DOMAIN ).
0670: tempwcattr.setProperty("com.sun.portal.domain.id",
0671: PS_DEPLOY_DOMAIN);
0672: tempwcattr
0673: .setProperty("com.sun.portal.portal.id", PS_PORTAL_ID);
0674: //The above key com.sun.portal.portal.id is defined in the following class
0675: //com.sun.portal.util.ResourceLoader
0676: tempwcattr.setProperty("com.sun.portal.instance.id",
0677: PS_INSTANCE_ID);
0678: tempwcattr.setProperty(InstanceAttributes.NAME, PS_INSTANCE_ID);
0679: //The above key com.sun.portal.instance.id is defined in the following class
0680: //com.sun.portal.util.ResourceLoader
0681:
0682: return tempwcattr;
0683: }
0684:
0685: public void initPortalInstallationDetails() throws UpgradeException {
0686: System.out
0687: .println("Loading current installation properties file.... ");
0688: logger.log(Level.INFO, "PSFB_CSPFUP0014");
0689: String sunPortalDir = null;
0690:
0691: try {
0692: if (sunOS == true) {
0693: sunPortalDir = "SUNWportal";
0694: amInstallationProps.load(new FileInputStream(
0695: UpgradeConstants.AMSDK_PKG_INFO_FILE));
0696:
0697: AM_BASEDIR = amInstallationProps.getProperty("BASEDIR",
0698: "/opt");
0699: AM_PRODUCT_DIR = amInstallationProps.getProperty(
0700: "PRODUCT_DIR", "SUNWam");
0701:
0702: AM_CONFIG_DIR = amInstallationProps.getProperty(
0703: "ETC_DIR", "/etc");
0704: AM_VAR_DIR = amInstallationProps.getProperty("VAR_DIR",
0705: "/var");
0706:
0707: psInstallationProps.load(new FileInputStream(
0708: UpgradeConstants.PS_PKG_INFO_FILE));
0709: PS_BASEDIR = psInstallationProps.getProperty("BASEDIR");
0710: PS_PRODUCT_DIR = psInstallationProps
0711: .getProperty("PRODUCT_DIR");
0712: PS_PRODUCT_DIR_OLD = PS_BASEDIR + fs + PS_PRODUCT_DIR;
0713: PS_70_PRODUCT_DIR = PS_BASEDIR + fs + sunPortalDir;
0714:
0715: PS_ETC_DIR = psInstallationProps.getProperty("ETC_DIR",
0716: "/etc");
0717: PS_VAR_DIR = psInstallationProps.getProperty("VAR_DIR",
0718: "/var");
0719: PS_CONFIG_DIR_OLD = PS_ETC_DIR + fs + "opt" + fs
0720: + "SUNWps";
0721: PS_DATA_DIR_OLD = PS_VAR_DIR + fs + "opt" + fs
0722: + "SUNWps";
0723:
0724: /*PS_PRODUCT_VERSION = psInstallationProps.getProperty("SUNW_PRODVERS","6.3.1");
0725: * This above one has a bug. Sometimes after application of the essential ps6.3.1 patch,
0726: * the SUNW_PRODVERS becomes 6.2.
0727: */
0728:
0729: } else if (linuxOS == true) {
0730:
0731: sunPortalDir = "sun" + fs + "portal";
0732: //AMSDK sun-identity-sdk.
0733: //Exec and find the base fir.
0734: //rpm -q --queryformat 'PRODUCT_DIR=%{INSTALLPREFIX}' sun-portal-configurator.
0735:
0736: AM_BASEDIR = UpgradeUtils.getAMBaseDirOnLinux();
0737: AM_PRODUCT_DIR = "identity";
0738:
0739: AM_CONFIG_DIR = "/etc";
0740: AM_VAR_DIR = "/var";
0741: PS_BASEDIR = UpgradeUtils.getPSBaseDirOnLinux();
0742: PS_PRODUCT_DIR = "portal";
0743: PS_70_PRODUCT_DIR = PS_BASEDIR + fs + "portal";
0744:
0745: PS_ETC_DIR = "/etc";
0746: PS_VAR_DIR = "/var";
0747: PS_CONFIG_DIR_OLD = PS_ETC_DIR + fs + "opt" + fs
0748: + "sun" + fs + "portal";
0749: PS_DATA_DIR_OLD = PS_VAR_DIR + fs + "opt" + fs + "sun"
0750: + fs + "portal";
0751: PS_PRODUCT_DIR_OLD = PS_70_PRODUCT_DIR;
0752: //PS_PRODUCT_VERSION = UpgradeUtils.getPSVersionOnLinux();
0753: }
0754:
0755: PS_PRODUCT_VERSION = UpgradeUtils.getPSVersion(
0756: PS_PRODUCT_DIR_OLD, PORTAL_INSTALLED);
0757: if (PS_PRODUCT_VERSION == null)
0758: throw new UpgradeException(
0759: "Could not determine PS Version! Cannot proceed.");
0760:
0761: //SUN portal directories.
0762: PS_70_DATA_DIR = PS_VAR_DIR + fs + "opt" + fs
0763: + sunPortalDir;
0764: PS_70_CONFIG_DIR = PS_ETC_DIR + fs + "opt" + fs
0765: + sunPortalDir;
0766: configFilePath = PS_70_CONFIG_DIR + fs
0767: + "PSConfig.properties";
0768:
0769: psInstallationProps.setProperty("PS_PRODUCT_VERSION",
0770: PS_PRODUCT_VERSION);
0771: psInstallationProps.setProperty("PS_70_PRODUCT_DIR",
0772: PS_70_PRODUCT_DIR);
0773: psInstallationProps.setProperty("PS_70_DATA_DIR",
0774: PS_70_DATA_DIR);
0775: psInstallationProps.setProperty("PS_70_CONFIG_DIR",
0776: PS_70_CONFIG_DIR);
0777: psInstallationProps.setProperty("PS_CONFIG_DIR_OLD",
0778: PS_CONFIG_DIR_OLD);
0779: psInstallationProps.setProperty("PS_PRODUCT_DIR_OLD",
0780: PS_PRODUCT_DIR_OLD);
0781: psInstallationProps.setProperty("PS_DATA_DIR_OLD",
0782: PS_DATA_DIR_OLD);
0783:
0784: logger.log(Level.INFO, "PSFB_CSPFUP0015", new Object[] {
0785: PS_CONFIG_DIR_OLD, PS_DATA_DIR_OLD,
0786: PS_PRODUCT_DIR_OLD });
0787:
0788: //First add AM location. It is needed to execute amadmin commands.
0789: psInstallationProps.setProperty("AM_PRODUCT_DIR",
0790: AM_PRODUCT_DIR);
0791: psInstallationProps.setProperty("AM_BASEDIR", AM_BASEDIR);
0792: //Now load the statefile information.
0793: //Only if Portal Server installation is detected.
0794: if (PORTAL_INSTALLED == true) {
0795: String psConfigPropFile = PS_CONFIG_DIR_OLD + fs
0796: + UpgradeConstants.PS_CONFIG_PROPPERTIES_FILE;
0797:
0798: psInstallationProps.load(new FileInputStream(
0799: psConfigPropFile));
0800:
0801: PS_JDKDIR = psInstallationProps.getProperty("JDK_DIR",
0802: "");
0803: PS_DEPLOY_TYPE = psInstallationProps
0804: .getProperty("DEPLOY_TYPE");
0805: PS_DEPLOY_URI = psInstallationProps
0806: .getProperty("DEPLOY_URI");
0807: PS_DS_HOST = psInstallationProps.getProperty("DS_HOST");
0808: PS_DS_DIRMGR_DN = psInstallationProps
0809: .getProperty("DS_DIRMGR_DN");
0810: PS_DS_PORT = psInstallationProps.getProperty("DS_PORT");
0811: PS_SERVER_PROTOCOL = psInstallationProps
0812: .getProperty("SERVER_PROTOCOL");
0813: HOST_NAME = psInstallationProps.getProperty("PS_HOST");
0814: HOST_NAME_PORT = psInstallationProps
0815: .getProperty("PS_PORT");
0816: PS_DEPLOY_INSTANCE = psInstallationProps.getProperty(
0817: "DEPLOY_INSTANCE", "");
0818: // PS_DEPLOY_INSTANCE_DIR=psInstallationProps.getProperty("DEPLOY_INSTANCE_DIR","");
0819: PS_IDSAME_AMSERVER = psInstallationProps
0820: .getProperty("IDSAME_AMSERVER");
0821: PS_DEPLOY_JDK_DIR = psInstallationProps.getProperty(
0822: "DEPLOY_JDK_DIR", "");
0823: PS_DEPLOY_ADMIN_PROTOCOL = psInstallationProps
0824: .getProperty("DEPLOY_ADMIN_PROTOCOL", "");
0825: PS_DEPLOY_ADMIN_PORT = psInstallationProps.getProperty(
0826: "DEPLOY_ADMIN_PORT", "");
0827: PS_DEPLOY_PRODUCT_DIR = psInstallationProps
0828: .getProperty("DEPLOY_DIR", "");
0829: PS_DEPLOY_NODE = psInstallationProps.getProperty(
0830: "DEPLOY_NODE", "");
0831: PS_DEPLOY_PROJECT_DIR = psInstallationProps
0832: .getProperty("DEPLOY_PROJECT_DIR", "");
0833: PS_DEPLOY_VIRTUAL_HOST = psInstallationProps
0834: .getProperty("DEPLOY_VIRTUAL_HOST", "");
0835: PS_JDK_DIR = psInstallationProps.getProperty("JDK_DIR",
0836: "");
0837: PS_DEPLOY_ADMIN_HOST = psInstallationProps.getProperty(
0838: "DEPLOY_ADMIN_HOST", "");
0839: PS_DEPLOY_ADMIN = psInstallationProps.getProperty(
0840: "DEPLOY_ADMIN", "");
0841: LOAD_BALANCER_URL = psInstallationProps.getProperty(
0842: "LOAD_BALANCER_URL", "");
0843: PS_DEPLOY_DOMAIN = psInstallationProps.getProperty(
0844: "DEPLOY_DOMAIN", "");
0845: PS_AMCONSOLE = psInstallationProps.getProperty(
0846: "IDSAME_AMCONSOLE", "");
0847: PS_DEPLOY_DOCROOT = psInstallationProps.getProperty(
0848: "DEPLOY_DOCROOT", "");
0849: PS_DEPLOY_CELL = psInstallationProps.getProperty(
0850: "DEPLOY_CELL", "");
0851: PS_DEPLOY_DIR = psInstallationProps.getProperty(
0852: "DEPLOY_DIR", "");
0853: PS_DEPLOY_DOMAIN = psInstallationProps.getProperty(
0854: "DEPLOY_DOMAIN", "");
0855: PS_PROTOCOL = psInstallationProps.getProperty(
0856: "PS_PROTOCOL", "http");
0857: PS_DEPLOY_MANAGED_SERVER = psInstallationProps
0858: .getProperty("MANAGED_SERVER", "false");
0859: if (PS_DEPLOY_TYPE.equals("IWS")
0860: || PS_DEPLOY_TYPE
0861: .equals(UpgradeConstants.WC_TYPE_S1WS6)) {
0862: PS_DEPLOY_INSTANCE_DIR = PS_DEPLOY_PRODUCT_DIR + fs
0863: + "https-" + PS_DEPLOY_INSTANCE;
0864: } else if (PS_DEPLOY_TYPE.equals("WEBLOGIC")) {
0865: PS_DEPLOY_INSTANCE_DIR = PS_DEPLOY_DIR + fs
0866: + PS_DEPLOY_PROJECT_DIR + fs + "domains"
0867: + fs + PS_DEPLOY_DOMAIN;
0868: } else {
0869: PS_DEPLOY_INSTANCE_DIR = psInstallationProps
0870: .getProperty("DEPLOY_INSTANCE_DIR", "");
0871: }
0872:
0873: }
0874:
0875: if (SRA_INSTALLED == true) {
0876: String sraConfigPropFile = null;
0877: if (sunOS == true)
0878: sraConfigPropFile = PS_ETC_DIR + fs + "opt" + fs
0879: + "SUNWps" + fs + "SRAConfig.properties";
0880: else
0881: sraConfigPropFile = PS_ETC_DIR + fs + "opt" + fs
0882: + "sun" + fs + "portal" + fs
0883: + "SRAConfig.properties";
0884: //Now load the statefile information.
0885: psInstallationProps.load(new FileInputStream(
0886: sraConfigPropFile));
0887: SRA_GW_PORT = psInstallationProps
0888: .getProperty("GW_PORT");
0889: SRA_GATEWAY_PROFILE = psInstallationProps
0890: .getProperty("SRA_GATEWAY_PROFILE");
0891: SRA_USE_WEBPROXY = psInstallationProps
0892: .getProperty("USE_WEBPROXY");
0893: SRA_GW_PROTOCOL = psInstallationProps
0894: .getProperty("GW_PROTOCOL");
0895: SRA_SERVER_DOMAIN = psInstallationProps
0896: .getProperty("SERVER_DOMAIN");
0897: GW_DOMAIN = psInstallationProps
0898: .getProperty("GW_DOMAIN");
0899: LOAD_BALANCER_URL = psInstallationProps
0900: .getProperty("LOAD_BALANCER_URL");
0901: SRA_ASSIGN_SERVICE = psInstallationProps
0902: .getProperty("ASSIGN_SERVICE");
0903:
0904: }
0905:
0906: String GW_NLP_RWPConfigPropFileDir = getGW_NLP_RWPPropertiesFileDir();
0907:
0908: if (GATEWAY_INSTALLED == true) {
0909: String gwConfigPropFile = null;
0910: gwConfigPropFile = GW_NLP_RWPConfigPropFileDir + fs
0911: + "GWConfig.properties";
0912:
0913: //Now load the statefile information.
0914: psInstallationProps.load(new FileInputStream(
0915: gwConfigPropFile));
0916:
0917: GW_GATEWAY_PROFILE = psInstallationProps
0918: .getProperty("GW_GATEWAY_PROFILE");
0919: GW_BASEDIR = psInstallationProps
0920: .getProperty("GW_BASEDIR");
0921: GW_CREATE_IS_INSTANCE = psInstallationProps
0922: .getProperty("CREATE_IS_INSTANCE");
0923: START_GATEWAY = psInstallationProps
0924: .getProperty("START_GATEWAY");
0925: GW_IDSAME_ORG_DN = psInstallationProps
0926: .getProperty("IDSAME_ORG_DN");
0927: GW_SERVER_PROTOCOL = psInstallationProps
0928: .getProperty("SERVER_PROTOCOL");
0929: LOAD_BALANCER_URL = psInstallationProps
0930: .getProperty("LOAD_BALANCER_URL");
0931: GW_IP = psInstallationProps.getProperty("GW_IP");
0932: GW_SELF_SIGNED_CERT = psInstallationProps
0933: .getProperty("SELF_SIGNED_CERT");
0934: GW_IDSAME_PASSWORD_KEY = psInstallationProps
0935: .getProperty("IDSAME_PASSWORD_KEY");
0936: GW_DEPLOY_URI = psInstallationProps
0937: .getProperty("DEPLOY_URI");
0938: GW_PORT = psInstallationProps.getProperty("GW_PORT");
0939: CERT_INFO = psInstallationProps
0940: .getProperty("CERT_INFO");
0941: GW_PROTOCOL = psInstallationProps
0942: .getProperty("GW_PROTOCOL");
0943: GW_HOST = psInstallationProps.getProperty("GW_HOST");
0944:
0945: if (PS_JDKDIR == null || PS_JDKDIR.length() < 1) {
0946: //Load the Gateway platform.conf.<profile> file
0947: PS_JDKDIR = UpgradeUtils
0948: .getGatewayJDKDir(GW_NLP_RWPConfigPropFileDir);
0949: }
0950: HOST_NAME = GW_HOST;
0951: }
0952:
0953: if (NETLET_PROXY_INSTALLED == true) {
0954: String nlpConfigPropFile = null;
0955: if (sunOS == true)
0956: nlpConfigPropFile = GW_NLP_RWPConfigPropFileDir
0957: + fs + "NLPConfig.properties";
0958: else if (linuxOS == true)
0959: nlpConfigPropFile = GW_NLP_RWPConfigPropFileDir
0960: + fs + "NLPConfig.properties";
0961:
0962: //Now load the statefile information.
0963: psInstallationProps.load(new FileInputStream(
0964: nlpConfigPropFile));
0965:
0966: NLP_PROTOCOL = psInstallationProps
0967: .getProperty("NLP_PROTOCOL");
0968: NLP_IP = psInstallationProps.getProperty("NLP_IP");
0969: CERT_INFO = psInstallationProps
0970: .getProperty("CERT_INFO");
0971: NLP_IDSAME_PASSWORD_KEY = psInstallationProps
0972: .getProperty("IDSAME_PASSWORD_KEY");
0973: NLP_GATEWAY_PROFILE = psInstallationProps
0974: .getProperty("NLP_GATEWAY_PROFILE");
0975: NLP_BASEDIR = psInstallationProps
0976: .getProperty("NLP_BASEDIR");
0977: LOAD_BALANCER_URL = psInstallationProps
0978: .getProperty("LOAD_BALANCER_URL");
0979: NLP_SELF_SIGNED_CERT = psInstallationProps
0980: .getProperty("SELF_SIGNED_CERT");
0981: NLP_PORT = psInstallationProps.getProperty("NLP_PORT");
0982: START_NETLETPROXY = psInstallationProps
0983: .getProperty("START_NETLETPROXY");
0984: NLP_HOST = psInstallationProps.getProperty("NLP_HOST");
0985:
0986: if (PS_JDKDIR == null || PS_JDKDIR.length() < 1) {
0987: //Load the Gateway platform.conf.<profile> file
0988: PS_JDKDIR = UpgradeUtils
0989: .getGatewayJDKDir(GW_NLP_RWPConfigPropFileDir);
0990: }
0991: HOST_NAME = NLP_HOST;
0992: }
0993:
0994: if (REWRITER_PROXY_INSTALLED == true) {
0995: String rwpConfigPropFile = null;
0996: if (sunOS == true)
0997: rwpConfigPropFile = GW_NLP_RWPConfigPropFileDir
0998: + fs + "RWPConfig.properties";
0999: else if (linuxOS == true)
1000: rwpConfigPropFile = GW_NLP_RWPConfigPropFileDir
1001: + fs + "RWPConfig.properties";
1002:
1003: //Now load the statefile information.
1004: psInstallationProps.load(new FileInputStream(
1005: rwpConfigPropFile));
1006:
1007: RWP_PROTOCOL = psInstallationProps
1008: .getProperty("RWP_PROTOCOL");
1009: RWP_IP = psInstallationProps.getProperty("RWP_IP");
1010: CERT_INFO = psInstallationProps
1011: .getProperty("CERT_INFO");
1012: RWP_IDSAME_PASSWORD_KEY = psInstallationProps
1013: .getProperty("IDSAME_PASSWORD_KEY");
1014: RWP_GATEWAY_PROFILE = psInstallationProps
1015: .getProperty("RWP_GATEWAY_PROFILE");
1016: RWP_BASEDIR = psInstallationProps
1017: .getProperty("RWP_BASEDIR");
1018: LOAD_BALANCER_URL = psInstallationProps
1019: .getProperty("LOAD_BALANCER_URL");
1020: RWP_SELF_SIGNED_CERT = psInstallationProps
1021: .getProperty("SELF_SIGNED_CERT");
1022: RWP_PORT = psInstallationProps.getProperty("RWP_PORT");
1023: START_REWRITERPROXY = psInstallationProps
1024: .getProperty("START_REWRITERPROXY");
1025: RWP_HOST = psInstallationProps.getProperty("RWP_HOST");
1026:
1027: if (PS_JDKDIR == null || PS_JDKDIR.length() < 1) {
1028: //Load the Gateway platform.conf.<profile> file
1029: PS_JDKDIR = UpgradeUtils
1030: .getGatewayJDKDir(GW_NLP_RWPConfigPropFileDir);
1031: }
1032: HOST_NAME = RWP_HOST;
1033: }
1034:
1035: } catch (Exception e) {
1036: psInstallationProps = null;
1037:
1038: logger.log(Level.SEVERE, "PSFB_CSPFUP0016", e);
1039: throw new UpgradeException(
1040: "Unable to load Existing Installation properties",
1041: e);
1042: }
1043:
1044: }
1045:
1046: private String getGW_NLP_RWPPropertiesFileDir() {
1047: String GW_NLP_RWPConfigPropFileDir = null;
1048: if (sunOS == true)
1049: GW_NLP_RWPConfigPropFileDir = PS_ETC_DIR + fs + "opt" + fs
1050: + "SUNWps";
1051: else if (linuxOS == true)
1052: GW_NLP_RWPConfigPropFileDir = PS_ETC_DIR + fs + "opt" + fs
1053: + "sun" + fs + "portal";
1054: return GW_NLP_RWPConfigPropFileDir;
1055: }
1056:
1057: public static void createPSInstallSilentFileForJESUpgrade(
1058: String basedir) throws UpgradeException {
1059: logger.log(Level.INFO,
1060: "Creating PS7.1 Silent Installation file.... ");
1061: logger.log(Level.INFO, "PSFB_CSPFUP0017");
1062: String componentsToInstall = "";
1063: if (PORTAL_INSTALLED == true)
1064: componentsToInstall += "1,";
1065: if (SRA_INSTALLED == true)
1066: componentsToInstall += "2,";
1067: if (GATEWAY_INSTALLED == true)
1068: componentsToInstall += "3,";
1069: if (NETLET_PROXY_INSTALLED == true)
1070: componentsToInstall += "4,";
1071: if (REWRITER_PROXY_INSTALLED == true)
1072: componentsToInstall += "5";
1073: //
1074: try {
1075: File tmpFile = File.createTempFile("psinstallfile",
1076: "silent");
1077: FileWriter fw = new FileWriter(tmpFile);
1078: fw.write("BASEDIR=" + basedir + "\n");
1079: fw.write("COMPONENTS=" + componentsToInstall + "\n");
1080: fw.close();
1081: silentJESInstall = new File(tmpFile.getAbsolutePath());
1082: //log("psinstall silent file created at:"+silentJESInstall.getAbsolutePath());
1083: logger.log(Level.INFO, "PSFB_CSPFUP0018", silentJESInstall
1084: .getAbsolutePath());
1085: } catch (IOException e) {
1086: throw new UpgradeException(
1087: "Could not create the ps install silent file", e);
1088: }
1089:
1090: }
1091:
1092: private void createJESSilentInstallFile() {
1093: //We need to change the hostname,ipaddress.
1094: // the webserver install directory,
1095: // components to install.
1096: // The shared components upgrade is automatic.
1097: //System.out.println("Creating Installation file.... ");
1098: // log("Creating Installation file.... ");
1099:
1100: silentJESInstall = null;
1101: try {
1102: //TODO: Log this.
1103: logger.log(Level.INFO, "PSFB_CSPFUP0019");
1104: if (sunOS == true)
1105: silentJESInstall = FileUtil.extractFileFromJar(
1106: RESOURCE_DIR + fs
1107: + UpgradeConstants.RESOURCE_JAR,
1108: UpgradeConstants.JES_INSTALL_FILE_SUNOS, DEBUG);
1109: else if (linuxOS == true)
1110: silentJESInstall = FileUtil.extractFileFromJar(
1111: RESOURCE_DIR + fs
1112: + UpgradeConstants.RESOURCE_JAR,
1113: UpgradeConstants.JES_INSTALL_FILE_LINUX, DEBUG);
1114:
1115: } catch (IOException e) {
1116: //TODO: Log the message.
1117: logger.log(Level.SEVERE, "PSFB_CSPFUP0020", e);
1118: e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
1119: }
1120: Set componentsToInstall = new HashSet();
1121: String[] array = { "" };
1122:
1123: if (PORTAL_INSTALLED == true) {
1124: array = UpgradeConstants.JES4_SILENT_INSTALL_COMPONENT_PORTAL_SERVER
1125: .split(",");
1126: for (int i = 0; i < array.length; i++)
1127: componentsToInstall.add(array[i]);
1128: }
1129:
1130: if (SRA_INSTALLED == true) {
1131: array = UpgradeConstants.JES4_SILENT_INSTALL_COMPONENT_SRA
1132: .split(",");
1133: for (int i = 0; i < array.length; i++)
1134: componentsToInstall.add(array[i]);
1135: }
1136:
1137: if (GATEWAY_INSTALLED == true) {
1138: array = UpgradeConstants.JES4_SILENT_INSTALL_COMPONENT_GATEWAY
1139: .split(",");
1140: for (int i = 0; i < array.length; i++)
1141: componentsToInstall.add(array[i]);
1142: }
1143:
1144: if (NETLET_PROXY_INSTALLED == true) {
1145: array = UpgradeConstants.JES4_SILENT_INSTALL_COMPONENT_NETLET
1146: .split(",");
1147: for (int i = 0; i < array.length; i++)
1148: componentsToInstall.add(array[i]);
1149: }
1150:
1151: if (REWRITER_PROXY_INSTALLED == true) {
1152: array = UpgradeConstants.JES4_SILENT_INSTALL_COMPONENT_REWRITER
1153: .split(",");
1154: for (int i = 0; i < array.length; i++)
1155: componentsToInstall.add(array[i]);
1156: }
1157:
1158: //Start - L10N Code change
1159:
1160: boolean locale = false;
1161:
1162: if (PORTAL_L10N_INSTALLED == true) {
1163: locale = true;
1164: array = UpgradeConstants.JES4_SILENT_INSTALL_COMPONENT_PORTAL_SERVER_L10N
1165: .split(",");
1166: for (int i = 0; i < array.length; i++)
1167: componentsToInstall.add(array[i]);
1168: }
1169:
1170: if (SRA_L10N_INSTALLED == true) {
1171: locale = true;
1172: array = UpgradeConstants.JES4_SILENT_INSTALL_COMPONENT_SRA_L10N
1173: .split(",");
1174: for (int i = 0; i < array.length; i++)
1175: componentsToInstall.add(array[i]);
1176: }
1177:
1178: if (GATEWAY_L10N_INSTALLED == true) {
1179: locale = true;
1180: array = UpgradeConstants.JES4_SILENT_INSTALL_COMPONENT_GATEWAY_L10N
1181: .split(",");
1182: for (int i = 0; i < array.length; i++)
1183: componentsToInstall.add(array[i]);
1184: }
1185:
1186: if (NETLET_PROXY_L10N_INSTALLED == true) {
1187: locale = true;
1188: array = UpgradeConstants.JES4_SILENT_INSTALL_COMPONENT_NETLET_PROXY_L10N
1189: .split(",");
1190: for (int i = 0; i < array.length; i++)
1191: componentsToInstall.add(array[i]);
1192: }
1193:
1194: // Finish - L10N Code change
1195:
1196: String[] componentsName = (String[]) componentsToInstall
1197: .toArray(new String[componentsToInstall.size()]);
1198:
1199: String PSP_SELECTED_COMPONENTS = "PSP_SELECTED_COMPONENTS = ";
1200: for (int i = 0; i < componentsName.length; i++)
1201: PSP_SELECTED_COMPONENTS = PSP_SELECTED_COMPONENTS
1202: + componentsName[i] + ",";
1203: //Remove the last ",".
1204: PSP_SELECTED_COMPONENTS = PSP_SELECTED_COMPONENTS.substring(0,
1205: PSP_SELECTED_COMPONENTS.length() - 1);
1206: // Now write the components.
1207: FileUtil.replaceLineInFile(silentJESInstall,
1208: "PSP_SELECTED_COMPONENTS", PSP_SELECTED_COMPONENTS);
1209:
1210: // Start - L10N Code change
1211:
1212: // Make Locale True if any product found
1213:
1214: if (locale == true)
1215: FileUtil.replaceLineInFile(silentJESInstall, "LOCALE",
1216: "LOCALE = " + locale);
1217:
1218: // Finish - L10N Code change
1219:
1220: FileUtil.replaceLineInFile(silentJESInstall, "CMN_HOST_NAME",
1221: "CMN_HOST_NAME = " + HOST_NAME);
1222: FileUtil.replaceLineInFile(silentJESInstall, "CMN_IPADDRESS",
1223: "CMN_IPADDRESS = "
1224: + UpgradeUtils.getLocalSystemIPAddress());
1225: FileUtil.replaceLineInFile(silentJESInstall, "PS_SERVER_HOST",
1226: "PS_SERVER_HOST = " + HOST_NAME.split("\\.")[0] + ".");
1227: FileUtil.replaceLineInFile(silentJESInstall, "SRA_SERVER_HOST",
1228: "SRA_SERVER_HOST = " + HOST_NAME);
1229: FileUtil.replaceLineInFile(silentJESInstall,
1230: "CMN_PS_INSTALLDIR", "CMN_PS_INSTALLDIR = "
1231: + PS_BASEDIR);
1232: FileUtil.replaceLineInFile(silentJESInstall,
1233: "CMN_SRA_INSTALLDIR", "CMN_SRA_INSTALLDIR = "
1234: + PS_BASEDIR);
1235:
1236: // Now write the wizardID.
1237: File psinstallShFile = new File(RESOURCE_DIR + fs + ".." + fs
1238: + ".." + fs + ".." + fs + ".." + fs + ".." + fs + ".."
1239: + fs + "installer");
1240: String wizardId = UpgradeUtils
1241: .getJESInstallerWizardID(psinstallShFile);
1242: FileUtil.replaceTokenInFile(silentJESInstall, "WIZARD_ID",
1243: wizardId);
1244:
1245: }
1246:
1247: /**
1248: * Read an xml file into an xml document (org.jdom.Document) and return
1249: * the request attribute value, given an xpath.
1250: */
1251: public static String setAttributeValue(final File sXMLFile,
1252: String xpath, String attr, String val) throws IOException,
1253: JDOMException {
1254: String attrValue = "";
1255: String[] childElements = xpath.split("/");
1256:
1257: Document doc = null;
1258:
1259: SAXBuilder builder = new SAXBuilder();
1260: doc = builder.build(sXMLFile);
1261: Element rootElement = doc.getRootElement();
1262: Element rootElementCopy = rootElement;
1263:
1264: for (int i = 0; i < childElements.length; i++)
1265: rootElementCopy = rootElementCopy
1266: .getChild(childElements[i]);
1267:
1268: rootElementCopy.setAttribute(attr, val);
1269:
1270: XMLOutputter serializer = new XMLOutputter();
1271: serializer.output(doc, new FileWriter(sXMLFile));
1272: return attrValue;
1273: }
1274:
1275: public File generateConfigFile() {
1276: File configfile = null;
1277: String GW_NLP_RWPConfigPropFileDir = getGW_NLP_RWPPropertiesFileDir();
1278: try {
1279: configfile = FileUtil.extractFileFromJar(RESOURCE_DIR + fs
1280: + UpgradeConstants.RESOURCE_JAR,
1281: UpgradeConstants.PS_CONFIG_XML_FILE, DEBUG);
1282:
1283: logger.log(Level.INFO, "PSFB_CSPFUP0021", configfile
1284: .getAbsolutePath());
1285:
1286: //Set System Details
1287: logger.log(Level.INFO, "PSFB_CSPFUP0022", HOST_NAME);
1288: setAttributeValue(configfile, "Configure",
1289: "ConfigurationHostName", HOST_NAME);
1290: //Set the shared components for Linux. Default is for SunOS.
1291: setAttributeValue(configfile, "Configure/SharedComponents",
1292: "JavaHome", PS_JDKDIR);
1293: if (linuxOS == true) {
1294: setAttributeValue(configfile,
1295: "Configure/SharedComponents", "CacaoProdDir",
1296: "/opt/sun/cacao");
1297: setAttributeValue(configfile,
1298: "Configure/SharedComponents", "CacaoConfigDir",
1299: "/etc/opt/sun/cacao/instances/default");
1300: setAttributeValue(configfile,
1301: "Configure/SharedComponents", "SharedLibDir",
1302: "/opt/sun/share/lib");
1303: setAttributeValue(configfile,
1304: "Configure/SharedComponents", "PrivateLibDir",
1305: "/opt/sun/private/share/lib");
1306: setAttributeValue(configfile,
1307: "Configure/SharedComponents", "JDMKLibDir",
1308: "/opt/sun/jdmk/5.1/lib");
1309: setAttributeValue(configfile,
1310: "Configure/SharedComponents", "NSSLibDir",
1311: "/opt/sun/private/lib");
1312: setAttributeValue(configfile,
1313: "Configure/SharedComponents", "JSSJarDir",
1314: "/opt/sun/private/share/lib");
1315: setAttributeValue(configfile,
1316: "Configure/SharedComponents", "WebNFSLibDir",
1317: "/opt/sun/webnfs");
1318: setAttributeValue(configfile,
1319: "Configure/SharedComponents", "DerbyLibDir",
1320: "/opt/sun/javadb/lib");
1321: setAttributeValue(configfile,
1322: "Configure/SharedComponents", "AntHomeDir",
1323: "/opt/sun");
1324: setAttributeValue(configfile,
1325: "Configure/SharedComponents", "AntLibDir",
1326: "/opt/sun/share/lib");
1327: setAttributeValue(configfile,
1328: "Configure/SharedComponents", "RegistryLibDir",
1329: "/opt/sun/srvc-registry/lib");
1330: setAttributeValue(configfile,
1331: "Configure/SharedComponents", "MFWKLibDir",
1332: "/opt/sun/mfwk/share/lib");
1333: setAttributeValue(configfile,
1334: "Configure/SharedComponents", "JAXLibDir",
1335: "/opt/sun/share/lib");
1336:
1337: }
1338:
1339: //Set Access Manager Details
1340: String AMSDKDir = null;
1341: if (sunOS == true)
1342: AMSDKDir = "SUNWam";
1343: else if (linuxOS == true)
1344: AMSDKDir = "sun" + fs + "identity";
1345:
1346: setAttributeValue(configfile,
1347: "Configure/AccessManager/InstallationDirectory",
1348: "ProdDir", AM_BASEDIR + fs + AM_PRODUCT_DIR);
1349: setAttributeValue(configfile,
1350: "Configure/AccessManager/InstallationDirectory",
1351: "DataDir", AM_VAR_DIR + fs + "opt" + fs + AMSDKDir);
1352: setAttributeValue(configfile,
1353: "Configure/AccessManager/InstallationDirectory",
1354: "ConfigDir", AM_CONFIG_DIR + fs + "opt" + fs
1355: + AMSDKDir + fs + "config");
1356: setAttributeValue(configfile,
1357: "Configure/AccessManager/UserCredentials",
1358: "AdministratorUID", ADMIN_DN);
1359: setAttributeValue(configfile,
1360: "Configure/AccessManager/UserCredentials",
1361: "AdministratorUserPassword", IDSAME_ADMIN_PASSWORD);
1362: setAttributeValue(configfile,
1363: "Configure/AccessManager/UserCredentials",
1364: "LDAPUserId", "amldapuser");
1365: setAttributeValue(configfile,
1366: "Configure/AccessManager/UserCredentials",
1367: "LDAPUserIdPassword", IDSAME_LDAP_USER_PASSWORD);
1368: setAttributeValue(configfile,
1369: "Configure/AccessManager/UserCredentials",
1370: "DirectoryManagerDn", PS_DS_DIRMGR_DN);
1371: setAttributeValue(configfile,
1372: "Configure/AccessManager/UserCredentials",
1373: "DirectoryManagerPassword", DS_DIRMGR_PASSWORD);
1374:
1375: //Set Portal Installation directories Details
1376: setAttributeValue(
1377: configfile,
1378: "Configure/PortalConfiguration/InstallationDirectory",
1379: "ProdDir", PS_70_PRODUCT_DIR);
1380: setAttributeValue(
1381: configfile,
1382: "Configure/PortalConfiguration/InstallationDirectory",
1383: "DataDir", PS_70_DATA_DIR);
1384: setAttributeValue(
1385: configfile,
1386: "Configure/PortalConfiguration/InstallationDirectory",
1387: "ConfigDir", PS_70_CONFIG_DIR);
1388:
1389: //Set Component Selection Details
1390: if (PORTAL_INSTALLED == true || SRA_INSTALLED == true) {
1391: setAttributeValue(configfile,
1392: "Configure/PortalConfiguration/SearchServer",
1393: "SearchServerID", "UpgradedSearch");
1394:
1395: setAttributeValue(
1396: configfile,
1397: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1398: "Host", HOST_NAME);
1399: setAttributeValue(
1400: configfile,
1401: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1402: "Port", HOST_NAME_PORT);
1403: setAttributeValue(
1404: configfile,
1405: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1406: "Scheme", PS_PROTOCOL);
1407: setAttributeValue(
1408: configfile,
1409: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1410: "WebContainerInstallDir", PS_DEPLOY_PRODUCT_DIR);
1411: setAttributeValue(
1412: configfile,
1413: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1414: "WebContainerInstanceName", PS_DEPLOY_INSTANCE);
1415: if (PS_DEPLOY_TYPE.equals("IWS")) {
1416: if (psInstallationProps.getProperty(
1417: "upgradeOnWS70", "false").equalsIgnoreCase(
1418: "true"))
1419: setAttributeValue(
1420: configfile,
1421: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1422: "WebContainerInstanceDir",
1423: PS_DEPLOY_INSTANCE_DIR);
1424: else
1425: setAttributeValue(
1426: configfile,
1427: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1428: "WebContainerInstanceDir",
1429: PS_DEPLOY_PRODUCT_DIR + fs + "https-"
1430: + PS_DEPLOY_INSTANCE);
1431: } else {
1432: setAttributeValue(
1433: configfile,
1434: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1435: "WebContainerInstanceDir",
1436: PS_DEPLOY_INSTANCE_DIR);
1437: }
1438: setAttributeValue(
1439: configfile,
1440: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1441: "WebContainerDocRoot", PS_DEPLOY_DOCROOT);
1442: setAttributeValue(
1443: configfile,
1444: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1445: "WebContainerAdminHost", PS_DEPLOY_ADMIN_HOST);
1446: //PS7.0 upgrade: Don't add the Webcontainer port scheme and uid if it is WS 6.1
1447: //PS7.1 upgrade: Following is needed even for WS.
1448: //Don't add the Webcontainer port scheme and uid if it is WS 6.1
1449: Properties WCType = new Properties();
1450: WCType.setProperty("version", PS_PRODUCT_VERSION);
1451: WCType.setProperty("deployType", PS_DEPLOY_TYPE);
1452: WCType.setProperty("upgradeOnWS70", psInstallationProps
1453: .getProperty("upgradeOnWS70", "false"));
1454: if (!UpgradeUtils.getWebContainerType(WCType).equals(
1455: UpgradeConstants.WC_TYPE_S1WS6)) {
1456: setAttributeValue(
1457: configfile,
1458: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1459: "WebContainerAdminPort",
1460: PS_DEPLOY_ADMIN_PORT);
1461: setAttributeValue(
1462: configfile,
1463: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1464: "WebContainerAdminScheme",
1465: PS_DEPLOY_ADMIN_PROTOCOL);
1466: setAttributeValue(
1467: configfile,
1468: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1469: "WebContainerAdminUid", PS_DEPLOY_ADMIN);
1470: }
1471:
1472: setAttributeValue(
1473: configfile,
1474: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1475: "WebContainerAdminPassword",
1476: WEB_CONTAINER_ADMIN_PASSWORD);
1477: setAttributeValue(
1478: configfile,
1479: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1480: "WebContainerMasterPassword",
1481: WEB_CONTAINER_MASTER_PASSWORD);
1482: setAttributeValue(
1483: configfile,
1484: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1485: "WebContainerCertificateDBPassword",
1486: CERT_DB_PASSWORD);
1487: setAttributeValue(
1488: configfile,
1489: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1490: "WebContainerDomainName", PS_DEPLOY_DOMAIN);
1491: setAttributeValue(
1492: configfile,
1493: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1494: "WebContainerJDKDir", PS_DEPLOY_JDK_DIR);
1495: setAttributeValue(
1496: configfile,
1497: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1498: "WebContainerDeployCell", PS_DEPLOY_CELL);
1499: setAttributeValue(
1500: configfile,
1501: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1502: "WebContainerDeployNode", PS_DEPLOY_NODE);
1503: setAttributeValue(
1504: configfile,
1505: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1506: "WebContainerManagedServer",
1507: PS_DEPLOY_MANAGED_SERVER);
1508:
1509: setAttributeValue(
1510: configfile,
1511: "Configure/PortalConfiguration/SearchServer/WebContainerProperties",
1512: "WebContainerType", UpgradeUtils
1513: .getWebContainerType(WCType));
1514: setAttributeValue(configfile,
1515: "Configure/PortalConfiguration/PortalServer",
1516: "PortalID", "Upgraded");
1517: setAttributeValue(configfile,
1518: "Configure/PortalConfiguration/PortalServer",
1519: "SearchServerID", "UpgradedSearch");
1520: if (LOAD_BALANCER_URL == null
1521: || LOAD_BALANCER_URL.length() == 0) {
1522: LOAD_BALANCER_URL = PS_PROTOCOL + "://" + HOST_NAME
1523: + ":" + HOST_NAME_PORT + PS_DEPLOY_URI;
1524: }
1525: setAttributeValue(configfile,
1526: "Configure/PortalConfiguration/PortalServer",
1527: "PortalAccessURL", LOAD_BALANCER_URL);
1528: setAttributeValue(configfile,
1529: "Configure/PortalConfiguration/PortalServer",
1530: "PortalWebappURI", PS_DEPLOY_URI);
1531:
1532: setAttributeValue(
1533: configfile,
1534: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1535: "Host", HOST_NAME);
1536: setAttributeValue(
1537: configfile,
1538: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1539: "Port", HOST_NAME_PORT);
1540: setAttributeValue(
1541: configfile,
1542: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1543: "Scheme", PS_PROTOCOL);
1544: setAttributeValue(
1545: configfile,
1546: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1547: "WebContainerInstallDir", PS_DEPLOY_PRODUCT_DIR);
1548: setAttributeValue(
1549: configfile,
1550: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1551: "WebContainerInstanceName", PS_DEPLOY_INSTANCE);
1552: setAttributeValue(
1553: configfile,
1554: "Configure/PortalConfiguration/PortalServer/Instance",
1555: "InstanceID", PORTAL_INSTANCE_ID);
1556:
1557: if (PS_DEPLOY_TYPE.equals("IWS")) {
1558: if (psInstallationProps.getProperty(
1559: "upgradeOnWS70", "false").equalsIgnoreCase(
1560: "true"))
1561: setAttributeValue(
1562: configfile,
1563: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1564: "WebContainerInstanceDir",
1565: PS_DEPLOY_INSTANCE_DIR);
1566: else
1567: setAttributeValue(
1568: configfile,
1569: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1570: "WebContainerInstanceDir",
1571: PS_DEPLOY_PRODUCT_DIR + fs + "https-"
1572: + PS_DEPLOY_INSTANCE);
1573: } else {
1574: setAttributeValue(
1575: configfile,
1576: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1577: "WebContainerInstanceDir",
1578: PS_DEPLOY_INSTANCE_DIR);
1579: }
1580: setAttributeValue(
1581: configfile,
1582: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1583: "WebContainerDocRoot", PS_DEPLOY_DOCROOT);
1584: setAttributeValue(
1585: configfile,
1586: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1587: "WebContainerAdminHost", PS_DEPLOY_ADMIN_HOST);
1588:
1589: //Don't add the Webcontainer port scheme and uid if it is WS 6.1
1590: if (!UpgradeUtils.getWebContainerType(WCType).equals(
1591: UpgradeConstants.WC_TYPE_S1WS6)) {
1592: setAttributeValue(
1593: configfile,
1594: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1595: "WebContainerAdminPort",
1596: PS_DEPLOY_ADMIN_PORT);
1597: setAttributeValue(
1598: configfile,
1599: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1600: "WebContainerAdminScheme",
1601: PS_DEPLOY_ADMIN_PROTOCOL);
1602: setAttributeValue(
1603: configfile,
1604: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1605: "WebContainerAdminUid", PS_DEPLOY_ADMIN);
1606: }
1607:
1608: setAttributeValue(
1609: configfile,
1610: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1611: "WebContainerAdminPassword",
1612: WEB_CONTAINER_ADMIN_PASSWORD);
1613: setAttributeValue(
1614: configfile,
1615: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1616: "WebContainerMasterPassword",
1617: WEB_CONTAINER_MASTER_PASSWORD);
1618: setAttributeValue(
1619: configfile,
1620: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1621: "WebContainerCertificateDBPassword",
1622: CERT_DB_PASSWORD);
1623: setAttributeValue(
1624: configfile,
1625: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1626: "WebContainerDomainName", PS_DEPLOY_DOMAIN);
1627:
1628: setAttributeValue(
1629: configfile,
1630: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1631: "WebContainerJDKDir", PS_DEPLOY_JDK_DIR);
1632: setAttributeValue(
1633: configfile,
1634: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1635: "WebContainerDeployCell", PS_DEPLOY_CELL);
1636: setAttributeValue(
1637: configfile,
1638: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1639: "WebContainerDeployNode", PS_DEPLOY_NODE);
1640: setAttributeValue(
1641: configfile,
1642: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1643: "WebContainerManagedServer",
1644: PS_DEPLOY_MANAGED_SERVER);
1645:
1646: setAttributeValue(
1647: configfile,
1648: "Configure/PortalConfiguration/PortalServer/Instance/WebContainerProperties",
1649: "WebContainerType", UpgradeUtils
1650: .getWebContainerType(WCType));
1651: }
1652:
1653: if (SRA_INSTALLED == true) {
1654: setAttributeValue(
1655: configfile,
1656: "Configure/PortalConfiguration/SecureRemoteAccessCore",
1657: "GatewayProtocol", SRA_GW_PROTOCOL);
1658: setAttributeValue(
1659: configfile,
1660: "Configure/PortalConfiguration/SecureRemoteAccessCore",
1661: "PortalServerDomain", SRA_SERVER_DOMAIN);
1662: setAttributeValue(
1663: configfile,
1664: "Configure/PortalConfiguration/SecureRemoteAccessCore",
1665: "GatewayPort", SRA_GW_PORT);
1666: setAttributeValue(
1667: configfile,
1668: "Configure/PortalConfiguration/SecureRemoteAccessCore",
1669: "GatewayProfileName", SRA_GATEWAY_PROFILE);
1670: setAttributeValue(
1671: configfile,
1672: "Configure/PortalConfiguration/SecureRemoteAccessCore",
1673: "LogUserPassword", SRA_LOG_USER_PASSWORD);
1674: setAttributeValue(
1675: configfile,
1676: "Configure/PortalConfiguration/SecureRemoteAccessCore",
1677: "SRAStatus", "on");
1678: }
1679: if (GATEWAY_INSTALLED == true) {
1680: if (PORTAL_INSTALLED == false)
1681: setAttributeValue(
1682: configfile,
1683: "Configure/PortalConfiguration/PortalServer",
1684: "PortalAccessURL", LOAD_BALANCER_URL);
1685: platformConfs = UpgradeUtils
1686: .returnFileListHavingPattern(
1687: GW_NLP_RWPConfigPropFileDir,
1688: "^platform.conf.\\w*$");
1689: UpgradeUtils.addSRAElementNodes(configfile,
1690: "Configure/PortalConfiguration", "Gateway",
1691: platformConfs, SRA_LOG_USER_PASSWORD,
1692: UpgradeUtils
1693: .getStartInstanceStatus(START_GATEWAY));
1694: }
1695: if (NETLET_PROXY_INSTALLED == true) {
1696: if (PORTAL_INSTALLED == false)
1697: setAttributeValue(
1698: configfile,
1699: "Configure/PortalConfiguration/PortalServer",
1700: "PortalAccessURL", LOAD_BALANCER_URL);
1701:
1702: String[] platformConfs = UpgradeUtils
1703: .returnFileListHavingPattern(
1704: GW_NLP_RWPConfigPropFileDir,
1705: "^platform.conf.\\w*$");
1706: UpgradeUtils
1707: .addSRAElementNodes(
1708: configfile,
1709: "Configure/PortalConfiguration",
1710: "NetletProxy",
1711: platformConfs,
1712: SRA_LOG_USER_PASSWORD,
1713: UpgradeUtils
1714: .getStartInstanceStatus(START_NETLETPROXY));
1715: }
1716:
1717: if (REWRITER_PROXY_INSTALLED == true) {
1718: if (PORTAL_INSTALLED == false)
1719: setAttributeValue(
1720: configfile,
1721: "Configure/PortalConfiguration/PortalServer",
1722: "PortalAccessURL", LOAD_BALANCER_URL);
1723:
1724: String[] platformConfs = UpgradeUtils
1725: .returnFileListHavingPattern(
1726: GW_NLP_RWPConfigPropFileDir,
1727: "^platform.conf.\\w*$");
1728: UpgradeUtils
1729: .addSRAElementNodes(
1730: configfile,
1731: "Configure/PortalConfiguration",
1732: "RewriterProxy",
1733: platformConfs,
1734: SRA_LOG_USER_PASSWORD,
1735: UpgradeUtils
1736: .getStartInstanceStatus(START_REWRITERPROXY));
1737: }
1738:
1739: if (REWRITER_PROXY_INSTALLED == true
1740: || NETLET_PROXY_INSTALLED == true
1741: || GATEWAY_INSTALLED == true) {
1742: UpgradeUtils.addSRACertificateInfoElement(configfile,
1743: "Configure/PortalConfiguration", CERT_INFO,
1744: CERT_DB_PASSWORD);
1745: }
1746:
1747: } catch (Exception e) {
1748: System.out.println(e);
1749: }
1750:
1751: return configfile;
1752: }
1753:
1754: public void setRunMode(boolean test) {
1755: testRunMode = test;
1756: }
1757:
1758: public void init(File initfile) throws UpgradeException {
1759:
1760: if (testRunMode == true) {
1761: initPasswords(initfile);
1762: }
1763:
1764: System.out.println("Gathering system details...");
1765: System.out.println("Checking for installed components...");
1766: System.out.println("....................................\n");
1767: logger.log(Level.INFO, "PSFB_CSPFUP0023");
1768:
1769: //Load OS specific commands.
1770: //Load package and patches list.
1771: //Load readme text.
1772: // File ex1=FileUtil.extractFileFromJar("upgraderesource.jar", "meta/osutils.txt");
1773: // Properties osCommands=new Properties();
1774: // osCommands.load(new FileInputStream(ex1));
1775: /* ExecuteUtil execUtil=new ExecuteUtil(Logger.getLogger("test"));
1776: String command=osCommands.getProperty("LS.windows");
1777: System.out.println(command);
1778: execUtil.storeOutput(true);
1779: execUtil.exec(command, args);
1780: String outputNeeded="";
1781: String output=execUtil.getOutput();
1782: System.out.println(output);
1783: */
1784:
1785: checkPortalServerInstalledComponents();
1786:
1787: //Obtain the Portal Installation details.
1788: initPortalInstallationDetails();
1789: //Obtain the AMSDK Installation details.
1790: initAMConfigDetails();
1791: if (PS_DS_SSL_ENABLED.equalsIgnoreCase("true"))
1792: UpgradeUtils.setSSLLDAPConnection(true);
1793: //We need the ORG_DN
1794: psInstallationProps.setProperty("ORG_DN", ORG_DN);
1795:
1796: //Set what is installed.
1797:
1798: //Set any properties we want to use in Ant's properties file or else where.
1799: psInstallationProps.setProperty("ADMIN_DN", ADMIN_DN);
1800: psInstallationProps.setProperty("PS_70_PRODUCT_DIR",
1801: PS_70_PRODUCT_DIR);
1802: //No webcontainer password for GW,NLP and RWP.
1803: //Portal Serrver7.1 works with
1804: if ((PORTAL_INSTALLED || SRA_INSTALLED)
1805: && (PS_DEPLOY_TYPE.equals("IWS") || PS_DEPLOY_TYPE
1806: .equals("SJSWS6"))) {
1807: System.out
1808: .println("Portal Server is installed on SunOne WebServer 6.x ");
1809: boolean ws70Installed = UpgradeUtils
1810: .isWebServer70Installed();
1811: if (ws70Installed == true) {
1812: String upgradePSOnWS7Str = UpgradeUtils
1813: .readInput("Detected Sun Java System Web Server 7.0 installation.\n"
1814: + "Upgrade Portal Server on Web Server 7.0 [y] : ");
1815:
1816: if (upgradePSOnWS7Str == null
1817: || upgradePSOnWS7Str.equals(""))
1818: upgradePSOnWS7Str = "y";
1819: boolean upgradePSOnWS7 = (upgradePSOnWS7Str
1820: .equalsIgnoreCase("y") ? true : false);
1821: psInstallationProps.setProperty("upgradeOnWS70", ""
1822: + upgradePSOnWS7);
1823: if (upgradePSOnWS7 == true) {
1824: boolean WS7_DEPLOY_ADMIN_PORT_SECURE = false;
1825: PS_DEPLOY_PRODUCT_DIR = UpgradeUtils
1826: .readInput("Please enter the Web Container 7.0 Install Directory : ");
1827: PS_DEPLOY_INSTANCE = UpgradeUtils
1828: .readInput("Please enter the Web Container Virtual Server Instance Name : ");
1829: PS_DEPLOY_INSTANCE_DIR = UpgradeUtils
1830: .readInput("Please enter the Web Container Instance Directory : ");
1831: HOST_NAME_PORT = UpgradeUtils
1832: .readInput("Please enter the Web Container Instance Port : ");
1833: PS_PROTOCOL = UpgradeUtils
1834: .readInput("Please enter the Web Container Instance Protocol : ");
1835: PS_DEPLOY_DOMAIN = UpgradeUtils
1836: .readInput("Please enter the Web Container config name : ");
1837: PS_DEPLOY_DOCROOT = UpgradeUtils
1838: .readInput("Please enter the Web Container Docs root directory : ");
1839: PS_DEPLOY_ADMIN_HOST = UpgradeUtils
1840: .readInput("Please enter the Web Container Admin Hostname : ");
1841: PS_DEPLOY_ADMIN_PORT = UpgradeUtils
1842: .readInput("Please enter the Web Container Admin Port : ");
1843: PS_DEPLOY_ADMIN_PROTOCOL = UpgradeUtils
1844: .readInput("Please enter the Web Container Admin Protocol : ");
1845: PS_DEPLOY_ADMIN = UpgradeUtils
1846: .readInput("Please enter the Web Container Admin UserID : ");
1847:
1848: //Don't ask password for testing purpose.
1849: if (testRunMode == false)
1850: WEB_CONTAINER_ADMIN_PASSWORD = UpgradeUtils
1851: .readPassword("Please enter the Web Container Admin password : ");
1852: if (WEB_CONTAINER_ADMIN_PASSWORD == null)
1853: WEB_CONTAINER_ADMIN_PASSWORD = "";
1854: //PS_DEPLOY_DOCROOT=UpgradeUtils.readInput("Please enter the Web Container docs root directory : ");
1855: psInstallationProps
1856: .setProperty(
1857: UpgradeConstants.WEB_CONTAINER_ADMIN_PASSWORD_STR,
1858: WEB_CONTAINER_ADMIN_PASSWORD);
1859:
1860: // wcAttributes.setProperty(InstanceAttributes.WEB_CONTAINER_ADMIN_PASSWORD,WEB_CONTAINER_ADMIN_PASSWORD);
1861:
1862: psInstallationProps.setProperty(
1863: "WS7_DEPLOY_PRODUCT_DIR",
1864: PS_DEPLOY_PRODUCT_DIR);
1865: psInstallationProps.setProperty(
1866: "WS7_DEPLOY_CONFIG_NAME", PS_DEPLOY_DOMAIN);
1867: psInstallationProps.setProperty(
1868: "WS7_DEPLOY_INSTANCE", PS_DEPLOY_INSTANCE);
1869: psInstallationProps.setProperty(
1870: "WS7_DEPLOY_INSTANCE_DIR",
1871: PS_DEPLOY_INSTANCE_DIR);
1872: psInstallationProps.setProperty(
1873: "WS7_DEPLOY_ADMIN_HOST",
1874: PS_DEPLOY_ADMIN_HOST);
1875: psInstallationProps.setProperty(
1876: "WS7_DEPLOY_ADMIN_PORT",
1877: PS_DEPLOY_ADMIN_PORT);
1878: psInstallationProps.setProperty("WS7_DEPLOY_ADMIN",
1879: PS_DEPLOY_ADMIN);
1880:
1881: if (PS_DEPLOY_ADMIN_PROTOCOL.equals("https"))
1882: WS7_DEPLOY_ADMIN_PORT_SECURE = true;
1883: psInstallationProps.setProperty(
1884: "WS7_DEPLOY_ADMIN_PORT_SECURE", ""
1885: + WS7_DEPLOY_ADMIN_PORT_SECURE);
1886: try {
1887: String WS7PasswordFile = createWS7PasswordFile(WEB_CONTAINER_ADMIN_PASSWORD);
1888: psInstallationProps.setProperty(
1889: "WS7_WEB_CONTAINER_PASSWORD_FILE",
1890: WS7PasswordFile);
1891: } catch (Exception e) {
1892: throw new UpgradeException(
1893: "Unable to create WS7 admin password file.");
1894: }
1895:
1896: }
1897: }
1898: }
1899:
1900: //If deploy type is AS7.0, then create the master password file and set Masterpassword file location.
1901: if ((PORTAL_INSTALLED || SRA_INSTALLED)
1902: && PS_DEPLOY_TYPE.equals("SUNONE")) {
1903: try {
1904: System.out
1905: .println("Portal Server is installed on Sun Java System Application Server 7.0.");
1906: PS_DEPLOY_PRODUCT_DIR = UpgradeUtils
1907: .readInput("Please enter the Web Container Install Directory : ");
1908: PS_DEPLOY_PRODUCT_DIR += "/appserver";
1909: PS_DEPLOY_INSTANCE_DIR = UpgradeUtils
1910: .readInput("Please enter the Portal Instance deploy Directory : ");
1911: PS_DEPLOY_INSTANCE = UpgradeUtils
1912: .readInput("Please enter the Web Container Instance Name : ");
1913: HOST_NAME_PORT = UpgradeUtils
1914: .readInput("Please enter the Web Container Instance Port : ");
1915: PS_PROTOCOL = UpgradeUtils
1916: .readInput("Please enter the Web Container Instance Protocol : ");
1917: PS_DEPLOY_DOMAIN = UpgradeUtils
1918: .readInput("Please enter the Web Container Domain name : ");
1919: PS_DEPLOY_DOCROOT = UpgradeUtils
1920: .readInput("Please enter the Web Container Docs root directory : ");
1921: PS_DEPLOY_ADMIN_HOST = UpgradeUtils
1922: .readInput("Please enter the Web Container Admin Hostname : ");
1923: PS_DEPLOY_ADMIN_PORT = UpgradeUtils
1924: .readInput("Please enter the Web Container Admin Port : ");
1925: PS_DEPLOY_ADMIN_PROTOCOL = UpgradeUtils
1926: .readInput("Please enter the Web Container Admin Protocol : ");
1927: PS_DEPLOY_ADMIN = UpgradeUtils
1928: .readInput("Please enter the Web Container Admin UserID : ");
1929:
1930: //Don't ask password for Test mode
1931: if (testRunMode == false)
1932: WEB_CONTAINER_ADMIN_PASSWORD = UpgradeUtils
1933: .readPassword("Please enter the Web Container Admin password : ");
1934: if (WEB_CONTAINER_ADMIN_PASSWORD == null)
1935: WEB_CONTAINER_ADMIN_PASSWORD = "";
1936: psInstallationProps
1937: .setProperty(
1938: UpgradeConstants.WEB_CONTAINER_ADMIN_PASSWORD_STR,
1939: WEB_CONTAINER_ADMIN_PASSWORD);
1940:
1941: //Don't ask password for Test mode
1942: if (testRunMode == false)
1943: WEB_CONTAINER_MASTER_PASSWORD = UpgradeUtils
1944: .readPassword("Please enter the Web Container Master password : ");
1945: if (WEB_CONTAINER_MASTER_PASSWORD == null)
1946: WEB_CONTAINER_MASTER_PASSWORD = "";
1947: psInstallationProps.setProperty(
1948: "WEB_CONTAINER_MASTER_PASSWORD",
1949: WEB_CONTAINER_MASTER_PASSWORD);
1950: String masterFilePath = createASPasswordFile();
1951: psInstallationProps.setProperty(
1952: "WEB_CONTAINER_MASTER_PASSWORD_FILE",
1953: masterFilePath);
1954:
1955: } catch (IOException e) {
1956: logger.log(Level.SEVERE, "PSFB_CSPFUP0024", e);
1957: throw new UpgradeException(
1958: "Unable to create AS 8.1 master password file.");
1959: }
1960: }
1961:
1962: //If deploy type is AS8.1, then create the master password file and set Masterpassword file location.
1963: if ((PORTAL_INSTALLED || SRA_INSTALLED)
1964: && PS_DEPLOY_TYPE.equals("SUNONE8")) {
1965: try {
1966: System.out
1967: .println("Portal Server is installed on Sun Java System Application Server.");
1968: //Don't ask password for Test mode
1969: if (testRunMode == false)
1970: WEB_CONTAINER_ADMIN_PASSWORD = UpgradeUtils
1971: .readPassword("Please enter the Web Container Admin password : ");
1972: if (WEB_CONTAINER_ADMIN_PASSWORD == null)
1973: WEB_CONTAINER_ADMIN_PASSWORD = "";
1974: psInstallationProps
1975: .setProperty(
1976: UpgradeConstants.WEB_CONTAINER_ADMIN_PASSWORD_STR,
1977: WEB_CONTAINER_ADMIN_PASSWORD);
1978:
1979: //Don't ask password for Test mode
1980: if (testRunMode == false)
1981: WEB_CONTAINER_MASTER_PASSWORD = UpgradeUtils
1982: .readPassword("Please enter the Web Container Master password : ");
1983: if (WEB_CONTAINER_MASTER_PASSWORD == null)
1984: WEB_CONTAINER_MASTER_PASSWORD = "";
1985: psInstallationProps.setProperty(
1986: "WEB_CONTAINER_MASTER_PASSWORD",
1987: WEB_CONTAINER_MASTER_PASSWORD);
1988: // wcAttributes.setProperty("WebContainerMasterPassword",WEB_CONTAINER_MASTER_PASSWORD);
1989: String masterFilePath = createASPasswordFile();
1990: psInstallationProps.setProperty(
1991: "WEB_CONTAINER_MASTER_PASSWORD_FILE",
1992: masterFilePath);
1993: } catch (IOException e) {
1994: logger.log(Level.SEVERE, "PSFB_CSPFUP0025", e);
1995: throw new UpgradeException(
1996: "Unable to create AS 8.1 master password file.");
1997: }
1998: }
1999:
2000: if ((PORTAL_INSTALLED || SRA_INSTALLED)
2001: && PS_DEPLOY_TYPE.equals("WEBSPHERE")) {
2002: System.out
2003: .println("Portal Server is installed on IBM Websphere Application Server.");
2004: String wasJACLFilePath = "";
2005:
2006: //Don't ask password for Test mode
2007: if (testRunMode == false)
2008: WEB_CONTAINER_ADMIN_PASSWORD = UpgradeUtils
2009: .readPassword("Please enter the Web Container Admin password : ");
2010: if (WEB_CONTAINER_ADMIN_PASSWORD == null)
2011: WEB_CONTAINER_ADMIN_PASSWORD = "";
2012: psInstallationProps.setProperty(
2013: UpgradeConstants.WEB_CONTAINER_ADMIN_PASSWORD_STR,
2014: WEB_CONTAINER_ADMIN_PASSWORD);
2015:
2016: try {
2017: wasJACLFilePath = createWebSphereUndeployFile();
2018: } catch (IOException e) {
2019: logger.log(Level.SEVERE, "PSFB_CSPFUP0026", e);
2020: throw new UpgradeException(
2021: "Unable to create Websphere jacl file for undeploy.");
2022: }
2023: psInstallationProps.setProperty("UNDEPL0Y_JACL_FILE",
2024: wasJACLFilePath);
2025: }
2026:
2027: if ((PORTAL_INSTALLED || SRA_INSTALLED)
2028: && PS_DEPLOY_TYPE.equals("WEBLOGIC")) {
2029: try {
2030: System.out
2031: .println("Portal Server is installed on BEA Weblogic Server.");
2032: logger.log(Level.INFO, "PSFB_CSPFUP0027");
2033:
2034: //Don't ask password for Test mode
2035: if (testRunMode == false)
2036: WEB_CONTAINER_ADMIN_PASSWORD = UpgradeUtils
2037: .readPassword("Please enter the Web Container Admin password : ");
2038: while (WEB_CONTAINER_ADMIN_PASSWORD == null)
2039: WEB_CONTAINER_ADMIN_PASSWORD = UpgradeUtils
2040: .readPassword("Please enter the Web Container Admin password : ");
2041: psInstallationProps
2042: .setProperty(
2043: UpgradeConstants.WEB_CONTAINER_ADMIN_PASSWORD_STR,
2044: WEB_CONTAINER_ADMIN_PASSWORD);
2045: } catch (Exception e) {
2046: logger.log(Level.SEVERE, "PSFB_CSPFUP0028", e);
2047: throw new UpgradeException(
2048: "Unable to set BEA Admin password");
2049: }
2050: }
2051:
2052: if (SRA_INSTALLED || GATEWAY_INSTALLED
2053: || NETLET_PROXY_INSTALLED || REWRITER_PROXY_INSTALLED) {
2054:
2055: //Don't ask password for Test mode
2056: if (testRunMode == false)
2057: SRA_LOG_USER_PASSWORD = UpgradeUtils
2058: .readPassword("Please enter the SRA Log user password : ");
2059: psInstallationProps.setProperty("CERT_DB_PASSWORD",
2060: CERT_DB_PASSWORD);
2061: psInstallationProps.setProperty("SRA_LOG_USER_PASSWORD",
2062: SRA_LOG_USER_PASSWORD);
2063: }
2064:
2065: //dpadmin command now requires monitoring jars.
2066: //Set them in upgrade.properties so that it is available in upgrade.xml
2067: String monitoringLibDir = sunOS ? "/opt/SUNWmfwk/lib"
2068: : "/opt/sun/mfwk/share/lib";
2069: psInstallationProps.setProperty("MFWKLibDir", monitoringLibDir);
2070:
2071: // Check we atleast have one constituient of Portal Server installation
2072: if (!(PORTAL_INSTALLED || SRA_INSTALLED || GATEWAY_INSTALLED
2073: || NETLET_PROXY_INSTALLED || REWRITER_PROXY_INSTALLED)) {
2074: logger.log(Level.SEVERE, "PSFB_CSPFUP0008");
2075: System.out
2076: .println("Portal Server installation not detected. Nothing to upgrade!!");
2077: System.exit(0);
2078: }
2079:
2080: //Gateway only installation does not have the directory server DN stored any where . So ask it from the user.
2081: if (!(PORTAL_INSTALLED)
2082: && (GATEWAY_INSTALLED || NETLET_PROXY_INSTALLED || REWRITER_PROXY_INSTALLED)) {
2083: PS_DS_DIRMGR_DN = UpgradeUtils
2084: .readInput("Please enter the Directory Server Admin DN [cn=Directory Manager] :");
2085: if (PS_DS_DIRMGR_DN == null || PS_DS_DIRMGR_DN.equals(""))
2086: PS_DS_DIRMGR_DN = "cn=Directory Manager";
2087: //ps.psInstallationProps.setProperty(UpgradeConstants.PS_DS_DIRMGR_DN,PS_DS_DIRMGR_DN);
2088:
2089: while (DS_DIRMGR_PASSWORD == null
2090: || DS_DIRMGR_PASSWORD.equals("")) {
2091: //Resolved Bug Id 6441440 on June26,2006
2092: DS_DIRMGR_PASSWORD = UpgradeUtils
2093: .readPassword("Please enter the Directory Manager("
2094: + PS_DS_DIRMGR_DN + ") password :");
2095: psInstallationProps.setProperty(
2096: UpgradeConstants.DS_DIRMGR_PASSWORD_STR,
2097: DS_DIRMGR_PASSWORD);
2098: }
2099: }
2100:
2101: //Don't ask password for Test mode
2102: if (testRunMode == false) {
2103:
2104: while (DS_DIRMGR_PASSWORD == null
2105: || DS_DIRMGR_PASSWORD.equals("")) {
2106: DS_DIRMGR_PASSWORD = UpgradeUtils
2107: .readPassword("Please enter the Directory Manager password : ");
2108: psInstallationProps.setProperty(
2109: UpgradeConstants.DS_DIRMGR_PASSWORD_STR,
2110: DS_DIRMGR_PASSWORD);
2111: }
2112: while (IDSAME_ADMIN_PASSWORD == null
2113: || IDSAME_ADMIN_PASSWORD.equals("")) {
2114: IDSAME_ADMIN_PASSWORD = UpgradeUtils
2115: .readPassword("Please enter the Access Manager Admin password : ");
2116: psInstallationProps.setProperty(
2117: UpgradeConstants.IDSAME_ADMIN_PASSWORD_STR,
2118: IDSAME_ADMIN_PASSWORD);
2119:
2120: }
2121: while (IDSAME_LDAP_USER_PASSWORD == null
2122: || IDSAME_LDAP_USER_PASSWORD.equals("")) {
2123: IDSAME_LDAP_USER_PASSWORD = UpgradeUtils
2124: .readPassword("Please enter the Directory Server ldapuser password : ");
2125: psInstallationProps.setProperty(
2126: UpgradeConstants.IDSAME_LDAP_USER_PASSWORD_STR,
2127: IDSAME_LDAP_USER_PASSWORD);
2128: }
2129: }//Test passwords input complete.
2130: if (PORTAL_INSTALLED == true) {
2131: wcAttributes = SetwcAttributes(psInstallationProps);
2132: }
2133: PORTAL_INSTANCE_ID = UpgradeUtils
2134: .readInput("Please enter a Portal Instance Id : ");
2135: }
2136:
2137: public void checkPortalServerInstalledComponents() {
2138: //TODO: Obtain this list from upgraderesourcejar's package list.
2139: if (sunOS == true) {
2140: PORTAL_INSTALLED = UpgradeUtils
2141: .isPackageInstalled("SUNWps");
2142: SRA_INSTALLED = UpgradeUtils.isPackageInstalled("SUNWpsnf");
2143: GATEWAY_INSTALLED = UpgradeUtils
2144: .isPackageInstalled("SUNWpsgw");
2145: NETLET_PROXY_INSTALLED = UpgradeUtils
2146: .isPackageInstalled("SUNWpsnlp");
2147: REWRITER_PROXY_INSTALLED = UpgradeUtils
2148: .isPackageInstalled("SUNWpsrwp");
2149: } else if (linuxOS == true) {
2150: PORTAL_INSTALLED = UpgradeUtils
2151: .isRPMInstalled("sun-portal-core");
2152: SRA_INSTALLED = UpgradeUtils
2153: .isRPMInstalled("sun-portal-netfile");
2154: GATEWAY_INSTALLED = UpgradeUtils
2155: .isRPMInstalled("sun-portal-gateway");
2156: NETLET_PROXY_INSTALLED = UpgradeUtils
2157: .isRPMInstalled("sun-portal-netletproxy");
2158: REWRITER_PROXY_INSTALLED = UpgradeUtils
2159: .isRPMInstalled("sun-portal-rewriterproxy");
2160: }
2161:
2162: // Start - L10N Code change
2163:
2164: // L10N Component check
2165: PORTAL_L10N_INSTALLED = isL10nInstalled("portal");
2166: SRA_L10N_INSTALLED = isL10nInstalled("sra");
2167: GATEWAY_L10N_INSTALLED = isL10nInstalled("gateway");
2168: NETLET_PROXY_L10N_INSTALLED = isL10nInstalled("netletproxy");
2169: REWRITER_PROXY_L10N_INSTALLED = isL10nInstalled("rewriterproxy");
2170:
2171: //Initalizing Upgrade constant static variable PORTAL_L10N_INSTALLED to use during display profile update operation
2172: UpgradeConstants.PORTAL_L10N_INSTALLED = this .PORTAL_L10N_INSTALLED;
2173:
2174: // Finish - L10N Code change
2175:
2176: if (PORTAL_INSTALLED) {
2177: System.out.println("Detected Portal Installation.");
2178: logger.log(Level.INFO, "PSFB_CSPFUP0029");
2179: psInstallationProps.setProperty("PORTAL_INSTALLED", ""
2180: + PORTAL_INSTALLED);
2181: }
2182: if (SRA_INSTALLED) {
2183: System.out.println("Detected SRA Installation.");
2184: logger.log(Level.INFO, "PSFB_CSPFUP0030");
2185: psInstallationProps.setProperty("SRA_INSTALLED", ""
2186: + SRA_INSTALLED);
2187: }
2188: if (GATEWAY_INSTALLED) {
2189: System.out.println("Detected Gateway Installation.");
2190: logger.log(Level.INFO, "PSFB_CSPFUP0031");
2191: psInstallationProps.setProperty("GATEWAY_INSTALLED", ""
2192: + GATEWAY_INSTALLED);
2193: }
2194: if (NETLET_PROXY_INSTALLED) {
2195: System.out.println("Detected Netlet Proxy Installation.");
2196: logger.log(Level.INFO, "PSFB_CSPFUP0032");
2197: psInstallationProps.setProperty("NETLET_PROXY_INSTALLED",
2198: "" + NETLET_PROXY_INSTALLED);
2199: }
2200: if (REWRITER_PROXY_INSTALLED) {
2201: System.out.println("Detected Rewriter Proxy Installation.");
2202: logger.log(Level.INFO, "PSFB_CSPFUP0033");
2203: psInstallationProps.setProperty("REWRITER_PROXY_INSTALLED",
2204: "" + REWRITER_PROXY_INSTALLED);
2205: }
2206:
2207: // Start - L10N Code change
2208:
2209: if (PORTAL_L10N_INSTALLED) {
2210: System.out
2211: .println("Detected Portal Localized Installation.");
2212: logger.log(Level.INFO, "PSFB_CSPFUP0146");
2213: psInstallationProps.setProperty("PORTAL_L10N_INSTALLED", ""
2214: + PORTAL_L10N_INSTALLED);
2215: }
2216: if (SRA_L10N_INSTALLED) {
2217: System.out.println("Detected SRA Localized Installation.");
2218: logger.log(Level.INFO, "PSFB_CSPFUP0147");
2219: psInstallationProps.setProperty("SRA_L10N_INSTALLED", ""
2220: + SRA_L10N_INSTALLED);
2221: }
2222: if (GATEWAY_L10N_INSTALLED) {
2223: System.out
2224: .println("Detected Gateway Localized Installation.");
2225: logger.log(Level.INFO, "PSFB_CSPFUP0148");
2226: psInstallationProps.setProperty("GATEWAY_L10N_INSTALLED",
2227: "" + GATEWAY_L10N_INSTALLED);
2228: }
2229: if (NETLET_PROXY_L10N_INSTALLED) {
2230: System.out
2231: .println("Detected Netlet Proxy Localized Installation.");
2232: logger.log(Level.INFO, "PSFB_CSPFUP0149");
2233: psInstallationProps.setProperty(
2234: "NETLET_PROXY_L10N_INSTALLED", ""
2235: + NETLET_PROXY_L10N_INSTALLED);
2236: }
2237: if (REWRITER_PROXY_L10N_INSTALLED) {
2238: System.out
2239: .println("Detected Rewriter Proxy Localized Installation.");
2240: logger.log(Level.INFO, "PSFB_CSPFUP0150");
2241: psInstallationProps.setProperty(
2242: "REWRITER_PROXY_L10N_INSTALLED", ""
2243: + REWRITER_PROXY_L10N_INSTALLED);
2244: }
2245:
2246: // Finish - L10N Code change
2247:
2248: }
2249:
2250: public void preupgrade() throws UpgradeException {
2251:
2252: //Check prerequistes
2253: //Check if the required servers are running.
2254: checkPreRequisites();
2255: String psBaseDir = File.separator + "opt";
2256: if (!(PS_BASEDIR.equals(psBaseDir)))
2257: removeSUNWebNFS();
2258: Vector v = new Vector();
2259:
2260: //Create neccessary JES Silent installer file and config file.
2261: createJESSilentInstallFile();
2262: configFile = generateConfigFile();
2263: if (DEBUG == true)
2264: System.out.println("The config file is created at "
2265: + configFile.getAbsoluteFile());
2266: setPSConfigSchemaLocation(configFile);
2267: removeUninstalledComponents(configFile);
2268:
2269: prepareUpgradePropertiesFile();
2270: prepareUpgradeAntFile();
2271:
2272: //Add ant preupgrade target.
2273: v.add(UpgradeConstants.PREUPGRADE);
2274:
2275: FileUtil.replaceLineInFile(upgradePropFile, "psinstallFile=",
2276: "psinstallFile=" + silentJESInstall.getAbsolutePath());
2277: FileUtil.replaceLineInFile(upgradePropFile, "psconfigFile=",
2278: "psconfigFile=" + configFilePath);
2279: FileUtil.replaceLineInFile(upgradePropFile, "LOGFILE=",
2280: "LOGFILE=" + LOGFILE);
2281:
2282: File psinstallShFile = new File(RESOURCE_DIR + fs + ".." + fs
2283: + ".." + fs + ".." + fs + ".." + fs + ".." + fs + ".."
2284: + fs + "installer");
2285: //Check if the JES installer is accessible.
2286: if (psinstallShFile.exists() == false) {
2287: throw new UpgradeException(
2288: "Installer does not exists in the required location.");
2289: }
2290:
2291: logger.log(Level.INFO, "PSFB_CSPFUP0034", psinstallShFile
2292: .getAbsolutePath());
2293: FileUtil.replaceLineInFile(upgradePropFile, "psinstallShFile=",
2294: "psinstallShFile=" + psinstallShFile.getAbsolutePath());
2295: System.out.println("Backing up existing installation..");
2296: try {
2297: File psBackupShFile = FileUtil.extractFileFromJar(
2298: RESOURCE_DIR + fs + UpgradeConstants.RESOURCE_JAR,
2299: UpgradeConstants.PS_BACKUP_SCRIPT_FILE, DEBUG);
2300: UpgradeUtils.preparePSAMBackupScript(psInstallationProps,
2301: psBackupShFile);
2302: FileUtil.replaceLineInFile(upgradePropFile,
2303: "psBackUpScript=", "psBackUpScript="
2304: + psBackupShFile.getAbsolutePath());
2305: } catch (IOException e) {
2306: logger.log(Level.SEVERE, "PSFB_CSPFUP0035", e);
2307: throw new UpgradeException(
2308: "Could not back up existing installation! ", e);
2309: }
2310:
2311: try {
2312: File removePortalRPMsShFile = FileUtil.extractFileFromJar(
2313: RESOURCE_DIR + fs + UpgradeConstants.RESOURCE_JAR,
2314: UpgradeConstants.PS_RPMS_REMOVE_SCRIPT_FILE, DEBUG);
2315: FileUtil.replaceLineInFile(upgradePropFile,
2316: "removePortalRPMsScript=",
2317: "removePortalRPMsScript="
2318: + removePortalRPMsShFile.getAbsolutePath());
2319: } catch (IOException e) {
2320: logger.log(Level.SEVERE, "PSFB_CSPFUP0036", e);
2321: throw new UpgradeException(
2322: "Could not remove existing portal rpms! ", e);
2323: } catch (Exception e) {
2324: logger.log(Level.SEVERE, "PSFB_CSPFUP0036", e);
2325: throw new UpgradeException(
2326: "Could not remove existing portal rpms! ", e);
2327: }
2328: //This is needed for accessing am request files
2329: try {
2330: UpgradeUtils.copyAllAMFilesToVarTmpPortal(RESOURCE_DIRS);
2331: } catch (IOException e) {
2332: e.printStackTrace();
2333: }
2334:
2335: if (PORTAL_INSTALLED
2336: && PS_PRODUCT_VERSION.equalsIgnoreCase("6.3")) {
2337: createUpdateServiceAMRequest();
2338: }
2339:
2340: FileUtil.replaceLineInFile(upgradePropFile, "LOGFILE=",
2341: "LOGFILE=" + LOGFILE);
2342: System.out.println("Installing Portal Server 7.1 packages...");
2343: UpgradeUtils.execAnt(upgradeAntFilePathStr, v, LOGFILE,
2344: upgradePropFilePathStr);
2345: //Check if the JES installer successfully installed portal packages.
2346: boolean latestPortalPackagesInstalled = UpgradeUtils
2347: .checkJESInstallerSuccess();
2348: logger.log(Level.INFO, "PSFB_CSPFUP0141", ""
2349: + latestPortalPackagesInstalled);
2350: if (latestPortalPackagesInstalled == false) {
2351: throw new UpgradeException(
2352: "Portal Server 7.1 packages could not get installed! \nCheck installer logs.");
2353: }
2354:
2355: }
2356:
2357: private void checkPreRequisites() throws UpgradeException {
2358: boolean success = UpgradeUtils.isDirectoryServerRunning(
2359: PS_DS_HOST, Integer.parseInt(PS_DS_PORT));
2360: if (success == false) {
2361: System.out.println("Make sure the directory server "
2362: + PS_DS_HOST + "on port " + PS_DS_PORT
2363: + " is running");
2364: throw new UpgradeException(
2365: "Unable to connect to the directory server");
2366: }
2367: success = UpgradeUtils.isAccessManagerAdminCredentialValid(
2368: PS_DS_HOST, Integer.parseInt(PS_DS_PORT), ADMIN_DN,
2369: IDSAME_ADMIN_PASSWORD);
2370: if (success == false) {
2371: System.out.println("Invalid Access Manager credentials !!");
2372: throw new UpgradeException(
2373: "Unable to authenticate with the Access Manager username or password");
2374: }
2375: success = UpgradeUtils.isDirectoryManagerCredentialValid(
2376: PS_DS_HOST, Integer.parseInt(PS_DS_PORT),
2377: PS_DS_DIRMGR_DN, DS_DIRMGR_PASSWORD);
2378: if (success == false) {
2379: System.out
2380: .println("Invalid Directory Manager credentials !!");
2381: throw new UpgradeException(
2382: "Unable to authenticate with the given LDAP Server directory manager username or password");
2383: }
2384:
2385: //LDAP User password
2386: //Validate amLdapUser Password Credentials
2387: success = UpgradeUtils.isAccessManagerLDAPUserCredentialValid(
2388: PS_DS_HOST, Integer.parseInt(PS_DS_PORT),
2389: AM_LDAP_USER_DN, IDSAME_LDAP_USER_PASSWORD);
2390: if (success == false) {
2391: System.out
2392: .println("Invalid Access Manager ldap user credentials !!");
2393: throw new UpgradeException(
2394: "Unable to authenticate with the Access Manager ldapusername or password");
2395: }
2396:
2397: String sraAgentName = "uid=amService-srapGateway,";
2398: //amService-srapGateway DN in JES2
2399: String sraAgentNameDN = sraAgentName + "ou=People," + ORG_DN;
2400:
2401: success = UpgradeUtils.isSRACredentialsValid(PS_DS_HOST,
2402: Integer.parseInt(PS_DS_PORT), sraAgentNameDN,
2403: SRA_LOG_USER_PASSWORD);
2404:
2405: if (success == false) {
2406: //amService-srapGateway DN in JES4 and above
2407: sraAgentNameDN = sraAgentName + "ou=agents," + ORG_DN;
2408: success = UpgradeUtils.isSRACredentialsValid(PS_DS_HOST,
2409: Integer.parseInt(PS_DS_PORT), sraAgentNameDN,
2410: SRA_LOG_USER_PASSWORD);
2411: }
2412:
2413: if (success == false) {
2414: System.out.println("Invalid SRA Log User credentials !!");
2415: throw new UpgradeException(
2416: "Unable to authenticate with the SRA password");
2417: }
2418:
2419: //TODO: Check for the webcontainer running.
2420: //TODO: Check for Webconatiner Admin password check.
2421:
2422: if (psInstallationProps.getProperty("PORTAL_INSTALLED",
2423: "" + PORTAL_INSTALLED).equalsIgnoreCase("true")) {
2424: if (!isValidWecontainerPassword()) {
2425: System.out
2426: .println("Invalid web container input. Please check log files.");
2427: throw new UpgradeException(
2428: "Invalid web container input");
2429: }
2430: }
2431:
2432: //TODO: Check if required patches are installed.
2433: if (sunOS == true) {//For now do for SunOS only.
2434: success = checkInstalledPatches();
2435: if (success == false) {
2436: System.out
2437: .println("Required Patches not installed. !!");
2438: throw new UpgradeException(
2439: "Required patches not installed on this system. Upgrade will not commence.");
2440: }
2441: }
2442:
2443: //TODO: Check disk space.
2444:
2445: }
2446:
2447: private boolean isValidWecontainerPassword()
2448: throws UpgradeException {
2449:
2450: Properties WCType = new Properties();
2451: WCType.setProperty("version", PS_PRODUCT_VERSION);
2452: WCType.setProperty("deployType", PS_DEPLOY_TYPE);
2453: WCType.setProperty("upgradeOnWS70", psInstallationProps
2454: .getProperty("upgradeOnWS70", "false"));
2455: wcAttributes.setProperty("WebContainerDomainName",
2456: PS_DEPLOY_DOMAIN);
2457: String webContType = UpgradeUtils.getWebContainerType(WCType);
2458: String sField = "Invalid";
2459: try {
2460: if (webContType.equals(UpgradeConstants.WC_TYPE_S1WS7)) {
2461: JESWS7Impl jimpl = new JESWS7Impl(wcAttributes);
2462: jimpl.validate();
2463: } else if (webContType
2464: .equals(UpgradeConstants.WC_TYPE_S1AS8)) {
2465: JESAS81Impl asImpl = new JESAS81Impl(wcAttributes);
2466: asImpl.validate();
2467: }/*else if(webContType.equals(UpgradeConstants.WC_TYPE_IBMWAS5)){
2468: IBMWAS5Impl ibmAsImpl = new IBMWAS5Impl(wcAttributes);
2469: ibmAsImpl.validate();
2470: }else if(webContType.equals(UpgradeConstants.WC_TYPE_BEAWL8)){
2471: BEAWL8Impl beaWlImpl = new BEAWL8Impl(wcAttributes);
2472: beaWlImpl.validate();
2473: }*/
2474: } catch (com.sun.portal.fabric.tasks.ValidationException ve) {
2475: throw new UpgradeException("Invalid web container input");
2476: }
2477: return true;
2478: }
2479:
2480: public void removeSUNWebNFS() throws UpgradeException {
2481: boolean success = false;
2482: if (sunOS == true) {
2483: String pkgName = "SUNWebnfs";
2484: success = UpgradeUtils.removeSunOSPackage(pkgName);
2485:
2486: } else if (linuxOS == true) {
2487: String pkgName = "sun-webnfs";
2488: success = UpgradeUtils.removeLinuxOSPackage(pkgName);
2489: }
2490: if (success == false) {
2491: System.out
2492: .println("Unable to remove SUNWebnfs Package. Please Manually Remove it before proceeding");
2493: throw new UpgradeException(
2494: "Unable to remove SUNWebnfs Package. Please Manually Remove it before proceeding");
2495: }
2496: }
2497:
2498: private void prepareUpgradePropertiesFile() throws UpgradeException {
2499: //TODO:log(" prepareUpgradePropertiesFile");
2500: logger.log(Level.INFO, "PSFB_CSPFUP0037");
2501: try {
2502: upgradePropFile = FileUtil.extractFileFromJar(RESOURCE_DIR
2503: + fs + UpgradeConstants.RESOURCE_JAR,
2504: UpgradeConstants.PS_UPGRADE_PROPERTIES_FILE, DEBUG);
2505: upgradePropFilePathStr = upgradePropFile.getAbsolutePath();
2506:
2507: psInstallationProps.store(new FileOutputStream(
2508: upgradePropFile, true), null);
2509: } catch (IOException e) {
2510: if (logger.isLoggable(Level.SEVERE)) {
2511: LogRecord rec = new LogRecord(Level.SEVERE,
2512: "PSFB_CSPFUP0038");
2513: rec.setLoggerName(logger.getName());
2514: rec
2515: .setParameters(new Object[] { UpgradeConstants.RESOURCE_JAR });
2516: rec.setThrown(e);
2517: logger.log(rec);
2518: }
2519: throw new UpgradeException(
2520: "Could not fetch or store properties file from "
2521: + UpgradeConstants.RESOURCE_JAR, e);
2522: }
2523:
2524: //Set the properties.
2525: }
2526:
2527: private void prepareUpgradeAntFile() throws UpgradeException {
2528:
2529: try {
2530: upgradeAntFile = FileUtil.extractFileFromJar(RESOURCE_DIR
2531: + fs + UpgradeConstants.RESOURCE_JAR,
2532: "upgrade.xml", DEBUG);
2533: upgradeAntFilePathStr = upgradeAntFile.getAbsolutePath();
2534: } catch (IOException e) {
2535: if (logger.isLoggable(Level.SEVERE)) {
2536: LogRecord rec = new LogRecord(Level.SEVERE,
2537: "PSFB_CSPFUP0039");
2538: rec.setLoggerName(logger.getName());
2539: rec
2540: .setParameters(new Object[] { UpgradeConstants.RESOURCE_JAR });
2541: rec.setThrown(e);
2542: logger.log(rec);
2543: }
2544: throw new UpgradeException("Could not fetch ant file from "
2545: + UpgradeConstants.RESOURCE_JAR, e);
2546: }
2547:
2548: }
2549:
2550: public void postupgrade() throws UpgradeException {
2551: logger.log(Level.INFO, "PSFB_CSPFUP0040");
2552:
2553: Vector antTargets = new Vector();
2554: Vector files = new Vector();
2555: //Add the Ant postupgrade target.
2556: antTargets.add(UpgradeConstants.POSTUPGRADE);
2557: FileUtil.replaceLineInFile(upgradePropFile, "LOGFILE=",
2558: "LOGFILE=" + LOGFILE);
2559: UpgradeUtils.execAnt(upgradeAntFilePathStr, antTargets,
2560: LOGFILE, upgradePropFilePathStr);
2561:
2562: /* antTargets.clear();
2563: //Add the Ant ruleset donwload target.
2564: antTargets.add("psadminDownloadRewriterRuleset");
2565: FileUtil.replaceLineInFile(upgradePropFile,"LOGFILE=","LOGFILE="+LOGFILE);
2566: UpgradeUtils.execAnt(upgradeAntFilePathStr ,antTargets,LOGFILE,upgradePropFilePathStr);
2567: */
2568:
2569: FileUtil
2570: .appendLineInFile(
2571: new File("/var/tmp/default_gateway_ruleset.xml"),
2572: "<JSRules>",
2573: "<Function name=\"writeCSS\" paramPatterns=\"y\" type=\"URL\"/>",
2574: FileUtil.APPEND_FIRST_OCCURANCE);
2575: antTargets.clear();
2576:
2577: //Add the Ant ruleset donwload target.
2578: antTargets.add("psadminUploadRewriterRuleset");
2579: FileUtil.replaceLineInFile(upgradePropFile, "LOGFILE=",
2580: "LOGFILE=" + LOGFILE);
2581: UpgradeUtils.execAnt(upgradeAntFilePathStr, antTargets,
2582: LOGFILE, upgradePropFilePathStr);
2583:
2584: //Fetch and execute all the AM request files
2585:
2586: //Search Server data migration.
2587: try {
2588: //Adjustment for WS7. Here PS_DEPLOY_INSTANCE already has https embedded.
2589: String SEARCH_SERVER_OLD_ROOT = PS_DATA_DIR_OLD + fs
2590: + "https-" + PS_DEPLOY_INSTANCE + fs + "portal";
2591: if (psInstallationProps.getProperty("upgradeOnWS70",
2592: "false").equalsIgnoreCase("true"))
2593: SEARCH_SERVER_OLD_ROOT = PS_DATA_DIR_OLD + fs
2594: + PS_DEPLOY_INSTANCE + fs + "portal";
2595:
2596: updateSearch(SEARCH_SERVER_OLD_ROOT, PS_70_DATA_DIR + fs
2597: + "searchservers" + fs + "UpgradedSearch");
2598: } catch (Exception e) {
2599: logger.log(Level.INFO, "PSFB_CSPFUP0041", e);
2600: }
2601:
2602: if (SRA_INSTALLED) {
2603: String GW_NLP_RWPConfigPropFileDir = getGW_NLP_RWPPropertiesFileDir();
2604: UpgradeUtils.enableSRA(platformConfs, psInstallationProps,
2605: amadminPasswordFilePath);
2606: }
2607: }
2608:
2609: //Any key value that might be required by Implementation class.
2610: public void setProperty(String key, String value) {
2611: psInstallationProps.setProperty(key, value);
2612: }
2613:
2614: public void upgrade() throws UpgradeException {
2615: //Invoke the configurator:
2616: logger.log(Level.INFO, "PSFB_CSPFUP0042");
2617: Vector v = new Vector();
2618: v.add(UpgradeConstants.UPGRADE);
2619:
2620: //Make the extracted and token replaced configuration file available to Ant upgrade target.
2621: FileUtil.replaceLineInFile(upgradePropFile, "psconfigFile=",
2622: "psconfigFile=" + configFile.getAbsolutePath());
2623: FileUtil.replaceLineInFile(upgradePropFile, "LOGFILE=",
2624: "LOGFILE=" + LOGFILE);
2625:
2626: logger.log(Level.INFO, "PSFB_CSPFUP0043");
2627: logger.log(Level.INFO, "PSFB_CSPFUP0044", configFile
2628: .getAbsolutePath());
2629:
2630: //Now we have fetched the global dp. Process and Exec Ant update global DP.
2631: //Create the password file required for psadmin
2632: try {
2633: amadminPasswordFilePath = createAMAdminPasswordFile();
2634: FileUtil
2635: .replaceLineInFile(upgradePropFile,
2636: "AM_ADMIN_PASSWORD_FILE=",
2637: "AM_ADMIN_PASSWORD_FILE="
2638: + amadminPasswordFilePath);
2639: } catch (IOException e) {
2640: System.out
2641: .println("Creating AM admin password file failed."
2642: + "\n. See log file for more details");
2643: logger.log(Level.SEVERE, "PSFB_CSPFUP0045", e);
2644: }
2645:
2646: //Execute AM updates only on PS node.
2647: if (psInstallationProps.getProperty("PORTAL_INSTALLED",
2648: "" + PORTAL_INSTALLED).equalsIgnoreCase("true")) {
2649:
2650: // MUST READ.
2651: //ALL TEST INSTRUMENTATION CODE SHOULD REVIEWED BY ALL UPGRADE TEAM MEMBERS.
2652: //IT IS TO AVOID DISRUPTION IN NORMAL FUNCTIONING OF CODE.
2653: //Test instrumentation. Always run if it is not in test mode.
2654: //All test automation portion of code should start with "if(testRunMode==false ||".
2655: //ASSUMPTION: System is not upgraded to PS7.1
2656: /* TEST-AUTOMATION-START for AM requests*/
2657: if (testRunMode == false || testRunModeAll == true
2658: || (testRunMode == true && testRunModeAM == true))
2659: UpgradeUtils.executeAccessManagerUpdates(
2660: psInstallationProps, RESOURCE_DIRS);
2661:
2662: if (testRunMode == true && testRunModeAM == true) {
2663: System.out.println("COMPLETED AM REQUESTS TESTING.");
2664: destroy();
2665: System.exit(0);
2666: }
2667: /* TEST-AUTOMATION-END for AM requests*/
2668:
2669: //MUST READ.
2670: //ALL TEST INSTRUMENTATION CODE SHOULD REVIEWED BY ALL UPGRADE TEAM MEMBERS.
2671: //IT IS TO AVOID DISRUPTION IN NORMAL FUNCTIONING OF CODE.
2672: //Test instrumentation. Always run if it is not in test mode.
2673: //All test automation portion of code should start with "if(testRunMode==false ||".
2674: //ASSUMPTION: System is not upgraded to PS7.1
2675: /* TEST-AUTOMATION-START for DP UPDATES*/
2676: if (testRunMode == false || testRunModeAll == true
2677: || (testRunMode == true && testRunModeDP == true))
2678: UpgradeUtils.executeDesktopProfileUpdates(
2679: psInstallationProps, RESOURCE_DIRS);
2680:
2681: if (testRunMode == true && testRunModeDP == true) {
2682: System.out.println("COMPLETED DP REQUESTS TESTING.");
2683: destroy();
2684: System.exit(0);
2685: }
2686: /* TEST-AUTOMATION-END for DP UPDATES*/
2687: }
2688:
2689: System.out.println("Configuring Portal Server 7.1");
2690: UpgradeUtils.execAnt(upgradeAntFilePathStr, v, LOGFILE,
2691: upgradePropFilePathStr);
2692:
2693: //Check the config success.
2694: String configSuccessStr = FileUtil.findTextInFile(new File(
2695: LOGFILE), "Configuration Successful");
2696: if (configSuccessStr != null && configSuccessStr != "")
2697: System.out.println("Configuration success.");
2698: else {
2699: System.out.println("Configuration failed.");
2700: UpgradeUtils
2701: .setExitCode(UpgradeConstants.SPECIFIC_UPGRADE_ERROR_CONFIGURATION_FAILED_EXIT_CODE);
2702: throw new UpgradeException(
2703: "Portal Server 7.1 configuration failed");
2704: }
2705:
2706: //NO CLASSPATH, SERVERPOLICY, JVM OPYIONS updates are necessary as of the req recieved till date
2707: if (PORTAL_INSTALLED == true) {
2708: try {
2709: System.out.println("Performing classpath updates...");
2710: File CPChangesFile = null;
2711: CPChangesFile = FileUtil.extractFileFromJar(
2712: UpgradeConstants.RESOURCE_DIR_PS631 + "/"
2713: + UpgradeConstants.RESOURCE_JAR,
2714: "ClasspathChanges.txt", DEBUG);
2715: UpgradeUtils.executeClassPathUpdates(CPChangesFile,
2716: configFilePath, wcAttributes, false);
2717:
2718: System.out
2719: .println("Performing server policy updates...");
2720: File SerPolChangesFile = null;
2721: SerPolChangesFile = FileUtil.extractFileFromJar(
2722: UpgradeConstants.RESOURCE_DIR_PS70 + "/"
2723: + UpgradeConstants.RESOURCE_JAR,
2724: "ServerPolicyChanges.txt");
2725: UpgradeUtils.executeServerPolicyUpdates(
2726: SerPolChangesFile, wcAttributes, log, false);
2727:
2728: System.out.println("Performing JVM options updates...");
2729: File jvmOpChangesFile = null;
2730: jvmOpChangesFile = FileUtil.extractFileFromJar(
2731: UpgradeConstants.RESOURCE_DIR_PS63 + "/"
2732: + UpgradeConstants.RESOURCE_JAR,
2733: "JVMOptionChanges.txt", DEBUG);
2734: UpgradeUtils.executeJVMOptionUpdates(jvmOpChangesFile,
2735: wcAttributes, false);
2736:
2737: } catch (Exception ex) {
2738:
2739: logger
2740: .log(
2741: Level.SEVERE,
2742: "Exception while executing various update operations",
2743: ex);
2744: System.out
2745: .println(" Error while executing upgrade ...");
2746:
2747: }
2748: }
2749:
2750: }
2751:
2752: private String createWS7PasswordFile(String passwd) {
2753: File passwdFile = null;
2754: String passFilePath = null;
2755:
2756: try {
2757: passwdFile = File.createTempFile(FileUtil
2758: .getRandomDirName(), "");
2759: // Initialize the value of the variable to be used in other methods
2760: passFilePath = passwdFile.getAbsolutePath();
2761: FileWriter fwriter = new FileWriter(passFilePath);
2762: String content = "wadm_password=" + passwd + "\n";
2763: fwriter.write(content);
2764: fwriter.close();
2765: execUtil
2766: .exec("chmod", new String[] { "600", passFilePath });
2767:
2768: } catch (IOException ioe) {
2769: if (logger.isLoggable(Level.SEVERE)) {
2770: LogRecord record = new LogRecord(Level.SEVERE,
2771: "PSFB_CSPFT0025");
2772: record.setThrown(ioe);
2773: record.setLoggerName(logger.getName());
2774: logger.log(record);
2775: }
2776: }
2777: return passFilePath;
2778:
2779: }
2780:
2781: String createASPasswordFile() throws IOException {
2782:
2783: StringBuffer fileData = new StringBuffer();
2784:
2785: fileData.append("AS_ADMIN_PASSWORD="
2786: + WEB_CONTAINER_ADMIN_PASSWORD + "\n");
2787:
2788: if ((WEB_CONTAINER_MASTER_PASSWORD != null)
2789: && (WEB_CONTAINER_MASTER_PASSWORD.length() > 0)) {
2790:
2791: fileData.append("AS_ADMIN_MASTERPASSWORD="
2792: + WEB_CONTAINER_MASTER_PASSWORD + "\n");
2793: }
2794: Date curDate = new Date();
2795: String sTmpFile = "" + curDate.getTime();
2796: File appPasswordFile = File.createTempFile(sTmpFile, "");
2797: appPasswordFile.deleteOnExit();
2798: wcAdminPasswordFilePath = appPasswordFile.getAbsolutePath();
2799:
2800: FileWriter fwriter = new FileWriter(appPasswordFile);
2801: fwriter.write(fileData.toString());
2802: fwriter.close();
2803:
2804: return wcAdminPasswordFilePath;
2805:
2806: }
2807:
2808: String createAMAdminPasswordFile() throws IOException {
2809:
2810: StringBuffer fileData = new StringBuffer();
2811:
2812: fileData.append(IDSAME_ADMIN_PASSWORD + "\n");
2813: Date curDate = new Date();
2814: String sTmpFile = "" + curDate.getTime();
2815: File amadminPasswordFile = File.createTempFile(sTmpFile, "");
2816: amadminPasswordFile.deleteOnExit();
2817: String amadminPasswordFilePath = amadminPasswordFile
2818: .getAbsolutePath();
2819:
2820: FileWriter fwriter = new FileWriter(amadminPasswordFile);
2821: fwriter.write(fileData.toString());
2822: fwriter.close();
2823:
2824: return amadminPasswordFilePath;
2825:
2826: }
2827:
2828: String createPSAdminPasswordFile() throws IOException {
2829:
2830: StringBuffer fileData = new StringBuffer();
2831:
2832: fileData.append(IDSAME_ADMIN_PASSWORD);
2833: Date curDate = new Date();
2834: String sTmpFile = "" + curDate.getTime();
2835: File psadminPasswordFile = File.createTempFile(sTmpFile, "");
2836: psadminPasswordFile.deleteOnExit();
2837: String psadminPasswordFilePath = psadminPasswordFile
2838: .getAbsolutePath();
2839:
2840: FileWriter fwriter = new FileWriter(psadminPasswordFile);
2841: fwriter.write(fileData.toString());
2842: fwriter.close();
2843:
2844: return psadminPasswordFilePath;
2845:
2846: }
2847:
2848: public String createWebSphereUndeployFile() throws IOException {
2849: File tmpFile = null;
2850:
2851: tmpFile = File.createTempFile("undeploy", ".jacl");
2852:
2853: StringBuffer command = new StringBuffer();
2854: command.append("$AdminApp uninstall ");
2855: //The uri is assumed to be of the type '/something'.
2856: // The APP URI is assumed will be replaced by Ant at run time.
2857: command.append("APP_URI");
2858: command.append(" {-node ");
2859: command.append(PS_DEPLOY_NODE);
2860: command.append(" -cell ");
2861: command.append(PS_DEPLOY_CELL);
2862: command.append(" -server ");
2863: command.append(PS_DEPLOY_INSTANCE);
2864: command.append("}");
2865: FileUtil.appendToFile(tmpFile, command.toString(), false);
2866: command = new StringBuffer();
2867: command.append("$AdminConfig save");
2868: FileUtil.appendToFile(tmpFile, command.toString(), false);
2869:
2870: return FileUtil.decoratePath(tmpFile.getAbsolutePath());
2871: }
2872:
2873: boolean checkInstalledPatches() {
2874: boolean success = true;
2875: String[] patchIDs = null;
2876: File patchIDsFile = null;
2877: try {
2878: patchIDsFile = FileUtil.extractFileFromJar(RESOURCE_DIR
2879: + fs + UpgradeConstants.RESOURCE_JAR,
2880: UpgradeConstants.PATCH_FILE, DEBUG);
2881: Properties patchProp = new Properties();
2882: patchProp.load(new FileInputStream(patchIDsFile));
2883: String patches = patchProp.getProperty(UpgradeUtils
2884: .getPatchKey());
2885: logger.log(Level.INFO, "PSFB_CSPFUP0046", patches);
2886:
2887: if (patches != null) {
2888: patchIDs = patches.split(",");
2889: //For each patch
2890: for (int i = 0; i < patchIDs.length; i++) {
2891: if (sunOS == true)
2892: success = UpgradeUtils
2893: .isSunOSPatchApplied(patchIDs[i]);//This method uses patchadd -p | grep "Patch: patchid"
2894: else if (linuxOS == true)
2895: success = UpgradeUtils
2896: .isLinuxPatchApplied(patchIDs[i]);//This method uses rpm query
2897:
2898: if (success == false) {
2899: System.out
2900: .println(" Required patch "
2901: + patchIDs[i]
2902: + "not applied. You may download it from SunSolve.\n"
2903: + "Please read README file to see if there are other required patches.");
2904: logger.log(Level.INFO, "PSFB_CSPFUP0047",
2905: patchIDs[i]);
2906: break;
2907: }
2908:
2909: }
2910: } else {
2911: success = true;
2912: }
2913:
2914: } catch (IOException e) {
2915: //TODO: Log the message.
2916: logger.log(Level.SEVERE, "PSFB_CSPFUP0048", e);
2917: e.printStackTrace();
2918: }
2919: return success;
2920: }
2921:
2922: /*Logs messages to the log file */
2923: public void log(String msg) {
2924: UpgradeUtils.log(msg);
2925:
2926: }
2927:
2928: /*
2929: * Perform all clean up work here.
2930: * Remove the extracted files from tmp directory.
2931: */
2932: public void destroy() {
2933: //TODO: Do other cleanups.
2934:
2935: //Required. Otherwise the log file lock is not released.
2936: //TODO: We should have the logger created here and set in the Utils, rather than creating in UpgradeUtils.
2937: UpgradeUtils.removeLogHandler();
2938: if (upgradeAntFile != null && upgradeAntFile.exists())
2939: upgradeAntFile.delete();
2940:
2941: }
2942:
2943: /* Returns a string that idetifies the Upgrade program version and capabilities.
2944: */
2945: String getInfo() {
2946: return "Portal Server 7.1 Upgrade, Supports PS6.3.1 to 7.1";
2947: }
2948:
2949: public void updateSearch(String oldServerRoot, String serverRoot) {
2950: File dir = new File(serverRoot + File.separator + "config");
2951: if (dir.isDirectory()) {
2952: // copy taxonomy
2953: try {
2954: UpgradeUtils.copy(new File(oldServerRoot
2955: + File.separator + "config" + File.separator
2956: + "taxonomy.rdm"), new File(serverRoot
2957: + File.separator + "config" + File.separator
2958: + "taxonomy.rdm"));
2959: } catch (Exception e) {
2960: System.err.println("Exception: " + e);
2961: }
2962:
2963: // copy robot sites
2964: try {
2965: UpgradeUtils.copy(new File(oldServerRoot
2966: + File.separator + "config" + File.separator
2967: + "filterrules.conf"), new File(serverRoot
2968: + File.separator + "config" + File.separator
2969: + "filterrules.conf"));
2970: } catch (Exception e) {
2971: System.err.println("Exception: " + e);
2972: }
2973:
2974: // copy robot classification
2975: try {
2976: UpgradeUtils.copy(new File(oldServerRoot
2977: + File.separator + "config" + File.separator
2978: + "classification.conf"), new File(serverRoot
2979: + File.separator + "config" + File.separator
2980: + "classification.conf"));
2981: } catch (Exception e) {
2982: System.err.println("Exception: " + e);
2983: }
2984:
2985: // migrate databases
2986: dir = new File(oldServerRoot + File.separator + "db");
2987: if (dir.isDirectory()) {
2988: // remove current databases
2989: try {
2990: UpgradeUtils.rmdir(new File(serverRoot
2991: + File.separator + "db"));
2992: UpgradeUtils.mkdir(serverRoot, "db");
2993: } catch (Exception e) {
2994: System.err.println("Exception: " + e);
2995: }
2996:
2997: // We need to set the PS 6.3.x backed up product directory in the library path.
2998: String orgLibPath = System.getProperty(
2999: "LD_LIBRARY_PATH", "");
3000: String orgPath = System.getProperty("PATH", "");
3001: String modifiedLibPath = PS_PRODUCT_DIR_OLD + ".bak"
3002: + File.separator + "lib" + ":"
3003: + PS_PRODUCT_DIR_OLD + ".bak" + File.separator
3004: + "lib" + File.separator + "filter" + ":"
3005: + orgLibPath;
3006:
3007: System.setProperty("LD_LIBRARY_PATH", modifiedLibPath);
3008: String modifiedPath = PS_PRODUCT_DIR_OLD + ".bak"
3009: + File.separator + "bin" + ":"
3010: + PS_PRODUCT_DIR_OLD + ".bak" + File.separator
3011: + "lib" + ":" + orgPath;
3012: System.setProperty("PATH", modifiedPath);
3013:
3014: // indexing taxonomy
3015: try {
3016: String[] command = {
3017: serverRoot + File.separator + "run-cs-cli",
3018: "rdmgr", "-T", "-I" };
3019: Process p = Runtime.getRuntime().exec(command);
3020: p.waitFor();
3021: } catch (Exception e) {
3022: System.err.println("Exception: " + e);
3023: }
3024:
3025: ArrayList databases = new ArrayList();
3026:
3027: // collect database name for migration
3028: File[] files = dir.listFiles();
3029: for (int i = 0; i < files.length; i++) {
3030: if (files[i].isDirectory()
3031: && !files[i].getName().equalsIgnoreCase(
3032: "root")
3033: && !files[i].getName().equalsIgnoreCase(
3034: "taxonomy")) {
3035: databases.add(files[i].getName());
3036: }
3037: }
3038:
3039: // import old databases
3040: for (int i = 0; i < databases.size(); i++) {
3041: String name = (String) databases.get(i);
3042: try {
3043: // export old persistent
3044: String[] persistentExportCommand = {
3045: serverRoot + File.separator
3046: + "run-cs-cli",
3047: "rdmgr",
3048: "-U",
3049: "-P",
3050: "-c",
3051: oldServerRoot + fs + "config" + fs
3052: + "search.conf", "-y", name };
3053: Process p = Runtime.getRuntime().exec(
3054: persistentExportCommand);
3055: execOutToFile(p.getInputStream(), serverRoot
3056: + File.separator + "tmp"
3057: + File.separator + name + ".p");
3058:
3059: // export old non-persistent
3060: String[] nonPersistentExportCommand = {
3061: serverRoot + File.separator
3062: + "run-cs-cli",
3063: "rdmgr",
3064: "-U",
3065: "-N",
3066: "-c",
3067: oldServerRoot + fs + "config" + fs
3068: + "search.conf", "-y", name };
3069: p = Runtime.getRuntime().exec(
3070: nonPersistentExportCommand);
3071: execOutToFile(p.getInputStream(), serverRoot
3072: + File.separator + "tmp"
3073: + File.separator + name + ".np");
3074:
3075: // import into database only, no indexing
3076: String[] persistentImportCommand = {
3077: serverRoot + File.separator
3078: + "run-cs-cli",
3079: "rdmgr",
3080: "-D",
3081: "-P",
3082: "-y",
3083: name,
3084: serverRoot + File.separator + "tmp"
3085: + File.separator + name + ".p" };
3086: p = Runtime.getRuntime().exec(
3087: persistentImportCommand);
3088: p.waitFor();
3089: String[] nonPersistentImportCommand = {
3090: serverRoot + File.separator
3091: + "run-cs-cli",
3092: "rdmgr",
3093: "-D",
3094: "-N",
3095: "-y",
3096: name,
3097: serverRoot + File.separator + "tmp"
3098: + File.separator + name + ".np" };
3099: p = Runtime.getRuntime().exec(
3100: nonPersistentImportCommand);
3101: p.waitFor();
3102:
3103: // copy all files for nova index except rd.db
3104: File d = new File(oldServerRoot
3105: + File.separator + "db"
3106: + File.separator + name);
3107: files = d.listFiles();
3108: for (int j = 0; j < files.length; j++) {
3109: if (!files[j].getName().equalsIgnoreCase(
3110: "rd.db")) {
3111: UpgradeUtils.copy(new File(files[j]
3112: .getAbsolutePath()), new File(
3113: serverRoot + File.separator
3114: + "db" + File.separator
3115: + name + File.separator
3116: + files[j].getName()));
3117: }
3118: }
3119: } catch (Exception e) {
3120: System.err.println("Exception: " + e);
3121: }
3122: }
3123: //Restore the old libray path and path values.
3124: System.setProperty("LD_LIBRARY_PATH", orgLibPath);
3125: System.setProperty("PATH", orgPath);
3126: }
3127:
3128: }
3129:
3130: }
3131:
3132: private void execOutToFile(InputStream is, String path)
3133: throws Exception {
3134: FileOutputStream fos = new FileOutputStream(path);
3135: byte[] buffer = new byte[10240];
3136: int returnValue;
3137: while ((returnValue = is.read(buffer)) >= 0) {
3138: fos.write(buffer, 0, returnValue);
3139: }
3140: fos.close();
3141: }
3142:
3143: //Start - L10N Code change
3144:
3145: public boolean isL10nInstalled(String component) {
3146: component = component.toLowerCase();
3147: boolean found = false;
3148: if (component.equals("portal")) {
3149: if (sunOS == true) {
3150: // JES1 or JES2 Portal Pacakge Check.
3151: if (UpgradeUtils.isPackageInstalled("SUNWdpsdt"))
3152: return true;
3153: else if (UpgradeUtils.isPackageInstalled("SUNWepsdt"))
3154: return true;
3155: else if (UpgradeUtils.isPackageInstalled("SUNWfpsdt"))
3156: return true;
3157: else if (UpgradeUtils.isPackageInstalled("SUNWjpsdt"))
3158: return true;
3159: else if (UpgradeUtils.isPackageInstalled("SUNWkpsdt"))
3160: return true;
3161: else if (UpgradeUtils.isPackageInstalled("SUNWcpsdt"))
3162: return true;
3163: else if (UpgradeUtils.isPackageInstalled("SUNWhpsdt"))
3164: return true;
3165: // JES3 or JES4 Portal Package Check
3166: if (UpgradeUtils.isPackageInstalled("SUNWdpscore"))
3167: return true;
3168: else if (UpgradeUtils.isPackageInstalled("SUNWepscore"))
3169: return true;
3170: else if (UpgradeUtils.isPackageInstalled("SUNWfpscore"))
3171: return true;
3172: else if (UpgradeUtils.isPackageInstalled("SUNWjpscore"))
3173: return true;
3174: else if (UpgradeUtils.isPackageInstalled("SUNWkpscore"))
3175: return true;
3176: else if (UpgradeUtils.isPackageInstalled("SUNWcpscore"))
3177: return true;
3178: else if (UpgradeUtils.isPackageInstalled("SUNWhpscore"))
3179: return true;
3180: } else if (linuxOS == true) {
3181: // JES1 or JES2 Portal RPM Check.
3182: if (UpgradeUtils
3183: .isRPMInstalled("sun-portal-desktop-de"))
3184: return true;
3185: else if (UpgradeUtils
3186: .isRPMInstalled("sun-portal-desktop-es"))
3187: return true;
3188: else if (UpgradeUtils
3189: .isRPMInstalled("sun-portal-desktop-fr"))
3190: return true;
3191: else if (UpgradeUtils
3192: .isRPMInstalled("sun-portal-desktop-ja"))
3193: return true;
3194: else if (UpgradeUtils
3195: .isRPMInstalled("sun-portal-desktop-ko"))
3196: return true;
3197: else if (UpgradeUtils
3198: .isRPMInstalled("sun-portal-desktop-zh_CN"))
3199: return true;
3200: else if (UpgradeUtils
3201: .isRPMInstalled("sun-portal-desktop-zh_TW"))
3202: return true;
3203: // JES3 or JES4 Portal RPM Check
3204: if (UpgradeUtils.isRPMInstalled("sun-portal-core-de"))
3205: return true;
3206: else if (UpgradeUtils
3207: .isRPMInstalled("sun-portal-core-es"))
3208: return true;
3209: else if (UpgradeUtils
3210: .isRPMInstalled("sun-portal-core-fr"))
3211: return true;
3212: else if (UpgradeUtils
3213: .isRPMInstalled("sun-portal-core-ja"))
3214: return true;
3215: else if (UpgradeUtils
3216: .isRPMInstalled("sun-portal-core-ko"))
3217: return true;
3218: else if (UpgradeUtils
3219: .isRPMInstalled("sun-portal-core-zh_CN"))
3220: return true;
3221: else if (UpgradeUtils
3222: .isRPMInstalled("sun-portal-core-zh_TW"))
3223: return true;
3224: }
3225: } else if (component.equals("sra")) {
3226: if (sunOS == true) {
3227: // JES1 or JES2 SRA Pacakge Check.
3228: if (UpgradeUtils.isPackageInstalled("SUNWdpsnf"))
3229: return true;
3230: else if (UpgradeUtils.isPackageInstalled("SUNWepsnf"))
3231: return true;
3232: else if (UpgradeUtils.isPackageInstalled("SUNWfpsnf"))
3233: return true;
3234: else if (UpgradeUtils.isPackageInstalled("SUNWjpsnf"))
3235: return true;
3236: else if (UpgradeUtils.isPackageInstalled("SUNWkpsnf"))
3237: return true;
3238: else if (UpgradeUtils.isPackageInstalled("SUNWcpsnf"))
3239: return true;
3240: else if (UpgradeUtils.isPackageInstalled("SUNWhpsnf"))
3241: return true;
3242: // JES3 or JES4 SRA Package Check
3243: if (UpgradeUtils.isPackageInstalled("SUNWdpsSRAcore"))
3244: return true;
3245: else if (UpgradeUtils
3246: .isPackageInstalled("SUNWepsSRAcore"))
3247: return true;
3248: else if (UpgradeUtils
3249: .isPackageInstalled("SUNWfpsSRAcore"))
3250: return true;
3251: else if (UpgradeUtils
3252: .isPackageInstalled("SUNWjpsSRAcore"))
3253: return true;
3254: else if (UpgradeUtils
3255: .isPackageInstalled("SUNWkpsSRAcore"))
3256: return true;
3257: else if (UpgradeUtils
3258: .isPackageInstalled("SUNWcpsSRAcore"))
3259: return true;
3260: else if (UpgradeUtils
3261: .isPackageInstalled("SUNWhpsSRAcore"))
3262: return true;
3263: } else if (linuxOS == true) {
3264: // JES3 or JES4 SRA RPM Check
3265: if (UpgradeUtils
3266: .isRPMInstalled("sun-portal-netfile-de"))
3267: return true;
3268: else if (UpgradeUtils
3269: .isRPMInstalled("sun-portal-netfile-es"))
3270: return true;
3271: else if (UpgradeUtils
3272: .isRPMInstalled("sun-portal-netfile-fr"))
3273: return true;
3274: else if (UpgradeUtils
3275: .isRPMInstalled("sun-portal-netfile-ja"))
3276: return true;
3277: else if (UpgradeUtils
3278: .isRPMInstalled("sun-portal-netfile-ko"))
3279: return true;
3280: else if (UpgradeUtils
3281: .isRPMInstalled("sun-portal-netfile-zh_CN"))
3282: return true;
3283: else if (UpgradeUtils
3284: .isRPMInstalled("sun-portal-netfile-zh_TW"))
3285: return true;
3286: // JES3 or JES4 SRA RPM Check
3287: if (UpgradeUtils
3288: .isRPMInstalled("sun-portal-sra-core-de"))
3289: return true;
3290: else if (UpgradeUtils
3291: .isRPMInstalled("sun-portal-sra-core-es"))
3292: return true;
3293: else if (UpgradeUtils
3294: .isRPMInstalled("sun-portal-sra-core-fr"))
3295: return true;
3296: else if (UpgradeUtils
3297: .isRPMInstalled("sun-portal-sra-core-ja"))
3298: return true;
3299: else if (UpgradeUtils
3300: .isRPMInstalled("sun-portal-sra-core-ko"))
3301: return true;
3302: else if (UpgradeUtils
3303: .isRPMInstalled("sun-portal-sra-core-zh_CN"))
3304: return true;
3305: else if (UpgradeUtils
3306: .isRPMInstalled("sun-portal-sra-core-zh_TW"))
3307: return true;
3308: }
3309: } else if (component.equals("gateway")) {
3310: if (sunOS == true) {
3311: // JES1 or JES2 Gateway Pacakge Check.
3312: if (UpgradeUtils.isPackageInstalled("SUNWdpsgwc"))
3313: return true;
3314: else if (UpgradeUtils.isPackageInstalled("SUNWepsgwc"))
3315: return true;
3316: else if (UpgradeUtils.isPackageInstalled("SUNWfpsgwc"))
3317: return true;
3318: else if (UpgradeUtils.isPackageInstalled("SUNWjpsgwc"))
3319: return true;
3320: else if (UpgradeUtils.isPackageInstalled("SUNWkpsgwc"))
3321: return true;
3322: else if (UpgradeUtils.isPackageInstalled("SUNWcpsgwc"))
3323: return true;
3324: else if (UpgradeUtils.isPackageInstalled("SUNWhpsgwc"))
3325: return true;
3326: // JES3 or JES4 Gateway Package Check
3327: if (UpgradeUtils.isPackageInstalled("SUNWdpsSRAgwcore"))
3328: return true;
3329: else if (UpgradeUtils
3330: .isPackageInstalled("SUNWepsSRAgwcore"))
3331: return true;
3332: else if (UpgradeUtils
3333: .isPackageInstalled("SUNWfpsSRAgwcore"))
3334: return true;
3335: else if (UpgradeUtils
3336: .isPackageInstalled("SUNWjpsSRAgwcore"))
3337: return true;
3338: else if (UpgradeUtils
3339: .isPackageInstalled("SUNWkpsSRAgwcore"))
3340: return true;
3341: else if (UpgradeUtils
3342: .isPackageInstalled("SUNWcpsSRAgwcore"))
3343: return true;
3344: else if (UpgradeUtils
3345: .isPackageInstalled("SUNWhpsSRAgwcore"))
3346: return true;
3347: } else if (linuxOS == true) {
3348: // JES1 or JES2 Gateway RPM Check
3349: if (UpgradeUtils
3350: .isRPMInstalled("sun-portal-gateway-de"))
3351: return true;
3352: else if (UpgradeUtils
3353: .isRPMInstalled("sun-portal-gateway-es"))
3354: return true;
3355: else if (UpgradeUtils
3356: .isRPMInstalled("sun-portal-gateway-fr"))
3357: return true;
3358: else if (UpgradeUtils
3359: .isRPMInstalled("sun-portal-gateway-ja"))
3360: return true;
3361: else if (UpgradeUtils
3362: .isRPMInstalled("sun-portal-gateway-ko"))
3363: return true;
3364: else if (UpgradeUtils
3365: .isRPMInstalled("sun-portal-gateway-zh_CN"))
3366: return true;
3367: else if (UpgradeUtils
3368: .isRPMInstalled("sun-portal-gateway-zh_TW"))
3369: return true;
3370: // JES3 or JES4 Gateway RPM Check
3371: if (UpgradeUtils
3372: .isRPMInstalled("sun-portal-sra-gateway-core-de"))
3373: return true;
3374: else if (UpgradeUtils
3375: .isRPMInstalled("sun-portal-sra-gateway-core-es"))
3376: return true;
3377: else if (UpgradeUtils
3378: .isRPMInstalled("sun-portal-sra-gateway-core-fr"))
3379: return true;
3380: else if (UpgradeUtils
3381: .isRPMInstalled("sun-portal-sra-gateway-core-ja"))
3382: return true;
3383: else if (UpgradeUtils
3384: .isRPMInstalled("sun-portal-sra-gateway-core-ko"))
3385: return true;
3386: else if (UpgradeUtils
3387: .isRPMInstalled("sun-portal-sra-gateway-core-zh_CN"))
3388: return true;
3389: else if (UpgradeUtils
3390: .isRPMInstalled("sun-portal-sra-gateway-core-zh_TW"))
3391: return true;
3392: }
3393: } else if (component.equals("netletproxy")) {
3394: if (sunOS == true) {
3395: // JES1 or JES2 Netlet Proxy Pacakge Check.
3396: if (UpgradeUtils.isPackageInstalled("SUNWdpsn"))
3397: return true;
3398: else if (UpgradeUtils.isPackageInstalled("SUNWepsn"))
3399: return true;
3400: else if (UpgradeUtils.isPackageInstalled("SUNWfpsn"))
3401: return true;
3402: else if (UpgradeUtils.isPackageInstalled("SUNWjpsn"))
3403: return true;
3404: else if (UpgradeUtils.isPackageInstalled("SUNWkpsn"))
3405: return true;
3406: else if (UpgradeUtils.isPackageInstalled("SUNWcpsn"))
3407: return true;
3408: else if (UpgradeUtils.isPackageInstalled("SUNWhpsn"))
3409: return true;
3410: // JES3 or JES4 Netlet Proxy Package Check
3411: if (UpgradeUtils.isPackageInstalled("SUNWdpsSRAnlcore"))
3412: return true;
3413: else if (UpgradeUtils
3414: .isPackageInstalled("SUNWepsSRAnlcore"))
3415: return true;
3416: else if (UpgradeUtils
3417: .isPackageInstalled("SUNWfpsSRAnlcore"))
3418: return true;
3419: else if (UpgradeUtils
3420: .isPackageInstalled("SUNWjpsSRAnlcore"))
3421: return true;
3422: else if (UpgradeUtils
3423: .isPackageInstalled("SUNWkpsSRAnlcore"))
3424: return true;
3425: else if (UpgradeUtils
3426: .isPackageInstalled("SUNWcpsSRAnlcore"))
3427: return true;
3428: else if (UpgradeUtils
3429: .isPackageInstalled("SUNWhpsSRAnlcore"))
3430: return true;
3431: } else if (linuxOS == true) {
3432: // JES1 or JES2 Netlet Proxy RPM Check
3433: if (UpgradeUtils
3434: .isRPMInstalled("sun-portal-netletproxy-de"))
3435: return true;
3436: else if (UpgradeUtils
3437: .isRPMInstalled("sun-portal-netletproxy-es"))
3438: return true;
3439: else if (UpgradeUtils
3440: .isRPMInstalled("sun-portal-netletproxy-fr"))
3441: return true;
3442: else if (UpgradeUtils
3443: .isRPMInstalled("sun-portal-netletproxy-ja"))
3444: return true;
3445: else if (UpgradeUtils
3446: .isRPMInstalled("sun-portal-netletproxy-ko"))
3447: return true;
3448: else if (UpgradeUtils
3449: .isRPMInstalled("sun-portal-netletproxy-zh_CN"))
3450: return true;
3451: else if (UpgradeUtils
3452: .isRPMInstalled("sun-portal-netletproxy-zh_TW"))
3453: return true;
3454: // JES3 or JES4 Netlet Proxy RPM Check
3455: if (UpgradeUtils
3456: .isRPMInstalled("sun-portal-sra-netlet-core-de"))
3457: return true;
3458: else if (UpgradeUtils
3459: .isRPMInstalled("sun-portal-sra-netlet-core-es"))
3460: return true;
3461: else if (UpgradeUtils
3462: .isRPMInstalled("sun-portal-sra-netlet-core-fr"))
3463: return true;
3464: else if (UpgradeUtils
3465: .isRPMInstalled("sun-portal-sra-netlet-core-ja"))
3466: return true;
3467: else if (UpgradeUtils
3468: .isRPMInstalled("sun-portal-sra-netlet-core-ko"))
3469: return true;
3470: else if (UpgradeUtils
3471: .isRPMInstalled("sun-portal-sra-netlet-core-zh_CN"))
3472: return true;
3473: else if (UpgradeUtils
3474: .isRPMInstalled("sun-portal-sra-netlet-core-zh_TW"))
3475: return true;
3476: }
3477: } else if (component.equals("rewriterproxy")) {
3478: if (sunOS == true) {
3479: // JES1 or JES2 Rewriter Proxy Pacakge Check.
3480: if (UpgradeUtils.isPackageInstalled("SUNWdpsrp"))
3481: return true;
3482: else if (UpgradeUtils.isPackageInstalled("SUNWepsrp"))
3483: return true;
3484: else if (UpgradeUtils.isPackageInstalled("SUNWfpsrp"))
3485: return true;
3486: else if (UpgradeUtils.isPackageInstalled("SUNWjpsrp"))
3487: return true;
3488: else if (UpgradeUtils.isPackageInstalled("SUNWkpsrp"))
3489: return true;
3490: else if (UpgradeUtils.isPackageInstalled("SUNWcpsrp"))
3491: return true;
3492: else if (UpgradeUtils.isPackageInstalled("SUNWhpsrp"))
3493: return true;
3494: // No Seperate package for JES3 or JES4 Rewriter Proxy.
3495: } else if (linuxOS == true) {
3496: // JES1 or JES2 Rewriter Proxy RPM Check
3497: if (UpgradeUtils
3498: .isRPMInstalled("sun-portal-rewriterproxy-de"))
3499: return true;
3500: else if (UpgradeUtils
3501: .isRPMInstalled("sun-portal-rewriterproxy-es"))
3502: return true;
3503: else if (UpgradeUtils
3504: .isRPMInstalled("sun-portal-rewriterproxy-fr"))
3505: return true;
3506: else if (UpgradeUtils
3507: .isRPMInstalled("sun-portal-rewriterproxy-ja"))
3508: return true;
3509: else if (UpgradeUtils
3510: .isRPMInstalled("sun-portal-rewriterproxy-ko"))
3511: return true;
3512: else if (UpgradeUtils
3513: .isRPMInstalled("sun-portal-rewriterproxy-zh_CN"))
3514: return true;
3515: else if (UpgradeUtils
3516: .isRPMInstalled("sun-portal-rewriterproxy-zh_TW"))
3517: return true;
3518: //No Seperate RPM for JES3 or JES4 Rewriter Proxy
3519: }
3520: }
3521: return false;
3522: }
3523:
3524: // Finish - L10N Code change
3525:
3526: private void createUpdateServiceAMRequest() {
3527:
3528: String resDir = UpgradeConstants.SOLARIS_TMP_DIR
3529: + File.separator + "portal" + File.separator + "ps63";
3530: List dnList = getAllSubOrgs(ORG_DN);
3531: String tmpDN = null;
3532:
3533: String fileNamePattern = "SRArequest[\\d]{1,3}.xml$";// Files of the form "request<number>.xml"
3534: String[] amrequestfiles = UpgradeUtils
3535: .returnFileListHavingPattern(resDir, fileNamePattern);
3536:
3537: int unRegisterCounter = dnList.size() + amrequestfiles.length;
3538: int registerCounter = dnList.size() + amrequestfiles.length + 1;
3539: String tmpAMRequestFile = null;
3540:
3541: for (int i = 0; i < dnList.size(); i++) {
3542: tmpDN = (String) dnList.get(i);
3543: tmpAMRequestFile = resDir + File.separator + "SRArequest"
3544: + unRegisterCounter + ".xml";
3545: FileUtil.copyFile(resDir + File.separator
3546: + "AMUnRegisterService.xml", tmpAMRequestFile);
3547: FileUtil.replaceTokenInFile(new File(tmpAMRequestFile),
3548: "DN_NAME", tmpDN.trim());
3549:
3550: tmpAMRequestFile = resDir + File.separator + "SRArequest"
3551: + registerCounter + ".xml";
3552: FileUtil.copyFile(resDir + File.separator
3553: + "AMRegisterService.xml", tmpAMRequestFile);
3554: FileUtil.replaceTokenInFile(new File(tmpAMRequestFile),
3555: "DN_NAME", tmpDN.trim());
3556: unRegisterCounter--;
3557: registerCounter++;
3558: }
3559:
3560: }
3561:
3562: private List getAllSubOrgs(String ORG_DN) {
3563:
3564: ArrayList dnList = new ArrayList();
3565: ExecuteUtil eu = new ExecuteUtil();
3566: eu.storeOutput(true);
3567: String[] amAdminArgs = new String[6];
3568: String reqFile = UpgradeConstants.SOLARIS_TMP_DIR
3569: + File.separator + "portal" + File.separator + "ps63"
3570: + File.separator + "getSubOrgList.xml";
3571:
3572: FileUtil
3573: .replaceTokenInFile(new File(reqFile), "ORG_DN", ORG_DN);
3574:
3575: amAdminArgs[0] = "-u";
3576: amAdminArgs[1] = ADMIN_DN;
3577: amAdminArgs[2] = "-w";
3578: amAdminArgs[3] = IDSAME_ADMIN_PASSWORD;
3579: amAdminArgs[4] = "-t";
3580: amAdminArgs[5] = reqFile;
3581: String command = AM_BASEDIR + File.separator + AM_PRODUCT_DIR
3582: + File.separator + "bin" + File.separator + "amadmin";
3583: eu.exec(command, amAdminArgs);
3584:
3585: StringTokenizer stk = new StringTokenizer(eu.getOutput(), "\n");
3586: stk.nextToken();
3587: stk.nextToken();
3588: stk.nextToken();
3589: String tmpDN = stk.nextToken();
3590: while (stk.hasMoreTokens()) {
3591: dnList.add(tmpDN.trim());
3592: tmpDN = stk.nextToken();
3593: }
3594: return dnList;
3595: }
3596: }
|