/** * @return the suggested program group */ public String getSuggestedProgramGroup() { return installData.getVariables().replace(suggestedProgramGroup); }
/** * Replaces any variables in the supplied value. * * @param value the value * @return the value with variables replaced */ protected String replaceVariables(String value) { return installData.getVariables().replace(value); }
/** * Helper to replace variables in a string. * * @param value the string to perform variable replacement on. May be {@code null} * @return the string with any variables replaced with their values */ protected String replaceVariables(String value) { return getInstallData().getVariables().replace(value); }
/** * Runs the panel using the supplied properties. * * @param installData the installation data * @param properties the properties * @return {@code true} if the installation is successful, otherwise {@code false} */ @Override public boolean run(InstallData installData, Properties properties) { String path = properties.getProperty(InstallData.INSTALL_PATH); path = installData.getVariables().replace(path); installData.setInstallPath(path); return true; }
private void handleInstallPath(InstallData installData, String path) { // Allow for variable substitution of the installpath value path = installData.getVariables().replace(path); installData.setInstallPath(path); } }
/** * Constructs an {@code AbstractPanels}. * * @param panels the panels * @param installData */ public AbstractPanels(List<T> panels, InstallData installData) { this.panels = new ArrayList<Panel>(); this.panelViews = panels; this.installData = installData; this.variables = installData.getVariables(); nextEnabled = !panels.isEmpty(); int index = 0; for (T panelView : panels) { panelView.setIndex(index++); this.panels.add(panelView.getPanel()); } }
/** * Returns the named attribute value, replacing any variables present. * * @param element the element * @param name the attribute name * @param defaultValue the default value if the attribute isn't set * @return the corresponding value */ public String getString(IXMLElement element, String name, String defaultValue) { String value = element.getAttribute(name); if (value != null && !value.isEmpty()) { value = installData.getVariables().replace(value); } if (value == null) { value = defaultValue; } return value; }
@Override public String resolve() { VariableSubstitutor substitutor = new VariableSubstitutorImpl(getInstallData().getVariables()); return resolve(substitutor); }
/** * Runs the specified process panel job. * @param job a ProcessPanelWorker job. * @return the job's return value. */ private boolean runJob(ProcessPanelWorker.ProcessingJob job) { Boolean val; this.handler.startProcess(job.name); val = job.run(this.handler, idata.getVariables()); this.handler.finishProcess(); return val; }
/** * Returns the uninstall name, used to initialise the {@link RegistryHandler#setUninstallName(String)}. * <p/> * This implementation returns a concatenation of the <em>APP_NAME</em> and <em>APP_VER</em> variables, * separated by a space. * * @return the uninstall name */ protected String getUninstallName() { Variables variables = getInstallData().getVariables(); return variables.get("APP_NAME") + " " + variables.get("APP_VER"); }
@Override public boolean run(InstallData installData, Properties properties) { boolean result = false; String path = properties.getProperty(InstallData.INSTALL_PATH); if (path == null || "".equals(path.trim())) { System.err.println("Missing mandatory target path!"); } else if (TargetPanelHelper.isIncompatibleInstallation(path, installData.getInfo().isReadInstallationInformation())) { System.err.println(getIncompatibleInstallationMsg(installData)); } else { path = installData.getVariables().replace(path); installData.setInstallPath(path); result = true; } return result; }
@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 variables.replace(val).equals(variables.replace(value)); } } else { return false; } }
/** * Helper to return a localised message, given its id. * * @param id the message identifier * @param replace if {@code true}, replace any variables in the message with their corresponding values * @return the corresponding message or {@code null} if none is found */ private String getMessage(String id, boolean replace) { String message = null; if (id != null) { Messages messages = installData.getMessages(); message = messages.get(id); if (replace) { message = installData.getVariables().replace(message); } } return message; }
@Override public void runAutomated(InstallData idata, IXMLElement panelRoot) { // We set the installation path IXMLElement ipath = panelRoot.getFirstChildNamed(UserPathPanel.pathElementName); // Allow for variable substitution of the installpath value if (ipath != null) { String path = ipath.getContent(); path = idata.getVariables().replace(path); idata.setVariable(UserPathPanel.pathVariableName, path); } }
text = installData.getVariables().replace(text); if (text != null)
if (installData.getRules().canInstallPack(pack, installData.getVariables()))
private void handleInstallPath(InstallData installData, String path) { // Allow for variable substitution of the installpath value path = installData.getVariables().replace(path); if (TargetPanelHelper.isIncompatibleInstallation(path, installData.getInfo().isReadInstallationInformation())) { throw new InstallerException(installData.getMessages().get("TargetPanel.incompatibleInstallation")); } installData.setInstallPath(path); } }
if (!getInstallData().getVariables().isBlockedVariableName(getVariable())) result = getInstallData().getVariables().replace(format(initialValues));
/** * Returns the default value of the field. * * @return the default value. May be {@code null} */ @Override public String getDefaultValue() { String value = super.getDefaultValue(); if (value != null) { ValidationStatus status = validateFormatted(value); this.defaultValues = status.isValid()?status.getValues():null; } else { // Maybe an unresolved variable, for example <spec default="${abc}"/> this.defaultValues = null; } if (defaultValues != null) { return getInstallData().getVariables().replace(format(defaultValues)); } return null; }
public PacksModel(InstallData idata) { this.installData = idata; this.rules = idata.getRules(); try{ this.messages = idata.getMessages().newMessages(Resources.PACK_TRANSLATIONS_RESOURCE_NAME); } catch(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.nameToRow = getNametoRowMapping(packs); this.nameToPack = getNametoPackMapping(idata.getAvailablePacks()); this.packs = setPackProperties(packs, nameToPack); this.checkValues = initCheckValues(packs, packsToInstall); updateConditions(true); updatePacksToInstall(); }