CentraSite 10.7 | CentraSite Developer's Guide | Importing Objects Using API | Writing Your Own Importer | The Build Environment
 
The Build Environment
This topic explains the build environment for generating the HTML files that are used for the GUI and for compiling the necessary Java source files. It assumes the use of Ant, the Java-based build tool.
Example of the file system structure under the plug-in directory:
Name of File or Folder
Description
src
The directory that holds the Java source files
xml
The directory that holds the XML file that specifies your import window
plugin.xml
Top plugin description file that specifies the extension point and the command class
build.xml
The Ant input file for building the destination files
The Ant file named build.xml, can be used to establish an import plug-in. Look for the properties with the following names:
*plugin.name
*plugin.provider
*tomcat.dir
*tomcat.ver.dir
and modify them as required to suit your installation.
This is build.xml:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="./ant2html.xsl"?>
<!--
Build an Import plugin
-->
 
<project name="Import Plugin Example" default="all" basedir=".">
<description> Build file for an Importer plugin </description>
 
<!-- environment -->
<property environment="env"/>
 
<property name="plugin.name" value="ImportMyFile" />
<property name="plugin.provider" value="Software AG" />
 
<!-- tomcat home directory -->
<!-- <property name="tomcat.dir"
value="tomcat directory of installation" /> -->
<property name="tomcat.dir" value="C:/SoftwareAG/profiles/CTP" />
<property name="tomcat.ver.dir" value="${tomcat.dir}/workspace"/>
 
<!-- point to the root of the pluggableUI to get the cis environment -->
<property name="pluggable.ui.root"
value="${tomcat.ver.dir}/webapps/PluggableUI"/>
 
<!-- the directory containing source code -->
<property name="plugin.dir" value="../${plugin.name}" />
<property name="src.dir" value="${plugin.dir}/src" />
<property name="xml.dir" value="${plugin.dir}/xml" />
<property name="classes" value="${plugin.dir}/classes" />
<property name="lib" value="${plugin.dir}/lib" />
 
<!-- classpath -->
<path id="plugin.class.path">
<fileset dir="${pluggable.ui.root}/CentraSiteControl/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${pluggable.ui.root}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
</path>
 
<!-- default target, build all -->
<target name="all" description="all" depends="jar, zip"/>
 
<!-- establish jar file of plugin -->
<target name="jar" depends="compile" description="jar">
<mkdir dir="${lib}" />
<jar destfile="${lib}/${plugin.name}.jar">
<fileset dir="${classes}"/>
<fileset dir="${src.dir}" includes="**/*.properties"/>
<manifest>
<section name="com/centrasite/control">
<attribute name="Implementation-Title" value="${plugin.name}"/>
<attribute name="Implementation-Version" value="1.0.0.0"/>
<attribute name="Implementation-Vendor"
value="${plugin.provider}"/>
</section>
</manifest>
</jar>
</target>
 
<!-- compile java sources -->
<target name="compile" description="compile" depends="">
<mkdir dir="${plugin.dir}/accesspath" />
<mkdir dir="${classes}" />
<javac srcdir="${src.dir}" destdir="${classes}" debug="on"
classpathref="plugin.class.path" />
</target>
 
<!-- Create plugin archive -->
<target name="zip" description="package the plugin" depends="">
<zip destfile="${plugin.name}.zip" basedir="${plugin.dir}/.."
includes="${plugin.name}/lib/**,
${plugin.name}/accesspath/**, ${plugin.name}/plugin.xml,
${plugin.name}/*_SWT.xml,
${plugin.name}/xml/** ${plugin.name}/*.html" />
</target>
 
<!-- Install plugin zip to PluggableUI -->
<target name="install" description="Install plugin zip to PluggableUI">
<java classname=
"com.softwareag.cis.plugin.ext.plugins.command.InstallPlugInCommand"
fork="true">
<arg value="-t" />
<arg value="${pluggable.ui.root}" />
<arg value="-z" />
<arg value="${plugin.name}.zip" />
<classpath>
<fileset dir="${pluggable.ui.root}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
</classpath>
</java>
</target>
 
<!-- Uninstall plugin zip from PluggableUI -->
<target name="uninstall" description="Uninstall plugin zip from PluggableUI">
<delete dir="${pluggable.ui.root}/${plugin.name}" />
</target>
 
<!-- Cleanup objects -->
<target name="clean" description="clean classes lib and generated files">
<delete dir="${classes}" />
<delete dir="${plugin.dir}/accesspath" />
<delete dir="${lib}" />
<delete file="${plugin.name}.zip" />
</target>
</project>
The classpath for the build step must comprise all JAR files used by the UI. Add these JAR files to the build path of your java project also.
In order to present a user-defined screen when the plug-in's import button is clicked, an XML file that describes the GUI must be located in the subdirectory xml. The example XML file (xml/ImportMyFile.xml) simply prompts for a filename:
<?xml version="1.0" encoding="UTF-8"?>
<page model="com.importer.myfile.control.ImportMyFileAdapter">
<pagebody>
<rowarea withleftborder="false" withtopborder="false"
withrightborder="false" withbottomborder="false"
withtoppadding="false"
paddingleft="10" paddingright="10">
<vdist height="30"></vdist>
<itr>
<label name="File:" width="100" asplaintext="true"></label>
<fileupload2 width="100%" cfileprop="fileClientUrl"
fileprop="fileServerUrl"
method="fileLoaded"></fileupload2>
</itr>
<vdist height="30"></vdist>
</rowarea>
</pagebody>
<statusbar></statusbar>
</page>