Ant Tasks and Sample Build File to Import Pluggable Views or Libraries
If you are using Ant to import or export pluggable views or libraries, you must add a <taskdef> in the Ant build.xml file to handle pluggable library or view imports, and optionally another to handle exports, such as this example:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Import/export pluggable views and libraries" default="all" basedir="." >
<!-- custom properties to your environment -->
<property file="build.properties"/>
<!-- path to library project folder -->
<property name="libs.dir" value= "${basedir}" />
<!-- path to JAR for custom tasks, presto.dir is installation directory,
set in build.properties -->
<property name="prestocli.jar"
value="${presto.dir}/prestocli/dist/prestocli.jar"/>
<!--MashZone NextGencustom tasks to import/export pluggable libraries -->
<taskdef name= "presto.lib.import"
classname="com.jackbe.jbp.sas.cli.ant.ImportLib"
classpath="${prestocli.jar}" />
<taskdef name="presto.lib.export"
classname="com.jackbe.jbp.sas.cli.ant.ExportLib"
classpath="${prestocli.jar}" />
<!-- targets to import libraries in this project -->
<target name="lib-import-basic-properties">
<presto.lib.import
id="mylibrary" name="My Common Library"
description="My common library for all views"
dir="${libs.dir}/mylibrary"
loadConfirmation="Sample.library.MyCommonLibrary"
overwrite="true" continueOnError="true" />
</target>
<!-- 3rd party library hosted externally -->
<target name="external-lib-import">
<presto.lib.import
id="reportgrid" name="Report Grid"
description="Report Grid" loadConfirmation="ReportGrid"
libPath="http://api.reportgrid.com/js"
js="reportgrid-charts.js" />
</target>
<!-- 3rd party library hosted inMashZone NextGen-->
<target name="d3-lib-import">
<presto.lib.import
id="d3" name="D3"
description="D3 - Data Driven Documents" dir="${libs.dir}/d3"
loadConfirmation="window.d3" js="js/d3.v2.js" />
</target>
<!-- basic view library import -->
<target name="minimal-view-import">
<presto.lib.import
id="mysample" name="My Sample View"
description="minimal pluggable view" dir="${libs.dir}/mysample"
type="view" loadConfirmation="Sample.view.MySampleView"/>
</target>
<!-- view with dependency on 3rd party and built-in libraries -->
<target name="pie-view-import-d3-dependency" >
<presto.lib.import
id="d3-pie" name="D3 Pie Chart"
description="Sample D3 Pie Chart" dir="${libs.dir}/d3-pie"
loadConfirmation="Sample.d3.Pie" type="view"
dependsOn="d3,presto-core" />
</target>
<!-- target to import D3 and all dependent views -->
<target name="import-d3-views" depends="d3-lib-import,
pie-view-import-d3-dependency" />
<target name="all" depends="import-d3-views,minimal-view-import,
external-lib-import,lib-import-basic-properties" />
...
</project>
Then create a separate target to import each pluggable view or library and use the
<presto.lib.import> task to perform the import. You can set any
Configuration Properties for Pluggable Views or Libraries in the
<presto.lib.import> task . In addition, you can also set three boolean flags to control aspects of how
importLib is run:
verbose = -v option, to control how much information is logged.
overwrite = -o option, to control whether this import overwrites the existing version, if any, of this pluggable library.
continueOnError = -c option, to control whether the build should continue if an error occurs during the build.
By default, all these flags are
false. See
Example: Controlling the Library Import Process for more information on these flags.
Finally, you need to set the following properties in build.properties to fit your environment:
# administration account username
presto.username=Administrator
# administration account password
presto.password=manage
# host:port to Mashup Server
presto.hostname=localhost:8080
# path toMashZone NextGen installation folder
presto.dir=/users/myname/Presto3.5