From: Santi B. <san...@us...> - 2008-01-12 00:46:43
|
Update of /cvsroot/babeldoc/babeldoc/readme/userguide In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23392/readme/userguide Modified Files: chapter1.xml chapter2.xml chapter7.xml chapter5.xml chapter3.xml Log Message: Syndication module added. Documentation start updating process. Index: chapter5.xml =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/readme/userguide/chapter5.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** chapter5.xml 30 Mar 2004 19:15:42 -0000 1.3 --- chapter5.xml 12 Jan 2008 00:46:45 -0000 1.4 *************** *** 4,29 **** <section> <title>Introduction</title> ! <para>The scanner is a tool that scans for messages from a variety of sources and when a message is found, it is fed into the pipeline. The scanner is an automation tool, in that a system can be built up using scanners and pipelines. This is an alternative to the <userinput>process</userinput> script which feeds a single document into the pipeline when run. The scanner is currently capable of scanning a directory in a filesystem, a mailbox on a mail-server, an FTP servcer, a web server, a database via a SQL query, external application output and a JMS queue. The period of scan and the pipeline to feed, as well as other specific configuration options are all set in the <userinput>config/scanner/config.properties</userinput>userinput> file. There may be one or many scanning threads active, each configured differently. For example, one scanner thread could be polling a mailbox once every 60 secs while another is scanning a directory every 10 seconds. The scanner is also capable of scanning based on a schedule specified in the same way that CRON is on UNIX systems.</para> ! <para>General attributes available are <userinput>file_name</userinput>, <userinput>scan_path</userinput> and <userinput>scan_date</userinput>.</para> ! </section> ! <section> ! <title>Starting scanner</title> ! <para>The scanner tool is started by running the command <userinput>babeldoc scanner</userinput>. This command will use configuration from <userinput>config/scanner/config.properties</userinput>. If you want to use configuration from a different file you can use <userinput>-s another_configuration</userinput> switch to specify the configuration that should be used instead of default one. ! </para> ! </section> ! <section> ! <title>Configuration</title> ! <para>There are two kinds of configuration options available:</para> ! <orderedlist> ! <listitem> ! <userinput>general</userinput>: these options are global and apply to all types of scanners.</listitem> ! <listitem> ! <userinput>specific</userinput>: Options for a certain kind of scanner. For example the configuration: 'host' is only pertinent to the email scanner.</listitem> ! </orderedlist> ! <para>The options for each scanner type are laid out below.</para> ! </section> ! &scanners; ! ! </chapter> --- 4,78 ---- <section> <title>Introduction</title> ! <para> ! The scanner is a tool that scans for messages from a variety ! of sources and when a message is found, it is fed into the ! pipeline. The scanner is an automation tool, in that a ! system can be built up using scanners and pipelines. This is ! an alternative to the ! <userinput>process</userinput> ! script which feeds a single document into the pipeline when ! run. The scanner is currently capable of scanning a ! directory in a filesystem, a mailbox on a mail-server, an ! FTP servcer, a web server, a database via a SQL query, ! external application output, a JMS queue and an Apache VFS. The period of ! scan and the pipeline to feed, as well as other specific ! configuration options are all set in the ! <userinput>config/scanner/config.properties</userinput> ! userinput> file. There may be one or many scanning threads ! active, each configured differently. For example, one ! scanner thread could be polling a mailbox once every 60 secs ! while another is scanning a directory every 10 seconds. The ! scanner is also capable of scanning based on a schedule ! specified in the same way that CRON is on UNIX systems. ! </para> ! <para> ! General attributes available are ! <userinput>file_name</userinput> ! , ! <userinput>scan_path</userinput> ! and ! <userinput>scan_date</userinput> ! . ! </para> ! </section> ! <section> ! <title>Starting scanner</title> ! <para> ! The scanner tool is started by running the command ! <userinput>babeldoc scanner</userinput> ! . This command will use configuration from ! <userinput>config/scanner/config.properties</userinput> ! . If you want to use configuration from a different file you ! can use ! <userinput>-s another_configuration</userinput> ! switch to specify the configuration that should be used ! instead of default one. ! </para> ! </section> ! <section> ! <title>Configuration</title> ! <para> ! There are two kinds of configuration options available: ! </para> ! <orderedlist> ! <listitem> ! <userinput>general</userinput> ! : these options are global and apply to all types of ! scanners. ! </listitem> ! <listitem> ! <userinput>specific</userinput> ! : Options for a certain kind of scanner. For example the ! configuration: 'host' is only pertinent to the email ! scanner. ! </listitem> ! </orderedlist> ! <para> ! The options for each scanner type are laid out below. ! </para> ! </section> ! &scanners; ! ! </chapter> Index: chapter2.xml =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/readme/userguide/chapter2.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** chapter2.xml 14 Apr 2004 20:13:41 -0000 1.7 --- chapter2.xml 12 Jan 2008 00:46:45 -0000 1.8 *************** *** 5,18 **** <section> <title>Introduction</title> ! <para>A pipeline is a program whose purpose is to transform a document into one or more resultant documents. An example pipeline could transform a received XML purchase order into a set of SQL statements intended to update a database, produce a printable PDF file for record keeping and a confirmation email sent to the originating party.</para> ! <para>All of the pipelines in <productname>Babeldoc</productname> must have a unique name like <userinput>test</userinput> or <userinput>document</userinput>. A pipeline is a set of processing steps arranged in a linear fashion. Each processing step is called a "pipeline stage" and each pipeline stage in a pipeline must have a unique name. Two pipelines may have a pipeline stage of the same name. There is a special pipeline stage in a pipeline, the <firstname>entryStage</firstname> which indicates which pipeline stage should initially receive the document from the feeder mechanisms. It is also possible to introduce a document into the "middle" of a pipeline. In order to designate a particular stage in a pipeline, the name is given as: <userinput>pipeline-name.pipeline stage-name</userinput>.</para> ! <para>The pipelines in the <userinput>babeldoc</userinput> system are managed by the <firstterm>Pipeline factory</firstterm> which determines how and when a pipeline runs. Each pipeline stage in a pipeline has a <firstterm>type</firstterm> and a set of configuration options. An example of the a pipeline stage is the <userinput>test.transform</userinput> pipeline stage whose type is <userinput>XslTranform</userinput>. This type of pipeline stage requires either the configuration option <userinput>tranformationFile</userinput> which supplies the filename (or URL) of the XSLt file to perform the transformation or <userinput>transformationScript</userinput> which is the inline XSL.t document. There is an additional non-mandatory configuration option, <userinput>bufferSize</userinput> which can help with larger transformations.</para> </section> <section> <title>Pipeline Documents</title> ! <para>The pipeline stages operate on documents. A useful metaphor is the pipes that constitute the plumbing in your home. Each of the stages in the plumbing pipeline represents bends, faucets and other functional requirements. A pipeline document is the water in the pluming pipeline. A document is successively transformed by the pipeline until it is finally stored, discarded or otherwise disposed of. The transformations are determined by the pipeline and its stages. A document is primarily a number of bytes (characters) of data. The data is characterized by a MIME type. There are a number of ways a document can get fed into a pipeline, namely:</para> [...1747 lines suppressed...] ! -C pipeline-name.stage-name or --config ! pipeline-name.stage-name ! </userinput> ! : List the configuration for a pipeline stage. ! </listitem> <listitem> ! <userinput> ! -L pipeline-name.stage-name -y or -L ! pipeline-name.stage-name --type ! </userinput> ! : List the type of the pipeline stage. ! </listitem> ! <!-- Can't get this to work <listitem><userinput>LIST CONNECTIVITY</userinput>: List the web or connectivity in a pipeline.</listitem> --> </orderedlist> ! <para> ! There are a number of options in this tool. Use the -h ! option to get the complete list. ! </para> </section> </chapter> Index: chapter3.xml =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/readme/userguide/chapter3.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** chapter3.xml 14 Apr 2004 20:13:41 -0000 1.5 --- chapter3.xml 12 Jan 2008 00:46:45 -0000 1.6 *************** *** 4,58 **** <section> <title>Introduction</title> ! <para>Resources in Babeldoc are a generalized way of accessing data sources. Resources are also considered to be scarce in that they have to be protected from leakage. This is particularly important for database and J2EE resources . They are named using a string name and are thus uniquely identified in the system. The resources are defined in the <userinput>config/resource/config.xml </userinput> file. Each resource name maps to a specific class name which governs the policy of the resource and is programmatically specified. The available resources are:</para> <orderedlist> <listitem> ! <userinput>jdbc</userinput> Unpooled Jdbc access to a database connection</listitem> <listitem> ! <userinput>jndi</userinput> Jndi lookup to a database connection</listitem> <listitem> ! <userinput>pooled</userinput> Pooled jdbc access to a database connection</listitem> </orderedlist> ! <para>Each of the named resources are defined in the <userinput>config/resources</userinput> as <userinput>resource-name</userinput>.properties. Each of the properties files has a required name/value pair called <userinput>type</userinput>. This can be one of the types as listed above. The rest of the configuration options are specific to the type of resource. These configuration options are given below:</para> </section> ! <section> <title>jdbc</title> ! <para>Each simple jdbc resource defines a connection to a database using the following configuration options:</para> <orderedlist> <listitem> ! <userinput>dbUser</userinput> name of user to log into the database. ! </listitem> <listitem> ! <userinput>dbPassword</userinput> password of the user. ! </listitem> <listitem> ! <userinput>dbDriver</userinput> the jdbc driver for the database. ! </listitem> <listitem> ! <userinput>dbUrl</userinput> the URL for jdbc to resolve the specific database. ! </listitem> </orderedlist> ! <para>For this to work correctly the jdbc jar file for the specific database you need to access needs to be in the classpath. Currently only the mysql jar is built into <productname>Babeldoc</productname>. Access to other kinds of databases like Oracle, DB2 and Sybase will require that the JDBC driver libraries be placed in the CLASSPATH. The name of the dbDriver parameter and the form of the dbUrl will be highly dependent on the particulars of the vendor database. There are a number of limitations to the simple jdbc resource, the primary limitation being that the resource does not pool connections. Each time a connection is requested, a new connection is created and this can be VERY time consuming.</para> </section> ! <section> <title>jndi</title> ! <para>This resource is useful when running in a J2EE container. This allows for accessing datasources using JNDI. There is a single configuration option:</para> <orderedlist> <listitem> ! <userinput>datasourceName</userinput> the jndi name of the datasource to lookup.</listitem> </orderedlist> </section> ! <section> <title>pooled</title> ! <para>Babeldoc provides a pooled connection using the (<ulink url="http://jakarta.apache.org/commons/dbcp/">Apache Commons DBCP</ulink>) library . The configuration for the resource is provided by the following configuration options</para> <orderedlist> <listitem> ! <userinput>dbUser</userinput> The user name with access the database</listitem> <listitem> ! <userinput>dbPassword</userinput> The user's password</listitem> <listitem> ! <userinput>dbUrl</userinput> Url for access to database</listitem> </orderedlist> </section> --- 4,126 ---- <section> <title>Introduction</title> ! <para> ! Resources in Babeldoc are a generalized way of accessing ! data sources. Resources are also considered to be scarce in ! that they have to be protected from leakage. This is ! particularly important for database and J2EE resources . ! They are named using a string name and are thus uniquely ! identified in the system. The resources are defined in the ! <userinput>config/resource/config.xml</userinput> ! file. Each resource name maps to a specific class name which ! governs the policy of the resource and is programmatically ! specified. The available resources are: ! </para> <orderedlist> <listitem> ! <userinput>jdbc</userinput> ! Unpooled Jdbc access to a database connection ! </listitem> <listitem> ! <userinput>jndi</userinput> ! Jndi lookup to a database connection ! </listitem> <listitem> ! <userinput>pooled</userinput> ! Pooled jdbc access to a database connection ! </listitem> </orderedlist> ! <para> ! Each of the named resources are defined in the ! <userinput>config/resources</userinput> ! as ! <userinput>resource-name</userinput> ! .properties. Each of the properties files has a required ! name/value pair called ! <userinput>type</userinput> ! . This can be one of the types as listed above. The rest of ! the configuration options are specific to the type of ! resource. These configuration options are given below: ! </para> </section> ! <section> <title>jdbc</title> ! <para> ! Each simple jdbc resource defines a connection to a database ! using the following configuration options: ! </para> <orderedlist> <listitem> ! <userinput>dbUser</userinput> ! name of user to log into the database. ! </listitem> <listitem> ! <userinput>dbPassword</userinput> ! password of the user. ! </listitem> <listitem> ! <userinput>dbDriver</userinput> ! the jdbc driver for the database. ! </listitem> <listitem> ! <userinput>dbUrl</userinput> ! the URL for jdbc to resolve the specific database. ! </listitem> </orderedlist> ! <para> ! For this to work correctly the jdbc jar file for the ! specific database you need to access needs to be in the ! classpath. Currently only the mysql jar is built into ! <productname>Babeldoc</productname> ! . Access to other kinds of databases like Oracle, DB2 and ! Sybase will require that the JDBC driver libraries be placed ! in the CLASSPATH. The name of the dbDriver parameter and the ! form of the dbUrl will be highly dependent on the ! particulars of the vendor database. There are a number of ! limitations to the simple jdbc resource, the primary ! limitation being that the resource does not pool ! connections. Each time a connection is requested, a new ! connection is created and this can be VERY time consuming. ! </para> </section> ! <section> <title>jndi</title> ! <para> ! This resource is useful when running in a J2EE container. ! This allows for accessing datasources using JNDI. There is a ! single configuration option: ! </para> <orderedlist> <listitem> ! <userinput>datasourceName</userinput> ! the jndi name of the datasource to lookup. ! </listitem> </orderedlist> </section> ! <section> <title>pooled</title> ! <para> ! Babeldoc provides a pooled connection using the ( ! <ulink url="http://jakarta.apache.org/commons/dbcp/"> ! Apache Commons DBCP ! </ulink> ! ) library . The configuration for the resource is provided ! by the following configuration options ! </para> <orderedlist> <listitem> ! <userinput>dbUser</userinput> ! The user name with access the database ! </listitem> <listitem> ! <userinput>dbPassword</userinput> ! The user's password ! </listitem> <listitem> ! <userinput>dbUrl</userinput> ! Url for access to database ! </listitem> </orderedlist> </section> Index: chapter1.xml =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/readme/userguide/chapter1.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** chapter1.xml 6 Aug 2004 18:45:57 -0000 1.7 --- chapter1.xml 12 Jan 2008 00:46:45 -0000 1.8 *************** *** 5,47 **** <title>Babeldoc</title> <para> ! <productname>Babeldoc</productname> is a document processing system. Babeldoc is especially suited for Business-to-Business (B2B) environments and similar integration projects. <productname>Babeldoc</productname> has a flexible and reconfigurable processing pipeline through which documents flow. These pipelines transform the document. Additionally <productname>Babeldoc</productname> has a sophisticated and extensible journaling system so that documents may be reprocessed and resubmitted as well as tracked through the system. Its runtime environment is flexible so that it can run standalone, in a web container or in a J2EE container (currently tested on Jboss 2.4.x and JBoss 3.0.x). <productname>Babeldoc</productname> has both a Web console, a number of GUI tools and a command-line console to control the document flow.</para> <note> ! <para>The flow based metaphor is an appropriate metaphor that will expanded on in this document. </para> </note> ! <para>Babeldoc can be used to process documents which are flowing in and out of a system. There are three basic ways to develop applications to handle these document flows:</para> <orderedlist> ! <listitem>Hand-coded standalone applications have the benefit of simplicity. These applications can be slow (java start-up times are significant) and also inflexible, hard to maintain, difficult to track errors and can result in fragile systems. Also such systems could be non-portable in that they make assumptions about their environments.</listitem> ! <listitem>Hand-coded RMI (or similar protocol based) server applications are better than (1) in terms of performance but can be hard to administer and control (you have to do this yourself).</listitem> [...1137 lines suppressed...] <simplelist> <member>@echo off</member> *************** *** 298,302 **** <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> --- 865,874 ---- <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.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** chapter7.xml 6 Aug 2004 18:45:57 -0000 1.2 --- chapter7.xml 12 Jan 2008 00:46:45 -0000 1.3 *************** *** 1,91 **** <?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> --- 1,279 ---- <?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> |