[izpack-users] Setting Built-In Variable
Dennis Reil
Dennis.Reil at reddot.de
Wed Oct 18 13:30:23 CEST 2006
I think you can create an installer listener. The modification of the
variable should be done in the beforePacks-method, so that it will be
modified right before starting the install process.
regards
Dennis
Am Mittwoch, den 18.10.2006, 10:42 +0200 schrieb Bartz, Klaus:
> Hi Thao,
> I thought a little bit about your problem, but the only resolution
> I have seen is to create a custom panel.
> Following my custom panel to ask for the BEA path.
> In my properties file I do not use $FILE_SEPARATOR because it is
> something like readonly, else I use a custom variable named
> EJBProperties.ServerHomeDir. In method isValidated you can see
> how to make the separators we need. There are two variables,
> one with UNIX, one with DOS separator.
> For creating a custom panel see the docu you have installed (I hope).
> There are also some threads in the izpack-users list, e.g.
> https://lists.berlios.de/pipermail/izpack-users/2006-October/002697.html
> https://lists.berlios.de/pipermail/izpack-users/2006-October/002729.html
> Some threads are broken on the mail archive, therefore search with
> "subject" sorting.
>
> Cheers
>
> Klaus
>
> -----------------------------------------------------------------------------
> package com.coi.tools.install.panels;
>
> import java.io.File;
> import java.net.InetAddress;
> import java.net.UnknownHostException;
>
> import javax.swing.JCheckBox;
> import javax.swing.JTextField;
> import javax.swing.border.EmptyBorder;
>
> import com.izforge.izpack.installer.InstallData;
> import com.izforge.izpack.installer.InstallerFrame;
> import com.izforge.izpack.panels.PathInputPanel;
> import com.izforge.izpack.util.IoHelper;
>
> /**
> * Panel which asks for the path of BEA and whether extended configuration should be performed or
> * not. Additional the host of the EJB will be verified.
> *
> * @author Klaus Bartz
> */
> public class BEAPathPanel extends PathInputPanel
> {
>
> private static final String[] testFiles = new String[] { "server" + File.separator + "lib"
> + File.separator + "weblogic.jar"};
>
> /** The text field for the host name. */
> protected JTextField hostName;
>
> /** The 'extended button. */
> protected JCheckBox extendedCheckBox;
>
> /**
> * The constructor.
> *
> * @param parent The parent window.
> * @param idata The installation data.
> */
> public BEAPathPanel(InstallerFrame parent, InstallData idata)
> {
> super(parent, idata);
> setMustExist(true);
> setExistFiles(BEAPathPanel.testFiles);
>
> }
>
> /**
> * This method will be called from ctor of PathInputPanel, after standard components are
> * defined.
> */
> public void createLayoutBottom()
> {
> hostName = CustomPanel.createHostNameFieldIfNeeded(this);
> extendedCheckBox = new JCheckBox(parent.langpack.getString("customCommon.extended"), false);
> extendedCheckBox.setBorder( new EmptyBorder( 0,0,0,0 ) );
> add(extendedCheckBox, NEXT_LINE);
> }
>
> /**
> * Indicates wether the panel has been validated or not.
> *
> * @return Wether the panel has been validated or not.
> */
> public boolean isValidated()
> {
> if(idata.getVariable("PANEL_LAYOUT_TEST") != null)
> return(true);
> if (!super.isValidated()) return (false);
> String chosenPath = pathSelectionPanel.getPath();
> if (chosenPath == null || chosenPath.length() < 1) return (false);
> String hostNameStr = null;
> try
> {
> hostNameStr = (hostName != null) ? hostName.getText() : idata.getVariable("LocalHost");
> InetAddress.getByName(hostNameStr);
> }
> catch (UnknownHostException e)
> {
> emitError(parent.langpack.getString("installer.error"), parent.langpack
> .getString("SelectEJBTypePanel.invalidHost"));
> return (false);
> }
> idata.setVariable("EJBProperties.EJB_Host", hostNameStr);
>
> idata.setVariable("EJBPath", chosenPath);
> idata.setVariable("BEAExtendedConfig", extendedCheckBox.isSelected() ? "yes" : "no");
> String path = chosenPath;
> path = IoHelper.replaceString(path, "\\", "/");
> idata.setVariable("EJBProperties.ServerHomeDir", path);
> path = IoHelper.replaceString(path, "/", "\\");
> idata.setVariable("ServerHomeDirDOS", path);
> path = IoHelper.replaceString(path, "\\", "\\\\");
> idata.setVariable("EJBProperties.ServerHomeDirDOS", path);
>
> return (true);
> }
>
> /*
> * (non-Javadoc)
> *
> * @see com.izforge.izpack.installer.IzPanel#panelActivate()
> */
> public void panelActivate()
> {
> super.panelActivate();
> if (!SelectEJBTypePanel.isTypeChoosen(idata, SelectEJBTypePanel.BEA)
> && idata.getVariable("PANEL_LAYOUT_TEST") == null)
> parent.skipPanel();
> else
> {
> String defaultPath = IoHelper.getenv("WLS_HOME");
> if (defaultPath == null) defaultPath = "";
> if (idata.getVariable("EJBPath") != null)
> pathSelectionPanel.setPath(idata.getVariable("EJBPath"));
> else
> pathSelectionPanel.setPath(defaultPath);
> if (hostName != null)
> {
> if (idata.getVariable("EJBProperties.EJB_Host") != null)
> hostName.setText(idata.getVariable("EJBProperties.EJB_Host"));
> else
> hostName.setText(idata.getVariable("LocalHost"));
> }
> }
> }
>
> }
>
> ----------------------------------------------------------------------
>
>
> >-----Original Message-----
> >From: izpack-users-bounces at lists.berlios.de
> >[mailto:izpack-users-bounces at lists.berlios.de]On Behalf Of thach thao
> >Sent: Wednesday, October 18, 2006 6:29 AM
> >To: izpack-users at lists.berlios.de
> >Subject: [izpack-users] Setting Built-In Variable
> >
> >
> >
> >Hi all,
> >
> >I set the value for $FILE_SEPARATOR but it same does not work :-(.
> >
> >I have a variable named $tomcat_home, during installing, this
> >variable will
> >receive the real-value of tomcat home of user machine.
> >
> >In window, the value will be as the same "c:\Program Files\Apache
> >Group\Tomcat 4.1\" and i want to change it to "c:/Program Files/Apache
> >Group/Tomcat 4.1/" before installer use it for parsering in files.
> >
> >How I can do it?
> >
> >I attach the installation.xml file and a example files need to parse.
> >
> >Thanks so much for your support.
> >Thach Thao.
> >
> >http://www.nabble.com/file/3730/Installation.xml Installation.xml
> >http://www.nabble.com/file/3731/log4j.properties%20%28Using%20f
> or%20Package%29
> log4j.properties (Using for Package)
> http://www.nabble.com/file/3732/log4j.properties%28After%20installed%29
> log4j.properties(After installed)
>
More information about the izpack-users
mailing list