[izpack-devel] Coding custom components against an IzPack API

Raz Yalov RYalov at the41.com
Tue May 22 17:38:39 CEST 2007


Thanks Klaus,

This is helpful. So maybe my problem was that the first custom element
I've tried to create was a Validator's implementation which could be
left out of the installation.jar file. Should it be part of it?

 

Thanks again,

 

Raz

________________________________

From: Bartz, Klaus [mailto:Klaus.Bartz at coi.de] 
Sent: Tuesday, May 22, 2007 12:11 AM
To: izpack-devel at lists.berlios.de
Subject: Re: [izpack-devel] Coding custom components against an IzPack
API

 

Hi Raz,

you need installer.jar of IzPack in your classpath to compile a custom
panel or a custom action.

All needed class files have to be stored in jar file which name is that
from the panel class (custom actions class).

You have to store (or copy) the created jar file to %IZ_HOME%\bin\panels
(%IZ_HOME%\bin\customActions).

 

You can use a package path you like for panels or custom actions.

You can store the sources for them else where.

 

I use an ant script for this. Following some parts of it which handels
panels and custom actions:

 

...

 <!-- Compile a custom panel -->
 <target name="compile.custompanel">
  <echo message="Compiles custom panel ${panel}" level="info"/>
  <mkdir dir="${bin.dir}/panels/${panel-dir}"/>
  <javac srcdir="${src.dir}" destdir="${bin.dir}/panels/${panel-dir}"
classpath="${installer.jar}"
   optimize="on" deprecation="on" debug="${debug}"
   source="${source}" debuglevel="${debuglevel}">
   <include name="${panel}*.java"/>
  </javac>
 </target>
 <!-- Make JAR for a custom panel -->
 <target name="compile.custompanel.finish">
  <jar jarfile="${bin.dir}/panels/${panel}.jar">
   <fileset dir="${bin.dir}/panels/${panel}">
    <include name="**/*.class"/>
   </fileset>
  </jar>
 </target>
 <!-- convenience: compile simple custom panel and finish it -->
 <target name="compile.custompanel.simple">
  <antcall target="compile.custompanel">
   <param name="panel" value="${panel}"/>
   <param name="panel-dir" value="${panel-dir}"/>
  </antcall>
  <antcall target="compile.custompanel.finish">
   <param name="panel" value="${panel-dir}"/>
  </antcall>
 </target>
 <!-- Compile all custom panels and put them at the right location -->
 <target name="build.customPanels" >
  <antcall target="compile.custompanel.simple">
   <param name="panel"
value="com/coi/tools/install/panels/AccountMonoSelectPanel"/>
   <param name="panel-dir" value="AccountMonoSelectPanel"/>
  </antcall>
...

 </target>
 <!-- Listener stuff targets
**************************************************** START -->
 <!-- "Normal" listener targets are also now defined here because common
IzPack
       build script was changed to macro usage -->
    <!-- Compile a listener -->
    <target name="compile.listener" >
        <echo message="Compiles listener ${listener}"/>
        <mkdir dir="${bin.dir}/customActions/${listener-dir}"/>
        <javac srcdir="${src.dir}"
               destdir="${bin.dir}/customActions/${listener-dir}"
 
classpath="${installer.jar};${compiler.jar};${izevent.jar}"
               optimize="on"
               deprecation="on"
               debug="${debug}"
        source="${source}"
               debuglevel="${debuglevel}">
            <include name="${listener-include}/${listener}*.java"/>
        </javac>
    </target>

 

    <!-- Make JAR for a listener -->
    <target name="compile.listener.finish">
     <unzip src="${izevent.jar}"
