From: bruce m. <tr...@us...> - 2004-08-06 18:46:07
|
Update of /cvsroot/babeldoc/babeldoc/readme/userguide In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24050/readme/userguide Modified Files: chapter1.xml chapter7.xml Log Message: documentation, javadoc and formatting here. Index: chapter1.xml =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/readme/userguide/chapter1.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** chapter1.xml 14 Apr 2004 20:13:41 -0000 1.6 --- chapter1.xml 6 Aug 2004 18:45:57 -0000 1.7 *************** *** 89,96 **** <computeroutput> <simplelist> <member>Usage: babeldoc <command></member> <member>where command must be one of:</member> <member>xls2xml, scanmon, addstagewiz, setupwiz, lightconfig, sqlload, pipeline, setentrywiz, journal, process, journalbrowser, flat2xml, scanner, guiprocess, pipelineb uilder, babelfish, module.</member> ! <member>Babeldoc 1.2.1 Copyright (C) 2002 Bruce McDonald, Dejan Krsmanovic, et al.</member> <member>Babeldoc comes with ABSOLUTELY NO WARRANTY;</member> <member>This is free software, and you are welcome to redistribute it under certain conditions</member> --- 89,100 ---- <computeroutput> <simplelist> + <member>*** This is Babeldoc! ***</member> + <member> </member> <member>Usage: babeldoc <command></member> + <member> </member> <member>where command must be one of:</member> <member>xls2xml, scanmon, addstagewiz, setupwiz, lightconfig, sqlload, pipeline, setentrywiz, journal, process, journalbrowser, flat2xml, scanner, guiprocess, pipelineb uilder, babelfish, module.</member> ! <member> </member> ! <member>Babeldoc 1.3.0 Copyright (C) 2002,2003,2004 The Babeldoc Team!!</member> <member>Babeldoc comes with ABSOLUTELY NO WARRANTY;</member> <member>This is free software, and you are welcome to redistribute it under certain conditions</member> *************** *** 279,291 **** <section> <title>Setting up a new project</title> ! <para>This section briefly describes the steps necessary to setup a new babeldoc project. It is assumed that <productname>Babeldoc</productname> is installed in c:\babeldoc.</para> ! <itemizedlist> ! <listitem>Create a project directory: c:\project (for instance)</listitem> ! <listitem>Add the following variables to your environment</listitem> ! <listitem>BABELDOC_HOME - This variable must point to the root of your babeldoc binary installation, <userinput>c:\babeldoc</userinput>. At a minimum it must contain the bin and lib directories. The bin directory must contain the babeldoc run scripts and the lib directory must contain all the babeldoc Java archive (JAR) files</listitem> ! <listitem>BABELDOC_USER - This variable must point to your project directory, <userinput>c:\project</userinput>, in this case</listitem> ! <listitem>PATH - Add the <userinput>c:\babeldoc\bin</userinput> directory to your path. This is not absolutely required, but will make running babeldoc easier by cutting down the commandline length</listitem> ! <listitem>Add the configuration directories to the <userinput>c:\project</userinput> directory. These could include <userinput>pipeline</userinput>, <userinput>journal</userinput>, etc </listitem> ! </itemizedlist> </section> --- 283,302 ---- <section> <title>Setting up a new project</title> ! <para>This section briefly describes the steps necessary to setup a new <productname>Babeldoc</productname> project. In the interests of brevity, the following assumptions are made:</para> ! <itemizedlist> ! <listitem>You are on a MS Windows environment.</listitem> ! <listitem>You have installed the Java SDK into the <userinput>c:\j2sdk1.4.2_04</userinput> directory.</listitem> ! <listitem><productname>Babeldoc</productname> is installed in the <userinput>c:\babeldoc</userinput> directory.</listitem> ! <listitem>Your project is in the <userinput>c:\project</userinput> directory.</listitem> ! </itemizedlist> ! <para>The simplest method of configuring your environment is to create a setup batch file in the project directory. This file is usually called <userinput>setup.bat</userinput> but the name is unimportant. The purpose of the file is to configure the local environment so that <productname>Babeldoc</productname> can run. The contents of this file for this environment is given below:</para> ! <simplelist> ! <member>@echo off</member> ! <member>set JAVA_HOME=c:\j2sdk1.4.2_04</member> ! <member>set BABELDOC_HOME=c:\babeldoc</member> ! <member>set BABELDOC_USER=c:\project</member> ! <member>set PATH=%PATH%;%BABELDOC_HOME%\bin</member> ! </simplelist> ! <para>Prior to using <productname>Babeldoc</productname> run this script. Now create the configuration files in this directory.</para> </section> Index: chapter7.xml =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/readme/userguide/chapter7.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** chapter7.xml 14 Apr 2004 20:13:41 -0000 1.1 --- chapter7.xml 6 Aug 2004 18:45:57 -0000 1.2 *************** *** 1,70 **** <?xml version="1.0" encoding="ISO-8859-1"?> ! <chapter> ! <title>HOW TOs</title> ! <section> ! <title>Introduction</title> ! <para>This chapter is intended to collect together some of the collected knowledge of those using <productname>babeldoc</productname>. The intention is to save you time if you are trying to perform some of these tasks or similar.</para> ! </section> ! <section><title>HOWTO Set up Eclipse with Babeldoc</title> ! <para>Pre-requisites: Eclipse 3.0 build M4 or later. Anything earlier will not work.</para> ! <orderedlist> ! <listitem>Open eclipse</listitem> ! <listitem>Make sure that you can see the CVS Repositories View. If you can't, click Window | Show View | Other ... and select CVS Repositories.</listitem> ! <listitem>The Repositories View will (probably) come up empty. Right click on the white space, and click New | Repository Location ... Enter all the repository details (extssh for anybody with a developer account, otherwise pserver), and click OK.</listitem> ! <listitem>A new entry for the repository will appear. It's the root node in a tree. Open the tree. Below you should see entries HEAD, Branches and Versions. If you want to develop on the HEAD, as most core developers would probably want, open the HEAD node.</listitem> ! <listitem>Right-click on the babeldoc node that appears under the HEAD, and select Check Out As... A dialog will appear. You can use "Check out as a project configured using the New Project Wizard". or try the "Check out as a project in the workspace".</listitem> ! <listitem>Complete the New Project Wizard details. </listitem> ! <listitem>Once the New Project Wizard has finished processing, you should have a project open in the Java perspective. If not, click on the Add Perspective button, and add a Java Perspective.</listitem> ! <listitem>Right-click on the project node, and select Properties. Select the Java Build Path option, and select the Source tab.</listitem> ! <listitem>You should see your project appear with a single (empty) exclusion filter. Edit the filter, and set it to **, i.e.: exclude all files (trust me, I'm a programmer), and click OK.</listitem> ! <listitem>Select Add Folder... and add each of the src/ folders. You can multiselect on the folder selection dialog. For example, you should open the root node, and then open modules/, and then open babelfish/, and then select the src/ directory. Then open the conversion/ directory, and select src/ (with the Ctrl button down, this time), and so on. In the j2ee/ folder, don't forget to add both src/ and gensrc/. All src/ directories inside modules/ should be added.</listitem> ! <listitem>Now in the Properties dialog, still in the Java Build Path option, select the Libraries tab. Click Add JARs... and select all the jar files in build/lib, except for any library beginning with "babeldoc_". Also add support/ant/lib/ant.jar and support/ant/lib/junit.jar.</listitem> ! <listitem>Now click OK in the Properties dialog. Eclipse will probably spend a few seconds rebuilding its project information.</listitem> ! </orderedlist> ! <para> You should now have a happy eclipse system showing all the source modules, and the libraries. Eclipse should not show any errors detected by the background compiler. However, there will be a stack of warnings. They can, for the moment, be ignored.</para> ! <para> Now to get ant working.</para> ! <orderedlist> ! <listitem>In the Java perspective, right-click on build.xml, and select Run Ant...</listitem> ! <listitem>The Ant dialog will now appear. Click on the Main tab, and ensure that the Base Directory is set to the project root. It will probably look something like this: ${workspace_loc:/Babeldoc}</listitem> ! <listitem> Click on the Classpath tab. Uncheck the "Use global classpath as specified in the Ant runtime preferences". Click Add JARs... and add support/ant/lib/babeldoc_bootstrap.jar, support/ant/lib/xercesImpl.jar, and support/jalopy/lib/jalopy-ant-0.6.1.jar, or whatever the current version is.</listitem> ! <listitem>Click on the JRE tab. Click Alternate JRE, and select one of your JREs. You should probably set it to something fairly recent. Now, this is critical. You have to set the Working directory. Uncheck the "Use default working directory", and select "Workspace". Click Browse... and select the root node of the project. Click OK. If you don't have a "Working directory" section on the JRE tab, running ant is not going to work. If you do not have the working directory section, you need to upgrade your eclipse to at least version 3.0 build M4. </listitem> ! <listitem>Click Apply.</listitem> ! <listitem>Click on the Targets tab. Select the "build" target, and click Run.</listitem> ! </orderedlist> ! <para> You should now get a Console View appear, and the ant output will be spooled into the Console View.</para> ! </section> ! <section><title>HOWTO Read an attribute from external XML file</title><para>As there is no equivalent to SQLEnrich for XML it is not obvious how to get an attribute from an external file and then revert to the original document. One way to do this is to store the current document as an attribute, process the second file and then revert the document to value of the attribute</para> ! <para> ! <simplelist> ! <member>doc2attrib.stageType=Scripting</member> ! <member>doc2attrib.nextStage={Stages that load other document etc.}</member> ! <member>doc2attrib.script=document.put("originalContent", document.getBytes());</member> ! <member> </member> ! <member>attrib2doc.stageType=Scripting</member> ! <member>attrib2doc.nextSyage={Continue with processing}</member> ! <member>attrib2doc.script=document.setBytes(document.get("originalContent"));</member> ! </simplelist></para></section> ! <section><title>HOWTO Access the attributes of a pipeline document inside an XSLT</title> ! <para>Essentially you can use document.get("myprop")</para> ! <simplelist><member><xsl:param name="doc" select="$document"/></member> ! <member><xsl:param name="myprop" select="java:get($doc, 'myprop')"/> </member></simplelist> ! <para>For the syntax, see: http://xml.apache.org/xalan-j/extensions.html See the java section. </para> ! <para>Additionally you can get the pipeline stage object from the XSL and then you can manipulate the java code directly.</para> ! <para> The snippet below is an example of how to get the current time and format it nicely:</para> ! <simplelist> ! <member> <xsl:variable name="date" select="java:java.util.Date.new()"/></member> ! <member> <xsl:variable name="seconds" select="java:getTime($date)"/></member> ! <member> <xsl:variable name="velocity"</member> ! <member>select="java:com.babeldoc.core.VelocityUtilityContext.new()"/></member> ! <member> <xsl:variable name="datestr" select="java:getFormattedDate($velocity, 'd MMM yyyy</member> ! <member>HH:mm:ss', $seconds)"/></member> ! </simplelist> ! </section> ! </chapter> --- 1,92 ---- <?xml version="1.0" encoding="ISO-8859-1"?> ! <chapter> ! <title>HOW TOs</title> ! <section> ! <title>Introduction</title> ! <para>This chapter is intended to collect together some of the collected knowledge of those using ! <productname>Babeldoc</productname>. The intention is to save you time if you are trying to perform some ! of these tasks or similar. Please contribute your nuggets of information - these can help others. ! </para> ! </section> ! <section> ! <title>HOWTO Set up Eclipse with Babeldoc</title> ! <para>Pre-requisites: Eclipse 3.0 build M4 or later. Anything earlier will not work.</para> ! <orderedlist> ! <listitem>Open eclipse</listitem> ! <listitem>Make sure that you can see the CVS Repositories View. If you can't, click Window | Show View | Other ... and select CVS Repositories.</listitem> ! <listitem>The Repositories View will (probably) come up empty. Right click on the white space, and click New | Repository Location ... Enter all the repository details (extssh for anybody with a developer account, otherwise pserver), and click OK.</listitem> ! <listitem>A new entry for the repository will appear. It's the root node in a tree. Open the tree. Below you should see entries HEAD, Branches and Versions. If you want to develop on the HEAD, as most core developers would probably want, open the HEAD node.</listitem> ! <listitem>Right-click on the babeldoc node that appears under the HEAD, and select Check Out As... A dialog will appear. You can use "Check out as a project configured using the New Project Wizard". or try the "Check out as a project in the workspace".</listitem> ! <listitem>Complete the New Project Wizard details. </listitem> ! <listitem>Once the New Project Wizard has finished processing, you should have a project open in the Java perspective. If not, click on the Add Perspective button, and add a Java Perspective.</listitem> ! <listitem>Right-click on the project node, and select Properties. Select the Java Build Path option, and select the Source tab.</listitem> ! <listitem>You should see your project appear with a single (empty) exclusion filter. Edit the filter, and set it to **, i.e.: exclude all files (trust me, I'm a programmer), and click OK.</listitem> ! <listitem>Select Add Folder... and add each of the src/ folders. You can multiselect on the folder selection dialog. For example, you should open the root node, and then open modules/, and then open babelfish/, and then select the src/ directory. Then open the conversion/ directory, and select src/ (with the Ctrl button down, this time), and so on. In the j2ee/ folder, don't forget to add both src/ and gensrc/. All src/ directories inside modules/ should be added.</listitem> ! <listitem>Now in the Properties dialog, still in the Java Build Path option, select the Libraries tab. Click Add JARs... and select all the jar files in build/lib, except for any library beginning with "babeldoc_". Also add support/ant/lib/ant.jar and support/ant/lib/junit.jar.</listitem> ! <listitem>Now click OK in the Properties dialog. Eclipse will probably spend a few seconds rebuilding its project information.</listitem> ! </orderedlist> ! <para> You should now have a happy eclipse system showing all the source modules, and the libraries. Eclipse should not show any errors detected by the background compiler. However, there will be a stack of warnings. They can, for the moment, be ignored.</para> ! <para> Now to get ant working.</para> ! <orderedlist> ! <listitem>In the Java perspective, right-click on build.xml, and select Run Ant...</listitem> ! <listitem>The Ant dialog will now appear. Click on the Main tab, and ensure that the Base Directory is set to the project root. It will probably look something like this: ${workspace_loc:/Babeldoc}</listitem> ! <listitem> Click on the Classpath tab. Uncheck the "Use global classpath as specified in the Ant runtime preferences". Click Add JARs... and add support/ant/lib/babeldoc_bootstrap.jar, support/ant/lib/xercesImpl.jar, and support/jalopy/lib/jalopy-ant-0.6.1.jar, or whatever the current version is.</listitem> ! <listitem>Click on the JRE tab. Click Alternate JRE, and select one of your JREs. You should probably set it to something fairly recent. Now, this is critical. You have to set the Working directory. Uncheck the "Use default working directory", and select "Workspace". Click Browse... and select the root node of the project. Click OK. If you don't have a "Working directory" section on the JRE tab, running ant is not going to work. If you do not have the working directory section, you need to upgrade your eclipse to at least version 3.0 build M4. </listitem> ! <listitem>Click Apply.</listitem> ! <listitem>Click on the Targets tab. Select the "build" target, and click Run.</listitem> ! </orderedlist> ! <para> You should now get a Console View appear, and the ant output will be spooled into the Console View.</para> ! </section> ! <section> ! <title>HOWTO Read an attribute from external XML file</title> ! <para>As there is no equivalent to SQLEnrich for XML it is not obvious how to get an attribute from an external file and then revert to the original document. One way to do this is to store the current document as an attribute, process the second file and then revert the document to value of the attribute</para> ! <para> ! <simplelist> ! <member>doc2attrib.stageType=Scripting</member> ! <member>doc2attrib.nextStage={Stages that load other document etc.}</member> ! <member>doc2attrib.script=document.put("originalContent", document.getBytes());</member> ! <member> </member> ! <member>attrib2doc.stageType=Scripting</member> ! <member>attrib2doc.nextSyage={Continue with processing}</member> ! <member>attrib2doc.script=document.setBytes(document.get("originalContent"));</member> ! </simplelist> ! </para> ! </section> ! ! <section> ! <title>HOWTO Access the attributes of a pipeline document inside an XSLT</title> ! <para>Essentially you can use document.get("myprop")</para> ! <simplelist> ! <member><xsl:param name="doc" select="$document"/></member> ! <member><xsl:param name="myprop" select="java:get($doc, 'myprop')"/> </member> ! </simplelist> ! <para>For the syntax, see: http://xml.apache.org/xalan-j/extensions.html See the java section. </para> ! <para>Additionally you can get the pipeline stage object from the XSL and then you can manipulate the java code directly.</para> ! <para> The snippet below is an example of how to get the current time and format it nicely:</para> ! <simplelist> ! <member> <xsl:variable name="date" select="java:java.util.Date.new()"/></member> ! <member> <xsl:variable name="seconds" select="java:getTime($date)"/></member> ! <member> <xsl:variable name="velocity"</member> ! <member>select="java:com.babeldoc.core.VelocityUtilityContext.new()"/></member> ! <member> <xsl:variable name="datestr" select="java:getFormattedDate($velocity, 'd MMM yyyy</member> ! <member>HH:mm:ss', $seconds)"/></member> ! </simplelist> ! </section> ! <section> ! <title>HOWTO Package up your application into a single jar file for easy distribution</title> ! <para>The idea of this HOWTO is to avoid distributing all the directories that make up your configuration by packaging them all up into a single jar file and using this to run your pipelines.</para> ! <para>Lets assume that your <userinput>BABELDOC_USER</userinput> points to the <userinput>c:\project</userinput> directory. This directory has all the required configuration directories like <userinput>pipeline</userinput>, <userinput>resource</userinput>, etc.</para> ! <itemizedlist> ! <listitem>Jar up your configuration files: <userinput>jar cf myproject.jar pipeline resource journal</userinput> producing a <userinput>myproject.jar</userinput> file.</listitem> ! <listitem>Change your <userinput>BABELDOC_USER</userinput> to: <userinput>set BABELDOC_USER=c:\project\myproject.jar</userinput></listitem> ! <listitem>Verify that your pipelines still work, but change directory away from <userinput>c:\project</userinput> directory to make sure that the configuration files there don't interfere with new BABELDOC_USER variable!</listitem> ! </itemizedlist> ! </section> ! </chapter> |