[MOBY-guts] biomoby commit

Andreas Groscurth groscurt at dev.open-bio.org
Wed Nov 19 15:29:32 UTC 2008


groscurt
Wed Nov 19 10:29:32 EST 2008
Update of /home/repository/moby/moby-live/Java/xmls
In directory dev.open-bio.org:/tmp/cvs-serv10249/Java/xmls

Modified Files:
	dashboardBuild.xml 
Log Message:
added the tasks for the Dashboard Webstart application

moby-live/Java/xmls dashboardBuild.xml,1.5,1.6
===================================================================
RCS file: /home/repository/moby/moby-live/Java/xmls/dashboardBuild.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Java/xmls/dashboardBuild.xml	2008/03/02 12:45:27	1.5
+++ /home/repository/moby/moby-live/Java/xmls/dashboardBuild.xml	2008/11/19 15:29:32	1.6
@@ -71,4 +71,262 @@
   </jar>
 
 </target>
+<!-- ================================================================== -->
+<!-- Create keystore for the Dashboard webstart                         -->
+<!-- ================================================================== -->
+<target name="_dashboard-create-keystore">
+	<echo>	
+	The following information is required to create keystore with which the jars for the webstart application will be signed.
+	</echo>
+	
+	<!-- ask all information required to set up the keystore -->
+	<input message="What is your first and last name?" addproperty="webstart.cn" defaultvalue="Unkown" />
+	<input message="What is the name of your organizational unit?" addproperty="webstart.ou" defaultvalue="Unkown" />
+	<input message="What is the name of your organization?" addproperty="webstart.o" defaultvalue="Unkown" />
+	<input message="What is the name of your City or Locality?" addproperty="webstart.l" defaultvalue="Unkown" />
+	<input message="What is the name of your State or Province?" addproperty="webstart.st" defaultvalue="Unkown" />
+	<input message="What is the two-letter country code for this unit?" addproperty="webstart.c" defaultvalue="Unkown" />
+	
+	<!-- ask for the password for the keystore -->
+	<antcall target="_dashboard-webstart-passwd" />
+	
+	<!-- create the keystore with the alias dashboard -->
+	<genkey alias="dashboard" storepass="${webstart.passwd}"
+		keystore="${dashboard.keystore.location}"
+		keypass="${webstart.keypasswd}">
+		<dname>
+			<param name="CN" value="${webstart.cn}" />
+			<param name="OU" value="${webstart.ou}" />
+			<param name="O" value="${webstart.o}" />
+			<param name="L" value="${webstart.l}" />
+			<param name="ST" value="${webstart.st}" />
+			<param name="C" value="${webstart.c}" />
+		</dname>
+	</genkey>
+	<echo>	
+	The keystore was successfully created and can be found under
+	${dashboard.keystore.location}.
+	</echo>
+</target>
+
+
+<!-- ================================================================== -->
+<!-- Signs the jars needed for the Dashboard webstart			-->
+<!-- ================================================================== -->
+<target name="_dashboard-sign-jars">
+	<!-- where shall the keystore be located ? or where is the existing one ? -->
+	<input taskname="Keystore location" addproperty="dashboard.keystore.location">
+	Enter the absolute path of the keystore (it has to be a valid and accessible path ! e.g. /usr/local/user/mykeystore).
+	If you want to use an existing one, type the location of the keystore, otherwise a new one will be created.
+	If you want recreate the keystore you have to do delete the existing one before !
+	</input>
+	<condition property="keystore.location.invalid">
+		<equals arg1="" arg2="${dashboard.keystore.location}" />
+	</condition>
+	<fail if="keystore.location.invalid">
+		You must provide a path for the keystore !
+	</fail>
+	
+	<!-- if no keystore is existing - create a new on -->
+	<if>
+		<not>
+			<available file="${dashboard.keystore.location}"/>
+		</not>
+		<then>
+			<antcall target="_dashboard-create-keystore"/>
+		</then>
+	</if>
+	
+	<!-- if the dummy password file is not there get the keystore password		-->
+	<!-- this avoids to enter the password twice if you create the keystore		-->
+	<!-- and then need it for signing the jars. I tried to use isset property  	-->
+	<!-- but that didnt work. It was ignored and the password was asked twice 	-->
+	<if>
+		<not>
+			<available file="${build.webstart}/passwd" />
+		</not>
+		<then>
+			<antcall target="_dashboard-webstart-passwd"/>
+		</then>
+	</if>	
+	
+	<!-- sign the jars -->
+	<signjar alias="dashboard" keystore="${dashboard.keystore.location}" storepass="${webstart.passwd}" keypass="${webstart.keypasswd}">
+		<path>
+			<fileset dir="${webstart.lib}" includes="**/*.jar" />
+		</path>
+	</signjar>
+</target>
+
+<!-- ================================================================== -->
+<!-- Initialise the directory for the Dashboard webstart                -->
+<!-- ================================================================== -->
+<target name="dashboard-webstart-init">
+	<property name="build.webstart" location="${build.dir}/dashboard-webstart"/>
+	<property name="webstart.lib.tmp.file" location="${build.webstart}/lib.tmp"/>
+	<delete dir="${build.webstart}"/>
+	<mkdir dir="${build.webstart}"/>
+</target>
+
+<!-- ================================================================== -->
+<!-- Create the Dashboard webstart application                          -->
+<!-- ================================================================== -->
+<target name="dashboard-webstart" depends="compile,jars,dashboard-config,dashboard-webstart-init" description="Creates a WebStart application">
+	<input taskname="Information">
+	This task will build the BioMoby dashboard as a JavaWebStart application.
+		
+	For that it has to sign the jars which dashboard requires. For this, several information is needed to establish a 'keystore'. 
+	In any case you already have a valid keystore, you are free to use this.
+	Otherwise the task will create a new one.
+		
+	Please fill out all information which is needed to build a working WebStart application.
+	Please FIRST read carefully the instructions and information in the /docs/DashboardWebstart.html !.
+		
+	Thank you :) (Press RETURN to continue)
+	</input>
+	<property name="webstart.destfile" value="${dist.dir}/dashboard-webstart-${TODAY_SHORT}" />
+	<property name="webstart.dir" value="dashboard-webstart" />
+	<property name="webstart.dist" value="${build.webstart}/${webstart.dir}" />
+	<property name="webstart.lib" value="${build.webstart}/lib"/>
+	<property name="webstart.lib.tmp" value="${build.webstart}/temp_lib"/>
+	
+	<artifact:dependencies pathId="dependency.classpath"
+			       filesetId="dependency.fileset">
+		<pom refid="maven.project" />
+	</artifact:dependencies>
+	
+	<!-- create a tmp directory in which all dependencies are copied 	-->
+	<!-- from that directory only the ones which are needed are copied	-->
+	<!-- to the final library directory of the webstart application		-->
+	<mkdir dir="${webstart.lib.tmp}" />
+	<copy todir="${webstart.lib.tmp}">
+		<fileset refid="dependency.fileset" />
+		<mapper type="flatten" />
+	</copy>
+	<mkdir dir="${webstart.lib}" />
+	
+	<!-- building the libraries  -->
+	<antcall target="_dashboard-build-lib"/>
+	
+	<!-- signing the jars  -->
+	<antcall target="_dashboard-sign-jars" />
+	
+	<!-- create the jnlp file  -->
+	<antcall target="_dashboard-webstart-jnlp"/>
+	
+	<!-- cleaning  -->
+	<delete dir="${webstart.lib.tmp}"/>
+	<delete file="${build.webstart}/passwd"/>
+	
+	<!-- packaging  -->
+	<tar destfile="${webstart.destfile}.tar.gz" basedir="${build.webstart}" longfile="gnu" compression="gzip"/>
+	<delete dir="${build.webstart}"/>
+</target>
+
+<!-- ================================================================== -->
+<!-- Create the jnlp file				                -->
+<!-- ================================================================== -->
+<target name="_dashboard-webstart-jnlp">
+	<!-- ask for the url of the webstart application -->
+	<input taskname="Dashboard URL" addproperty="webstart.url">
+	Please type in the base URL where the dashboard web start will be accessible. 
+	This must be a publicly available URL (like http://mydomain.com/dashboard)
+	</input>
+	<condition property="do.abort">
+		<equals arg1="" arg2="${webstart.url}"/>
+	</condition>
+	<fail if="do.abort">You have to provide a URL to procceed !</fail>
+	
+	<!-- get the jnlp template file -->
+	<copy file="${dashboard.config.dir}/dashboard.jnlp.template" tofile="${build.webstart}/dashboard.jnlp" />
+	<!-- set the provided URL  -->
+	<replace file="${build.webstart}/dashboard.jnlp" token="@host" value="${webstart.url}" />
+	<!-- load the needed libraries (serialized as xml) -->
+	<loadfile property="webstart.dashboard.libs" srcFile="${webstart.lib.tmp.file}"/>
+	<!-- set the libraries in the jnlp file -->
+	<replace file="${build.webstart}/dashboard.jnlp" token="@libs" value="${webstart.dashboard.libs}" />
+	<!-- delete the file with the libraries -->
+	<delete file="${webstart.lib.tmp.file}"/>
+</target>
+
+<!-- ================================================================== -->
+<!-- Build the libraries for the webstart		                -->
+<!-- ================================================================== -->
+<target name="_dashboard-build-lib">
+	<!-- icu4j**.jar contains xml files which terminates the signing process -->
+	<!-- so it is unpacked and packed again without the xml files -->
+	<tempfile property="tmp.dir" destDir="${java.io.tmpdir}/dashboardwebstart-${user.name}"/>
+	<mkdir dir="${tmp.dir}"/>
+	<unjar dest="${tmp.dir}">
+		<fileset dir="${webstart.lib.tmp}" includes="icu4j**"/>
+	</unjar>
+	<jar destfile="${webstart.lib}/icu-4j.jar">
+		<fileset dir="${tmp.dir}" excludes="**/*.xml"/>
+		<manifest>
+			<attribute name="Built-By" value="${user.name}"/>
+		</manifest>
+	</jar>
+	<delete dir="${tmp.dir}"/>
+	
+	<!-- copy only the libraries which are needed to the library folder for the webstart -->
+	<copy todir="${webstart.lib}">
+		<fileset id="webstart.libs" dir="${webstart.lib.tmp}" includes="activation** alltools** ant-1** axis** commons-collections** 
+			 commons-configuration** commons-discovery** commons-httpclient** commons-io** commons-lang** commons-logging** 
+			 iri** icis-pedigree** jdom** jena** logj4** lsid-** mail** xercesImpl**" />
+		<fileset dir="${build.lib}" includes="${dashboard.config.jar} ${project-dashboard.jar} ${project.jar}" />
+	</copy>
+	
+	<!-- these libraries have to be written down as <jar href="lib/xxx.jar"/> in the jnlp file -->
+	<!-- so this trick will return the format which is needed -->
+	
+	<!-- first the patch of the libraries is converted into a property -->
+	<pathconvert pathsep="@${line.separator}" property="path.convert.lib" refid="webstart.libs" targetos="unix">
+		<map from="${webstart.lib.tmp}" to="lib"/>
+	</pathconvert>
+	
+	<!-- the property is print into a file -->
+	<echo file="${webstart.lib.tmp.file}">${path.convert.lib}</echo>
+	
+	<!-- the @ is at the end of the name of the library, so "/> has to be added -->
+<replace file="${webstart.lib.tmp.file}" token="@">
+	<replacevalue><![CDATA["/>]]></replacevalue>
+</replace>
 
+<!-- at the begin only 'lib' is found there, so <jar href="lib will be put there -->
+	<replace file="${webstart.lib.tmp.file}" token="lib">
+		<replacevalue><![CDATA[<jar href="lib]]></replacevalue>
+		</replace>
+		
+		<!-- put the project libraries information at the end -->
+		<echo file="${webstart.lib.tmp.file}" append="true"><![CDATA["/>
+		<jar href="lib/${dashboard.config.jar}"/>
+		<jar href="lib/${project-dashboard.jar}" main="true"/>
+		<jar href="lib/${project.jar}"/>]]></echo>	
+</target>
+
+<!-- ================================================================== -->
+<!-- Get the password for the keystore/signing process	                -->
+<!-- ================================================================== -->
+<target name="_dashboard-webstart-passwd">
+	<input taskname="Keystore Password" addproperty="webstart.passwd">
+	Please enter a at least 6 character password for the keystore (mandatory !) 
+	(if you already created the keystore then please retype your password !
+	if you cant remember your password, delete keystore file and re-run the task again !)
+	</input>
+	<condition property="passwd.empty">
+		<equals arg1="" arg2="${webstart.passwd}" />
+	</condition>
+	<fail if="passwd.empty">
+		You must provide a password for the signature of the key for the
+		dashboard webstart !
+	</fail>
+	
+	<input taskname="Key Password" addproperty="webstart.keypasswd.tmp">
+	Enter the key password (RETURN if same as keystore password)
+	(if you already created the keystore then please retype the password or return if its the same as the keystore password)
+	</input>	
+	<condition property="webstart.keypasswd" value="${webstart.passwd}" else="${webstart.keypasswd.tmp}">
+		<equals arg1="" arg2="${webstart.keypasswd.tmp}" />
+	</condition>
+	<echo file="${build.webstart}/passwd">.</echo>
+</target>




More information about the MOBY-guts mailing list