dest="${bin.dir}/customActions/${listener}" />
        <jar jarfile="${bin.dir}/customActions/${listener}.jar">
            <fileset dir="${bin.dir}/customActions/${listener}">
                <include name="**/*.class"/>
                <exclude name="**/*${listener-exclude1}*.class"/>
                <exclude name="**/*${listener-exclude2}*.class"/>
            </fileset>
        </jar>
    </target>
    <!-- convenience: compile simple listener and finish it -->
    <target name="compile.listener.simple">
        <antcall target="compile.listener">
            <param name="listener" value="${listener}"/>
            <param name="listener-dir" value="${listener-dir}"/>
            <param name="listener-include" value="${listener-include}"/>
        </antcall>
        <antcall target="compile.listener.finish">
            <param name="listener" value="${listener}"/>
            <param name="listener-exclude1"
value="${listener-exclude1}"/>
            <param name="listener-exclude2"
value="${listener-exclude2}"/>
        </antcall>
    </target>

 

    <!-- simple installer listener -->
    <target name="compile.installer-listener.simple">
        <antcall target="compile.listener.simple">
            <param name="listener" value="${listener}"/>
            <param name="listener-dir" value="${listener-dir}"/>
            <param name="listener-include" value="${listener-include}"/>
            <param name="listener-exclude1" value="Uninstaller"/>
            <param name="listener-exclude2" value="_NO_MORE_EXCLUDES_"/>
        </antcall>
    </target>
    <!-- simple uninstaller listener -->
    <target name="compile.uninstaller-listener.simple">
        <antcall target="compile.listener.simple">
            <param name="listener" value="${listener}"/>
            <param name="listener-dir" value="${listener-dir}"/>
            <param name="listener-include" value="${listener-include}"/>
            <param name="listener-exclude1" value="Installer"/>
            <param name="listener-exclude2" value="_NO_MORE_EXCLUDES_"/>
        </antcall>
    </target>
    <!-- simple compiler listener -->
    <target name="compile.compiler-listener.simple">
        <antcall target="compile.listener.simple">
            <param name="listener" value="${listener}"/>
            <param name="listener-dir" value="${listener-dir}"/>
            <param name="listener-include" value="${listener-include}"/>
            <param name="listener-exclude1" value="Installer"/>
            <param name="listener-exclude2" value="Uninstaller"/>
        </antcall>
    </target>
 <!-- Listener stuff targets
**************************************************** END -->
 <!-- Compile all custom actions (listener) and put them at the right
location -->
 <target name="build.listener" >
  <antcall target="compile.compiler-listener.simple">
   <param name="listener" value="PermissionCompilerListener"/>
   <param name="listener-dir" value="PermissionCompilerListener"/>
   <param name="listener-include"
value="com/coi/tools/install/listener"/>
  </antcall>
  <antcall target="compile.installer-listener.simple">
   <param name="listener" value="InitDBInstallerListener"/>
   <param name="listener-dir" value="InitDBInstallerListener"/>
   <param name="listener-include"
value="com/coi/tools/install/listener"/>
  </antcall>
...

 

Cheers

 

Klaus

	-----Ori  ginal Message-----
	From: izpack-devel-bounces at lists.berlios.de
[mailto:izpack-devel-bounces at lists.berlios.de] On Behalf Of Raz Yalov
	Sent: Monday, May 21, 2007 9:01 PM
	To: izpack-devel at lists.berlios.de
	Subject: [izpack-devel] Coding custom components against an
IzPack API

	First, sorry if this is the wrong list for this question.

	 

	In short: is there an official "izpack-api.jar" exposed to
enabled development of custom elements (panels, validators etc.) outside
the IzPack project context?

	 

	Details: I would like to create as part of my product's project
an izPack-ext.jar that will hold customized code I've written to enhance
my IzPack setup but I want to maintain and build this in the context of
my product's baseline and not within IzPack project.

	 

	I couldn't find any kind of "izpack-api.jar" type of file that
holds all the interfaces that are needed in order to compile your own
extensions.

	 

	Is the only expected way to add custom elements is by adding
them to a local copy of the entire IzPack project?

	 

	 

	Any ideas/direction would be appreciated.

	 

	 

	Raz

	 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.berlios.de/pipermail/izpack-devel/attachments/20070522/d46f42d8/attachment.html 


More information about the izpack-devel mailing list