[izpack-users] Using ProcessPanel and Log4J

Mandeep Saini Mandeep.Saini at dante.org.uk
Thu Apr 26 16:04:15 CEST 2007


Hi Marius,

I am sending the attachments again as doc (M.S.) files. I used the 
Altova XML editor to wrote them.

Regards
Mandeep


  Hi Mandeep,
> 
> Im having some trouble with the attachment, not sure if you worked in an
> editor or something, but the xml files look as follow:
> 
> {\rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\fnil Courier
> New;}{\f1\fnil\fcharset0 Courier New;}{\f2\fswiss\fcharset0 Arial;}}
> {\colortbl
> ;\red0\green128\blue128;\red63\green127\blue127;\red127\green0\blue127;\
> red0\green0\blue0;\red42\green0\blue255;\red232\green242\blue254;}
> {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\cf1\f0\fs20
> <?\cf2 xml \cf3 version\cf4 =\cf5 "1.0" \cf3 encoding\cf4 =\cf5
> "iso-8859-1" \cf3 standalone\cf4 =\cf5 "yes" \cf1 ?>\cf0\par
> \cf1 <\cf2 installation \cf3 version\cf4 =\cf5 "1.0"\cf1 >\cf0\par
> \cf4\tab\cf1 <\cf2 info\cf1 >\cf0\par
> \cf4         \cf1 <\cf2 appname\cf1 >\cf4 TradeRoot\cf1 </\cf2
> appname\cf1 >\cf0\par
> \cf4         \cf1 <\cf2 appversion\cf1 >\cf4 4.5.1\cf1 </\cf2
> appversion\cf1 >\cf0\par
> \cf4         \cf1 <\cf2 authors\cf1 >\cf0\par
> \cf4             \cf1 <\cf2 author \cf3 name\cf4 =\cf5 "Marius" \cf3
> email\cf4 =\cf5 "marius.hugo at traderoot.com"\cf1 />\cf0\par
> \cf4             \cf1 <\cf2 author \cf3 name\cf4 =\cf5 "TRADEROOT" \cf3
> email\cf4 =\cf5 "traderoot at traderoot.com"\cf1 />\cf0\par
> \cf4         \cf1 </\cf2 authors\cf1 >\cf0\par
> \cf4         \cf1 <\cf2 url\cf1 >\cf4 http://www.traderoot.com/\cf1
> </\cf2 url\cf1 >\cf0\par
> \cf4         \cf1 <\cf2 javaversion\cf1 >\cf4 1.4\cf1 </\cf2
> javaversion\cf1 >\cf0\par
> \cf4     \f1\tab\cf1\f0 </\cf2 info\cf1 >\cf0\par
> 
>  this does not parse,
> Unless I ma missing something dreadfully obvious
> 
> Thanks,
> marius
> 
> -----Original Message-----
> From: izpack-users-bounces at lists.berlios.de
> [mailto:izpack-users-bounces at lists.berlios.de] On Behalf Of Mandeep
> Saini
> Sent: 24 April 2007 15:44
> To: izpack-users at lists.berlios.de
> Subject: Re: [izpack-users] Using ProcessPanel and Log4J
> 
> Hi Marius,
> 
> I am sending you a detailed example try to follow it:
> for ProcessPanel.Spec.xml and install.xml find the attachments:
> 
> com.traderoot.tools.artifact.installer.LicenseInstall class:
> 
> public class LicenseInstall {
> public void run( AbstractUIProcessHandler handler, String[] args) {
> 	String installPath = args[0];
> 	String trtLicense = args[1];
> 	String tradeRootInstallationPath = args[2];
> 	String tradeRootRepositoriesPath = args[3];
> 	String check = args[4];
> 	String output = null;
> 	
> 	if(check.equals("Selected"){
> 	output = "install path is: " + installPath + "\n";
> 	output = output + "trtLicense variable contains: " + trtLicense
> + "\n";
> 	output = output + "tradeRootInstallationPath is: " +
> tradeRootInstallationPath + "\n";
> 
> 	}	
> 	
> 	try {
> 	 FileWriter propWriter propWriter= new
> FileWriter(tradeRootRepositoriesPath + "/MyProp.properties");
> 	 BufferedWriter outBuffer = new BufferedWriter(propWriter);
> 	 outBuffer.write(output);
> 	 outBuffer.close();
> 	}
> 	catch(java.io.IOException ioe){	 }	
> 
> }
> }
> 
> Hope it will help.
> 
> Regards
> Mandeep
> 
> Marius Hugo wrote:
>> Thanks, I tried all of that now, but I still get an exception and I 
>> cannot get the ProcessPanel logging to work...
>> My code that im passing looks like this
>>
>> public class LicenseInstall {
>> 	public void run(AbstractUIProcessHandler handler, String[]
> args){
>> 		String install_path = args[0];
>> 		Util.configureLogging();
>> 		Util.setLogLevel(Util.VERBOSE);
>> 		Util.log(Util.VERBOSE,"WORKING",classname,null);
>> 		
>> 		try{
>> 			LicenseInstall l = new LicenseInstall(args);
>> 		} catch (Exception x){
>> 			Util.log(Util.ERROR,"Uh-oh! ", classname,x);
>> 		}
>> 	}
>> 	 
>> ...
>> ..
>> ..
>> ..
>> }
>>
>> I expected to have a log file created containing the text "WORKING" on
> 
>> the C drive as is configured in my log4j, that didn't work inside the 
>> ProcessPanel (if I just run it in my environment it works) I have 
>> tried to just make a BufferedWriter and create a text file just to see
> 
>> if my class at least runs, but that also does nothing...so I don't 
>> think the log4j is the problem.
>>
>> I get the following window that pops up when I run the process panel:
>> Title -> Post Processing Error
>> -> Exception when running class:
>> com.traderoot.tools.artifact.installer.LicenseInstall,
>> com.traderoot.tools.artifact.installer.LicenseInstall.
>>
>> Could anyone point out anything that I'm missing? I'm gonna attach my 
>> install.xml file, etc...
>>
>> Thanks,
>> Marius
>>
>>
>> -----Original Message-----
>> From: izpack-users-bounces at lists.berlios.de
>> [mailto:izpack-users-bounces at lists.berlios.de] On Behalf Of Mandeep 
>> Saini
>> Sent: 20 April 2007 11:20
>> To: izpack-users at lists.berlios.de
>> Subject: Re: [izpack-users] Using ProcessPanel and Log4J
>>
>> Hi Marius,
>>
>> see the related comments below:
>> Marius Hugo wrote:
>>> Hi, I'm new to IzPack and I'm having a bit of trouble with the
>> following:
>>>  
>>> I have to merge files based on versioning and a license that I must 
>>> parse.  I have written my own code to handle this and included it in 
>>> a
>>> ProcessPanel.  I loaded the jars necessary using the <jar> tag (these
> 
>>> tags are in my install.xml).
>> Make sure you also include the jars on which your class has 
>> dependency, unless its already in izpack. For example, if my classes 
>> have dependency on 'commons-codec-1.3.jar' and my processing classes 
>> are in another jar file (say processingClasses.jar) then in my
> install.xml I will write:
>> <jar src="target/processPanelJar/processingClasses.jar" /> <jar 
>> src="target/jars/commons-codec-1.3.jar" />
>>
>>
>>> When I  get to running the panel, it simply tells me that there has 
>>> been an exception using my class and there is no actual indication 
>>> that the correct action was taken or that my class was even run (I 
>>> also have no clue what the exception is, it doesn't specify)
>>>  
>>> My class uses log4j and that has to read a file for its config.  
>>> Normally I would just say the following:
>>> java  -Dlog4j.configuration=log4j.properties com.bla bla bla.MyClass
>> If your class file needs some config file like 'log4j.properties' then
> 
>> the jar file which contains your class should also contain the 
>> properties file. make the code to find it from there.
>>>  
>>> How would I get this right in the process panel?  Cause I need to see
> 
>>> the logs so that I can know what's going on.
>>>  
>>> Also, I attempted to enable the ProcessPanel logging, but the file 
>>> never gets created in $INSTALL_PATH.
>> I have also tried to enable ProcessPanel logging but I could not do
> so. 
>> As far as I remember this feature is not completely implemented yet 
>> but I cant remember the actual cause.
>>> My ProcessPanel config looks a little something like this:
>>>  
>>> <processing>
>>>  <job name="InstallArtifacts">
>>>  <logfiledir>$INSTALL_PATH</logfiledir>
>>>  <executeclass
>> name="com.traderoot.tools.artifact.installer.LicenseInstall">
>>>   <args>
>>>               <arg value="$trtLicense"/>
>>>               <arg value="$INSTALL_PATH/TradeRoot/Installations/"/>
>>>               <arg value="$INSTALL_PATH/TradeRoot/Repositories"/>
>>>               <arg value="Stack"/>
>>>              </args>
>>>  </executeclass>
>>>  </job>
>>> </processing>
>>>  
>>> $trtLicense -> location of license that i captured in a UserInput
>> panel....
>>> I understand that all these values are passed in the specified order 
>>> to the main method of the class that I specified.
>> When you write any class for process panel, you don't need to write 
>> main method instead you write the run( AbstractUIProcessHandler 
>> handler, String[] args) method. For example:
>>
>> import com.izforge.izpack.util.AbstractUIProcessHandler;
>>
>> public class MyClass {
>> 	
>> public void run( AbstractUIProcessHandler handler, String[] args){
>> 	String install_path = args[0];
>> 	myMethod(install_path);
>> }
>>
>> public void myMethod(){
>> }
>> }
>>
>> Hope this works for you.
>>
>> Regards
>> Mandeep
>>
>>>  
>>> thanks guys
>>>  
>>>  
>>>  
>>> 	
>>>
>>> MARIUS HUGO
>>>
>>>
>>> SOFTWARE ENGINEER
>>>
>>> 	
>>> c
>>> t
>>> f
>>> 	+27 72 237 4083
>>> +27 21 551 5444
>>> +27 21 551 5449
>>>
>>> 	*TRADEROOT **TECHNOLOGIES (Pty)Ltd. Reg. No. 2000/005984/07.
>>> www.traderoot.com Directors* E von Engelhardt, J Ludik, B Dungan, W
>> Reece.
>>>  
>>>
>>>
>>> ---------------------------------------------------------------------
>>> -
>>> --
>>>
>>> _______________________________________________
>>> 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
>>
>>
>> ----------------------------------------------------------------------
>> --
>>
>> <?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
>>
>> <!--
>>
>> Some handy tips....
>>
>> VARIABLES
>>
>> <variables>
>> 	<variable name="app-version" value="1.4"/>
>> 	<variable name="released-on" value="08/03/2002"/> </variables>
>>
>> use variable as follows -> $name
>>
>>
>>
>> -->
>>
>>
>>
>> <installation version="1.0">
>>
>>
>>     
>>     
>>     <!-- gui preferences -->
>>     
>>     <guiprefs height="700" resizable="yes" width="900">
>> 	<laf name="metouia">
>> 		<os family="unix" />
>> 		<param name="decorate.frames" value="yes" />
>> 		<param name="decorate.dialogs" value="yes" />
>> 	</laf>
>> 	<laf name="metouia">
>> 		<os family="windows" />		
>> 		<param name="decorate.frames" value="yes" />
>> 		<param name="decorate.dialogs" value="yes" />
>> 	</laf>
>>      </guiprefs>
>>      
>>      
>>      
>>     <!-- 
>>  	Specify the supported languages
>>     -->
>>     <locale>
>>         <langpack iso3="eng"/>        
>>     </locale>
>>     
>>     
>>     <!-- 
>>  	Specify resources that can be loaded by the panels (defined and
> used later in this file)
>>  	I defined the logo, text containing info and the license
> agreement
>>     -->
>>     
>>     <resources>
>>     	<res id="Installer.image" src="/Logo/logo.jpg"/>
> <!-- left hand picture for all panes, trtLogo
>>     	...can also specify for each panel...id=Installer.image.n, where
> 
>> n=0..lastpanel-1  -->
>>     	
>> 	<res id="InfoPanel.info" src="/Doc/ReadMe.txt"/>
>> 	<res id="LicencePanel.licence" src="/Legal/License.txt"/>
>> 	<res id="userInputSpec.xml" src="userInputSpec.xml"/>
>> 	<res id="ProcessPanel.Spec.xml" src="ProcessPanel.Spec.xml"/>	
>>     </resources>
>>    
>>
>>     <jar src="lib/artifact-SNAPSHOT.jar"/>
>>     <jar src="lib/commons-io-1.1.jar"/>
>>     <jar src="lib/commons-logging-1.0.4.jar"/>
>>     <jar src="lib/log4j-1.2.8.jar"/>
>>     <jar src="lib/truezip-6.jar"/>
>>     
>>     <!-- 
>>         Indicate the panels we want to use, in order.
>>     -->
>>     <panels>
>>         <panel classname="HelloPanel"/>
>>         <panel classname="InfoPanel"/>
>>         <panel classname="UserInputPanel"/>
>>         <panel classname="LicencePanel"/>
>>         <panel classname="TargetPanel"/> 
>>         <panel classname="PacksPanel"/>
>>         <panel classname="InstallPanel"/>
>>         <panel classname="ProcessPanel"/>
>>         <panel classname="FinishPanel"/>
>>     </panels>
>>     
>>     
>>     
>>     <!-- InfoPanel -> info about this installer....for the info 
>> panel... -->
>>
>>     <info>
>>         <appname>TradeRoot</appname>
>>         <appversion>4.5.1</appversion>
>>         <authors>
>>             <author name="Marius" email="marius.hugo at traderoot.com"/>
>>             <author name="TRADEROOT" email="traderoot at traderoot.com"/>
>>         </authors>
>>         <url>http://www.traderoot.com/</url>
>>         <javaversion>1.4</javaversion>
>>     </info>
>>     
>>     
>>     
>>     
>>      <!-- 
>>         The packs section.
>>         We specify our packs here.
>>     -->
>>     
>>     
>>     
>>     <packs>
>>         <pack name="TradeRoot Core" required="yes">
>>             <description>The core files required for a TradeRoot
> Installation.  Please note that you are required to select at least one
> Installation</description>
>>             <required>yes</required>
>>             <preselected>yes</preselected>                        
>>             <file src="TradeRoot Skeleton/Export"
> targetdir="$INSTALL_PATH">
>>             	<exclude>**</exclude>
>>             </file>
>>             <file src="TradeRoot Skeleton/Import"
> targetdir="$INSTALL_PATH">
>>                 <exclude>**</exclude>
>>             </file>
>>             
>>             <file src="TradeRoot Skeleton/Installations"
> targetdir="$INSTALL_PATH">
>>                 <exclude>**</exclude>
>>             </file>            
>>             <file src="TradeRoot Skeleton/Java"
> targetdir="$INSTALL_PATH">
>>                 <exclude>**</exclude>
>>             </file>            
>>             <file src="TradeRoot Skeleton/UserApplications"
> targetdir="$INSTALL_PATH">
>>                 <exclude>**</exclude>
>>             </file>
>>             
>>             <file src="TradeRoot Skeleton/Repositories"
> targetdir="$INSTALL_PATH"/>
>>             <file src="TradeRoot Skeleton/Install" 
>> targetdir="$INSTALL_PATH"/>
>>                         
>>
>>         </pack>
>>      </packs>
>>      
>> </installation>
>>     
>>     
>>
>>
>>
>>
>>
>> ----------------------------------------------------------------------
>> --
>>
>> <processing>
>> 	<job name="InstallArtifacts">
>> 	<logfiledir>$INSTALL_PATH</logfiledir>
>> 	    <jar src="lib/artifact-SNAPSHOT.jar"/>
>>     <jar src="lib/commons-io-1.1.jar"/>
>>     <jar src="lib/commons-logging-1.0.4.jar"/>
>>     <jar src="lib/log4j-1.2.8.jar"/>
>>     <jar src="lib/truezip-6.jar"/>
>> 	<executeclass
> name="com.traderoot.tools.artifact.installer.LicenseInstall">
>> 		<args>
>>             		<arg value="$trtLicense"/>
>>             		<arg
> value="$INSTALL_PATH/TradeRoot/Installations/"/>
>>             		<arg
> value="$INSTALL_PATH/TradeRoot/Repositories"/>
>>             		<arg value="Stack"/>
>>             	</args>
>> 	</executeclass>
>> 	</job>
>> </processing>
>>
>>
>> ----------------------------------------------------------------------
>> --
>>
>> _______________________________________________
>> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: install.xml.doc
Type: application/ms-word
Size: 35328 bytes
Desc: not available
Url : https://lists.berlios.de/pipermail/izpack-users/attachments/20070426/0064d7e2/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ProcessPanel.Spec.doc
Type: application/ms-word
Size: 24576 bytes
Desc: not available
Url : https://lists.berlios.de/pipermail/izpack-users/attachments/20070426/0064d7e2/attachment-0001.bin 


More information about the izpack-users mailing list