[izpack-users] variable dependent on os

nbc nathan.chun at ngc.com
Thu Oct 4 22:39:34 CEST 2007


Dennis:
here is what I ended up implementing

My conditions.xml :
<conditions>
   <conditions type="MyWindowsOs" id="windowsos"/>
</conditions>


The UserInput.xml:
<panel order="0">
   <variable name="MY_VAR" value="Yellow"/>
   <variable name="MY_VAR" value="Blue" conditionid="windowsos"/>


the condition impl: file name MywindowsosConditions.java (I only needed to
impl isTrue())
...
publuic boolean isTrue()
{
   String sys = System.getProperties("os.name");
   if (sys.startsWith("Windows")) 
   {
      return true;
  }
  else 
 {
    return false;
 }

}


I just needed to set MY_VAR Blue if on windows.  Any other os MY_VAR =
Yellow


Thanks again Dennis





Dennis Reil wrote:
> 
> Please post your condition implementation and your conditions.xml.
> 
> Regards,
> 
>    Dennis
> 
> -----Ursprüngliche Nachricht-----
> Von: izpack-users-bounces at lists.berlios.de
> [mailto:izpack-users-bounces at lists.berlios.de] Im Auftrag von nbc
> Gesendet: Samstag, 29. September 2007 01:22
> An: izpack-users at lists.berlios.de
> Betreff: Re: [izpack-users] variable dependent on os
> 
> 
> Dennis:
> 
> I attempted to implement what you had posted.  It works fine on a windows
> install, but on a unix install, I get:
> 
> java.lang.NullPointerException 
>         at
> com.izforge.izpack.rules.RulesEngine.analyzeCondition(RulesEngine.java:97) 
>         at
> com.izforge.izpack.rules.RulesEngine.readConditions(RulesEngine.java:119) 
>         at
> com.izforge.izpack.rules.RulesEngine.<init>(RulesEngine.java:55) 
>         at
> com.izforge.izpack.installer.InstallerFrame.loadConditions(InstallerFrame.java:286) 
>         at
> com.izforge.izpack.installer.InstallerFrame.<init>(InstallerFrame.java:251) 
>         at
> com.izforge.izpack.installer.GUIInstaller.loadGUI(GUIInstaller.java:433) 
>         at
> com.izforge.izpack.installer.GUIInstaller.access$100(GUIInstaller.java:79) 
>         at
> com.izforge.izpack.installer.GUIInstaller$2.run(GUIInstaller.java:148) 
>         at
> java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) 
>         at java.awt.EventQueue.dispatchEvent(EventQueue.java:461) 
>         at
> java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242) 
>         at
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163) 
>         at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157) 
>         at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149) 
>         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110) 
> 
> 
> 
> I also tried qualifying the condition with com.izpack...rules.  Same
> exception on unix.
> (I placed my condition in the rules package.)
> 
> 
> Thanks again
> 
> 
> 
> 
> 
> 
> 
> Dennis Reil wrote:
>> 
>> Currently this can only be done in UserInputPanel by using the variable
>> element and custom conditions on OS, e.g.
>> 
>> In your userinputpanel.xml:
>> 
>> <panel ...>
>> ...
>>    <variable name="MY_VAR" value="Blue" conditionid="unixos" />
>>    <variable name="MY_VAR" value="Yellow" conditionid="windowsos" />
>> ...
>> </panel>
>> 
>> And you'll have to implement a condition based on
>> com.izforge.izpack.rules.Condition, assuming a name of
>> com.mycompany.OsCondition, 
>> your conditions.xml has to look like:
>> 
>> conditions.xml:
>> <conditions>
>>   <condition type="com.mycompany.OsCondition" id="unixos">
>>      <os family="unix" />
>>   </condition>
>>   <condition type="com.mycompany.OsCondition" id="windowsos">
>>      <os family="windows" />
>>   </condition>
>> </conditions>
>> 
>> Regards,
>>    Dennis
>> 
>> -----Ursprüngliche Nachricht-----
>> Von: izpack-users-bounces at lists.berlios.de
>> [mailto:izpack-users-bounces at lists.berlios.de] Im Auftrag von nbc
>> Gesendet: Mittwoch, 26. September 2007 17:59
>> An: izpack-users at lists.berlios.de
>> Betreff: [izpack-users] variable dependent on os
>> 
>> 
>> Hi everyone:
>> 
>> I wanted to define a variable depneding upon a particular os.  Example:
>> If
>> the os is unix, then I want $MY_VAR = Blue, if the os is windows, I want
>> $MY_VAR = Yellow.  The variable will then be used in substituion within a
>> file.
>> 
>> Any help welcomed.
>> 
>> Thanks
>> -- 
>> View this message in context:
>> http://www.nabble.com/variable-dependent-on-os-tf4523224.html#a12903923
>> Sent from the izpack users mailing list archive at Nabble.com.
>> 
>> _______________________________________________
>> izpack-users mailing list
>> izpack-users at lists.berlios.de
>> https://lists.berlios.de/mailman/listinfo/izpack-users
>> _______________________________________________
>> izpack-users mailing list
>> izpack-users at lists.berlios.de
>> https://lists.berlios.de/mailman/listinfo/izpack-users
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/variable-dependent-on-os-tf4523224.html#a12950143
> Sent from the izpack users mailing list archive at Nabble.com.
> 
> _______________________________________________
> izpack-users mailing list
> izpack-users at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/izpack-users
> _______________________________________________
> izpack-users mailing list
> izpack-users at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/izpack-users
> 
> 

-- 
View this message in context: http://www.nabble.com/variable-dependent-on-os-tf4523224.html#a13048287
Sent from the izpack users mailing list archive at Nabble.com.



More information about the izpack-users mailing list