/** * Returns the default install path. * * @return the default install path or null if none set yet * @see #setDefaultInstallPath */ @Override public String getDefaultInstallPath() { return getVariable(DEFAULT_INSTALL_PATH); }
/** * Constructs an <tt>AutomatedInstallData</tt>. * * @param variables the variables * @param platform the platform */ public AutomatedInstallData(Variables variables, Platform platform) { this.variables = variables; this.platform = platform; setAvailablePacks(new ArrayList<Pack>()); setSelectedPacks(new ArrayList<Pack>()); setPanelsOrder(new ArrayList<Panel>()); setAttributes(new HashMap<String, Object>()); }
/** * Sets the default install path. * * @param path the default install path * @see #getDefaultInstallPath */ @Override public void setDefaultInstallPath(String path) { setVariable(DEFAULT_INSTALL_PATH, path); }
installData.setVariable(ScriptParserConstant.APP_NAME, info.getAppName()); if (info.getAppURL() != null) installData.setVariable(ScriptParserConstant.APP_URL, info.getAppURL()); installData.setVariable(ScriptParserConstant.APP_VER, info.getAppVersion()); if (info.getUninstallerCondition() != null) installData.setVariable("UNINSTALLER_CONDITION", info.getUninstallerCondition()); installData.setInfo(info); if (info.getInstallationSubPath() != null) installPath = IoHelper.translatePath(dir + info.getInstallationSubPath(), installData.getVariables()); installData.setDefaultInstallPath(installPath); installData.setInstallPath(installPath); installData.setVariable(varName, properties.getProperty(varName)); installData.setPanelsOrder(panelsOrder); installData.setAvailablePacks(availablePacks); installData.setAllPacks(allPacks); installData.getSelectedPacks().add(availablePack);
PrivilegedRunner runner = new PrivilegedRunner(installData.getPlatform()); if (!runner.hasCorrectPermissions(installData.getInfo(), installData.getRules())) System.out.println(installData.getMessages().get("AutomatedInstaller.permissionError")); installData.setInstallationRecord(installRecord); String code = installRecord.getAttribute("langpack", "eng"); locales.setLocale(code); installData.setMessages(locales.getMessages()); installData.setLocale(locales.getLocale(), locales.getISOCode()); installData.setMediaPath(mediaPath);
this.automatedInstallData.setAvailablePacks(new ArrayList<Pack>()); for (Pack pack : this.automatedInstallData.getAllPacks()) this.automatedInstallData.getAvailablePacks().add(pack); this.automatedInstallData.setVariable("INSTALL_GROUP", selected.name); logger.fine("Added variable INSTALL_GROUP=" + selected.name);
/** * Sets the locale. * <p/> * NOTE: for backwards compatibility, this sets the {@link ScriptParserConstant#ISO3_LANG ISO3} variable to be the * the <em>lowercase</em> version of the supplied ISO code. * * @param locale the locale * @param code the 3 character ISO code used to select the locale. May be an ISO country code or an ISO language * code */ public void setLocale(Locale locale, String code) { this.locale = locale; getInstallationRecord().setAttribute("langpack", code.toLowerCase()); setVariable(ScriptParserConstant.ISO3_LANG, code.toLowerCase()); if(locale != null) { setVariable(ScriptParserConstant.ISO2_LANG, locale.getLanguage()); } }
String logfile = installData.getVariable(LOGFILE_PATH); BufferedWriter writer = null; if (logfile != null) logfile = installData.getInfo().getUninstallerPath() + "/install.log"; logfile = IoHelper.translatePath(logfile, installData.getVariables()); File outFile = new File(logfile); if (!outFile.getParentFile().exists())
IXMLElement installationRecord = installData.getInstallationRecord(); if (installationRecord != null && installationRecord.hasChildren()) if (installData.isRebootNecessary()) switch (installData.getInfo().getRebootAction())
/** * Add the contents of a custom langpack to the default langpack, if it exists. * * @param installData the install data to be used */ public static void addCustomLangpack(AutomatedInstallData installData, Locales locales) { // We try to load and add a custom langpack. try { installData.getMessages().add(locales.getMessages(Resources.CUSTOM_TRANSLATIONS_RESOURCE_NAME)); logger.fine("Found custom langpack for " + installData.getLocaleISO3()); } catch (ResourceNotFoundException exception) { logger.fine("No custom langpack for " + installData.getLocaleISO3() + " available"); } }
protected void setSelectedPacksBySelectedGroup(GroupData selected) { logger.fine("data=" + selected.name); // Now remove the packs not in groupPackNames Iterator<Pack> iter = automatedInstallData.getAvailablePacks().iterator(); while (iter.hasNext()) { Pack pack = iter.next(); //reverse dependencies must be reset in case the user is going //back and forth between the group selection panel and the packs selection panel pack.setDependants(null); if (!selected.packNames.contains(pack.getName())) { iter.remove(); logger.fine("Removed available pack: " + pack.getName()); } } this.automatedInstallData.getSelectedPacks().clear(); this.automatedInstallData.getSelectedPacks().addAll(this.automatedInstallData.getAvailablePacks()); }
protected static String getString(AutomatedInstallData automatedInstallData, String key) { return automatedInstallData.getMessages().get(key); } }
/** * Returns the value of the named attribute. * * @param name the name of the attribute * @return the value of the attribute or null if not set * @see #setAttribute */ @Override public Object getAttribute(String name) { return getAttributes().get(name); }
private void handleError(IzPackException ize) throws IzPackException { Messages messages = installData.getMessages(); // Enable continuing subsequent actions on warnings only switch (ize.getPromptType()) { case WARNING: AbstractUIHandler handler = new PromptUIHandler(prompt); if (handler.askWarningQuestion(null, AbstractPrompt.getThrowableMessage(ize) + "\n" + messages.get("installer.continueQuestion"), AbstractUIHandler.CHOICES_YES_NO, AbstractUIHandler.ANSWER_NO) != AbstractUIHandler.ANSWER_YES) { throw new InstallerException(messages.get("installer.cancelled")); } break; default: throw ize; } }
/** * Sets a named attribute. The panels and other IzPack components can attach custom attributes * to InstallData to communicate with each other. For example, a set of co-operating custom * panels do not need to implement a common data storage but can use InstallData singleton. The * name of the attribute should include the package and class name to prevent name space * collisions. * * @param name the name of the attribute to set * @param value the value of the attribute or null to unset the attribute * @see #getAttribute */ @Override public void setAttribute(String name, Object value) { if (value == null) { getAttributes().remove(name); } else { getAttributes().put(name, value); } }
@Override public String getLocaleISO3() { return getVariable(ScriptParserConstant.ISO3_LANG); }
/** * Sets the install path. * * @param path the new install path * @see #getInstallPath */ @Override public void setInstallPath(String path) { setVariable(INSTALL_PATH, path); }
/** * Returns the media path for multi-volume installation. * * @return the media path. May be <tt>null</tt> */ @Override public String getMediaPath() { return getVariable(MEDIA_PATH); }
/** * Sets the media path for multi-volume installation. * * @param path the media path. May be <tt>null</tt> */ @Override public void setMediaPath(String path) { setVariable(MEDIA_PATH, path); }
@Override public String getLocaleISO2() { return getVariable(ScriptParserConstant.ISO2_LANG); }