You can subscribe to this list here.
| 2003 |
Jan
|
Feb
(14) |
Mar
(107) |
Apr
(211) |
May
(93) |
Jun
(158) |
Jul
(159) |
Aug
(368) |
Sep
(188) |
Oct
(151) |
Nov
(115) |
Dec
(98) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(25) |
Feb
|
Mar
(33) |
Apr
(28) |
May
(116) |
Jun
(2) |
Jul
(117) |
Aug
(19) |
Sep
(9) |
Oct
(2) |
Nov
|
Dec
(4) |
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(9) |
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
(22) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
(6) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(267) |
Sep
|
Oct
|
Nov
(6) |
Dec
(512) |
| 2008 |
Jan
(187) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(6) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <tr...@us...> - 2003-07-24 23:51:26
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/stage In directory sc8-pr-cvs1:/tmp/cvs-serv30425 Modified Files: EntityResolverDiskCache.java EntityResolverMemoryCache.java Log Message: Added the apache license Index: EntityResolverDiskCache.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/stage/EntityResolverDiskCache.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EntityResolverDiskCache.java 24 Jul 2003 14:06:14 -0000 1.1 --- EntityResolverDiskCache.java 24 Jul 2003 23:51:20 -0000 1.2 *************** *** 1,7 **** package com.babeldoc.core.pipeline.stage; ! import java.util.*; import java.io.*; - import org.xml.sax.*; import java.net.URL; --- 1,74 ---- + /* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2000 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact ap...@ap.... + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + * Portions of this software are based upon public domain software + * originally written at the National Center for Supercomputing Applications, + * University of Illinois, Urbana-Champaign. + * ==================================================================== + * + * Babeldoc: The Universal Document Processor + * + * $Header$ + * $DateTime$ + * $Author$ + * + */ package com.babeldoc.core.pipeline.stage; ! import org.xml.sax.EntityResolver; ! import org.xml.sax.InputSource; ! import org.xml.sax.SAXException; ! import java.io.*; import java.net.URL; Index: EntityResolverMemoryCache.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/stage/EntityResolverMemoryCache.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EntityResolverMemoryCache.java 24 Jul 2003 14:06:14 -0000 1.1 --- EntityResolverMemoryCache.java 24 Jul 2003 23:51:20 -0000 1.2 *************** *** 1,2 **** --- 1,67 ---- + /* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2000 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact ap...@ap.... + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + * Portions of this software are based upon public domain software + * originally written at the National Center for Supercomputing Applications, + * University of Illinois, Urbana-Champaign. + * ==================================================================== + * + * Babeldoc: The Universal Document Processor + * + * $Header$ + * $DateTime$ + * $Author$ + * + */ package com.babeldoc.core.pipeline.stage; |
|
From: Bill H. <Bil...@Ac...> - 2003-07-24 20:34:33
|
<?xml version="1.0" ?><html> <head> <title></title> </head> <body> <div align="left"><font face="Arial"><span style="font-size:10pt">Hi Bruce,</span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">Thanks for the reply.  Apologies for not posting through the list before.  Please ignore the responses I sent directly back to you.</span></font></div> <div align="left"><br/></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">I'm using Babeldoc 1.0, tomcat 4.1.24.   I'm doing this on my personal</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">machine for testing.</span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">The log entries for Tomcat are:</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">2003-07-22 17:56:38 HostConfig[localhost]: Deploying web application</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">directory babeldoc-console</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">2003-07-22 17:56:38 StandardHost[localhost]: Installing web application at</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">context path /babeldoc-</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">console from URL </span></font><font face="Arial" color="#008000"><span style="font-size:10pt"><u>file:C:\jakarta-tomcat-4.1.24\webapps\babeldoc-console</u></span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">2003-07-22 17:56:38 WebappLoader[/babeldoc-console]: Deploying class</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">repositories to work </span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">directory</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">C:\jakarta-tomcat-4.1.24\work\Standalone\localhost\babeldoc-console</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">2003-07-22 17:56:38 StandardManager[/babeldoc-console]: Seeding random</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">number generator </span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">class java.security.SecureRandom</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">2003-07-22 17:56:38 StandardManager[/babeldoc-console]: Seeding of random</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">number generator </span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">has been completed</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">2003-07-22 17:56:40 StandardWrapper[/babeldoc-console:default]: Loading</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">container servlet default</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">2003-07-22 17:56:40 StandardWrapper[/babeldoc-console:invoker]: Loading</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">container servlet </span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">invoker</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">2003-07-22 17:58:49 StandardWrapper[/manager:HTMLManager]: Loading</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">container servlet </span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">HTMLManager</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">2003-07-22 17:58:49 HTMLManager: init: Associated with Deployer</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">'localhost'</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">2003-07-22 17:58:49 HTMLManager: init: Global resources are available</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">2003-07-22 17:58:49 HTMLManager: list: Listing contexts for virtual host</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">'localhost'</span></font></div> <div align="left"><br/> </div> <div align="left"><br/> </div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">Which all seem okay.  There is also a velocity log indicating that</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">velocity has started successfully.</span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">When I reference the url:</span></font></div> <div align="left"><font face="Arial" color="#008000"><span style="font-size:10pt"><u>http://localhost/babeldoc-console/servlet/Console</u></span></font><font face="Arial"><span style="font-size:10pt"> the response returned </span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">is:</span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt"><html><body></body></html></span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">So, the servlet is serving, but I must have something wrong in the</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">configuration somewhere.</span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">When I reference localhost/babeldoc-console/index.html the response is:</span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt"><html></span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt"><head></span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt"></head></span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">            <frameset cols="100,*"></span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">                        <frame name="navigation" src="navigation.vm" noresize frameborder=0></span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">                        <frame name="main" src="main.vm" noresize frameborder=0></span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">            </frameset></span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt"><body></body></span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt"></html></span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">but the screen is blank.</span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">When i reference localhost/babeldoc-console/navigation.vm  the response</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">is:</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt"><html><body></body></html></span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">When I reference localhost/babeldoc-console/main.vm the response is the</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">same.</span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">I am suspecting a velocity set-up problem, but don't know where to start</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">looking, as the web.xml file has the mapping:</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">  <servlet-mapping></span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">    <servlet-name>ConsoleServlet</servlet-name></span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">    <url-pattern>*.vm</url-pattern></span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">  </servlet-mapping></span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">Which seems to indicate to me that the console servlet is processing the velocity files.</span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">The web.xml file seems to reference a <init-param>:</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">    <init-param></span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">      <param-name>properties</param-name></span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">      <param-value>/velocity.properties</param-value></span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">    </init-param></span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">I finally found this file in the babeldoc-console directory but all it has in it is:</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">file.resource.loader.path = .</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">runtime.log = velocity.log</span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">beyond that I'm searching... not sure what to look at next.</span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">Thanks for any help.</span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">Bill</span></font></div> <div align="left"><br/> </div> <div align="left"><br/></div> <div align="left"><br/> </div> <div align="left"><br/></div> <div align="left"><font face="Arial"><span style="font-size:10pt">On 24 Jul 2003 at 11:57, McDonald, Bruce wrote:</span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> Bill, is there any logging that you can can find?</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> What version of babeldoc and tomcat are you using?</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> What is your url?</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> regards,</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> Bruce.</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> PS.  Please post through the mailing list.</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> -----Original Message-----</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> From: Bill Harrelson [mailto:Bil...@ac...]</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> Sent: Wednesday, July 23, 2003 8:28 PM</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> To: McDonald, Bruce</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> Subject: Babeldoc console configuration.</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> Bruce,</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> I don't seem to be having much luck getting babeldoc to work under</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> Tomcat, and I wondered if you could point me to any configuration</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> information?</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> I've read through the .bat file, and made what seem to be the</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> appropriate modifications, and I get a log indicating that velocity</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> has started, and the Tomcat manager says that the babeldoc-console</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> servlet is started, but the console servlet just serves a blank page.</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> Is there any documentation or tips anywhere on how to approach this?</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> Thanks,</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> Bill</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> -------------------------------------------------------</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> This SF.Net email sponsored by: Free pre-built ASP.NET sites including</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> Data Reports, E-commerce, Portals, and Forums are available now.</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> Download today and enter to win an XBOX or Visual Studio .NET.</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> 01/01 _______________________________________________ Babeldoc-devel</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> mailing list Bab...@li...</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> https://lists.sourceforge.net/lists/listinfo/babeldoc-devel</span></font></div> <div align="left"><br/> </div> <div align="left"><br/></div> <div align="left"><font face="Arial"><span style="font-size:10pt">-- </span></font></div> <div align="left"><font face="Arial" size="1"><span style="font-size:8pt">William B. Harrelson</span></font></div> <div align="left"><font face="Arial" size="1"><span style="font-size:8pt">President</span></font></div> <div align="left"><font face="Arial" size="1"><span style="font-size:8pt">Accordare </span></font></div> <div align="left"><font face="Arial" size="1"><span style="font-size:8pt">13A Medford Street, Suite 4</span></font></div> <div align="left"><font face="Arial" size="1"><span style="font-size:8pt">Arlington, MA 02474</span></font></div> <div align="left"><font face="Arial" size="1"><span style="font-size:8pt">t:781-646-2241 f:781-459-8347 c:617-335-0702</span></font></div> <div align="left"><font face="Arial" size="1"><span style="font-size:8pt">Bil...@Ac...</span></font></div> <div align="left"></div> </body> </html> |
|
From: McDonald, B. <Bru...@ba...> - 2003-07-24 15:59:26
|
Bill, is there any logging that you can can find? What version of babeldoc and tomcat are you using? What is your url? regards, Bruce. PS. Please post through the mailing list. -----Original Message----- From: Bill Harrelson [mailto:Bil...@ac...] Sent: Wednesday, July 23, 2003 8:28 PM To: McDonald, Bruce Subject: Babeldoc console configuration. Bruce, I don't seem to be having much luck getting babeldoc to work under Tomcat, and I wondered if you could point me to any configuration information? I've read through the .bat file, and made what seem to be the appropriate modifications, and I get a log indicating that velocity has started, and the Tomcat manager says that the babeldoc-console servlet is started, but the console servlet just serves a blank page. Is there any documentation or tips anywhere on how to approach this? Thanks, Bill |
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/stage In directory sc8-pr-cvs1:/tmp/cvs-serv17111 Modified Files: DomifyPipelineStage.java XpathSplitterPipelineStage.java Added Files: EntityResolverDiskCache.java EntityResolverMemoryCache.java Log Message: added XML Entity Resolving (local dtd cache), preemptive DOM caching of documents out of XpathSplitter. Changed DOM caching implementation from document attribute to WeakHashMap in DomifyPipelineStage, as the previous exposed a java serialization bug when journaling large XML documents. --- NEW FILE: EntityResolverDiskCache.java --- package com.babeldoc.core.pipeline.stage; import java.util.*; import java.io.*; import org.xml.sax.*; import java.net.URL; // TODO: make a maximum size of all the files on disk // TODO: eliminate extra read from disk on initial population // TODO: figure out cache invalidation // TODO: make a better filename scheme than hashcode // TODO: read the filenames in the directory in the constructor to avoid checking for files every time. /** * EntityResolverDiskCache is a disk cache for resolving XML entities. * If an entity is in the disk cache, it is resolved from there; otherwise * it is resolved from the backend and stored in the disk cache. * The disk cache is just a directory that is full of files. **/ public class EntityResolverDiskCache implements EntityResolver { /** * Construct a new EntityResolverDiskCache that backends to the given EntityResolver and * caches its entities in the given directory. **/ public EntityResolverDiskCache(EntityResolver entityResolver, String baseDirectory) throws Exception { this.entityResolver = entityResolver; this.baseDirectory = new File(baseDirectory); if (!this.baseDirectory.isDirectory()) { throw new Exception("Not a directory."); } } /** * resolve an entity **/ public InputSource resolveEntity (String publicId, String systemId) throws SAXException, IOException { try { File file = null; // synchronize on the systemId so two attempts to resolve don't result in two gets from the backend synchronized (systemId.intern()) { file = new File(baseDirectory, Integer.toString(systemId.hashCode())); if (!file.exists()) { InputSource inputSource = entityResolver.resolveEntity(publicId, systemId); if (inputSource != null) { Reader reader = inputSource.getCharacterStream(); if (reader != null) { FileWriter fw = new FileWriter(file); char[] buffer = new char[1024]; int charsRead; while ((charsRead = reader.read(buffer)) != 01) { fw.write(buffer, 0, charsRead); } fw.close(); reader.close(); } else { InputStream byteStream = inputSource.getByteStream(); if (byteStream != null) { FileOutputStream outputStream = new FileOutputStream(file); byte[] buffer = new byte[1024]; int bytesRead; while ((bytesRead = byteStream.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); } outputStream.close(); byteStream.close(); } } } if (!file.exists()) { URL url = new URL(systemId); InputStream inputStream = url.openStream(); FileOutputStream outputStream = new FileOutputStream(file); byte[] buffer = new byte[1024]; int bytesRead; while ((bytesRead = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); } outputStream.close(); inputStream.close(); } } } InputSource is = new InputSource(new FileInputStream(file)); is.setPublicId(publicId); is.setSystemId(systemId); return is; } catch (RuntimeException t) { t.printStackTrace(); throw t; } } /** the EntityResolver to backend to **/ EntityResolver entityResolver; /** the directory to use as a cache **/ File baseDirectory; } --- NEW FILE: EntityResolverMemoryCache.java --- package com.babeldoc.core.pipeline.stage; import java.util.*; import java.io.*; import org.xml.sax.*; import java.net.URL; import org.xml.sax.helpers.DefaultHandler; // TODO: make a maximum size for the cache (number of entries or total size in bytes) // TODO: figure out cache invalidation /** * EntityResolverMemoryCache is a memory cache for resolving XML entities. * If an entity is in the memory cache, it is resolved from there; otherwise * it is resolved normally and stored in the memory cache for the next time. **/ public class EntityResolverMemoryCache implements EntityResolver { /** an EntityResolver for babeldoc to use; a memory cache backended to a disk cache **/ static EntityResolver babeldocEntityResolver = null; static { try { babeldocEntityResolver = new EntityResolverMemoryCache(new EntityResolverDiskCache(new DefaultHandler(), "dtdcache")); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } /** * Construct a new EntityResolverMemoryCache that backends to the given EntityResolver **/ public EntityResolverMemoryCache(EntityResolver entityResolver) { this.entityResolver = entityResolver; } /** * resolve an entity **/ public InputSource resolveEntity (String publicId, String systemId) throws SAXException, IOException { try { byte[] bytes = null; // synchronize on the systemId so two attempts to resolve don't result in two gets from the backend synchronized (systemId.intern()) { synchronized (cache) { // synchronize all access on the cache bytes = (byte[])cache.get(systemId); } if (bytes == null) { // wasn't cached; resolve it and put it there InputSource inputSource = entityResolver.resolveEntity(publicId, systemId); if (inputSource != null) { // try to read it as a character steam, if not a byte stream Reader reader = inputSource.getCharacterStream(); if (reader != null) { CharArrayWriter caw = new CharArrayWriter(); char[] buffer = new char[1024]; int charsRead; while ((charsRead = reader.read(buffer)) != 01) { caw.write(buffer, 0, charsRead); } caw.close(); reader.close(); String temp = caw.toString(); bytes = temp.getBytes(); } else { InputStream byteStream = inputSource.getByteStream(); if (byteStream != null) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int bytesRead; while ((bytesRead = byteStream.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); } outputStream.close(); byteStream.close(); bytes = outputStream.toByteArray(); } } } if (bytes == null) { // read it as a URL URL url = new URL(systemId); InputStream inputStream = url.openStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int bytesRead; while ((bytesRead = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); } outputStream.close(); inputStream.close(); bytes = outputStream.toByteArray(); } synchronized(cache) { // store it in the cache cache.put(systemId, bytes); } } } InputSource is = new InputSource(new ByteArrayInputStream(bytes)); is.setPublicId(publicId); is.setSystemId(systemId); return is; } catch (RuntimeException t) { t.printStackTrace(); throw t; } } /** the cache is just a LinkedHashMap **/ LinkedHashMap cache = new LinkedHashMap(); /** the EntityResolver to backend to **/ EntityResolver entityResolver; } Index: DomifyPipelineStage.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/stage/DomifyPipelineStage.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** DomifyPipelineStage.java 27 Jun 2003 02:19:59 -0000 1.11 --- DomifyPipelineStage.java 24 Jul 2003 14:06:13 -0000 1.12 *************** *** 72,75 **** --- 72,77 ---- import com.babeldoc.core.pipeline.*; import com.babeldoc.core.pipeline.command.PipelineFeeder; + import com.babeldoc.core.config.ConfigService; + import com.babeldoc.core.config.IConfig; import org.w3c.dom.Document; *************** *** 86,89 **** --- 88,94 ---- import java.util.ArrayList; import java.util.Collection; + import java.util.WeakHashMap; + import java.util.Map; + import java.util.Collections; import javax.xml.parsers.DocumentBuilder; *************** *** 112,118 **** public static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; ! /** Constants: attribute name */ ! public static String DOM_KEY = "dom_representation"; ! /** * construct with configuration information object --- 117,162 ---- public static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; ! /** constants for the configuration stuff */ ! public static final String CONFIG_FILENAME = "domify/config"; ! public static final String USE_DTD_CACHE_NAME = "useDtdCache"; ! public static boolean USE_DTD_CACHE; ! ! /** cache document representations here rather than as document attributes **/ ! private static Map domCache = Collections.synchronizedMap(new WeakHashMap()); ! ! /** keep a DocumentBuilder per Thread **/ ! public static ThreadLocal docBuilder = new ThreadLocal() { ! public Object initialValue() { ! synchronized(DocumentBuilderFactory.class) { ! DocumentBuilder builder = null; ! try { ! DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); ! dfactory.setNamespaceAware(true); ! builder = dfactory.newDocumentBuilder(); ! if (USE_DTD_CACHE) { ! builder.setEntityResolver(EntityResolverMemoryCache.babeldocEntityResolver); ! } ! } ! catch (Exception e) { ! com.babeldoc.core.LogService.getInstance().logError("docBuilder.initialValue()", e); ! } ! return builder; ! } ! } ! }; ! ! ! static { ! try { ! /** ! * configuation variables ! */ ! IConfig config = ConfigService.getInstance().getConfig(CONFIG_FILENAME); ! USE_DTD_CACHE = "true".equalsIgnoreCase(config.getString(USE_DTD_CACHE_NAME)); ! } catch (Exception e) { ! com.babeldoc.core.LogService.getInstance().logError("Static{}", e); ! } ! } ! /** * construct with configuration information object *************** *** 150,153 **** --- 194,206 ---- // } + public static Document getCachedDom(PipelineDocument document) { + Document doc = (Document)domCache.get(document); + return doc; + } + + public static void putCachedDom(PipelineDocument document, Document doc) { + domCache.put(document, doc); + } + /** * Process the xml document to a document *************** *** 159,163 **** */ public static Document parseToDom(PipelineDocument document, boolean force) { ! Document doc = (Document) document.get(DOM_KEY); try { --- 212,216 ---- */ public static Document parseToDom(PipelineDocument document, boolean force) { ! Document doc = getCachedDom(document); try { *************** *** 175,182 **** } ! DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); ! dfactory.setNamespaceAware(true); ! doc = dfactory.newDocumentBuilder().parse(xmlSource); ! document.put(DOM_KEY, doc); } } catch (Exception e) { --- 228,234 ---- } ! DocumentBuilder builder = (DocumentBuilder)docBuilder.get(); ! doc = builder.parse(xmlSource); ! putCachedDom(document, doc); } } catch (Exception e) { *************** *** 244,248 **** public Document parseToDom(PipelineDocument document, boolean force, boolean validate, String schemaFilePath) throws Exception { ! Document doc = (Document) document.get(DOM_KEY); try { --- 296,300 ---- public Document parseToDom(PipelineDocument document, boolean force, boolean validate, String schemaFilePath) throws Exception { ! Document doc = getCachedDom(document); try { *************** *** 287,290 **** --- 339,345 ---- DocumentBuilder builder = dfactory.newDocumentBuilder(); + if (USE_DTD_CACHE) { + builder.setEntityResolver(EntityResolverMemoryCache.babeldocEntityResolver); + } //We have to provide an error handler for parser. It will be used *************** *** 357,361 **** } ! document.put(DOM_KEY, doc); setAdditionalInfo(errorHandler.getErrorDescription()); } --- 412,416 ---- } ! putCachedDom(document, doc); setAdditionalInfo(errorHandler.getErrorDescription()); } Index: XpathSplitterPipelineStage.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/stage/XpathSplitterPipelineStage.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** XpathSplitterPipelineStage.java 27 Jun 2003 02:19:59 -0000 1.5 --- XpathSplitterPipelineStage.java 24 Jul 2003 14:06:14 -0000 1.6 *************** *** 92,95 **** --- 92,96 ---- import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; + import javax.xml.parsers.DocumentBuilder; *************** *** 152,161 **** TransformerFactory transformFactory = TransformerFactory.newInstance(); ! String[] results = applyXpath(transformFactory, doc, xpath); if ((results == null) || (results.length == 0)) { return super.processHelper(); } else { ! return super.processHelper("text/xml", results); } } catch (Exception x) { --- 153,171 ---- TransformerFactory transformFactory = TransformerFactory.newInstance(); ! Node[] nodes = applyXpath(doc, xpath); ! String[] results = serialize(transformFactory, nodes); if ((results == null) || (results.length == 0)) { return super.processHelper(); } else { ! PipelineStageResult[] psr = super.processHelper("text/xml", results); ! DocumentBuilder documentBuilder = (DocumentBuilder)DomifyPipelineStage.docBuilder.get(); ! for (int i = 0; i < psr.length; i++) { ! Document splitDoc = documentBuilder.newDocument(); ! Node importedNode = splitDoc.importNode(nodes[i], true); ! splitDoc.appendChild(importedNode); ! DomifyPipelineStage.putCachedDom(psr[i].getDocument(), splitDoc); ! } ! return psr; } } catch (Exception x) { *************** *** 182,193 **** } ! /** ! * ! */ ! private String[] applyXpath(TransformerFactory transformFactory, ! Document doc, String xpath) throws Exception { boolean xmlOmit = false; ! boolean xmlIndent = false; ! // Load the configuration data if (this.hasOption(OMIT_XML_DECL)) { --- 192,206 ---- } ! private String[] serialize(TransformerFactory transformFactory, Node[] nodes) ! throws Exception ! { ! if (nodes == null) { ! return null; ! } ! String[] results = new String[nodes.length]; ! boolean xmlOmit = false; ! boolean xmlIndent = false; ! // Load the configuration data if (this.hasOption(OMIT_XML_DECL)) { *************** *** 198,205 **** xmlIndent = Boolean.getBoolean(getOptions(XML_INDENT)); } ! // Set up an identity transformer to use as serializer. Transformer serializer = transformFactory.newTransformer(); ! if (xmlOmit) { serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); --- 211,218 ---- xmlIndent = Boolean.getBoolean(getOptions(XML_INDENT)); } ! // Set up an identity transformer to use as serializer. Transformer serializer = transformFactory.newTransformer(); ! if (xmlOmit) { serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); *************** *** 209,213 **** serializer.setOutputProperty(OutputKeys.INDENT, "yes"); } ! NodeIterator nl = XPathAPI.selectNodeIterator(doc, xpath); --- 222,241 ---- serializer.setOutputProperty(OutputKeys.INDENT, "yes"); } ! ! ByteArrayOutputStream baos = new ByteArrayOutputStream(); ! for (int i = 0; i < nodes.length; i++) { ! baos.reset(); ! serializer.transform(new DOMSource(nodes[i]), new StreamResult(baos)); ! results[i] = baos.toString(); ! } ! ! return results; ! } ! ! /** ! * ! */ ! private Node[] applyXpath(Document doc, String xpath) throws Exception { ! NodeIterator nl = XPathAPI.selectNodeIterator(doc, xpath); *************** *** 217,223 **** while ((n = nl.nextNode()) != null) { if (!isTextNode(n)) { ! ByteArrayOutputStream baos = new ByteArrayOutputStream(); ! serializer.transform(new DOMSource(n), new StreamResult(baos)); ! vec.addElement(baos.toString()); } } --- 245,249 ---- while ((n = nl.nextNode()) != null) { if (!isTextNode(n)) { ! vec.addElement(n); } } *************** *** 225,229 **** // Return the results vector into an array and return it. if (vec.size() > 0) { ! String[] results = new String[vec.size()]; vec.copyInto(results); --- 251,255 ---- // Return the results vector into an array and return it. if (vec.size() > 0) { ! Node[] results = new Node[vec.size()]; vec.copyInto(results); |
|
From: Leech, J. <jl...@vi...> - 2003-07-24 14:02:52
|
Oops I haven't committed the XML EntityResolver code yet. I have been busy working on my pipeline configuration -- a testament to the quality of babeldoc, it works! Once I commit the XML EntityResolver code, you will be able to make it work like this (and while it works, it is more like a good prototype than anything else, and thus subject to change): - in your babeldoc environment make a domify/config.properties that says useDtdCache=true - create a directory called dtdcache in the current working directory - run your pipeline stages! You can verify that DTDs are getting cached by inspection of the dtdcache directory. Let me know if you see any performance improvement -- I definitely do but the documents I parse reference about 171 dtds (lots of nesting). Incidentally, I modified my pipeline configuration from this: XPathSplitter->XPathExtractor->SqlWriter to this: XslTransform->SqlWriter and it really flies. So I used to split up the XML, extract values from it, then write each row to the database. Now I just transform the XML into a bunch of SQL statements and run them. Its much faster and it might be a good pattern in general. -Jonathan -----Original Message----- From: Bruce McDonald [mailto:br...@mc...] Sent: Wednesday, July 23, 2003 7:33 PM To: Leech, Jonathan; bab...@li... Subject: Re: [Babeldoc-devel] perils of synchronization in PooledJdbc.java Jonathan, I haven't heard from you in some time - how is it going? The work that you have done on babeldoc in recent weeks and months has been excellent. I am hoping to see your work on the xml entity resolver. regards, Bruce. On Thursday 10 July 2003 06:42 pm, Leech, Jonathan wrote: > I think we need to remove synchronization from the checkIn() and checkOut() > methods of PooledJdbc.java, and here's the reason why: It causes deadlock > every time the connection pool is exhausted. > > Example: > - All database connections in the pool are being used by various threads. > - A thread calls checkOut(), which locks the PooledJdbc object, and the > connection pool is waiting for a checkin. > - As the various threads finish using their database connections, they call > checkIn(), but are locked out. > > The only problem I see with it doing it is that there's a chance that > multiple threads could ask for the first connection, which calls > setupJdbc(), and that might be not well behaved. I think moving the > setupJdbc to the default constructor would handle this. > > Thoughts? > > -Jonathan |
|
From: Bruce M. <br...@mc...> - 2003-07-24 01:36:30
|
All, Just wanted to let you know that I am contactable on Yahoo Instant Messenger, id: triphopping_man. Unfortunately the firewall at my current work is somewhat restrictive and sometimes messages get dropped :( Keep trying. regards, Bruce. |
|
From: Bruce M. <br...@mc...> - 2003-07-24 01:32:37
|
Jonathan, I haven't heard from you in some time - how is it going? The work that you have done on babeldoc in recent weeks and months has been excellent. I am hoping to see your work on the xml entity resolver. regards, Bruce. On Thursday 10 July 2003 06:42 pm, Leech, Jonathan wrote: > I think we need to remove synchronization from the checkIn() and checkOut() > methods of PooledJdbc.java, and here's the reason why: It causes deadlock > every time the connection pool is exhausted. > > Example: > - All database connections in the pool are being used by various threads. > - A thread calls checkOut(), which locks the PooledJdbc object, and the > connection pool is waiting for a checkin. > - As the various threads finish using their database connections, they call > checkIn(), but are locked out. > > The only problem I see with it doing it is that there's a chance that > multiple threads could ask for the first connection, which calls > setupJdbc(), and that might be not well behaved. I think moving the > setupJdbc to the default constructor would handle this. > > Thoughts? > > -Jonathan |
|
From: Stefan K. <ste...@co...> - 2003-07-23 21:10:49
|
Hi, I just recognized that the FlatToXmlPipelineStage does not XML encode the characters >,<,&,". If the text file includes those characters, the result will be invalid XML. Regards, Stefan |
|
From: <tr...@us...> - 2003-07-19 15:32:31
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/option
In directory sc8-pr-cvs1:/tmp/cvs-serv13778/modules/core/src/com/babeldoc/core/option
Modified Files:
ConfigInfo.java
Log Message:
Removed ostermiller utils from babeldoc
Index: ConfigInfo.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/option/ConfigInfo.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ConfigInfo.java 27 Jun 2003 02:19:58 -0000 1.5
--- ConfigInfo.java 19 Jul 2003 15:32:27 -0000 1.6
***************
*** 159,163 ****
*/
public ConfigOption getOptionInPath(String path) {
! return getOptionInPath(new com.Ostermiller.util.StringTokenizer(path, "/").toArray());
}
--- 159,168 ----
*/
public ConfigOption getOptionInPath(String path) {
! StringTokenizer st = new StringTokenizer(path, "/");
! String [] pathParts = new String[st.countTokens()];
! for(int i=0; i<pathParts.length; ++i) {
! pathParts[i] = st.nextToken();
! }
! return getOptionInPath(pathParts);
}
|
|
From: <tr...@us...> - 2003-07-19 15:32:31
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal/simple In directory sc8-pr-cvs1:/tmp/cvs-serv13778/modules/core/src/com/babeldoc/core/journal/simple Modified Files: SimpleJournal.java Log Message: Removed ostermiller utils from babeldoc Index: SimpleJournal.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal/simple/SimpleJournal.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SimpleJournal.java 27 Jun 2003 02:19:58 -0000 1.5 --- SimpleJournal.java 19 Jul 2003 15:32:27 -0000 1.6 *************** *** 66,72 **** package com.babeldoc.core.journal.simple; - import com.Ostermiller.util.CSVParser; - import com.Ostermiller.util.CSVPrinter; - import com.babeldoc.core.I18n; import com.babeldoc.core.LogService; --- 66,69 ---- *************** *** 76,79 **** --- 73,78 ---- import com.babeldoc.core.journal.query.QueryTicket; import com.babeldoc.core.pipeline.PipelineDocument; + import com.mindprod.csv.CSVWriter; + import com.mindprod.csv.CSVReader; import java.io.*; *************** *** 136,140 **** /** Configuration stuff */ private static FileWriter logWriter; ! private static CSVPrinter logPrinter; private static String logFile; private static int logMaxSize = 1024 * 1024; --- 135,139 ---- /** Configuration stuff */ private static FileWriter logWriter; ! private static CSVWriter logPrinter; private static String logFile; private static int logMaxSize = 1024 * 1024; *************** *** 152,156 **** CONFIG_NAME, JOURNAL_LOGFILE)); logWriter = new FileWriter(logFile, true); ! logPrinter = new CSVPrinter(logWriter); trackerDir = com.babeldoc.core.VariableProcessor.expandString(ConfigService.getString( CONFIG_NAME, JOURNAL_DIR)); --- 151,155 ---- CONFIG_NAME, JOURNAL_LOGFILE)); logWriter = new FileWriter(logFile, true); ! logPrinter = new CSVWriter(logWriter); trackerDir = com.babeldoc.core.VariableProcessor.expandString(ConfigService.getString( CONFIG_NAME, JOURNAL_DIR)); *************** *** 184,192 **** try { ! CSVParser parser = new CSVParser(new FileReader(logFile)); String[] values; String tickval = Long.toString(((JournalTicket) parent).getValue()); ! while ((values = parser.getLine()) != null) { // Value in the journal for this ticket? if (values[2].equals(JournalOperation.forkTicket.toString()) && --- 183,191 ---- try { ! CSVReader csvReader = new CSVReader(new FileReader(logFile)); String[] values; String tickval = Long.toString(((JournalTicket) parent).getValue()); ! while ((values = csvReader.getAllFieldsInLine()) != null) { // Value in the journal for this ticket? if (values[2].equals(JournalOperation.forkTicket.toString()) && *************** *** 217,224 **** try { ! CSVParser parser = new CSVParser(new FileReader(logFile)); String[] values; ! while ((values = parser.getLine()) != null) { // Value in the journal for this ticket? if (ticket.equals(values[0])) { --- 216,223 ---- try { ! CSVReader csvReader = new CSVReader(new FileReader(logFile)); String[] values; ! while ((values = csvReader.getAllFieldsInLine()) != null) { // Value in the journal for this ticket? if (ticket.equals(values[0])) { *************** *** 261,265 **** try { ! File directory = getLogDirectory(ticket); File logop = makeTicketDocumentFile(ticket, step); ois = new ObjectInputStream(new FileInputStream(logop)); --- 260,264 ---- try { ! // File directory = getLogDirectory(ticket); File logop = makeTicketDocumentFile(ticket, step); ois = new ObjectInputStream(new FileInputStream(logop)); *************** *** 329,333 **** try { ! CSVParser parser = new CSVParser(new FileReader(logFile)); String[] values; int index = 0; --- 328,332 ---- try { ! CSVReader csvReader = new CSVReader(new FileReader(logFile)); String[] values; int index = 0; *************** *** 335,339 **** boolean found; ! while (((values = parser.getLine()) != null) && (count < jQuery.getNumResults())) { // Value in the journal for this ticket? --- 334,338 ---- boolean found; ! while (((values = csvReader.getAllFieldsInLine()) != null) && (count < jQuery.getNumResults())) { // Value in the journal for this ticket? *************** *** 475,483 **** if (operation.equals(JournalOperation.updateStatus)) { ! logPrinter.println(new String[] { ticket.getId(), Integer.toString( ! index), operation.toString(), Long.toString(new Date().getTime()), otherStr, pstageName, addnl }); } else { ! logPrinter.println(new String[] { ticket.getId(), Integer.toString( ! index), operation.toString(), Long.toString(new Date().getTime()), otherStr, pstageName, NULL }); } } --- 474,492 ---- if (operation.equals(JournalOperation.updateStatus)) { ! logPrinter.put(ticket.getId()); ! logPrinter.put(Integer.toString(index)); ! logPrinter.put(operation.toString()); ! logPrinter.put(Long.toString(new Date().getTime())); ! logPrinter.put(otherStr); ! logPrinter.put(pstageName); ! logPrinter.put(addnl); } else { ! logPrinter.put(ticket.getId()); ! logPrinter.put(Integer.toString(index)); ! logPrinter.put(operation.toString()); ! logPrinter.put(Long.toString(new Date().getTime())); ! logPrinter.put(otherStr); ! logPrinter.put(pstageName); ! logPrinter.put(NULL); } } *************** *** 501,505 **** log.renameTo(new File(fileName)); logWriter = new FileWriter(logFile, true); ! logPrinter = new CSVPrinter(logWriter); } } --- 510,514 ---- log.renameTo(new File(fileName)); logWriter = new FileWriter(logFile, true); ! logPrinter = new CSVWriter(logWriter); } } |
|
From: <tr...@us...> - 2003-07-19 15:32:31
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal/command
In directory sc8-pr-cvs1:/tmp/cvs-serv13778/modules/core/src/com/babeldoc/core/journal/command
Modified Files:
JournalCommand.java
Log Message:
Removed ostermiller utils from babeldoc
Index: JournalCommand.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal/command/JournalCommand.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** JournalCommand.java 27 Jun 2003 02:19:57 -0000 1.4
--- JournalCommand.java 19 Jul 2003 15:32:27 -0000 1.5
***************
*** 66,72 ****
package com.babeldoc.core.journal.command;
- import com.Ostermiller.util.CSVPrinter;
-
import com.babeldoc.core.I18n;
import com.babeldoc.core.journal.IJournalTicket;
import com.babeldoc.core.journal.JournalFactory;
--- 66,71 ----
package com.babeldoc.core.journal.command;
import com.babeldoc.core.I18n;
+ import com.babeldoc.core.LogService;
import com.babeldoc.core.journal.IJournalTicket;
import com.babeldoc.core.journal.JournalFactory;
***************
*** 76,79 ****
--- 75,79 ----
import com.babeldoc.core.journal.query.QueryOption;
import com.babeldoc.core.journal.query.QueryTicket;
+ import com.mindprod.csv.CSVWriter;
import org.apache.commons.cli.CommandLine;
***************
*** 85,88 ****
--- 85,89 ----
import java.util.Date;
import java.util.Iterator;
+ import java.io.PrintWriter;
***************
*** 422,426 ****
System.out.println(" </QueryTicket>");
}
-
System.out.println("</QueryTickets>");
--- 423,426 ----
***************
*** 428,442 ****
case CSV_DISP:
!
! CSVPrinter csv = new CSVPrinter(System.out);
!
for (int i = 0; i < qts.length; ++i) {
! String[] vals = { qts[i].getTicket().getId(), Integer.toString(qts[i].getStep()), qts[i].getStage(), qts[i].getDate()
! .toString(), ((qts[i].getOperation() == null)
! ? "null" : qts[i].getOperation()), ((qts[i].getOther() == null)
! ? "null" : qts[i].getOther()), ((qts[i].getAdditional() == null)
! ? "null" : qts[i].getAdditional()) };
!
! csv.println(vals);
}
--- 428,441 ----
case CSV_DISP:
! CSVWriter csv = new CSVWriter(new PrintWriter(System.out));
for (int i = 0; i < qts.length; ++i) {
! csv.put(qts[i].getTicket().getId());
! csv.put(Integer.toString(qts[i].getStep()));
! csv.put(qts[i].getStage());
! csv.put(qts[i].getDate().toString());
! csv.put((qts[i].getOperation() == null) ? "null" : qts[i].getOperation());
! csv.put((qts[i].getOther() == null) ? "null" : qts[i].getOther());
! csv.put((qts[i].getAdditional() == null) ? "null" : qts[i].getAdditional());
! csv.nl();
}
***************
*** 452,457 ****
}
} else {
! com.babeldoc.core.LogService.getInstance().logWarn(com.babeldoc.core.I18n.get(
! "012001"));
}
}
--- 451,455 ----
}
} else {
! LogService.getInstance().logWarn(I18n.get("012001"));
}
}
|
|
From: <tr...@us...> - 2003-07-19 15:32:31
|
Update of /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/user
In directory sc8-pr-cvs1:/tmp/cvs-serv13778/modules/sql/src/com/babeldoc/sql/user
Modified Files:
SqlUserFactory.java
Log Message:
Removed ostermiller utils from babeldoc
Index: SqlUserFactory.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/user/SqlUserFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SqlUserFactory.java 27 Jun 2003 02:05:59 -0000 1.3
--- SqlUserFactory.java 19 Jul 2003 15:32:28 -0000 1.4
***************
*** 70,73 ****
--- 70,74 ----
import com.babeldoc.core.resource.ResourceFactory;
import com.babeldoc.core.user.*;
+ import com.babeldoc.core.LogService;
import com.babeldoc.sql.util.SqlQueryManager;
***************
*** 79,82 ****
--- 80,87 ----
import java.util.ArrayList;
+ import java.security.MessageDigest;
+ import java.security.NoSuchAlgorithmException;
+
+ import sun.security.provider.MD5;
***************
*** 912,916 ****
*/
public static String hash(String string) {
! return com.Ostermiller.util.MD5.getHashString(string);
}
--- 917,927 ----
*/
public static String hash(String string) {
! try {
! MessageDigest messageDigest = MessageDigest.getInstance("MD5");
! return new String(messageDigest.digest(string.getBytes()));
! } catch (NoSuchAlgorithmException e) {
! LogService.getInstance().logError(e);
! }
! return "";
}
|
|
From: <tr...@us...> - 2003-07-19 15:32:31
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core
In directory sc8-pr-cvs1:/tmp/cvs-serv13778/modules/core/src/com/babeldoc/core
Modified Files:
EnvironmentLoader.java TieredConfigurationHelper.java
VelocityUtilityContext.java
Log Message:
Removed ostermiller utils from babeldoc
Index: EnvironmentLoader.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/EnvironmentLoader.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** EnvironmentLoader.java 27 Jun 2003 02:19:57 -0000 1.8
--- EnvironmentLoader.java 19 Jul 2003 15:32:27 -0000 1.9
***************
*** 66,71 ****
package com.babeldoc.core;
- import com.Ostermiller.util.StringTokenizer;
-
import com.babeldoc.core.config.ConfigService;
import com.babeldoc.core.config.IConfig;
--- 66,69 ----
***************
*** 76,79 ****
--- 74,78 ----
import java.util.ArrayList;
import java.util.Iterator;
+ import java.util.StringTokenizer;
Index: TieredConfigurationHelper.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/TieredConfigurationHelper.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TieredConfigurationHelper.java 16 Jul 2003 22:45:26 -0000 1.4
--- TieredConfigurationHelper.java 19 Jul 2003 15:32:27 -0000 1.5
***************
*** 68,72 ****
import com.babeldoc.core.config.IConfig;
import com.babeldoc.core.config.ConfigService;
- import com.Ostermiller.util.StringTokenizer;
import java.util.*;
--- 68,71 ----
Index: VelocityUtilityContext.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/VelocityUtilityContext.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** VelocityUtilityContext.java 27 Jun 2003 02:19:57 -0000 1.9
--- VelocityUtilityContext.java 19 Jul 2003 15:32:27 -0000 1.10
***************
*** 66,73 ****
package com.babeldoc.core;
- import com.Ostermiller.util.Base64;
- import com.Ostermiller.util.MD5;
- import com.Ostermiller.util.StringTokenizer;
-
import com.babeldoc.core.config.ConfigService;
--- 66,69 ----
***************
*** 82,85 ****
--- 78,86 ----
import java.util.Calendar;
import java.util.Random;
+ import java.util.StringTokenizer;
+ import java.security.MessageDigest;
+ import java.security.NoSuchAlgorithmException;
+
+ import org.apache.xerces.impl.dv.util.Base64;
***************
*** 354,359 ****
*/
public String md5String(String value) {
! return MD5.getHashString(value);
! }
/**
--- 355,366 ----
*/
public String md5String(String value) {
! try {
! MessageDigest messageDigest = MessageDigest.getInstance("MD5");
! return new String(messageDigest.digest(value.getBytes()));
! } catch (NoSuchAlgorithmException e) {
! LogService.getInstance().logError(e);
! }
! return "";
! }
/**
***************
*** 435,439 ****
*/
public String toBase64(String string) {
! return Base64.encode(string);
}
--- 442,446 ----
*/
public String toBase64(String string) {
! return new String(Base64.encode(string.getBytes()));
}
|
|
From: <tr...@us...> - 2003-07-19 15:32:31
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/user In directory sc8-pr-cvs1:/tmp/cvs-serv13778/modules/core/src/com/babeldoc/core/user Modified Files: UserResource.java Log Message: Removed ostermiller utils from babeldoc Index: UserResource.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/user/UserResource.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UserResource.java 27 Jun 2003 02:20:00 -0000 1.3 --- UserResource.java 19 Jul 2003 15:32:27 -0000 1.4 *************** *** 66,70 **** package com.babeldoc.core.user; ! import com.Ostermiller.util.StringTokenizer; --- 66,70 ---- package com.babeldoc.core.user; ! import java.util.StringTokenizer; |
|
From: <tr...@us...> - 2003-07-19 15:32:30
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/simple In directory sc8-pr-cvs1:/tmp/cvs-serv13778/modules/core/src/com/babeldoc/core/pipeline/simple Modified Files: SimplePipelineStageResolver.java Log Message: Removed ostermiller utils from babeldoc Index: SimplePipelineStageResolver.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/simple/SimplePipelineStageResolver.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SimplePipelineStageResolver.java 16 Jul 2003 22:45:28 -0000 1.5 --- SimplePipelineStageResolver.java 19 Jul 2003 15:32:27 -0000 1.6 *************** *** 66,70 **** package com.babeldoc.core.pipeline.simple; ! import com.Ostermiller.util.StringTokenizer; import com.babeldoc.core.config.IConfig; --- 66,70 ---- package com.babeldoc.core.pipeline.simple; ! import java.util.StringTokenizer; import com.babeldoc.core.config.IConfig; |
|
From: <tr...@us...> - 2003-07-19 15:32:30
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/lib In directory sc8-pr-cvs1:/tmp/cvs-serv13778/modules/conversion/lib Removed Files: csv19.jar Log Message: Removed ostermiller utils from babeldoc --- csv19.jar DELETED --- |
|
From: <tr...@us...> - 2003-07-19 15:32:30
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/lib In directory sc8-pr-cvs1:/tmp/cvs-serv13778/modules/core/lib Added Files: csv19.jar Log Message: Removed ostermiller utils from babeldoc --- NEW FILE: csv19.jar --- (This appears to be a binary file; contents omitted.) |
|
From: <tr...@us...> - 2003-07-19 15:32:30
|
Update of /cvsroot/babeldoc/babeldoc/modules/babelfish/src/com/babeldoc/babelfish
In directory sc8-pr-cvs1:/tmp/cvs-serv13778/modules/babelfish/src/com/babeldoc/babelfish
Modified Files:
BabelfishTranslator.java
Log Message:
Removed ostermiller utils from babeldoc
Index: BabelfishTranslator.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/babelfish/src/com/babeldoc/babelfish/BabelfishTranslator.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** BabelfishTranslator.java 27 Jun 2003 00:47:26 -0000 1.7
--- BabelfishTranslator.java 19 Jul 2003 15:32:27 -0000 1.8
***************
*** 66,70 ****
package com.babeldoc.babelfish;
- import com.Ostermiller.util.StringTokenizer;
import com.babeldoc.core.BabeldocCommand;
--- 66,69 ----
***************
*** 82,85 ****
--- 81,85 ----
import java.util.Enumeration;
import java.util.Properties;
+ import java.util.StringTokenizer;
***************
*** 94,98 ****
* @version 1.0
*/
! public class BabelfishTranslator extends BabeldocCommand {
public static final String BABELFISH_URL = "http://babelfish.altavista.com/babelfish/tr";
public static final String jTranslateStart = "<Div style=padding:10px;";
--- 94,100 ----
* @version 1.0
*/
! public class BabelfishTranslator
! extends BabeldocCommand {
!
public static final String BABELFISH_URL = "http://babelfish.altavista.com/babelfish/tr";
public static final String jTranslateStart = "<Div style=padding:10px;";
***************
*** 222,226 ****
while (st.hasMoreTokens()) {
! String line = (String) st.next();
transValue += translateText(line, fromTo);
--- 224,228 ----
while (st.hasMoreTokens()) {
! String line = st.nextToken();
transValue += translateText(line, fromTo);
|
|
From: <tr...@us...> - 2003-07-19 13:26:32
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/excel In directory sc8-pr-cvs1:/tmp/cvs-serv24880/excel Log Message: Directory /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/excel added to the repository |
|
From: <tr...@us...> - 2003-07-19 13:16:50
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/pipeline/stage
In directory sc8-pr-cvs1:/tmp/cvs-serv25588/src/com/babeldoc/conversion/pipeline/stage
Modified Files:
FlatToXmlPipelineStage.java XlsToXmlPipelineStage.java
Log Message:
Lots of rearrangement of the conversion module - now using dom4j in the flatfile code - moved packages around.
Index: FlatToXmlPipelineStage.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/pipeline/stage/FlatToXmlPipelineStage.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** FlatToXmlPipelineStage.java 27 Jun 2003 01:44:07 -0000 1.5
--- FlatToXmlPipelineStage.java 19 Jul 2003 13:16:47 -0000 1.6
***************
*** 66,73 ****
package com.babeldoc.conversion.pipeline.stage;
! import com.babeldoc.conversion.ConversionClient;
! import com.babeldoc.conversion.ConversionUnmarshaller;
! import com.babeldoc.conversion.digester.DigesterConversionUnmarshaller;
!
import com.babeldoc.core.I18n;
import com.babeldoc.core.option.ConfigOption;
--- 66,72 ----
package com.babeldoc.conversion.pipeline.stage;
! import com.babeldoc.conversion.ConversionHelper;
! import com.babeldoc.conversion.flatfile.FlatFileConverter;
! import com.babeldoc.conversion.flatfile.digester.DigesterConversionUnmarshaller;
import com.babeldoc.core.I18n;
import com.babeldoc.core.option.ConfigOption;
***************
*** 76,82 ****
import java.io.InputStream;
- import java.io.PrintWriter;
- import java.io.StringWriter;
-
import java.util.ArrayList;
import java.util.Collection;
--- 75,78 ----
***************
*** 84,88 ****
/**
! * Pipelinestage to convert the document from a flatfile to an xml document.
* The Rules governing the conversion is supplied as argument. This is the
* merely defers most of the work to the conversion client client.
--- 80,84 ----
/**
! * Pipelinestage to toXml the document from a flatfile to an xml document.
* The Rules governing the conversion is supplied as argument. This is the
* merely defers most of the work to the conversion client client.
***************
*** 135,147 ****
InputStream config = com.babeldoc.core.ResourceLoader.getResourceStream(configFile);
InputStream input = getDocument().getInputStream();
- StringWriter writer = new StringWriter();
-
- ConversionUnmarshaller unmarshaller = new DigesterConversionUnmarshaller(config);
- ConversionClient.doConversion(unmarshaller, input, new PrintWriter(writer));
- writer.flush();
! PipelineDocument newDocument = new PipelineDocument(this.getDocument(),
! writer.toString().getBytes());
! newDocument.setBinary(true);
return processHelper(newDocument);
--- 131,138 ----
InputStream config = com.babeldoc.core.ResourceLoader.getResourceStream(configFile);
InputStream input = getDocument().getInputStream();
! PipelineDocument newDocument = ConversionHelper.render(new FlatFileConverter(
! new DigesterConversionUnmarshaller(config)).toXml(input), this.getDocument());
! newDocument.setBinary(false);
return processHelper(newDocument);
Index: XlsToXmlPipelineStage.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/pipeline/stage/XlsToXmlPipelineStage.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** XlsToXmlPipelineStage.java 18 Jul 2003 11:54:49 -0000 1.2
--- XlsToXmlPipelineStage.java 19 Jul 2003 13:16:47 -0000 1.3
***************
*** 66,86 ****
package com.babeldoc.conversion.pipeline.stage;
! import java.io.IOException;
! import java.util.ArrayList;
! import java.util.Collection;
! import org.apache.poi.hssf.usermodel.HSSFCell;
! import org.apache.poi.hssf.usermodel.HSSFRow;
! import org.apache.poi.hssf.usermodel.HSSFSheet;
! import org.apache.poi.hssf.usermodel.HSSFWorkbook;
! import org.apache.poi.poifs.filesystem.POIFSFileSystem;
! import org.dom4j.Document;
! import org.dom4j.DocumentHelper;
! import org.dom4j.Element;
! import com.babeldoc.core.pipeline.PipelineDocument;
! import com.babeldoc.core.pipeline.PipelineException;
! import com.babeldoc.core.pipeline.PipelineStage;
! import com.babeldoc.core.pipeline.PipelineStageInfo;
! import com.babeldoc.core.pipeline.PipelineStageResult;
/**
--- 66,75 ----
package com.babeldoc.conversion.pipeline.stage;
! import com.babeldoc.conversion.ConversionException;
! import com.babeldoc.conversion.ConversionHelper;
! import com.babeldoc.conversion.excel.ExcelConverter;
! import com.babeldoc.core.pipeline.*;
! import java.util.Collection;
/**
***************
*** 92,95 ****
--- 81,86 ----
public class XlsToXmlPipelineStage extends PipelineStage {
+ public static String DATE_FORMAT = "dd.mm.yyyy";
+
public XlsToXmlPipelineStage() {
super(new PipelineStageInfo() {
***************
*** 103,211 ****
public Collection getTypeSpecificOptions() {
! return new ArrayList();
}
});
-
}
! /* (non-Javadoc)
! * @see com.babeldoc.core.pipeline.PipelineStage#process()
*/
! public PipelineStageResult[] process() throws PipelineException {
- POIFSFileSystem fs;
try {
! fs = new POIFSFileSystem(this.getDocument().getInputStream());
! HSSFWorkbook wb = new HSSFWorkbook(fs);
!
! HSSFSheet sheet = null;
! HSSFRow row = null;
! HSSFCell cell = null;
!
! Document document = DocumentHelper.createDocument();
! //
! Element root = document.addElement("workbook");
!
! int numberOfSheets = wb.getNumberOfSheets();
! root.addAttribute(
! "number-of-sheets",
! String.valueOf(numberOfSheets));
!
! for (int i = 0; i < numberOfSheets; i++) {
! Element sheetElement = root.addElement("sheet");
! sheet = wb.getSheetAt(i);
! String sheetName = wb.getSheetName(i);
! sheetElement.addAttribute("name", sheetName);
! sheetElement.addAttribute(
! "sheet-number",
! (new Integer(i)).toString());
! int rowCount = 0;
! int firstRowNum = sheet.getFirstRowNum();
! int lastRowNum = sheet.getLastRowNum();
!
! for (int m = firstRowNum; m <= lastRowNum; m++) {
! row = sheet.getRow(m);
! if (row == null)
! continue;
! Element rowElement = sheetElement.addElement("row");
! rowElement.addAttribute(
! "rowNum",
! (new Integer(m)).toString());
! rowCount++;
! int firstCellNum = row.getFirstCellNum();
! int lastCellNum = row.getLastCellNum();
! int cellCount = 0;
! for (int p = firstCellNum; p <= lastCellNum; p++) {
! cell = row.getCell((short) p);
! // if (cell == null || cell.getCellType() == HSSFCell.CELL_TYPE_BLANK) continue;
! if (cell == null)
! continue;
! cellCount++;
! Element cellElement = rowElement.addElement("cell");
! cellElement.addAttribute("colNum", String.valueOf(p));
- int cellType = cell.getCellType();
- switch (cellType) {
- case HSSFCell.CELL_TYPE_NUMERIC :
- cellElement.addAttribute("type", "Numeric");
- cellElement.addText(
- String.valueOf(cell.getNumericCellValue()));
- break;
- case HSSFCell.CELL_TYPE_STRING :
- cellElement.addAttribute("type", "String");
- cellElement.addText(cell.getStringCellValue());
- break;
- case HSSFCell.CELL_TYPE_BOOLEAN :
- cellElement.addAttribute("type", "Boolean");
- cellElement.addText(
- String.valueOf(cell.getBooleanCellValue()));
- break;
- case HSSFCell.CELL_TYPE_BLANK :
- cellElement.addAttribute("type", "N/A");
- break;
- default :
- break;
- }
- }
- rowElement.addAttribute(
- "number-of-cells",
- String.valueOf(cellCount));
- }
- sheetElement.addAttribute(
- "number-of-rows",
- String.valueOf(rowCount));
- }
-
- PipelineDocument doc =
- new PipelineDocument(
- this.getDocument(),
- document.asXML().getBytes());
return processHelper(doc);
! } catch (IOException e) {
// TODO Auto-generated catch block
throw new PipelineException("Error converting XLS file to XML");
}
-
}
-
}
--- 94,119 ----
public Collection getTypeSpecificOptions() {
! return null;
}
});
}
! /**
! * Process. This converts the document from Microsoft Excel (tm) data format
! * to an xml format. This uses the ExcelConverter.
*/
! public PipelineStageResult[] process()
! throws PipelineException {
try {
! PipelineDocument doc = ConversionHelper.render(new ExcelConverter().toXml(this.getDocument().getInputStream()),
! this.getDocument());
! doc.setBinary(false);
return processHelper(doc);
! } catch (ConversionException e) {
// TODO Auto-generated catch block
throw new PipelineException("Error converting XLS file to XML");
}
}
}
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/flatfile In directory sc8-pr-cvs1:/tmp/cvs-serv25588/src/com/babeldoc/conversion/flatfile Added Files: ConversionUnmarshaller.java FieldData.java FlatFileConversionClient.java FlatFileConverter.java LineSegmentData.java Log Message: Lots of rearrangement of the conversion module - now using dom4j in the flatfile code - moved packages around. --- NEW FILE: ConversionUnmarshaller.java --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. * ==================================================================== * * Babeldoc: The Universal Document Processor * * $Header: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/flatfile/ConversionUnmarshaller.java,v 1.1 2003/07/19 13:16:47 triphop Exp $ * $DateTime$ * $Author: triphop $ * */ package com.babeldoc.conversion.flatfile; /** * Interface that conversion unmarshallers must implement. The definitive * implementation of this class is DigesterConversionUnmarshaller. No further * implementations are necessary and certainly not planned. The reason for * this class stems from when the old SAX based conversion unmarshaller was * replaced with the new digester and I needed to swap the two * interchangeably. * * @author bmcdonald * @version 1.0 */ public interface ConversionUnmarshaller { /** What kind of file is this? */ public static final int CSV_CONVERSION = 0; public static final int LINE_CONVERSION = 1; public static final int PARA_CONVERSION = 2; public static final int LINESEG_CONVERSION = 3; /** * Get the conversion type * * @return */ public int getConversionType(); /** * Get the field separator for csv fields. * * @return */ public String getFieldSeparator(); /** * Get the field data * * @return */ public FieldData[] getFields(); /** * get the interparagraph skip * * @return */ public int getInterParagraphSkip(); /** * get the characters to skip from the left * * @return */ public int getLeftMargin(); /** * Get the line segments. * * @return */ public LineSegmentData[] getLineSegments(); /** * get the line separator * * @return */ public String getLineSeparator(); /** * Get the lines per para * * @return */ public int getLinesPerPara(); /** * Get the root element * * @return */ public String getRootElement(); /** * get the row element * * @return */ public String getRowElement(); /** * Get the lines to skip * * @return */ public int getTopSkip(); } --- NEW FILE: FieldData.java --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. * ==================================================================== * * Babeldoc: The Universal Document Processor * * $Header: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/flatfile/FieldData.java,v 1.1 2003/07/19 13:16:47 triphop Exp $ * $DateTime$ * $Author: triphop $ * */ package com.babeldoc.conversion.flatfile; import org.apache.commons.lang.builder.ToStringBuilder; /** * Simple utility class to hold all the field data. This is one of the two * main data objects in the conversion process. * * @author Bmcdonald * @version 1.0 */ public class FieldData { public String name; public int column; public int number; public int row; public int width; /** * Useful for debugging. * * @return */ public String toString() { return new ToStringBuilder(this).append("name", name).append("row", row) .append("column", column) .append("width", width) .append("number", number).toString(); } } --- NEW FILE: FlatFileConversionClient.java --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. * ==================================================================== * * Babeldoc: The Universal Document Processor * * $Header: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/flatfile/FlatFileConversionClient.java,v 1.1 2003/07/19 13:16:47 triphop Exp $ * $DateTime$ * $Author: triphop $ * */ package com.babeldoc.conversion.flatfile; import com.babeldoc.conversion.ConversionException; import com.babeldoc.conversion.ConversionHelper; import com.babeldoc.conversion.flatfile.digester.DigesterConversionUnmarshaller; import com.babeldoc.core.BabeldocCommand; import com.babeldoc.core.I18n; import com.babeldoc.core.LogService; import com.babeldoc.core.ResourceLoader; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.Options; import org.dom4j.Document; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; /** * <p> * Do conversions based on conversion xml file. This is the entry point for * running xml based conversions. The conversions xml file is converted to a * set of value objects by the Unmarshaller. These classes carry the data * controlling the conversion process. * </p> * * <p> * The actual conversion xml is specied by a schema xml file, * readme/schema/conversion.xsd * </p> * * @author Bmcdonald * @version 1.0 */ public class FlatFileConversionClient extends BabeldocCommand { protected static final String NULL = ""; protected ConversionUnmarshaller unmarshaller; private Document document; /** * Construct this object and call the super with the argument for setting up * the conversion client. * * @param args */ public FlatFileConversionClient(String[] args) { super("conversion", I18n.get("conversion.009"), args); } /** * Main method. * * @param commandline DOCUMENT ME! */ public void execute(CommandLine commandline) { InputStream in = null; InputStream conf = null; if (commandline.hasOption('c')) { String convFile = commandline.getOptionValue('c'); try { conf = ResourceLoader.getResourceStream(convFile); } catch (IOException e) { LogService.getInstance().logError(I18n.get( "conversion.exception.io.convfile", convFile), e); return; } } if (commandline.hasOption('f')) { String inFile = commandline.getOptionValue('f'); try { in = ResourceLoader.getResourceStream(inFile); } catch (IOException e) { LogService.getInstance().logError(I18n.get( "conversion.exception.io.infile", inFile), e); return; } } if ((in != null) && (conf != null)) { PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out)); try { ConversionHelper.render(new FlatFileConverter(new DigesterConversionUnmarshaller(conf)).toXml(in), System.out); } catch (ConversionException e) { LogService.getInstance().logError(e); } writer.flush(); writer.close(); } else { System.err.println(I18n.get("conversion.008")); } } /** * Main * * @param args the arguments */ public static void main(String[] args) { new FlatFileConversionClient(args); } /** * setup the options on the command line. * * @param options the options to access */ public void setupCommandLine(Options options) { super.setupCommandLine(options); LogService.getInstance(); options.addOption(OptionBuilder.isRequired().hasArg(true) .withDescription(I18n.get("conversion.010")) .withLongOpt("file").create('f')); options.addOption(OptionBuilder.isRequired().hasArg(true) .withDescription(I18n.get("conversion.011")) .withLongOpt("config").create('c')); } } --- NEW FILE: FlatFileConverter.java --- package com.babeldoc.conversion.flatfile; import com.babeldoc.conversion.ConversionException; import com.babeldoc.core.I18n; import com.babeldoc.core.NameValuePair; import com.mindprod.csv.CSVReader; import org.dom4j.Document; import org.dom4j.DocumentFactory; import org.dom4j.Element; import java.io.*; /** */ public class FlatFileConverter { protected ConversionUnmarshaller unmarshaller; private Document document; /** * Construct - this requires an unmarshaller which governs the conversion * of the flat file. * * @param unmarshaller */ public FlatFileConverter(ConversionUnmarshaller unmarshaller) { this.unmarshaller = unmarshaller; } /** * handle csv conversions. Watch the errors and make sure that xml start and * end tags get handled correctly. * * @param is the data */ public Document toXml(InputStream is) { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); boolean carryOn = true; this.setUnmarshaller(unmarshaller); document = DocumentFactory.getInstance().createDocument(); Element root = getDocument().addElement(getUnmarshaller().getRootElement()); try { doSkipLines(reader, getUnmarshaller().getTopSkip()); while (carryOn) { String[] paragraph = getParagraph(reader); if (paragraph == null) { break; } // Handle line-segments if (getUnmarshaller().getConversionType() == ConversionUnmarshaller.LINESEG_CONVERSION) { handleSegmentedLine(root, paragraph); } else { handleNonSegmented(root, paragraph); } carryOn = doSkipLines(reader, getUnmarshaller().getInterParagraphSkip()); } } catch (Exception e) { errorComment(root, e); } return document; } /** * Set the unmarshaller * * @param unmarshaller the ConversionXmlUnmarshaller to use. */ public void setUnmarshaller(ConversionUnmarshaller unmarshaller) { this.unmarshaller = unmarshaller; } /** * Get the unmarshaller * * @return the unmarshaller */ public ConversionUnmarshaller getUnmarshaller() { return unmarshaller; } /** * Convert the data. Depending on the setting of the type in the * unmarshaller the different converters get called. * * @param element the element underwhich to add the new elements (!!!) * @param para is the array of strings * * @throws com.babeldoc.conversion.ConversionException DOCUMENT ME! */ public void convert(Element element, String[] para) throws ConversionException { if (getUnmarshaller().getConversionType() == ConversionUnmarshaller.CSV_CONVERSION) { convertCsv(element, para, getUnmarshaller().getFields()); } else if (getUnmarshaller().getConversionType() == ConversionUnmarshaller.LINE_CONVERSION) { convertLine(element, para, getUnmarshaller().getFields()); } else if (getUnmarshaller().getConversionType() == ConversionUnmarshaller.PARA_CONVERSION) { convertPara(element, para, getUnmarshaller().getFields()); } else { throw new ConversionException(I18n.get("conversion.007")); } } /** * Skip the number of lines at the top of the file. * * @param reader DOCUMENT ME! * @param numToSkip DOCUMENT ME! * * @return more lines found?? */ protected boolean doSkipLines(BufferedReader reader, int numToSkip) { for (int i = 0; i < numToSkip; ++i) { if (readLine(reader) == null) { return false; } } return true; } /** * Add an error comment right here. * * @param element * @param e */ protected void errorComment(Element element, Exception e) { element.addComment(e.toString()); } /** * read the line from the input stream. * * @param reader the input stream. * * @return return null if no more lines found, else return the line. */ protected static String readLine(BufferedReader reader) { try { return reader.readLine(); } catch (Exception e) { return null; } } /** * Scan the input for all the lines in a paragraph and return them * * @param reader the input stream * * @return the paragraph of lines OR NULL if lines ran out before end. */ protected String[] getParagraph(BufferedReader reader) { String[] lines = new String[getUnmarshaller().getLinesPerPara()]; for (int i = 0; i < lines.length; ++i) { String line = readLine(reader); if (line != null) { lines[i] = trimLine(line); } else { return null; } } return lines; } /** * Convert from csv format. Simple enough. Things to watch for: Differing * number of tokens in input and configuration and if the configuration file * duplicate field numbers are found. * * @param row the row element to add the elements to. * @param para the array of lines (only one line expected) * @param fields DOCUMENT ME! * * @throws com.babeldoc.conversion.ConversionException DOCUMENT ME! */ protected void convertCsv(Element row, String[] para, FieldData[] fields) throws ConversionException { if (para.length != 1) { throw new ConversionException(I18n.get("conversion.001")); } char separator = ','; if(this.getUnmarshaller().getFieldSeparator()!=null) { separator = this.getUnmarshaller().getFieldSeparator().charAt(0); } for(int l=0; l < para.length; ++l) { CSVReader csvreader = new CSVReader(new StringReader(para[l]), separator, '\"', false, true); if(this.getUnmarshaller().getFieldSeparator()!=null) { } String[] ltokens = new String[0]; try { ltokens = csvreader.getAllFieldsInLine(); } catch (IOException e) { e.printStackTrace(); //This should never happen } if (ltokens != null) { NameValuePair[] pairs = new NameValuePair[ltokens.length]; for (int i = 0; i < fields.length; ++i) { FieldData field = fields[i]; String name = field.name; int fieldNum = field.number - 1; // Make sure that we dont try and reference an ltoken in // the input stream from the field number that does not exist // And protect against data duplication. if (fieldNum > pairs.length) { throw new ConversionException(I18n.get("conversion.002", new Integer(getUnmarshaller().getFields().length), new Integer(ltokens.length))); } else if (pairs[fieldNum] != null) { throw new ConversionException(I18n.get("conversion.003", name)); } else { pairs[fieldNum] = new NameValuePair(name, ltokens[fieldNum]); } } addElements(row, pairs); } } } private static void addElements(Element row, NameValuePair[] pairs) { for(int j = 0; j < pairs.length; ++j) { Element element = row.addElement(pairs[j].getName()); element.addText(pairs[j].getValue()); } } /** * Convert from lines. * * @param row the row element to add the field elements to. * @param para the paragraph of input data * @param fields the fields to extract from the input data * * @throws com.babeldoc.conversion.ConversionException DOCUMENT ME! */ protected void convertLine(Element row, String[] para, FieldData[] fields) throws ConversionException { if (para.length != 1) { throw new ConversionException(I18n.get("conversion.004")); } String line = para[0]; NameValuePair[] pairs = new NameValuePair[fields.length]; for (int i = 0; i < fields.length; ++i) { FieldData field = fields[i]; String name = field.name; int start = field.column - 1; int width = field.width; int end = start + width; // Check overruns. String value = null; // Handle negative starts bug: 741190 ] if (start < 0) { start = 0; } // Ok get data - first check if we can get all the data if (end > line.length()) { // can we get any of it? if (line.length() < start) { value = ""; } // Well, we get what we can. else { value = line.substring(start); } } else { value = line.substring(start, end); } pairs[i] = new NameValuePair(name, value); } addElements(row, pairs); } /** * Convert from para. Things to watch are that the field does not exceed the * current line length or the number of rows. Other than that this is a * simple piece of code. * * @param rowElement the row element to which to add the field elements * @param para the paragraph of input * @param fields DOCUMENT ME! * * @throws com.babeldoc.conversion.ConversionException DOCUMENT ME! */ protected void convertPara(Element rowElement, String[] para, FieldData[] fields) throws ConversionException { NameValuePair[] pairs = new NameValuePair[fields.length]; for (int i = 0; i < fields.length; ++i) { FieldData field = fields[i]; String name = field.name; int row = field.row - 1; int start = field.column - 1; int width = field.width; int end = start + width; // Check overruns. if (row > para.length) { throw new ConversionException(I18n.get("conversion.005", name)); } else if (end > para[row].length()) { throw new ConversionException(I18n.get("conversion.006", name)); } String value = para[row].substring(start, end); pairs[i] = new NameValuePair(name, value); } addElements(rowElement, pairs); } /** * Trim the left margin from the line. * * @param input the line to trim * * @return the trimmed line */ protected String trimLine(String input) { int leftMargin = unmarshaller.getLeftMargin(); if (leftMargin == 0) { return input; } else if (leftMargin >= input.length()) { return null; } else { return input.substring(leftMargin); } } /** * Handle a line segment. * * @param startElement add a line segment * @param lineSegment */ private Element handleLineSegmentElement(Element startElement, LineSegmentData lineSegment) { if (lineSegment.startGroup != null) { startElement = startElement.addElement(lineSegment.startGroup); } return startElement.addElement(lineSegment.name); } /** * Handle non-segmented paragraph * * @param root the root element * @param paragraph the paragraph */ private void handleNonSegmented(Element root, String[] paragraph) { Element rowElement = root.addElement(getUnmarshaller().getRowElement()); try { convert(rowElement, paragraph); } catch (ConversionException ce) { errorComment(rowElement, ce); } } /** * Handle segmentline paragraph * * @param element element to start doing this segmented line * @param para the paragraph */ private void handleSegmentedLine(Element element, String[] para) { String line = para[0]; int numSegments = getUnmarshaller().getLineSegments().length; for (int i = 0; i < numSegments; ++i) { LineSegmentData lineSegment = getUnmarshaller().getLineSegments()[i]; int column = lineSegment.column - 1; int width = lineSegment.width; String value = lineSegment.value; if ((line.length() > (column + width)) && line.substring(column, width).equals(value)) { Element segmentElement = handleLineSegmentElement(element, lineSegment); try { handlineLineSegmentElementData(segmentElement, lineSegment, para); break; } catch (Exception e) { errorComment(segmentElement, e); } finally { } } } } /** * Handle the two kinds of line segments... * * @param lineSegment * @param para * * @throws com.babeldoc.conversion.ConversionException */ private void handlineLineSegmentElementData(Element element, LineSegmentData lineSegment, String[] para) throws ConversionException { FieldData[] fields = lineSegment.fields; if (lineSegment.conversionType == ConversionUnmarshaller.CSV_CONVERSION) { convertCsv(element, para, fields); } else if (lineSegment.conversionType == ConversionUnmarshaller.LINE_CONVERSION) { convertLine(element, para, fields); } else { throw new ConversionException(I18n.get("conversion.007")); } } public Document getDocument() { return document; } public void setDocument(Document document) { this.document = document; } } --- NEW FILE: LineSegmentData.java --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. * ==================================================================== * * Babeldoc: The Universal Document Processor * * $Header: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/flatfile/LineSegmentData.java,v 1.1 2003/07/19 13:16:47 triphop Exp $ * $DateTime$ * $Author: triphop $ * */ package com.babeldoc.conversion.flatfile; import org.apache.commons.lang.builder.ToStringBuilder; /** * Hold the configuration for each of the line segments. This one of the two * main data objects in the conversion process. * * @author Bmcdonald * @version 1.0 */ public class LineSegmentData { public String endGroup; public String name; public String startGroup; public String value; public FieldData[] fields; public int column; public int conversionType; public int width; /** * toXml to a string * * @return string */ public String toString() { return new ToStringBuilder(this).append("name", name) .append("column", column) .append("width", width) .append("conversionType", conversionType) .append("value", value) .append("startGroup", startGroup) .append("endGroup", endGroup) .append("fields", fields).toString(); } } |
|
From: <tr...@us...> - 2003-07-19 13:16:50
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/excel In directory sc8-pr-cvs1:/tmp/cvs-serv25588/src/com/babeldoc/conversion/excel Added Files: ExcelConversionClient.java ExcelConverter.java Log Message: Lots of rearrangement of the conversion module - now using dom4j in the flatfile code - moved packages around. --- NEW FILE: ExcelConversionClient.java --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. * ==================================================================== * * Babeldoc: The Universal Document Processor * * $Header: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/excel/ExcelConversionClient.java,v 1.1 2003/07/19 13:16:47 triphop Exp $ * $DateTime$ * $Author: triphop $ * */ package com.babeldoc.conversion.excel; import com.babeldoc.conversion.ConversionException; import com.babeldoc.conversion.ConversionHelper; import com.babeldoc.core.BabeldocCommand; import com.babeldoc.core.I18n; import com.babeldoc.core.LogService; import com.babeldoc.core.ResourceLoader; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.Options; import java.io.IOException; import java.io.InputStream; /** * Class to access the Apache POI library to toXml Excel files to XML. * * @author dejank */ public class ExcelConversionClient extends BabeldocCommand { /** * Construct this object and call the super with the argument for setting up * the conversion client. * * @param args */ public ExcelConversionClient(String[] args) { super("conversion", I18n.get("conversion.009"), args); } /** * Main method. * * @param commandline DOCUMENT ME! */ public void execute(CommandLine commandline) { InputStream in = null; if (commandline.hasOption('f')) { String inFile = commandline.getOptionValue('f'); try { in = ResourceLoader.getResourceStream(inFile); } catch (IOException e) { LogService.getInstance().logError(I18n.get( "conversion.exception.io.infile", inFile), e); return; } } if (in != null) { try { ConversionHelper.render(new ExcelConverter().toXml(in), System.out); } catch (ConversionException e) { LogService.getInstance().logError(e); } } else { System.err.println(I18n.get("conversion.008")); } } /** * setup the options on the command line. * * @param options the options to access */ public void setupCommandLine(Options options) { super.setupCommandLine(options); options.addOption(OptionBuilder.isRequired().hasArg(true) .withDescription(I18n.get("conversion.010")) .withLongOpt("file").create('f')); } /** * Main * * @param args the arguments */ public static void main(String[] args) { new ExcelConversionClient(args); } } --- NEW FILE: ExcelConverter.java --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. * ==================================================================== * * Babeldoc: The Universal Document Processor * * $Header: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/excel/ExcelConverter.java,v 1.1 2003/07/19 13:16:47 triphop Exp $ * $DateTime$ * $Author: triphop $ * */ package com.babeldoc.conversion.excel; import com.babeldoc.conversion.ConversionException; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; import java.io.IOException; import java.io.InputStream; /** * Simple class to toXml an input stream of an excel file to an * xml output stream * * @author dejank */ public class ExcelConverter { /** * Convert a input stream of excel file as input to an xml document. * * @param in excel file stream * @return the document * @throws com.babeldoc.conversion.ConversionException */ public Document toXml(InputStream in) throws ConversionException { POIFSFileSystem fs; try { fs = new POIFSFileSystem(in); HSSFWorkbook wb = new HSSFWorkbook(fs); HSSFSheet sheet = null; HSSFRow row = null; HSSFCell cell = null; Document document = DocumentHelper.createDocument(); // Element root = document.addElement("workbook"); int numberOfSheets = wb.getNumberOfSheets(); root.addAttribute("number-of-sheets", String.valueOf(numberOfSheets)); for (int i = 0; i < numberOfSheets; i++) { Element sheetElement = root.addElement("sheet"); sheet = wb.getSheetAt(i); String sheetName = wb.getSheetName(i); sheetElement.addAttribute("sheet-name", sheetName); sheetElement.addAttribute("sheet-number", (new Integer(i)).toString()); int rowCount = 0; int firstRowNum = sheet.getFirstRowNum(); int lastRowNum = sheet.getLastRowNum(); for (int m = firstRowNum; m <= lastRowNum; m++) { row = sheet.getRow(m); if (row == null) continue; Element rowElement = sheetElement.addElement("row"); rowElement.addAttribute("row-number", (new Integer(m)).toString()); rowCount++; int firstCellNum = row.getFirstCellNum(); int lastCellNum = row.getLastCellNum(); int cellCount = 0; for (int p = firstCellNum; p <= lastCellNum; p++) { cell = row.getCell((short) p); // if (cell == null || cell.getCellType() == HSSFCell.CELL_TYPE_BLANK) continue; if (cell == null) continue; cellCount++; Element cellElement = rowElement.addElement("cell"); cellElement.addAttribute("cell-number", String.valueOf(cellCount)); cellElement.addAttribute("cell-colnum", String.valueOf(cell.getCellNum())); int cellType = cell.getCellType(); switch (cellType) { case HSSFCell.CELL_TYPE_NUMERIC : cellElement.addAttribute("type", "Numeric"); cellElement.addText( String.valueOf(cell.getNumericCellValue())); break; case HSSFCell.CELL_TYPE_STRING : cellElement.addAttribute("type", "String"); cellElement.addText(cell.getStringCellValue()); break; case HSSFCell.CELL_TYPE_BOOLEAN : cellElement.addAttribute("type", "Boolean"); cellElement.addText( String.valueOf(cell.getBooleanCellValue())); break; case HSSFCell.CELL_TYPE_BLANK : cellElement.addAttribute("type", "N/A"); break; default : break; } } rowElement.addAttribute( "number-of-cells", String.valueOf(cellCount)); } sheetElement.addAttribute( "number-of-rows", String.valueOf(rowCount)); } return document; } catch(IOException iox) { throw new ConversionException("", iox); } } } |
|
From: <tr...@us...> - 2003-07-19 13:16:50
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion
In directory sc8-pr-cvs1:/tmp/cvs-serv25588/src/com/babeldoc/conversion
Modified Files:
ConversionException.java
Added Files:
ConversionHelper.java
Removed Files:
ConversionClient.java ConversionUnmarshaller.java
FieldData.java LineSegmentData.java
Log Message:
Lots of rearrangement of the conversion module - now using dom4j in the flatfile code - moved packages around.
--- NEW FILE: ConversionHelper.java ---
package com.babeldoc.conversion;
import com.babeldoc.core.pipeline.PipelineDocument;
import org.dom4j.Document;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.StringWriter;
/**
* Helper methods for the conversion utilities
*
* @author bmcdonald
*/
public class ConversionHelper {
/**
* Render the document to the output stream.
*
* @param document dom4j document
* @param out the output stream to render to
* @throws ConversionException
*/
public static void render(Document document, OutputStream out)
throws ConversionException {
try {
OutputFormat outformat = OutputFormat.createPrettyPrint();
// outformat.setEncoding(aEncodingScheme);
XMLWriter writer = new XMLWriter(out, outformat);
writer.write(document);
writer.flush();
} catch(IOException iox) {
throw new ConversionException("", iox);
}
}
/**
* Render a document into a pipeline document
*
* @param document the dom4j document
* @param pdoc the parent pipeline document
* @return new pipeline document
* @throws ConversionException
*/
public static PipelineDocument render(Document document, PipelineDocument pdoc)
throws ConversionException {
try {
OutputFormat outformat = OutputFormat.createCompactFormat();
StringWriter stringWriter = new StringWriter();
XMLWriter writer = new XMLWriter(stringWriter, outformat);
writer.write(document);
writer.flush();
return new PipelineDocument(pdoc, stringWriter.toString().getBytes());
} catch (IOException iox) {
throw new ConversionException("", iox);
}
}
}
Index: ConversionException.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/ConversionException.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ConversionException.java 27 Jun 2003 01:44:06 -0000 1.3
--- ConversionException.java 19 Jul 2003 13:16:47 -0000 1.4
***************
*** 66,69 ****
--- 66,71 ----
package com.babeldoc.conversion;
+ import com.babeldoc.core.GeneralException;
+
/**
* Conversion exception. Simplistic overload of GeneralException.
***************
*** 72,76 ****
* @version 1.0
*/
! public class ConversionException extends com.babeldoc.core.GeneralException {
/**
* Conversion exception
--- 74,79 ----
* @version 1.0
*/
! public class ConversionException
! extends GeneralException {
/**
* Conversion exception
--- ConversionClient.java DELETED ---
--- ConversionUnmarshaller.java DELETED ---
--- FieldData.java DELETED ---
--- LineSegmentData.java DELETED ---
|
|
From: <tr...@us...> - 2003-07-19 13:16:50
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/lib In directory sc8-pr-cvs1:/tmp/cvs-serv25588/lib Added Files: csv19.jar Log Message: Lots of rearrangement of the conversion module - now using dom4j in the flatfile code - moved packages around. --- NEW FILE: csv19.jar --- (This appears to be a binary file; contents omitted.) |
|
From: <tr...@us...> - 2003-07-19 13:16:50
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/config/service In directory sc8-pr-cvs1:/tmp/cvs-serv25588/config/service Modified Files: query.properties Log Message: Lots of rearrangement of the conversion module - now using dom4j in the flatfile code - moved packages around. Index: query.properties =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/config/service/query.properties,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** query.properties 17 Jul 2003 14:49:45 -0000 1.4 --- query.properties 19 Jul 2003 13:16:46 -0000 1.5 *************** *** 1,3 **** ! Command.flat2xml=com.babeldoc.conversion.ConversionClient PipelineStage.FlatToXml=com.babeldoc.conversion.pipeline.stage.FlatToXmlPipelineStage PipelineStage.XlsToXml=com.babeldoc.conversion.pipeline.stage.XlsToXmlPipelineStage --- 1,4 ---- ! Command.flat2xml=com.babeldoc.conversion.flatfile.FlatFileConversionClient ! Command.xls2xml=com.babeldoc.conversion.excel.ExcelConversionClient PipelineStage.FlatToXml=com.babeldoc.conversion.pipeline.stage.FlatToXmlPipelineStage PipelineStage.XlsToXml=com.babeldoc.conversion.pipeline.stage.XlsToXmlPipelineStage |