public PacksModel(InstallData idata) { this.installData = idata; this.rules = idata.getRules(); try { this.messages = idata.getMessages().newMessages(PackHelper.LANG_FILE_NAME); } catch (com.izforge.izpack.api.exception.ResourceNotFoundException ex) { this.messages = idata.getMessages(); } this.variables = idata.getVariables(); this.packsToInstall = idata.getSelectedPacks(); this.modifyInstallation = Boolean.valueOf(idata.getVariable(InstallData.MODIFY_INSTALLATION)); this.installedPacks = loadInstallationInformation(modifyInstallation); this.packs = getVisiblePacks(); this.hiddenPacks = getHiddenPacks(); this.allPacks = idata.getAvailablePacks(); this.nameToRow = getNametoRowMapping(packs); this.nameToPack = getNametoPackMapping(allPacks); this.packs = setPackProperties(packs, nameToPack); this.checkValues = initCheckValues(packs, packsToInstall); updateConditions(true); updatePacksToInstall(); }
/** * Attempt to read load specifications from OS specific shortcut specification file. If fail to * read from OS specific shortcut specification file, attempt to load general shortcut * specification file. * * @throws Exception for any problems in reading the specification TODO: If internal flag mapped * installData.isDebug() print out information on substitutedSpec */ private IXMLElement readShortcutSpec() throws Exception { IXMLElement spec = null; InputStream shortcutSpec = null; try { shortcutSpec = resources.getInputStream(TargetFactory.getCurrentOSPrefix() + SPEC_FILE_NAME); } catch (ResourceNotFoundException resourceNotFound) { try { shortcutSpec = resources.getInputStream(SPEC_FILE_NAME); } catch (ResourceNotFoundException shortcutsNotFound) { // Fail on next try block } } try { VariableSubstitutor replacer = new VariableSubstitutorImpl(installData.getVariables()); String substitutedSpec = replacer.substitute(shortcutSpec, SubstitutionType.TYPE_XML); IXMLParser parser = new XMLParser(); spec = parser.parse(substitutedSpec); } catch (Exception e) { return null; } shortcutSpec.close(); return spec; }
@Override public boolean isTrue() { InstallData installData = getInstallData(); if (installData != null) { String val = installData.getVariable(variablename); if (val == null) { return false; } else { Variables variables = installData.getVariables(); return val.equals(variables.replace(value)); } } else { return false; } }
/** @return the suggested program group */ public String getSuggestedProgramGroup() { return installData.getVariables().replace(suggestedProgramGroup); }