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: Michael A. <mic...@ze...> - 2004-03-12 00:30:42
|
Hi,=20 Does anybody have a sample of configuration data for a database configuration? =20 Cheers... MikeA |
|
From: Michael A. <mic...@ze...> - 2004-03-02 23:29:31
|
Well, in a nutshell, the Journal classes and Config classes have some issues. There are too many dependencies between them and other classes. They seem to be the primary area of concern. Way too many dependencies. The tool talks in terms of anti-patterns: global and local hubs, global and local butterflies, and a few others. The Journal and Config packages seem to be significant global hubs. =20 Then there are a whole list of classes, about 60 or 70, that are global breakable, i.e.: they are dependent on many other classes, implying that if any class in the system changes, the global breakables are at significant risk of causing cascading changes through the system. There are also a lot of dependency loops, where packages are dependent on each other, or in a cycle. Anyway, interesting analysis. Probably worth using as a tool over the next few versions, and trying to improve the really bad areas. Cheers... MikeA On Tue, 2004-03-02 at 02:01, Bruce McDonald wrote: > I saw that tool on serverside... What results did you get? >=20 > On Monday 01 March 2004 06:05 pm, Michael Ansley wrote: > > Has anybody put the babeldoc code through a code analysis tool? I just > > downloaded IBMs new Structural Analysis for Java tool > > (http://www.alphaworks.ibm.com/tech/sa4j) and run it over babeldoc. I > > was just interested to hear anybody elses results and opinions. > > > > Cheers... > > > > > > MikeA |
|
From: Bruce M. <br...@mc...> - 2004-03-02 02:06:25
|
I saw that tool on serverside... What results did you get? On Monday 01 March 2004 06:05 pm, Michael Ansley wrote: > Has anybody put the babeldoc code through a code analysis tool? I just > downloaded IBMs new Structural Analysis for Java tool > (http://www.alphaworks.ibm.com/tech/sa4j) and run it over babeldoc. I > was just interested to hear anybody elses results and opinions. > > Cheers... > > > MikeA |
|
From: Michael A. <mic...@ze...> - 2004-03-01 23:05:33
|
Has anybody put the babeldoc code through a code analysis tool? I just downloaded IBMs new Structural Analysis for Java tool (http://www.alphaworks.ibm.com/tech/sa4j) and run it over babeldoc. I was just interested to hear anybody elses results and opinions. Cheers... MikeA |
|
From: Dejan K. <dej...@nb...> - 2004-01-28 08:31:17
|
Mike, IMO, modules should be released separatly. And it should be rule for all new extensions that are not "core" stuff. I mean, if you have pipeline stage that depends on some jars that are not already bundled with Babeldoc and if that pipeline (scanner worker, journal implementation...) is not something that all users would need - then I think it is better to be separated from core Babeldoc. And, I also think that modules should be as fine grained as possible. I like to think of this modules as plugins. In future we could separate We haven't agreed on what should be packaged in module file. For now I think we could just put jar files (documentation could be generated from them), but we should think about it in future! Do you have any ideas? Right now, it is important that modules become visible to users so we can just put lib files into zip file. We don't have any howto for making releases. Bruce was the only one who made releases for Babeldoc - I haven't done it. Anyway, there are documents on SourceForge site which explains how this should be made. In short, you should upload files on SourceForge ftp server and add files to file group (Admin section). About documentation (I just received your last mail). It can be generated from your code so don't worry about it right now. You see, PipelineStageInfo classes are used for few different purposes. One of them is document generation (we were too lazy to write documentation by hand!). So when you put libs in babeldoc lib folder and generate babeldoc documentation as explained in readme (I can't remember now which pipeline it is) documentation should be generated for all stages and scanner workers. We should think about providing examples, too but that could be left for future too. It is not production ready anyway, isn't it?! Regards, Dejan ----- Original Message ----- From: "Michael Ansley" <mic...@ze...> To: "Dejan Krsmanovic" <dej...@nb...> Sent: Tuesday, January 27, 2004 10:59 PM Subject: Re: Rights for making releases Thanks, Dejan. I'll set the version at 0.9.0, and then it can go. How exactly do you plan to do this? Are all the modules going to go together (all two of them ;-) or release each module on its own? Presumably, having authorised me as a packager, you mean for me to package the jfreereports module. Is there a release HOWTO or something that I can read that explains how I prepare the release? Cheers... MikeA On Tue, 2004-01-27 at 13:40, Dejan Krsmanovic wrote: > Mike, > I have granted you "release tech" right. As I could understood that > should be enough for you to make releases. If you have problems with > making releases please contact me... > > Regards, > Dejan |
|
From: Michael A. <mic...@ze...> - 2004-01-28 08:10:10
|
Documentation?!?! ;-) Do you have some sample source documentation, so that I can copy the layout and format and stuff? Cheers... MikeA On Tue, 2004-01-27 at 09:05, Dejan Krsmanovic wrote: > Mike,=20 > I think we should release modules now. As long as they > are in beta, they should have version numbers < 1.0.=20 > It is important that users are able to download and > test them. I am not sure how many users are aware of > them now. >=20 > I'll will try to grant you necessery rights for making > releases so you can do it by yourself in future. By > now, modules could be in separate download group > called 'modules'. >=20 > What do you think, is it enough to put module's jar > files into one zip file? Documentation could be > generated using babeldoc after module zip file is > extracted into $BABELDOC_HOME/lib folder... >=20 > Dejan >=20 > --- Michael Ansley <mic...@ze...> wrote: > > Hi, > >=20 > > I think it's ready for a beta test, but not > > production yet. I've given > > it a few tests, but nothing major. It'll get some > > more serious testing > > over the next two months or so. > >=20 > > Unless anyone else wants to get testing and send me > > some feedback... > >=20 > > The main issue that probably needs to be discussed > > is the XMLTableModel > > that I've written. It uses XPath to fetch data from > > the input document > > (the data for the report), but I'd imagine that this > > is horrendously > > slow. If anybody has any alternate ideas for the > > TableModel, I'm > > listening. I'm sure that this type of thing has > > already been done by > > somebody, I just couldn't find anything. Perhaps > > creating a local copy > > of the data from the XML file privately within the > > TableModel will be > > better? > >=20 > > Cheers... > >=20 > >=20 > > MikeA > > On Sun, 2004-01-25 at 16:13, Dejan Krsmanovic wrote: > > > Not only it compiles, it is working, too ;) =20 > > >=20 > > > I am thinking of making a first release of this > > module > > > soon. What about jfreereport module? Do you think > > it > > > can be released, too? > > >=20 > > > Dejan > > >=20 > > >=20 > > > --- Michael Ansley <mic...@ze...> > > wrote: > > > > Hi, > > > >=20 > > > > Dejan, with your most recent changes to the > > jabber > > > > module, I got a clean > > > > compile in eclipse. First clean build for me > > ever > > > > of the jabber > > > > module. Just thought you might like to know ;-) > > > >=20 > > > > Cheers... > > > >=20 > > > >=20 > > > > MikeA > > > >=20 > > > >=20 > > > >=20 > > >=20 > > > > ATTACHMENT part 2 application/pgp-signature > > > name=3Dsignature.asc > > >=20 > > >=20 > > >=20 > > > __________________________________ > > > Do you Yahoo!? > > > Yahoo! SiteBuilder - Free web site building tool. > > Try it! > > > http://webhosting.yahoo.com/ps/sb/ > > >=20 > > >=20 > > > > > > ------------------------------------------------------- > > > The SF.Net email is sponsored by EclipseCon 2004 > > > Premiere Conference on Open Tools Development and > > Integration > > > See the breadth of Eclipse activity. February 3-5 > > in Anaheim, CA. > > > http://www.eclipsecon.org/osdn > > > _______________________________________________ > > > Babeldoc-devel mailing list > > > Bab...@li... > > > > > > https://lists.sourceforge.net/lists/listinfo/babeldoc-devel > >=20 >=20 > > ATTACHMENT part 2 application/pgp-signature > name=3Dsignature.asc >=20 >=20 >=20 > __________________________________ > Do you Yahoo!? > Yahoo! SiteBuilder - Free web site building tool. Try it! > http://webhosting.yahoo.com/ps/sb/ >=20 >=20 > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Babeldoc-devel mailing list > Bab...@li... > https://lists.sourceforge.net/lists/listinfo/babeldoc-devel |
|
From: Dejan K. <dej...@ya...> - 2004-01-27 09:05:36
|
Mike, I think we should release modules now. As long as they are in beta, they should have version numbers < 1.0. It is important that users are able to download and test them. I am not sure how many users are aware of them now. I'll will try to grant you necessery rights for making releases so you can do it by yourself in future. By now, modules could be in separate download group called 'modules'. What do you think, is it enough to put module's jar files into one zip file? Documentation could be generated using babeldoc after module zip file is extracted into $BABELDOC_HOME/lib folder... Dejan --- Michael Ansley <mic...@ze...> wrote: > Hi, > > I think it's ready for a beta test, but not > production yet. I've given > it a few tests, but nothing major. It'll get some > more serious testing > over the next two months or so. > > Unless anyone else wants to get testing and send me > some feedback... > > The main issue that probably needs to be discussed > is the XMLTableModel > that I've written. It uses XPath to fetch data from > the input document > (the data for the report), but I'd imagine that this > is horrendously > slow. If anybody has any alternate ideas for the > TableModel, I'm > listening. I'm sure that this type of thing has > already been done by > somebody, I just couldn't find anything. Perhaps > creating a local copy > of the data from the XML file privately within the > TableModel will be > better? > > Cheers... > > > MikeA > On Sun, 2004-01-25 at 16:13, Dejan Krsmanovic wrote: > > Not only it compiles, it is working, too ;) > > > > I am thinking of making a first release of this > module > > soon. What about jfreereport module? Do you think > it > > can be released, too? > > > > Dejan > > > > > > --- Michael Ansley <mic...@ze...> > wrote: > > > Hi, > > > > > > Dejan, with your most recent changes to the > jabber > > > module, I got a clean > > > compile in eclipse. First clean build for me > ever > > > of the jabber > > > module. Just thought you might like to know ;-) > > > > > > Cheers... > > > > > > > > > MikeA > > > > > > > > > > > > > > ATTACHMENT part 2 application/pgp-signature > > name=signature.asc > > > > > > > > __________________________________ > > Do you Yahoo!? > > Yahoo! SiteBuilder - Free web site building tool. > Try it! > > http://webhosting.yahoo.com/ps/sb/ > > > > > > > ------------------------------------------------------- > > The SF.Net email is sponsored by EclipseCon 2004 > > Premiere Conference on Open Tools Development and > Integration > > See the breadth of Eclipse activity. February 3-5 > in Anaheim, CA. > > http://www.eclipsecon.org/osdn > > _______________________________________________ > > Babeldoc-devel mailing list > > Bab...@li... > > > https://lists.sourceforge.net/lists/listinfo/babeldoc-devel > > ATTACHMENT part 2 application/pgp-signature name=signature.asc __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ |
|
From: Michael A. <mic...@ze...> - 2004-01-27 08:36:55
|
PS: As a follow-up to the last question, how should the TableModel integrate with the SqlQuery schema? How to not bind the TableModel directly to the SqlQuery schema? Should the element names identifying the rows and columns be exposed on the public interface, or should the user of the TableModel simply set the XPath queries (that assumes, of course, that XPath will continue to be used). Also, what if the SqlQuery result has no "class" attribute? Is it feasible to guess, or should everything just be a String? Cheers... MikeA On Sun, 2004-01-25 at 16:13, Dejan Krsmanovic wrote: > Not only it compiles, it is working, too ;) =20 >=20 > I am thinking of making a first release of this module > soon. What about jfreereport module? Do you think it > can be released, too? >=20 > Dejan >=20 >=20 > --- Michael Ansley <mic...@ze...> wrote: > > Hi, > >=20 > > Dejan, with your most recent changes to the jabber > > module, I got a clean > > compile in eclipse. First clean build for me ever > > of the jabber > > module. Just thought you might like to know ;-) > >=20 > > Cheers... > >=20 > >=20 > > MikeA > >=20 > >=20 > >=20 >=20 > > ATTACHMENT part 2 application/pgp-signature > name=3Dsignature.asc >=20 >=20 >=20 > __________________________________ > Do you Yahoo!? > Yahoo! SiteBuilder - Free web site building tool. Try it! > http://webhosting.yahoo.com/ps/sb/ >=20 >=20 > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Babeldoc-devel mailing list > Bab...@li... > https://lists.sourceforge.net/lists/listinfo/babeldoc-devel |
|
From: Michael A. <mic...@ze...> - 2004-01-27 08:21:10
|
Hi, I think it's ready for a beta test, but not production yet. I've given it a few tests, but nothing major. It'll get some more serious testing over the next two months or so. Unless anyone else wants to get testing and send me some feedback... The main issue that probably needs to be discussed is the XMLTableModel that I've written. It uses XPath to fetch data from the input document (the data for the report), but I'd imagine that this is horrendously slow. If anybody has any alternate ideas for the TableModel, I'm listening. I'm sure that this type of thing has already been done by somebody, I just couldn't find anything. Perhaps creating a local copy of the data from the XML file privately within the TableModel will be better? Cheers... MikeA On Sun, 2004-01-25 at 16:13, Dejan Krsmanovic wrote: > Not only it compiles, it is working, too ;) =20 >=20 > I am thinking of making a first release of this module > soon. What about jfreereport module? Do you think it > can be released, too? >=20 > Dejan >=20 >=20 > --- Michael Ansley <mic...@ze...> wrote: > > Hi, > >=20 > > Dejan, with your most recent changes to the jabber > > module, I got a clean > > compile in eclipse. First clean build for me ever > > of the jabber > > module. Just thought you might like to know ;-) > >=20 > > Cheers... > >=20 > >=20 > > MikeA > >=20 > >=20 > >=20 >=20 > > ATTACHMENT part 2 application/pgp-signature > name=3Dsignature.asc >=20 >=20 >=20 > __________________________________ > Do you Yahoo!? > Yahoo! SiteBuilder - Free web site building tool. Try it! > http://webhosting.yahoo.com/ps/sb/ >=20 >=20 > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Babeldoc-devel mailing list > Bab...@li... > https://lists.sourceforge.net/lists/listinfo/babeldoc-devel |
|
From: Dejan K. <dej...@ya...> - 2004-01-25 16:13:14
|
Not only it compiles, it is working, too ;) I am thinking of making a first release of this module soon. What about jfreereport module? Do you think it can be released, too? Dejan --- Michael Ansley <mic...@ze...> wrote: > Hi, > > Dejan, with your most recent changes to the jabber > module, I got a clean > compile in eclipse. First clean build for me ever > of the jabber > module. Just thought you might like to know ;-) > > Cheers... > > > MikeA > > > > ATTACHMENT part 2 application/pgp-signature name=signature.asc __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ |
|
From: Michael A. <mic...@ze...> - 2004-01-24 22:31:09
|
Hi, Dejan, with your most recent changes to the jabber module, I got a clean compile in eclipse. First clean build for me ever of the jabber module. Just thought you might like to know ;-) Cheers... MikeA |
|
From: Dejan K. <dej...@nb...> - 2004-01-15 10:41:19
|
Hi all, I have finally found some time to deal with my jabber module so it is working now (Thanks Mike for fixing build.xml). Currently there is only a pipeline stage - but I will maybe write scanner, too. However, it brings some questions that we already have talked about, but I can't remember if we agreed on something. Problem is how this modules should be released. IMO, we should try to develop and release new modules independently of core Babeldoc. We still don't know what core Babeldoc means, but I am sure that modules such jabber and jfreerepors should stay out of main Babeldoc distribution. I also think that in future some existing modules such as FO should be out of Babeldoc too, since it is not used by many users and it requires few quite large libraries which makes distribution large. One solution is that all stays in current SourceForge project. We could make new download section called Modules or something like that. Another solution is to make completely new SF project which should just contain modules - something like Jedit-plugins project. The only reason for creating new project is that we could more easily grant necessary rights for accessing CVS and for making releases to all interested developers. Third option would be that all stay as is - so that modules are available only on CVS. I am not in favour of that option since modules should be visible to as much as possible users. What do you think? For now, we could start releasing modules on current Babeldoc project. By now, there are two modules - JfreeReport (mike) and Jabber (me), so we can start by granting Mike release rights. If there will be more user modules in future we could start new SF project with new CVS repository. Another question is module format (structure). Currently, installing new modules should only require copying jars in BABELDOC_HOME/lib which is OK in my opinion. However, how should we document modules? Babeldoc could generate documentation for these modules as it does with its own modules but this process is not quite user friendly. We could also put generated documentation on Babeldoc site but note that particular stage belongs to module that should be downloaded separately.. Thoughts?! Regards, Dejan |
|
From: <de...@us...> - 2004-01-14 12:25:02
|
Update of /cvsroot/babeldoc/modules/jabber/src/com/babeldoc/jabber/pipeline/stage In directory sc8-pr-cvs1:/tmp/cvs-serv15917/modules/jabber/src/com/babeldoc/jabber/pipeline/stage Modified Files: XmppWriterPipelineStage.java Log Message: Fixing many bugs in XmppWriter stage. This stage should actaully work now! Index: XmppWriterPipelineStage.java =================================================================== RCS file: /cvsroot/babeldoc/modules/jabber/src/com/babeldoc/jabber/pipeline/stage/XmppWriterPipelineStage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XmppWriterPipelineStage.java 9 Oct 2003 14:03:58 -0000 1.1 --- XmppWriterPipelineStage.java 14 Jan 2004 12:24:59 -0000 1.2 *************** *** 1,7 **** ! /* ! * Created on 2003.10.3 * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments */ package com.babeldoc.jabber.pipeline.stage; --- 1,66 ---- ! /* ==================================================================== ! * 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.jabber.pipeline.stage; *************** *** 10,13 **** --- 69,78 ---- import java.util.Collection; + import org.apache.commons.lang.StringUtils; + import org.jivesoftware.smack.Chat; + import org.jivesoftware.smack.GroupChat; + import org.jivesoftware.smack.SSLXMPPConnection; + import org.jivesoftware.smack.XMPPConnection; + import com.babeldoc.core.option.ConfigOption; import com.babeldoc.core.option.IConfigOptionType; *************** *** 17,29 **** import com.babeldoc.core.pipeline.stage.GenericWriterPipelineStage; - import org.apache.commons.lang.StringUtils; - import org.jivesoftware.smack.*; - import org.jivesoftware.smack.packet.Message;; /** ! * @author dejan * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments */ public class XmppWriterPipelineStage extends GenericWriterPipelineStage { --- 82,91 ---- import com.babeldoc.core.pipeline.stage.GenericWriterPipelineStage; /** ! * This class is using for sending messaging using XMPP protocol (jabber). ! * ! * @author dejank * */ public class XmppWriterPipelineStage extends GenericWriterPipelineStage { *************** *** 80,91 **** public PipelineStageResult[] process() throws PipelineException { ! String host = this.getOptions(HOST); ! int port = 5222; ! String username = null; ! String password = null; ! String[] recipients = StringUtils.split(this.getOptions(RECIPIENTS), ","); ! String chatroom = null; ! String nickname = null; ! boolean useSSL = false; XMPPConnection conn = null; GroupChat groupChat = null; --- 142,153 ---- public PipelineStageResult[] process() throws PipelineException { ! String host = this.getInfo().getStrValue(HOST); ! int port = this.getInfo().getIntValue(PORT); ! String username = this.getInfo().getStrValue(USERNAME); ! String password = this.getInfo().getStrValue(PASSWORD); ! String[] recipients = StringUtils.split(this.getInfo().getStrValue(RECIPIENTS), ","); ! String chatroom = this.getInfo().getStrValue(CHATROOM); ! String nickname = this.getInfo().getStrValue(NICKNAME); ! boolean useSSL = this.getInfo().getBooleanValue(SSL); XMPPConnection conn = null; GroupChat groupChat = null; *************** *** 97,103 **** conn = new XMPPConnection(host, port); } conn.login(username, password); ! for (int i = 0; i < recipients.length; i++) { ! Chat chat = conn.createChat(recipients[i]); chat.sendMessage(message); } --- 159,166 ---- conn = new XMPPConnection(host, port); } + conn.login(username, password); ! for (int i = 0; i < recipients.length; i++) { ! Chat chat = conn.createChat(recipients[i]); chat.sendMessage(message); } *************** *** 107,116 **** } conn.close(); ! } catch (XMPPException xme) { ! xme.printStackTrace(); } ! ! return null; } --- 170,179 ---- } conn.close(); ! } catch (Exception xme) { ! throw new PipelineException("Error sending message", xme); ! //xme.printStackTrace(); } ! return this.processHelper(); } |
|
From: <de...@us...> - 2004-01-14 10:22:41
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline
In directory sc8-pr-cvs1:/tmp/cvs-serv28995/modules/core/src/com/babeldoc/core/pipeline
Modified Files:
PipelineDocument.java
Log Message:
Added methods for getting pipeline attributes as ints and booleans. This should enable easer manipulation with attributes in Velocity. We could also add methods for other types later.
No exceptions are handled so NumberFormatException can be thrown in case of illegal attribute values.
Index: PipelineDocument.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/PipelineDocument.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** PipelineDocument.java 29 Dec 2003 08:55:07 -0000 1.18
--- PipelineDocument.java 14 Jan 2004 10:22:38 -0000 1.19
***************
*** 438,440 ****
--- 438,459 ----
return new PipelineDocument(this, getBytes());
}
+
+ /**
+ * Get attribute as int
+ * @param attributeName
+ */
+
+ public int getInt(String attributeName) {
+ return Integer.parseInt((String) this.get(attributeName));
+ }
+
+ /**
+ * Get attribute as boolean
+ * @param attributeName
+ */
+
+ public boolean getBoolean(String attributeName) {
+ return Boolean.valueOf((String) this.get(attributeName)).booleanValue();
+ }
+
}
|
|
From: <de...@us...> - 2004-01-14 10:15:21
|
Update of /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner
In directory sc8-pr-cvs1:/tmp/cvs-serv27810/modules/scanner/src/com/babeldoc/scanner
Modified Files:
Tag: V1-2
ScannerWorker.java
Log Message:
Fixing bug - argument noJurnal in FeedDocument call was incorrect since it should be opposite of scanner journal property
Index: ScannerWorker.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/ScannerWorker.java,v
retrieving revision 1.30.4.1
retrieving revision 1.30.4.2
diff -C2 -d -r1.30.4.1 -r1.30.4.2
*** ScannerWorker.java 13 Jan 2004 11:44:32 -0000 1.30.4.1
--- ScannerWorker.java 14 Jan 2004 10:15:18 -0000 1.30.4.2
***************
*** 427,434 ****
if (!attr.containsKey(SCAN_DATE_KEY)) {
attr.put(SCAN_DATE_KEY, new Long(System.currentTimeMillis()));
! }
!
FeedDocument feed = new FeedDocument(this.getPipelineName(), data, attr,
! isBinary(), getInfo().getBooleanValue(ScannerWorkerInfo.JOURNAL));
try {
--- 427,433 ----
if (!attr.containsKey(SCAN_DATE_KEY)) {
attr.put(SCAN_DATE_KEY, new Long(System.currentTimeMillis()));
! }
FeedDocument feed = new FeedDocument(this.getPipelineName(), data, attr,
! isBinary(), !getInfo().getBooleanValue(ScannerWorkerInfo.JOURNAL));
try {
|
|
From: <de...@us...> - 2004-01-14 10:12:32
|
Update of /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner
In directory sc8-pr-cvs1:/tmp/cvs-serv27387/modules/scanner/src/com/babeldoc/scanner
Modified Files:
ScannerWorker.java
Log Message:
Fixing bug - argument noJurnal in FeedDocument call was incorrect since it should be opposite of scanner journal property
Index: ScannerWorker.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/ScannerWorker.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** ScannerWorker.java 13 Jan 2004 11:47:22 -0000 1.31
--- ScannerWorker.java 14 Jan 2004 10:12:29 -0000 1.32
***************
*** 427,434 ****
if (!attr.containsKey(SCAN_DATE_KEY)) {
attr.put(SCAN_DATE_KEY, new Long(System.currentTimeMillis()));
! }
!
FeedDocument feed = new FeedDocument(this.getPipelineName(), data, attr,
! isBinary(), getInfo().getBooleanValue(ScannerWorkerInfo.JOURNAL));
try {
--- 427,433 ----
if (!attr.containsKey(SCAN_DATE_KEY)) {
attr.put(SCAN_DATE_KEY, new Long(System.currentTimeMillis()));
! }
FeedDocument feed = new FeedDocument(this.getPipelineName(), data, attr,
! isBinary(), !getInfo().getBooleanValue(ScannerWorkerInfo.JOURNAL));
try {
|
|
From: <de...@us...> - 2004-01-13 11:50:26
|
Update of /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker
In directory sc8-pr-cvs1:/tmp/cvs-serv19296/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker
Modified Files:
DirectoryScanner.java
Log Message:
doneDirectory made optional. In case it is not specified warning message will be displayed on start and every processed documents will be deleted.
Index: DirectoryScanner.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker/DirectoryScanner.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** DirectoryScanner.java 10 Oct 2003 08:09:35 -0000 1.25
--- DirectoryScanner.java 13 Jan 2004 11:50:23 -0000 1.26
***************
*** 157,160 ****
--- 157,161 ----
setDoneDirectory(this.getInfo().getStrValue(DONE_DIR));
+ if (getDoneDirectory() != null && !"".equals(getDoneDirectory())) {
//if the done directory does not end with '/' then add one.
if (!getDoneDirectory().endsWith(File.pathSeparator)) {
***************
*** 171,174 ****
--- 172,179 ----
null);
}
+ } else {
+ getLog().logInfo("Done directory not specified. All processed file will be deleted!!!");
+ setDoneDirectory(null);
+ }
try {
***************
*** 206,210 ****
protected void moveFile(File file) throws Exception {
try {
! String path = file.getAbsolutePath();
int index = path.lastIndexOf(File.separatorChar) + 1;
--- 211,220 ----
protected void moveFile(File file) throws Exception {
try {
! if (getDoneDirectory() == null) {
! file.delete();
! return;
! }
!
! String path = file.getAbsolutePath();
int index = path.lastIndexOf(File.separatorChar) + 1;
***************
*** 431,435 ****
IConfigOptionType.DIRECTORY,
null,
! true,
I18n.get("scanner.DirectoryScannerInfo.option.doneDirectory")));
--- 441,445 ----
IConfigOptionType.DIRECTORY,
null,
! false,
I18n.get("scanner.DirectoryScannerInfo.option.doneDirectory")));
|
|
From: <de...@us...> - 2004-01-13 11:47:26
|
Update of /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner In directory sc8-pr-cvs1:/tmp/cvs-serv18888/babeldoc/modules/scanner/src/com/babeldoc/scanner Modified Files: ScannerWorker.java Log Message: Fixed bug in FeedDocument constructor call Index: ScannerWorker.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/ScannerWorker.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ScannerWorker.java 13 Oct 2003 07:24:39 -0000 1.30 --- ScannerWorker.java 13 Jan 2004 11:47:22 -0000 1.31 *************** *** 1,66 **** ! /* ==================================================================== ! * 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.scanner; --- 1,54 ---- ! /* ! * ==================================================================== 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/scanner/src/com/babeldoc/scanner/ScannerWorker.java,v ! * 1.30 2003/10/13 07:24:39 dejank Exp $ $DateTime$ $Author$ ! * */ package com.babeldoc.scanner; *************** *** 82,90 **** import com.babeldoc.core.pipeline.feeder.IFeeder; - /** * This class represents parent of all scanner workers. Scanner workers should * implement doScan() method. ! * * @author dejank */ --- 70,77 ---- import com.babeldoc.core.pipeline.feeder.IFeeder; /** * This class represents parent of all scanner workers. Scanner workers should * implement doScan() method. ! * * @author dejank */ *************** *** 92,100 **** private ScannerWorkerInfo info; ! /** Use this feeder to submit documents to the pipeline */ private IFeeder feeder; /** Log service to use */ ! private LogService log = LogService.getInstance(ScannerWorker.class.getName()); /** Store the worker status in this object */ --- 79,88 ---- private ScannerWorkerInfo info; ! /** Use this feeder to submit documents to the pipeline */ private IFeeder feeder; /** Log service to use */ ! private LogService log = LogService ! .getInstance(ScannerWorker.class.getName()); /** Store the worker status in this object */ *************** *** 123,131 **** public static final String SCANNER_KEY = "scanner"; public static final String SCAN_DATE_KEY = "scan_date"; public static final String SCAN_PATH_KEY = "scan_path"; public static final String SCAN_MIMETYPE_KEY = "mimeType"; - public static final String FILE_NAME_KEY = "file_name"; /** --- 111,122 ---- public static final String SCANNER_KEY = "scanner"; + public static final String SCAN_DATE_KEY = "scan_date"; + public static final String SCAN_PATH_KEY = "scan_path"; + public static final String SCAN_MIMETYPE_KEY = "mimeType"; + public static final String FILE_NAME_KEY = "file_name"; /** *************** *** 141,161 **** /** * Return true if this is worker is a cron schedule type ! * * @return cron schedule type = tue */ public boolean isCronScheduleType() { ! return "true".equalsIgnoreCase(getInfo().getStrValue(ScannerWorkerInfo.SCANNER_CRON_SCHEDULE)); } /** ! * Get the cron schedule from this worker. This will lazily create the schedule. If the schedule is ! * not provided in the configuration parameters, then return null. Also if the schedule is invalid, ! * log exception. ! * * @return cron schedule */ public ScannerSchedule getCronSchedule() { ! String cronSched = getInfo().getStrValue(ScannerWorkerInfo.SCANNER_CRON_SCHEDULE); ! if(cronSchedule==null&&cronSched!=null) { try { cronSchedule = new ScannerSchedule(cronSched); --- 132,154 ---- /** * Return true if this is worker is a cron schedule type ! * * @return cron schedule type = tue */ public boolean isCronScheduleType() { ! return "true".equalsIgnoreCase(getInfo().getStrValue( ! ScannerWorkerInfo.SCANNER_CRON_SCHEDULE)); } /** ! * Get the cron schedule from this worker. This will lazily create the ! * schedule. If the schedule is not provided in the configuration parameters, ! * then return null. Also if the schedule is invalid, log exception. ! * * @return cron schedule */ public ScannerSchedule getCronSchedule() { ! String cronSched = getInfo().getStrValue( ! ScannerWorkerInfo.SCANNER_CRON_SCHEDULE); ! if (cronSchedule == null && cronSched != null) { try { cronSchedule = new ScannerSchedule(cronSched); *************** *** 169,183 **** /** * Get the information object ! * * @return information object */ public IConfigInfo getInfo() { ! return info; } /** * Set the feeder object ! * ! * @param feeder to set this worker */ public void setFeeder(IFeeder feeder) { --- 162,177 ---- /** * Get the information object ! * * @return information object */ public IConfigInfo getInfo() { ! return info; } /** * Set the feeder object ! * ! * @param feeder ! * to set this worker */ public void setFeeder(IFeeder feeder) { *************** *** 187,191 **** /** * Get the worker status ! * * @return worker status object */ --- 181,185 ---- /** * Get the worker status ! * * @return worker status object */ *************** *** 196,200 **** /** * Get the time since last status change ! * * @return number of milliseconds since last status change */ --- 190,194 ---- /** * Get the time since last status change ! * * @return number of milliseconds since last status change */ *************** *** 205,209 **** /** * Get time in miliseconds until starting this worker ! * * @return time in miliseconds until start time */ --- 199,203 ---- /** * Get time in miliseconds until starting this worker ! * * @return time in miliseconds until start time */ *************** *** 214,218 **** /** * Get the scanner worker value object ! * * @return scanner worker value object */ --- 208,212 ---- /** * Get the scanner worker value object ! * * @return scanner worker value object */ *************** *** 221,304 **** } - /** ! * Add named filter to use when deciding what documents ! * to accept for processing. This method gets called by ! * implementing subclasses to add filters specific to ! * each scanner implementation. * ! * The filter is fetched from the scanner configuration ! * and must be a valid Java regular expression according ! * to the documentation for java.util.regex.Pattern * ! * An empty or non-existing pattern is interpreted and ! * stored as ".*", i.e the match-all wildcard pattern. * ! * @param filterName Name of configured filter to add, ! * replaces any existing pattern having the same name */ protected void addFilter(String filterName) { ! String patternExp = (String) this.getInfo().getOption(filterName).getValue(); ! if ((patternExp==null) || patternExp.equals("")) { ! patternExp = ".*"; //match all ! } ! Pattern pattern = Pattern.compile(patternExp); ! if (LogService.getInstance().isDebugEnabled()) { ! LogService.getInstance().logDebug( ! I18n.get( ! "scanner.ScannerWorker.debug.addingFilter", ! patternExp, ! filterName)); ! } ! patterns.put(filterName, pattern); } /** * Allow sub-classes access to the filters ! * ! * @param filterName Name of the filter to get ! * */ protected String getFilter(String filterName) { ! return ((String) patterns.get(filterName)); } /** ! * Does this worker accept this entry when matched against ! * the named pattern? If the pattern name does not exist, ! * the entry is not accepted, else the entry is accepted ! * if the entry matches the regular expression defined by * the named pattern. ! * ! * @param patternName Name of pattern to use when matching ! * @param text Text to match against the pattern ! * * @return true if accepted - false otherwise */ protected boolean acceptEntry(String patternName, String text) { ! Pattern pattern = (Pattern) patterns.get(patternName); ! if (pattern == null) { ! LogService.getInstance().logDebug( ! I18n.get("scanner.ScannerWorker.warn.noFilter", patternName)); ! return false; ! } ! Matcher matcher = pattern.matcher(text); ! boolean result = matcher.matches(); ! if (LogService.getInstance().isDebugEnabled()) { ! LogService.getInstance().logDebug( ! I18n.get( ! "scanner.ScannerWorker.debug.match", ! Boolean.toString(result), ! text)); ! } ! return result; } - /** ! * Configure this Scanner worker. This applies the configuration informatio * from the configuration file to the info object. ! * ! * @param configData Configuration object */ public void configure(IConfigData configData) { --- 215,296 ---- } /** ! * Add named filter to use when deciding what documents to accept for ! * processing. This method gets called by implementing subclasses to add ! * filters specific to each scanner implementation. * ! * The filter is fetched from the scanner configuration and must be a valid ! * Java regular expression according to the documentation for ! * java.util.regex.Pattern * ! * An empty or non-existing pattern is interpreted and stored as ".*", i.e ! * the match-all wildcard pattern. * ! * @param filterName ! * Name of configured filter to add, replaces any existing pattern ! * having the same name */ protected void addFilter(String filterName) { ! String patternExp = (String) this.getInfo().getOption(filterName) ! .getValue(); ! if ((patternExp == null) || patternExp.equals("")) { ! patternExp = ".*"; //match all ! } ! Pattern pattern = Pattern.compile(patternExp); ! if (LogService.getInstance().isDebugEnabled()) { ! LogService.getInstance().logDebug( ! I18n.get("scanner.ScannerWorker.debug.addingFilter", patternExp, ! filterName)); ! } ! patterns.put(filterName, pattern); } /** * Allow sub-classes access to the filters ! * ! * @param filterName ! * Name of the filter to get ! * */ protected String getFilter(String filterName) { ! return ((String) patterns.get(filterName)); } /** ! * Does this worker accept this entry when matched against the named pattern? ! * If the pattern name does not exist, the entry is not accepted, else the ! * entry is accepted if the entry matches the regular expression defined by * the named pattern. ! * ! * @param patternName ! * Name of pattern to use when matching ! * @param text ! * Text to match against the pattern ! * * @return true if accepted - false otherwise */ protected boolean acceptEntry(String patternName, String text) { ! Pattern pattern = (Pattern) patterns.get(patternName); ! if (pattern == null) { ! LogService.getInstance().logDebug( ! I18n.get("scanner.ScannerWorker.warn.noFilter", patternName)); ! return false; ! } ! Matcher matcher = pattern.matcher(text); ! boolean result = matcher.matches(); ! if (LogService.getInstance().isDebugEnabled()) { ! LogService.getInstance().logDebug( ! I18n.get("scanner.ScannerWorker.debug.match", Boolean ! .toString(result), text)); ! } ! return result; } /** ! * Configure this Scanner worker. This applies the configuration informatio * from the configuration file to the info object. ! * ! * @param configData ! * Configuration object */ public void configure(IConfigData configData) { *************** *** 308,313 **** this.getValueObject().setConfig(configData); this.setStatus(ScannerWorkerStatus.STOPPED); ! getLog().logInfo(getName() + " (" + ! configData.getValue(ScannerWorkerInfo.SCANNER_TYPE) + ") configured..."); this.countdown = getInfo().getIntValue(ScannerWorkerInfo.COUNTDOWN); this.binary = getInfo().getBooleanValue(ScannerWorkerInfo.BINARY); --- 300,306 ---- this.getValueObject().setConfig(configData); this.setStatus(ScannerWorkerStatus.STOPPED); ! getLog().logInfo( ! getName() + " (" + configData.getValue(ScannerWorkerInfo.SCANNER_TYPE) ! + ") configured..."); this.countdown = getInfo().getIntValue(ScannerWorkerInfo.COUNTDOWN); this.binary = getInfo().getBooleanValue(ScannerWorkerInfo.BINARY); *************** *** 318,334 **** * method will be queued. Note that children can also queue documents by * themeselves. In that case null should be returned. ! * ! * @throws ScannerException if anything goes wrong */ public abstract void doScan() throws ScannerException; /** ! * Initialize the worker. This could throw configuration exception if ! * any of the configuration options are incorrent. ! * ! * @throws ScannerConfigurationException check for invalid configuration */ ! public void initializeWorker() ! throws ScannerConfigurationException { //this.log = LogService.getInstance("scanner." + getName()); //Initialize concrete worker --- 311,328 ---- * method will be queued. Note that children can also queue documents by * themeselves. In that case null should be returned. ! * ! * @throws ScannerException ! * if anything goes wrong */ public abstract void doScan() throws ScannerException; /** ! * Initialize the worker. This could throw configuration exception if any of ! * the configuration options are incorrent. ! * ! * @throws ScannerConfigurationException ! * check for invalid configuration */ ! public void initializeWorker() throws ScannerConfigurationException { //this.log = LogService.getInstance("scanner." + getName()); //Initialize concrete worker *************** *** 356,362 **** /** ! * Actually do the configuration. This method gets called based on the schedule ! * and then calls the doScan on the worker. This then queues up the documents to the ! * feeder */ public void process() { --- 350,356 ---- /** ! * Actually do the configuration. This method gets called based on the ! * schedule and then calls the doScan on the worker. This then queues up the ! * documents to the feeder */ public void process() { *************** *** 400,404 **** /** ! * This method is called when worker is being initialized. It should be do * all needed initalization stuff. */ --- 394,398 ---- /** ! * This method is called when worker is being initialized. It should be do * all needed initalization stuff. */ *************** *** 407,411 **** /** * Get the pipeline name that this scanner is feeding. ! * * @return */ --- 401,405 ---- /** * Get the pipeline name that this scanner is feeding. ! * * @return */ *************** *** 416,427 **** /** * Make a scan ! * ! * @param data DOCUMENT ME! ! * @param attr DOCUMENT ME! ! * * @return DOCUMENT ME! */ ! protected boolean enqueue(byte[] data, Map attr) { ! if(attr==null) { attr = new HashMap(); } --- 410,423 ---- /** * Make a scan ! * ! * @param data ! * DOCUMENT ME! ! * @param attr ! * DOCUMENT ME! ! * * @return DOCUMENT ME! */ ! protected boolean enqueue(byte[] data, Map attr) { ! if (attr == null) { attr = new HashMap(); } *************** *** 429,445 **** // Provide date key if not provided ! if(!attr.containsKey(SCAN_DATE_KEY)) { attr.put(SCAN_DATE_KEY, new Long(System.currentTimeMillis())); } ! FeedDocument feed = new FeedDocument(this.getPipelineName(), ! data, ! attr, ! getInfo().getBooleanValue(ScannerWorkerInfo.JOURNAL), ! isBinary()); try { ! log.logInfo("Document " + attr.get(FILE_NAME_KEY) + ! " enqueued for pipeline " + this.getPipelineName()); getFeeder().process(feed); } catch (GeneralException e) { --- 425,438 ---- // Provide date key if not provided ! if (!attr.containsKey(SCAN_DATE_KEY)) { attr.put(SCAN_DATE_KEY, new Long(System.currentTimeMillis())); } ! FeedDocument feed = new FeedDocument(this.getPipelineName(), data, attr, ! isBinary(), getInfo().getBooleanValue(ScannerWorkerInfo.JOURNAL)); try { ! log.logInfo("Document " + attr.get(FILE_NAME_KEY) ! + " enqueued for pipeline " + this.getPipelineName()); getFeeder().process(feed); } catch (GeneralException e) { *************** *** 452,456 **** /** * Add a feed document with path specified only ! * * @param data * @param path --- 445,449 ---- /** * Add a feed document with path specified only ! * * @param data * @param path *************** *** 465,472 **** } - /** * Simplified enqueue method ! * * @param data * @param path --- 458,464 ---- } /** * Simplified enqueue method ! * * @param data * @param path *************** *** 485,491 **** /** * Another quick and easy way to enqueue some data ! * ! * @param data array of bytes ! * @param pairs name value pair array * @return success flag */ --- 477,485 ---- /** * Another quick and easy way to enqueue some data ! * ! * @param data ! * array of bytes ! * @param pairs ! * name value pair array * @return success flag */ *************** *** 496,501 **** /** * Set the status on this object ! * ! * @param newStatus DOCUMENT ME! */ private synchronized void setStatus(ScannerWorkerStatus newStatus) { --- 490,496 ---- /** * Set the status on this object ! * ! * @param newStatus ! * DOCUMENT ME! */ private synchronized void setStatus(ScannerWorkerStatus newStatus) { *************** *** 506,510 **** /** * Get the currently defined feeder object ! * * @return */ --- 501,505 ---- /** * Get the currently defined feeder object ! * * @return */ *************** *** 515,519 **** /** * Get the log for this class ! * * @return log */ --- 510,514 ---- /** * Get the log for this class ! * * @return log */ *************** *** 524,529 **** /** * Set the log for this object ! * ! * @param log new log */ protected void setLog(LogService log) { --- 519,525 ---- /** * Set the log for this object ! * ! * @param log ! * new log */ protected void setLog(LogService log) { *************** *** 533,537 **** /** * Set the scanner value object ! * * @param valueObject */ --- 529,533 ---- /** * Set the scanner value object ! * * @param valueObject */ *************** *** 542,546 **** /** * Get the last status change time ! * * @return time in millis */ --- 538,542 ---- /** * Get the last status change time ! * * @return time in millis */ *************** *** 551,555 **** /** * Set the last status change time. ! * * @param lastStatusChangeTime */ --- 547,551 ---- /** * Set the last status change time. ! * * @param lastStatusChangeTime */ *************** *** 560,564 **** /** * Get the time started ! * * @return */ --- 556,560 ---- /** * Get the time started ! * * @return */ *************** *** 569,573 **** /** * Set the time this scanner was started. ! * * @param timeStarted */ --- 565,569 ---- /** * Set the time this scanner was started. ! * * @param timeStarted */ *************** *** 577,587 **** /** ! * This scanner worker is considered counted down if the counter is NOT -1 or if ! * post decrement == 0. ! * * @return */ public boolean isCountedDown() { ! if(countdown==-1) { return false; } else { --- 573,583 ---- /** ! * This scanner worker is considered counted down if the counter is NOT -1 or ! * if post decrement == 0. ! * * @return */ public boolean isCountedDown() { ! if (countdown == -1) { return false; } else { *************** *** 589,593 **** } ! // return !(countdown == -1) || countdown-- == 0; } --- 585,589 ---- } ! // return !(countdown == -1) || countdown-- == 0; } |
|
From: <de...@us...> - 2004-01-13 11:44:35
|
Update of /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner
In directory sc8-pr-cvs1:/tmp/cvs-serv18510/modules/scanner/src/com/babeldoc/scanner
Modified Files:
Tag: V1-2
ScannerWorker.java
Log Message:
Fixing bug - arguments in FeedDocument constructor were incorrectly orderer
Index: ScannerWorker.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/ScannerWorker.java,v
retrieving revision 1.30
retrieving revision 1.30.4.1
diff -C2 -d -r1.30 -r1.30.4.1
*** ScannerWorker.java 13 Oct 2003 07:24:39 -0000 1.30
--- ScannerWorker.java 13 Jan 2004 11:44:32 -0000 1.30.4.1
***************
*** 1,66 ****
! /* ====================================================================
! * 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.scanner;
--- 1,54 ----
! /*
! * ==================================================================== 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/scanner/src/com/babeldoc/scanner/ScannerWorker.java,v
! * 1.30 2003/10/13 07:24:39 dejank Exp $ $DateTime$ $Author$
! *
*/
package com.babeldoc.scanner;
***************
*** 82,90 ****
import com.babeldoc.core.pipeline.feeder.IFeeder;
-
/**
* This class represents parent of all scanner workers. Scanner workers should
* implement doScan() method.
! *
* @author dejank
*/
--- 70,77 ----
import com.babeldoc.core.pipeline.feeder.IFeeder;
/**
* This class represents parent of all scanner workers. Scanner workers should
* implement doScan() method.
! *
* @author dejank
*/
***************
*** 92,100 ****
private ScannerWorkerInfo info;
! /** Use this feeder to submit documents to the pipeline */
private IFeeder feeder;
/** Log service to use */
! private LogService log = LogService.getInstance(ScannerWorker.class.getName());
/** Store the worker status in this object */
--- 79,88 ----
private ScannerWorkerInfo info;
! /** Use this feeder to submit documents to the pipeline */
private IFeeder feeder;
/** Log service to use */
! private LogService log = LogService
! .getInstance(ScannerWorker.class.getName());
/** Store the worker status in this object */
***************
*** 123,131 ****
public static final String SCANNER_KEY = "scanner";
public static final String SCAN_DATE_KEY = "scan_date";
public static final String SCAN_PATH_KEY = "scan_path";
public static final String SCAN_MIMETYPE_KEY = "mimeType";
- public static final String FILE_NAME_KEY = "file_name";
/**
--- 111,122 ----
public static final String SCANNER_KEY = "scanner";
+
public static final String SCAN_DATE_KEY = "scan_date";
+
public static final String SCAN_PATH_KEY = "scan_path";
+
public static final String SCAN_MIMETYPE_KEY = "mimeType";
+ public static final String FILE_NAME_KEY = "file_name";
/**
***************
*** 141,161 ****
/**
* Return true if this is worker is a cron schedule type
! *
* @return cron schedule type = tue
*/
public boolean isCronScheduleType() {
! return "true".equalsIgnoreCase(getInfo().getStrValue(ScannerWorkerInfo.SCANNER_CRON_SCHEDULE));
}
/**
! * Get the cron schedule from this worker. This will lazily create the schedule. If the schedule is
! * not provided in the configuration parameters, then return null. Also if the schedule is invalid,
! * log exception.
! *
* @return cron schedule
*/
public ScannerSchedule getCronSchedule() {
! String cronSched = getInfo().getStrValue(ScannerWorkerInfo.SCANNER_CRON_SCHEDULE);
! if(cronSchedule==null&&cronSched!=null) {
try {
cronSchedule = new ScannerSchedule(cronSched);
--- 132,154 ----
/**
* Return true if this is worker is a cron schedule type
! *
* @return cron schedule type = tue
*/
public boolean isCronScheduleType() {
! return "true".equalsIgnoreCase(getInfo().getStrValue(
! ScannerWorkerInfo.SCANNER_CRON_SCHEDULE));
}
/**
! * Get the cron schedule from this worker. This will lazily create the
! * schedule. If the schedule is not provided in the configuration parameters,
! * then return null. Also if the schedule is invalid, log exception.
! *
* @return cron schedule
*/
public ScannerSchedule getCronSchedule() {
! String cronSched = getInfo().getStrValue(
! ScannerWorkerInfo.SCANNER_CRON_SCHEDULE);
! if (cronSchedule == null && cronSched != null) {
try {
cronSchedule = new ScannerSchedule(cronSched);
***************
*** 169,183 ****
/**
* Get the information object
! *
* @return information object
*/
public IConfigInfo getInfo() {
! return info;
}
/**
* Set the feeder object
! *
! * @param feeder to set this worker
*/
public void setFeeder(IFeeder feeder) {
--- 162,177 ----
/**
* Get the information object
! *
* @return information object
*/
public IConfigInfo getInfo() {
! return info;
}
/**
* Set the feeder object
! *
! * @param feeder
! * to set this worker
*/
public void setFeeder(IFeeder feeder) {
***************
*** 187,191 ****
/**
* Get the worker status
! *
* @return worker status object
*/
--- 181,185 ----
/**
* Get the worker status
! *
* @return worker status object
*/
***************
*** 196,200 ****
/**
* Get the time since last status change
! *
* @return number of milliseconds since last status change
*/
--- 190,194 ----
/**
* Get the time since last status change
! *
* @return number of milliseconds since last status change
*/
***************
*** 205,209 ****
/**
* Get time in miliseconds until starting this worker
! *
* @return time in miliseconds until start time
*/
--- 199,203 ----
/**
* Get time in miliseconds until starting this worker
! *
* @return time in miliseconds until start time
*/
***************
*** 214,218 ****
/**
* Get the scanner worker value object
! *
* @return scanner worker value object
*/
--- 208,212 ----
/**
* Get the scanner worker value object
! *
* @return scanner worker value object
*/
***************
*** 221,304 ****
}
-
/**
! * Add named filter to use when deciding what documents
! * to accept for processing. This method gets called by
! * implementing subclasses to add filters specific to
! * each scanner implementation.
*
! * The filter is fetched from the scanner configuration
! * and must be a valid Java regular expression according
! * to the documentation for java.util.regex.Pattern
*
! * An empty or non-existing pattern is interpreted and
! * stored as ".*", i.e the match-all wildcard pattern.
*
! * @param filterName Name of configured filter to add,
! * replaces any existing pattern having the same name
*/
protected void addFilter(String filterName) {
! String patternExp = (String) this.getInfo().getOption(filterName).getValue();
! if ((patternExp==null) || patternExp.equals("")) {
! patternExp = ".*"; //match all
! }
! Pattern pattern = Pattern.compile(patternExp);
! if (LogService.getInstance().isDebugEnabled()) {
! LogService.getInstance().logDebug(
! I18n.get(
! "scanner.ScannerWorker.debug.addingFilter",
! patternExp,
! filterName));
! }
! patterns.put(filterName, pattern);
}
/**
* Allow sub-classes access to the filters
! *
! * @param filterName Name of the filter to get
! *
*/
protected String getFilter(String filterName) {
! return ((String) patterns.get(filterName));
}
/**
! * Does this worker accept this entry when matched against
! * the named pattern? If the pattern name does not exist,
! * the entry is not accepted, else the entry is accepted
! * if the entry matches the regular expression defined by
* the named pattern.
! *
! * @param patternName Name of pattern to use when matching
! * @param text Text to match against the pattern
! *
* @return true if accepted - false otherwise
*/
protected boolean acceptEntry(String patternName, String text) {
! Pattern pattern = (Pattern) patterns.get(patternName);
! if (pattern == null) {
! LogService.getInstance().logDebug(
! I18n.get("scanner.ScannerWorker.warn.noFilter", patternName));
! return false;
! }
! Matcher matcher = pattern.matcher(text);
! boolean result = matcher.matches();
! if (LogService.getInstance().isDebugEnabled()) {
! LogService.getInstance().logDebug(
! I18n.get(
! "scanner.ScannerWorker.debug.match",
! Boolean.toString(result),
! text));
! }
! return result;
}
-
/**
! * Configure this Scanner worker. This applies the configuration informatio
* from the configuration file to the info object.
! *
! * @param configData Configuration object
*/
public void configure(IConfigData configData) {
--- 215,296 ----
}
/**
! * Add named filter to use when deciding what documents to accept for
! * processing. This method gets called by implementing subclasses to add
! * filters specific to each scanner implementation.
*
! * The filter is fetched from the scanner configuration and must be a valid
! * Java regular expression according to the documentation for
! * java.util.regex.Pattern
*
! * An empty or non-existing pattern is interpreted and stored as ".*", i.e
! * the match-all wildcard pattern.
*
! * @param filterName
! * Name of configured filter to add, replaces any existing pattern
! * having the same name
*/
protected void addFilter(String filterName) {
! String patternExp = (String) this.getInfo().getOption(filterName)
! .getValue();
! if ((patternExp == null) || patternExp.equals("")) {
! patternExp = ".*"; //match all
! }
! Pattern pattern = Pattern.compile(patternExp);
! if (LogService.getInstance().isDebugEnabled()) {
! LogService.getInstance().logDebug(
! I18n.get("scanner.ScannerWorker.debug.addingFilter", patternExp,
! filterName));
! }
! patterns.put(filterName, pattern);
}
/**
* Allow sub-classes access to the filters
! *
! * @param filterName
! * Name of the filter to get
! *
*/
protected String getFilter(String filterName) {
! return ((String) patterns.get(filterName));
}
/**
! * Does this worker accept this entry when matched against the named pattern?
! * If the pattern name does not exist, the entry is not accepted, else the
! * entry is accepted if the entry matches the regular expression defined by
* the named pattern.
! *
! * @param patternName
! * Name of pattern to use when matching
! * @param text
! * Text to match against the pattern
! *
* @return true if accepted - false otherwise
*/
protected boolean acceptEntry(String patternName, String text) {
! Pattern pattern = (Pattern) patterns.get(patternName);
! if (pattern == null) {
! LogService.getInstance().logDebug(
! I18n.get("scanner.ScannerWorker.warn.noFilter", patternName));
! return false;
! }
! Matcher matcher = pattern.matcher(text);
! boolean result = matcher.matches();
! if (LogService.getInstance().isDebugEnabled()) {
! LogService.getInstance().logDebug(
! I18n.get("scanner.ScannerWorker.debug.match", Boolean
! .toString(result), text));
! }
! return result;
}
/**
! * Configure this Scanner worker. This applies the configuration informatio
* from the configuration file to the info object.
! *
! * @param configData
! * Configuration object
*/
public void configure(IConfigData configData) {
***************
*** 308,313 ****
this.getValueObject().setConfig(configData);
this.setStatus(ScannerWorkerStatus.STOPPED);
! getLog().logInfo(getName() + " (" +
! configData.getValue(ScannerWorkerInfo.SCANNER_TYPE) + ") configured...");
this.countdown = getInfo().getIntValue(ScannerWorkerInfo.COUNTDOWN);
this.binary = getInfo().getBooleanValue(ScannerWorkerInfo.BINARY);
--- 300,306 ----
this.getValueObject().setConfig(configData);
this.setStatus(ScannerWorkerStatus.STOPPED);
! getLog().logInfo(
! getName() + " (" + configData.getValue(ScannerWorkerInfo.SCANNER_TYPE)
! + ") configured...");
this.countdown = getInfo().getIntValue(ScannerWorkerInfo.COUNTDOWN);
this.binary = getInfo().getBooleanValue(ScannerWorkerInfo.BINARY);
***************
*** 318,334 ****
* method will be queued. Note that children can also queue documents by
* themeselves. In that case null should be returned.
! *
! * @throws ScannerException if anything goes wrong
*/
public abstract void doScan() throws ScannerException;
/**
! * Initialize the worker. This could throw configuration exception if
! * any of the configuration options are incorrent.
! *
! * @throws ScannerConfigurationException check for invalid configuration
*/
! public void initializeWorker()
! throws ScannerConfigurationException {
//this.log = LogService.getInstance("scanner." + getName());
//Initialize concrete worker
--- 311,328 ----
* method will be queued. Note that children can also queue documents by
* themeselves. In that case null should be returned.
! *
! * @throws ScannerException
! * if anything goes wrong
*/
public abstract void doScan() throws ScannerException;
/**
! * Initialize the worker. This could throw configuration exception if any of
! * the configuration options are incorrent.
! *
! * @throws ScannerConfigurationException
! * check for invalid configuration
*/
! public void initializeWorker() throws ScannerConfigurationException {
//this.log = LogService.getInstance("scanner." + getName());
//Initialize concrete worker
***************
*** 356,362 ****
/**
! * Actually do the configuration. This method gets called based on the schedule
! * and then calls the doScan on the worker. This then queues up the documents to the
! * feeder
*/
public void process() {
--- 350,356 ----
/**
! * Actually do the configuration. This method gets called based on the
! * schedule and then calls the doScan on the worker. This then queues up the
! * documents to the feeder
*/
public void process() {
***************
*** 400,404 ****
/**
! * This method is called when worker is being initialized. It should be do
* all needed initalization stuff.
*/
--- 394,398 ----
/**
! * This method is called when worker is being initialized. It should be do
* all needed initalization stuff.
*/
***************
*** 407,411 ****
/**
* Get the pipeline name that this scanner is feeding.
! *
* @return
*/
--- 401,405 ----
/**
* Get the pipeline name that this scanner is feeding.
! *
* @return
*/
***************
*** 416,427 ****
/**
* Make a scan
! *
! * @param data DOCUMENT ME!
! * @param attr DOCUMENT ME!
! *
* @return DOCUMENT ME!
*/
! protected boolean enqueue(byte[] data, Map attr) {
! if(attr==null) {
attr = new HashMap();
}
--- 410,423 ----
/**
* Make a scan
! *
! * @param data
! * DOCUMENT ME!
! * @param attr
! * DOCUMENT ME!
! *
* @return DOCUMENT ME!
*/
! protected boolean enqueue(byte[] data, Map attr) {
! if (attr == null) {
attr = new HashMap();
}
***************
*** 429,445 ****
// Provide date key if not provided
! if(!attr.containsKey(SCAN_DATE_KEY)) {
attr.put(SCAN_DATE_KEY, new Long(System.currentTimeMillis()));
}
! FeedDocument feed = new FeedDocument(this.getPipelineName(),
! data,
! attr,
! getInfo().getBooleanValue(ScannerWorkerInfo.JOURNAL),
! isBinary());
try {
! log.logInfo("Document " + attr.get(FILE_NAME_KEY) +
! " enqueued for pipeline " + this.getPipelineName());
getFeeder().process(feed);
} catch (GeneralException e) {
--- 425,438 ----
// Provide date key if not provided
! if (!attr.containsKey(SCAN_DATE_KEY)) {
attr.put(SCAN_DATE_KEY, new Long(System.currentTimeMillis()));
}
! FeedDocument feed = new FeedDocument(this.getPipelineName(), data, attr,
! isBinary(), getInfo().getBooleanValue(ScannerWorkerInfo.JOURNAL));
try {
! log.logInfo("Document " + attr.get(FILE_NAME_KEY)
! + " enqueued for pipeline " + this.getPipelineName());
getFeeder().process(feed);
} catch (GeneralException e) {
***************
*** 452,456 ****
/**
* Add a feed document with path specified only
! *
* @param data
* @param path
--- 445,449 ----
/**
* Add a feed document with path specified only
! *
* @param data
* @param path
***************
*** 465,472 ****
}
-
/**
* Simplified enqueue method
! *
* @param data
* @param path
--- 458,464 ----
}
/**
* Simplified enqueue method
! *
* @param data
* @param path
***************
*** 485,491 ****
/**
* Another quick and easy way to enqueue some data
! *
! * @param data array of bytes
! * @param pairs name value pair array
* @return success flag
*/
--- 477,485 ----
/**
* Another quick and easy way to enqueue some data
! *
! * @param data
! * array of bytes
! * @param pairs
! * name value pair array
* @return success flag
*/
***************
*** 496,501 ****
/**
* Set the status on this object
! *
! * @param newStatus DOCUMENT ME!
*/
private synchronized void setStatus(ScannerWorkerStatus newStatus) {
--- 490,496 ----
/**
* Set the status on this object
! *
! * @param newStatus
! * DOCUMENT ME!
*/
private synchronized void setStatus(ScannerWorkerStatus newStatus) {
***************
*** 506,510 ****
/**
* Get the currently defined feeder object
! *
* @return
*/
--- 501,505 ----
/**
* Get the currently defined feeder object
! *
* @return
*/
***************
*** 515,519 ****
/**
* Get the log for this class
! *
* @return log
*/
--- 510,514 ----
/**
* Get the log for this class
! *
* @return log
*/
***************
*** 524,529 ****
/**
* Set the log for this object
! *
! * @param log new log
*/
protected void setLog(LogService log) {
--- 519,525 ----
/**
* Set the log for this object
! *
! * @param log
! * new log
*/
protected void setLog(LogService log) {
***************
*** 533,537 ****
/**
* Set the scanner value object
! *
* @param valueObject
*/
--- 529,533 ----
/**
* Set the scanner value object
! *
* @param valueObject
*/
***************
*** 542,546 ****
/**
* Get the last status change time
! *
* @return time in millis
*/
--- 538,542 ----
/**
* Get the last status change time
! *
* @return time in millis
*/
***************
*** 551,555 ****
/**
* Set the last status change time.
! *
* @param lastStatusChangeTime
*/
--- 547,551 ----
/**
* Set the last status change time.
! *
* @param lastStatusChangeTime
*/
***************
*** 560,564 ****
/**
* Get the time started
! *
* @return
*/
--- 556,560 ----
/**
* Get the time started
! *
* @return
*/
***************
*** 569,573 ****
/**
* Set the time this scanner was started.
! *
* @param timeStarted
*/
--- 565,569 ----
/**
* Set the time this scanner was started.
! *
* @param timeStarted
*/
***************
*** 577,587 ****
/**
! * This scanner worker is considered counted down if the counter is NOT -1 or if
! * post decrement == 0.
! *
* @return
*/
public boolean isCountedDown() {
! if(countdown==-1) {
return false;
} else {
--- 573,583 ----
/**
! * This scanner worker is considered counted down if the counter is NOT -1 or
! * if post decrement == 0.
! *
* @return
*/
public boolean isCountedDown() {
! if (countdown == -1) {
return false;
} else {
***************
*** 589,593 ****
}
! // return !(countdown == -1) || countdown-- == 0;
}
--- 585,589 ----
}
! // return !(countdown == -1) || countdown-- == 0;
}
|
|
From: <de...@us...> - 2004-01-08 11:37:16
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/pipeline/stage
In directory sc8-pr-cvs1:/tmp/cvs-serv7807/modules/conversion/src/com/babeldoc/conversion/pipeline/stage
Modified Files:
Tag: V1-2
XlsToXmlPipelineStage.java
Log Message:
- locale config parameter is not ignored now in pipeline stage
- added formatData config option which could be used for specifying if dates and numbers should be formatted. Default is true.
- added noformat command line option to ExcelConversionClient which can be used for setting formatData option to false.
Index: XlsToXmlPipelineStage.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/pipeline/stage/XlsToXmlPipelineStage.java,v
retrieving revision 1.5.4.1
retrieving revision 1.5.4.2
diff -C2 -d -r1.5.4.1 -r1.5.4.2
*** XlsToXmlPipelineStage.java 6 Jan 2004 14:09:59 -0000 1.5.4.1
--- XlsToXmlPipelineStage.java 8 Jan 2004 11:37:13 -0000 1.5.4.2
***************
*** 88,97 ****
*/
public class XlsToXmlPipelineStage extends PipelineStage {
!
! public static String DATE_FORMAT = "dd.MM.yyyy";
! public static final String ENCODING = "encoding";
! protected static final String ATTRIBUTES = "attributes";
! protected static final String LOCALE = "locale";
!
/**
* Construct this stage - create the information object
--- 88,97 ----
*/
public class XlsToXmlPipelineStage extends PipelineStage {
!
! public static String DATE_FORMAT = "dd.MM.yyyy";
! public static final String ENCODING = "encoding";
! public static final String ATTRIBUTES = "attributes";
! public static final String LOCALE = "locale";
! public static final String FORMAT_DATA = "formatData";
/**
* Construct this stage - create the information object
***************
*** 117,120 ****
--- 117,123 ----
options.add(new ConfigOption(LOCALE, IConfigOptionType.STRING, null, false,
I18n.get("conversion.pipeline.stage.XlsToXml.locale")));
+ options.add(new ConfigOption(FORMAT_DATA,
+ IConfigOptionType.BOOLEAN,"true", false,
+ I18n.get("conversion.pipeline.stage.XlsToXml.formatData")));
return options;
}
***************
*** 139,142 ****
--- 142,148 ----
//we should make this more configurable later...
converter.getWorkBookAttributes().put("date", new SimpleDateFormat(DATE_FORMAT).format(new Date()));
+
+ converter.setFormatData(this.getInfo().getBooleanValue(FORMAT_DATA));
+ converter.setLocale(this.getOptions(LOCALE));
//this.getInfo().getOptions().
PipelineDocument doc = ConversionHelper.render(converter.toXml(this.getDocument().getInputStream()),
|
|
From: <de...@us...> - 2004-01-08 11:37:16
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/excel
In directory sc8-pr-cvs1:/tmp/cvs-serv7807/modules/conversion/src/com/babeldoc/conversion/excel
Modified Files:
Tag: V1-2
ExcelConversionClient.java ExcelConverter.java
Log Message:
- locale config parameter is not ignored now in pipeline stage
- added formatData config option which could be used for specifying if dates and numbers should be formatted. Default is true.
- added noformat command line option to ExcelConversionClient which can be used for setting formatData option to false.
Index: ExcelConversionClient.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/excel/ExcelConversionClient.java,v
retrieving revision 1.2.4.1
retrieving revision 1.2.4.2
diff -C2 -d -r1.2.4.1 -r1.2.4.2
*** ExcelConversionClient.java 6 Jan 2004 14:11:48 -0000 1.2.4.1
--- ExcelConversionClient.java 8 Jan 2004 11:37:13 -0000 1.2.4.2
***************
*** 6,26 ****
*
* 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,
--- 6,25 ----
*
* 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,
***************
*** 124,131 ****
ExcelConverter converter = new ExcelConverter();
if (commandline.hasOption('l')) {
- System.out.println("Setting locale "
- + commandline.getOptionValue('l'));
converter.setLocale(commandline.getOptionValue('l'));
}
ConversionHelper.render(converter.toXml(in), os, null);
} catch (ConversionException e) {
--- 123,131 ----
ExcelConverter converter = new ExcelConverter();
if (commandline.hasOption('l')) {
converter.setLocale(commandline.getOptionValue('l'));
}
+ if (commandline.hasOption('n')) {
+ converter.setFormatData(false);
+ }
ConversionHelper.render(converter.toXml(in), os, null);
} catch (ConversionException e) {
***************
*** 162,165 ****
--- 162,168 ----
I18n.get("conversion.excel.client.locale")).withLongOpt("locale")
.create('l'));
+ options.addOption(OptionBuilder.hasArg(false).withDescription(
+ I18n.get("conversion.excel.client.noFormat")).withLongOpt("noformat")
+ .create('n'));
}
Index: ExcelConverter.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/excel/ExcelConverter.java,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -C2 -d -r1.1.4.1 -r1.1.4.2
*** ExcelConverter.java 6 Jan 2004 14:09:58 -0000 1.1.4.1
--- ExcelConverter.java 8 Jan 2004 11:37:13 -0000 1.1.4.2
***************
*** 108,115 ****
private HashMap workBookAttributes = new HashMap();
private String locale = null;
public Document toXml(InputStream in)
throws ConversionException {
!
POIFSFileSystem fs;
try {
--- 108,116 ----
private HashMap workBookAttributes = new HashMap();
private String locale = null;
+ private boolean formatData = true;
public Document toXml(InputStream in)
throws ConversionException {
!
POIFSFileSystem fs;
try {
***************
*** 177,199 ****
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:
case HSSFCell.CELL_TYPE_FORMULA :
! double value = cell.getNumericCellValue();
try {
!
! String format = dataFormat.getFormat(cell.getCellStyle().getDataFormat());
! formatter.applyPattern(format);
! cellElement.addText(formatter.format(value));
} catch (Exception e) {
//set the value without formatting
LogService.getInstance(this.getClass().getName()).logWarn("Error trying to format number" + e);
! cellElement.addText(String.valueOf(value));
}
cellElement.addAttribute("type", "Numeric");
--- 178,202 ----
Element cellElement = rowElement.addElement("cell");
cellElement.addAttribute("cell-number", String.valueOf(cellCount));
!
int cellType = cell.getCellType();
switch (cellType) {
case HSSFCell.CELL_TYPE_NUMERIC:
+ //value of numeric formulas can be accessed in the same way as other cells
case HSSFCell.CELL_TYPE_FORMULA :
! double cellValue = cell.getNumericCellValue();
try {
! if (formatData) {
! String format = dataFormat.getFormat(cell.getCellStyle().getDataFormat());
! formatter.applyPattern(format);
! cellElement.addText(formatter.format(cellValue));
! } else {
! cellElement.addText(String.valueOf(cellValue));
! }
} catch (Exception e) {
//set the value without formatting
LogService.getInstance(this.getClass().getName()).logWarn("Error trying to format number" + e);
! cellElement.addText(String.valueOf(cellValue));
}
cellElement.addAttribute("type", "Numeric");
***************
*** 247,254 ****
/**
! * @param locale The locale to set.
*/
public void setLocale(String locale) {
this.locale = locale;
}
}
--- 250,264 ----
/**
! * @param locale Locale that should be used for formatting data
*/
public void setLocale(String locale) {
this.locale = locale;
+ }
+ /**
+ * Should numbers and dates be formatted or not in resulting XML document
+ * @param formatData
+ */
+ public void setFormatData(boolean formatData) {
+ this.formatData = formatData;
}
}
|
|
From: <de...@us...> - 2004-01-08 11:37:16
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/config/i18n
In directory sc8-pr-cvs1:/tmp/cvs-serv7807/modules/conversion/config/i18n
Modified Files:
Tag: V1-2
messages.properties
Log Message:
- locale config parameter is not ignored now in pipeline stage
- added formatData config option which could be used for specifying if dates and numbers should be formatted. Default is true.
- added noformat command line option to ExcelConversionClient which can be used for setting formatData option to false.
Index: messages.properties
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/config/i18n/messages.properties,v
retrieving revision 1.5.4.1
retrieving revision 1.5.4.2
diff -C2 -d -r1.5.4.1 -r1.5.4.2
*** messages.properties 6 Jan 2004 14:09:58 -0000 1.5.4.1
--- messages.properties 8 Jan 2004 11:37:13 -0000 1.5.4.2
***************
*** 29,32 ****
--- 29,34 ----
conversion.pipeline.stage.XlsToXml.error=Error converting XLS file to XML
conversion.pipeline.stage.XlsToXml.locale=Locale which should be used for formatting numbers and dates from Excel workbook. If not specified, default Locale will be used.
+ conversion.pipeline.stage.XlsToXml.formatData=Format numbers and dates with format specified in cell
conversion.excel.client.locale=Locale which should be used for formatting numbers and dates from Excel workbook. If not specified, default Locale will be used.
+ conversion.excel.client.noFormat=Do not format numbers and dates
|
|
From: <de...@us...> - 2004-01-06 14:25:05
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/excel In directory sc8-pr-cvs1:/tmp/cvs-serv4001/babeldoc/modules/conversion/src/com/babeldoc/conversion/excel Modified Files: ExcelConversionClient.java ExcelConverter.java Log Message: Updating Head branch Index: ExcelConversionClient.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/excel/ExcelConversionClient.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExcelConversionClient.java 7 Aug 2003 21:09:02 -0000 1.2 --- ExcelConversionClient.java 6 Jan 2004 14:25:02 -0000 1.3 *************** *** 1,151 **** ! /* ==================================================================== ! * 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.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, null); ! } 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); ! } ! } --- 1,175 ---- ! /* ! * ==================================================================== 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.2 2003/08/07 21:09:02 triphop Exp $ $DateTime$ $Author$ ! * ! */ ! 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.FileOutputStream; ! import java.io.IOException; ! import java.io.InputStream; ! import java.io.OutputStream; ! ! /** ! * 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; ! } ! } ! OutputStream os = null; ! if (commandline.hasOption('o')) { ! try { ! String outFile = commandline.getOptionValue('o'); ! os = new FileOutputStream(outFile); ! } catch (IOException ioe) { ! LogService.getInstance().logError( ! "Error creating output file. Switching to System.out", ioe); ! } ! } ! if (os == null) { ! os = System.out; ! } ! if (in != null) { ! try { ! ExcelConverter converter = new ExcelConverter(); ! if (commandline.hasOption('l')) { ! System.out.println("Setting locale " ! + commandline.getOptionValue('l')); ! converter.setLocale(commandline.getOptionValue('l')); ! } ! ConversionHelper.render(converter.toXml(in), os, null); ! } catch (ConversionException e) { ! LogService.getInstance().logError(e); ! } finally { ! if (os != System.out) { ! try { ! os.close(); ! } catch (IOException 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.excel.client.file")).withLongOpt("file").create( ! 'f')); ! options.addOption(OptionBuilder.hasArg(true).withDescription( ! I18n.get("conversion.excel.client.output")).withLongOpt("output") ! .create('o')); ! options.addOption(OptionBuilder.hasArg(true).withDescription( ! I18n.get("conversion.excel.client.locale")).withLongOpt("locale") ! .create('l')); ! } ! ! /** ! * Main ! * ! * @param args ! * the arguments ! */ ! public static void main(String[] args) { ! new ExcelConversionClient(args); ! } ! } Index: ExcelConverter.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/excel/ExcelConverter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExcelConverter.java 29 Dec 2003 14:52:58 -0000 1.2 --- ExcelConverter.java 6 Jan 2004 14:25:02 -0000 1.3 *************** *** 67,71 **** --- 67,75 ---- import com.babeldoc.conversion.ConversionException; + import com.babeldoc.core.LogService; + + import org.apache.poi.hssf.model.Workbook; import org.apache.poi.hssf.usermodel.HSSFCell; + import org.apache.poi.hssf.usermodel.HSSFDataFormat; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; *************** *** 78,85 **** --- 82,93 ---- import java.io.IOException; import java.io.InputStream; + import java.text.DecimalFormat; + import java.text.DecimalFormatSymbols; + import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Iterator; + import java.util.Locale; /** *************** *** 99,102 **** --- 107,111 ---- */ private HashMap workBookAttributes = new HashMap(); + private String locale = null; public Document toXml(InputStream in) *************** *** 106,117 **** 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"); --- 115,131 ---- try { fs = new POIFSFileSystem(in); ! HSSFWorkbook wb = new HSSFWorkbook(fs); HSSFSheet sheet = null; HSSFRow row = null; HSSFCell cell = null; ! HSSFDataFormat dataFormat = wb.createDataFormat(); Document document = DocumentHelper.createDocument(); ! DecimalFormat formatter; ! if (locale == null) { ! formatter = (DecimalFormat) NumberFormat.getInstance(); ! } else { ! formatter = (DecimalFormat) NumberFormat.getInstance(new Locale(locale)); ! } Element root = document.addElement("workbook"); *************** *** 168,175 **** 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 : --- 182,202 ---- int cellType = cell.getCellType(); switch (cellType) { ! case HSSFCell.CELL_TYPE_NUMERIC: ! case HSSFCell.CELL_TYPE_FORMULA : ! ! double value = cell.getNumericCellValue(); ! ! try { ! ! String format = dataFormat.getFormat(cell.getCellStyle().getDataFormat()); ! formatter.applyPattern(format); ! cellElement.addText(formatter.format(value)); ! } catch (Exception e) { ! //set the value without formatting ! LogService.getInstance(this.getClass().getName()).logWarn("Error trying to format number" + e); ! cellElement.addText(String.valueOf(value)); ! } cellElement.addAttribute("type", "Numeric"); ! //cellElement.addText(String.valueOf(value)); break; case HSSFCell.CELL_TYPE_STRING : *************** *** 215,218 **** --- 242,254 ---- public void setWorkBookAttributes(HashMap workBookAttributes) { this.workBookAttributes = workBookAttributes; + } + + + + /** + * @param locale The locale to set. + */ + public void setLocale(String locale) { + this.locale = locale; } } |
|
From: <de...@us...> - 2004-01-06 14:25:05
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/config/i18n In directory sc8-pr-cvs1:/tmp/cvs-serv4001/babeldoc/modules/conversion/config/i18n Modified Files: messages.properties Log Message: Updating Head branch Index: messages.properties =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/config/i18n/messages.properties,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** messages.properties 7 Aug 2003 21:09:01 -0000 1.5 --- messages.properties 6 Jan 2004 14:25:02 -0000 1.6 *************** *** 9,13 **** conversion.008=Incorrect number of arguments conversion.009=Commandline client to convert flatfiles to xml documents ! conversion.010=file to convert conversion.011=conversion configuration file conversion.012=Use xml unmarshaller --- 9,15 ---- conversion.008=Incorrect number of arguments conversion.009=Commandline client to convert flatfiles to xml documents ! conversion.excel.client.file=file to convert ! conversion.excel.client.output=output file ! conversion.excel.client.locale=format date and numbers with this locale conversion.011=conversion configuration file conversion.012=Use xml unmarshaller *************** *** 26,27 **** --- 28,32 ---- conversion.pipeline.stage.XlsToXml.encoding=Encoding string for the output XML. By default it is UTF-8. conversion.pipeline.stage.XlsToXml.error=Error converting XLS file to XML + conversion.pipeline.stage.XlsToXml.locale=Locale which should be used for formatting numbers and dates from Excel workbook. If not specified, default Locale will be used. + + conversion.excel.client.locale=Locale which should be used for formatting numbers and dates from Excel workbook. If not specified, default Locale will be used. |
|
From: <de...@us...> - 2004-01-06 14:25:05
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/pipeline/stage
In directory sc8-pr-cvs1:/tmp/cvs-serv4001/babeldoc/modules/conversion/src/com/babeldoc/conversion/pipeline/stage
Modified Files:
XlsToXmlPipelineStage.java
Log Message:
Updating Head branch
Index: XlsToXmlPipelineStage.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/pipeline/stage/XlsToXmlPipelineStage.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** XlsToXmlPipelineStage.java 29 Dec 2003 15:11:07 -0000 1.6
--- XlsToXmlPipelineStage.java 6 Jan 2004 14:25:02 -0000 1.7
***************
*** 92,95 ****
--- 92,96 ----
public static final String ENCODING = "encoding";
protected static final String ATTRIBUTES = "attributes";
+ protected static final String LOCALE = "locale";
/**
***************
*** 114,118 ****
I18n.get("conversion.pipeline.stage.XlsToXml.encoding")));
options.add(new ConfigOption(ATTRIBUTES, IConfigOptionType.MULTI, null, false, "Attributes"));
!
return options;
}
--- 115,120 ----
I18n.get("conversion.pipeline.stage.XlsToXml.encoding")));
options.add(new ConfigOption(ATTRIBUTES, IConfigOptionType.MULTI, null, false, "Attributes"));
! options.add(new ConfigOption(LOCALE, IConfigOptionType.STRING, null, false,
! I18n.get("conversion.pipeline.stage.XlsToXml.locale")));
return options;
}
|