You can subscribe to this list here.
| 2003 |
Jan
|
Feb
(14) |
Mar
(107) |
Apr
(211) |
May
(93) |
Jun
(158) |
Jul
(159) |
Aug
(368) |
Sep
(188) |
Oct
(151) |
Nov
(115) |
Dec
(98) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(25) |
Feb
|
Mar
(33) |
Apr
(28) |
May
(116) |
Jun
(2) |
Jul
(117) |
Aug
(19) |
Sep
(9) |
Oct
(2) |
Nov
|
Dec
(4) |
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(9) |
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
(22) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
(6) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(267) |
Sep
|
Oct
|
Nov
(6) |
Dec
(512) |
| 2008 |
Jan
(187) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(6) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <tr...@us...> - 2003-06-27 01:45:05
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/pipeline/stage In directory sc8-pr-cvs1:/tmp/cvs-serv29412/src/com/babeldoc/conversion/pipeline/stage Modified Files: FlatToXmlPipelineStage.java Log Message: Reformatted and changed the license header - also added javadoc comments. Index: FlatToXmlPipelineStage.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/pipeline/stage/FlatToXmlPipelineStage.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FlatToXmlPipelineStage.java 10 Jun 2003 00:00:22 -0000 1.4 --- FlatToXmlPipelineStage.java 27 Jun 2003 01:44:07 -0000 1.5 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/24 18:15:55 $ * * ! * babeldoc: universal document processor * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.babeldoc.conversion.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.conversion.pipeline.stage; *************** *** 25,28 **** --- 69,73 ---- import com.babeldoc.conversion.ConversionUnmarshaller; import com.babeldoc.conversion.digester.DigesterConversionUnmarshaller; + import com.babeldoc.core.I18n; import com.babeldoc.core.option.ConfigOption; *************** *** 33,36 **** --- 78,82 ---- import java.io.PrintWriter; import java.io.StringWriter; + import java.util.ArrayList; import java.util.Collection; *************** *** 38,54 **** /** ! * Pipelinestage to convert the document from a flatfile to an xml document. The ! * Rules governing the conversion is supplied as argument. This is the merely defers ! * most of the work to the conversion client client. * * @author bmcdonald * @version 1.0 */ ! public class FlatToXmlPipelineStage ! extends PipelineStage { ! /** ! * Constants ! */ ! public final static String FLAT2XML_FILE = "flatToXmlFile"; /** --- 84,97 ---- /** ! * Pipelinestage to convert the document from a flatfile to an xml document. ! * The Rules governing the conversion is supplied as argument. This is the ! * merely defers most of the work to the conversion client client. * * @author bmcdonald * @version 1.0 */ ! public class FlatToXmlPipelineStage extends PipelineStage { ! /** Constants */ ! public static final String FLAT2XML_FILE = "flatToXmlFile"; /** *************** *** 57,87 **** public FlatToXmlPipelineStage() { super(new PipelineStageInfo() { ! public String getName() { ! return "FlatToXml"; ! } ! public String getDescription() { ! return I18n.get("conversion.022"); ! } ! public Collection getTypeSpecificOptions() { ! ArrayList options = new ArrayList(); ! //add specific options ! options.add(new ConfigOption(FLAT2XML_FILE, ! IConfigOptionType.FILENAME, null, false, ! I18n.get("conversion.023"))); ! return options; ! } ! }); } /** ! * Process the contest of the document as a input to the conversion ! * client code. The results of the conversion get placed in a new ! * pipeline document and returned. * * @return the name of the next stage in the pipe line or nothing */ public PipelineStageResult[] process() throws PipelineException { --- 100,132 ---- public FlatToXmlPipelineStage() { super(new PipelineStageInfo() { ! public String getName() { ! return "FlatToXml"; ! } ! public String getDescription() { ! return I18n.get("conversion.022"); ! } ! public Collection getTypeSpecificOptions() { ! ArrayList options = new ArrayList(); ! //add specific options ! options.add(new ConfigOption(FLAT2XML_FILE, ! IConfigOptionType.FILENAME, null, false, ! I18n.get("conversion.023"))); ! return options; ! } ! }); } /** ! * Process the contest of the document as a input to the conversion client ! * code. The results of the conversion get placed in a new pipeline ! * document and returned. * * @return the name of the next stage in the pipe line or nothing + * + * @throws PipelineException DOCUMENT ME! */ public PipelineStageResult[] process() throws PipelineException { *************** *** 92,97 **** StringWriter writer = new StringWriter(); ! ConversionUnmarshaller unmarshaller = new ! DigesterConversionUnmarshaller(config); ConversionClient.doConversion(unmarshaller, input, new PrintWriter(writer)); writer.flush(); --- 137,141 ---- StringWriter writer = new StringWriter(); ! ConversionUnmarshaller unmarshaller = new DigesterConversionUnmarshaller(config); ConversionClient.doConversion(unmarshaller, input, new PrintWriter(writer)); writer.flush(); *************** *** 100,103 **** --- 144,148 ---- writer.toString().getBytes()); newDocument.setBinary(true); + return processHelper(newDocument); } catch (Exception except) { |
|
From: <tr...@us...> - 2003-06-27 01:45:04
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/module In directory sc8-pr-cvs1:/tmp/cvs-serv29412/src/com/babeldoc/conversion/module Modified Files: ConversionModule.java Log Message: Reformatted and changed the license header - also added javadoc comments. Index: ConversionModule.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/module/ConversionModule.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ConversionModule.java 22 May 2003 03:20:23 -0000 1.2 --- ConversionModule.java 27 Jun 2003 01:44:07 -0000 1.3 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime$ * * ! * babeldoc: universal document processor * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.babeldoc.conversion.module; --- 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.conversion.module; *************** *** 29,64 **** /** ! * The conversion module concerns itself with the orderly conversion of arbitrary and repeating ! * text documents into xml. This is not meant to be an anytext to anyxml conversion process. If ! * you have some ultra-specific XML you <strong>WILL</strong> need to transform the product using ! * XSL. * ! * @author bmcdonald * @version 1.0 */ ! ! public class ConversionModule ! extends BabeldocModule { ! ! public final static String MODULE = "conversion"; /** ! * The Name of the module is babelfish - and dont you forget it! * * @return */ ! public String getName() { ! return MODULE; } /** ! * babelfish module only depends on core * * @return */ ! public Set getDependsOn() { ! Set set = new HashSet(); ! set.add("core"); ! return set; } } --- 73,106 ---- /** ! * The conversion module concerns itself with the orderly conversion of ! * arbitrary and repeating text documents into xml. This is not meant to be ! * an anytext to anyxml conversion process. If you have some ultra-specific ! * XML you <strong>WILL</strong> need to transform the product using XSL. * ! * @author bmcdonald * @version 1.0 */ ! public class ConversionModule extends BabeldocModule { ! public static final String MODULE = "conversion"; /** ! * babelfish module only depends on core * * @return */ ! public Set getDependsOn() { ! Set set = new HashSet(); ! set.add("core"); ! ! return set; } /** ! * The Name of the module is babelfish - and dont you forget it! * * @return */ ! public String getName() { ! return MODULE; } } |
Update of /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion
In directory sc8-pr-cvs1:/tmp/cvs-serv29412/src/com/babeldoc/conversion
Modified Files:
ConversionClient.java ConversionException.java
ConversionUnmarshaller.java FieldData.java
LineSegmentData.java
Log Message:
Reformatted and changed the license header - also added javadoc comments.
Index: ConversionClient.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/ConversionClient.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ConversionClient.java 22 May 2003 03:02:49 -0000 1.6
--- ConversionClient.java 27 Jun 2003 01:44:06 -0000 1.7
***************
*** 1,30 ****
! /*
! * $Header$
! * $DateTime: 2002/07/24 01:14:28 $
*
*
! * babeldoc: universal document processor
*
! * This program is free software; you can redistribute it and/or
! * modify it under the terms of the GNU General Public License
! * as published by the Free Software Foundation; either version 2
[...1066 lines suppressed...]
- * @param options the options to access
- */
- public void setupCommandLine(Options options) {
- super.setupCommandLine(options);
- LogService.getInstance();
- options.addOption(OptionBuilder.isRequired().hasArg(true).withDescription(I18n.get("conversion.010")).withLongOpt("file").create('f'));
- options.addOption(OptionBuilder.isRequired().hasArg(true).withDescription(I18n.get("conversion.011")).withLongOpt("config").create('c'));
- }
-
- /**
- * Main
- *
- * @param args the arguments
- */
- public static void main(String[] args) {
- new ConversionClient(args);
- }
}
-
--- 676,678 ----
Index: ConversionException.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/ConversionException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ConversionException.java 15 Mar 2003 23:45:31 -0000 1.2
--- ConversionException.java 27 Jun 2003 01:44:06 -0000 1.3
***************
*** 1,26 ****
! /*
! * $Header$
! * $DateTime: 2002/07/24 18:15:55 $
*
*
! * babeldoc: universal document processor
*
! * This program is free software; you can redistribute it and/or
! * modify it under the terms of the GNU General Public License
! * as published by the Free Software Foundation; either version 2
! * of the License, or (at your option) any later version.
*
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.babeldoc.conversion;
-
/**
* Conversion exception. Simplistic overload of GeneralException.
--- 1,69 ----
! /* ====================================================================
! * 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;
/**
* Conversion exception. Simplistic overload of GeneralException.
***************
*** 29,35 ****
* @version 1.0
*/
! public class ConversionException
! extends com.babeldoc.core.GeneralException {
!
/**
* Conversion exception
--- 72,76 ----
* @version 1.0
*/
! public class ConversionException extends com.babeldoc.core.GeneralException {
/**
* Conversion exception
***************
*** 53,57 ****
/**
* Conversion exception
- *
*/
public ConversionException() {
--- 94,97 ----
Index: ConversionUnmarshaller.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/ConversionUnmarshaller.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ConversionUnmarshaller.java 15 Mar 2003 23:45:31 -0000 1.2
--- ConversionUnmarshaller.java 27 Jun 2003 01:44:06 -0000 1.3
***************
*** 1,22 ****
! /*
! * $Header$
! * $DateTime$
*
*
! * babeldoc: universal document processor
*
! * This program is free software; you can redistribute it and/or
! * modify it under the terms of the GNU General Public License
! * as published by the Free Software Foundation; either version 2
! * of the License, or (at your option) any later version.
*
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.babeldoc.conversion;
--- 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.conversion;
***************
*** 24,31 ****
/**
* Interface that conversion unmarshallers must implement. The definitive
! * implementation of this class is DigesterConversionUnmarshaller. No
! * further implementations are necessary and certainly not planned. The reason
! * for this class stems from when the old SAX based conversion unmarshaller
! * was replaced with the new digester and I needed to swap the two interchangeably.
*
* @author bmcdonald
--- 68,76 ----
/**
* Interface that conversion unmarshallers must implement. The definitive
! * implementation of this class is DigesterConversionUnmarshaller. No further
! * implementations are necessary and certainly not planned. The reason for
! * this class stems from when the old SAX based conversion unmarshaller was
! * replaced with the new digester and I needed to swap the two
! * interchangeably.
*
* @author bmcdonald
***************
*** 33,39 ****
*/
public interface ConversionUnmarshaller {
! /**
! * What kind of file is this?
! */
public static final int CSV_CONVERSION = 0;
public static final int LINE_CONVERSION = 1;
--- 78,82 ----
*/
public interface ConversionUnmarshaller {
! /** What kind of file is this? */
public static final int CSV_CONVERSION = 0;
public static final int LINE_CONVERSION = 1;
***************
*** 49,119 ****
/**
! * Get the lines to skip
*
* @return
*/
! public int getTopSkip();
/**
! * get the characters to skip from the left
*
* @return
*/
! public int getLeftMargin();
/**
! * Get the field separator for csv fields.
*
* @return
*/
! public String getFieldSeparator();
/**
! * get the line separator
*
* @return
*/
! public String getLineSeparator();
/**
! * get the row element
*
* @return
*/
! public String getRowElement();
/**
! * Get the root element
*
* @return
*/
! public String getRootElement();
/**
! * get the interparagraph skip
*
* @return
*/
! public int getInterParagraphSkip();
/**
! * Get the lines per para
*
* @return
*/
! public int getLinesPerPara();
/**
! * Get the field data
*
* @return
*/
! public FieldData[] getFields();
/**
! * Get the line segments.
*
* @return
*/
! public LineSegmentData[] getLineSegments();
}
--- 92,162 ----
/**
! * Get the field separator for csv fields.
*
* @return
*/
! public String getFieldSeparator();
/**
! * Get the field data
*
* @return
*/
! public FieldData[] getFields();
/**
! * get the interparagraph skip
*
* @return
*/
! public int getInterParagraphSkip();
/**
! * get the characters to skip from the left
*
* @return
*/
! public int getLeftMargin();
/**
! * Get the line segments.
*
* @return
*/
! public LineSegmentData[] getLineSegments();
/**
! * get the line separator
*
* @return
*/
! public String getLineSeparator();
/**
! * Get the lines per para
*
* @return
*/
! public int getLinesPerPara();
/**
! * Get the root element
*
* @return
*/
! public String getRootElement();
/**
! * get the row element
*
* @return
*/
! public String getRowElement();
/**
! * Get the lines to skip
*
* @return
*/
! public int getTopSkip();
}
Index: FieldData.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/FieldData.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FieldData.java 15 Mar 2003 23:45:31 -0000 1.2
--- FieldData.java 27 Jun 2003 01:44:06 -0000 1.3
***************
*** 1,22 ****
! /*
! * $Header$
! * $DateTime: 2002/07/24 01:14:28 $
*
*
! * babeldoc: universal document processor
*
! * This program is free software; you can redistribute it and/or
! * modify it under the terms of the GNU General Public License
! * as published by the Free Software Foundation; either version 2
! * of the License, or (at your option) any later version.
*
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.babeldoc.conversion;
--- 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.conversion;
***************
*** 24,30 ****
import org.apache.commons.lang.builder.ToStringBuilder;
/**
! * Simple utility class to hold all the field data. This is one of the
! * two main data objects in the conversion process.
*
* @author Bmcdonald
--- 68,75 ----
import org.apache.commons.lang.builder.ToStringBuilder;
+
/**
! * Simple utility class to hold all the field data. This is one of the two
! * main data objects in the conversion process.
*
* @author Bmcdonald
***************
*** 33,40 ****
public class FieldData {
public String name;
- public int row;
public int column;
- public int width;
public int number;
/**
--- 78,85 ----
public class FieldData {
public String name;
public int column;
public int number;
+ public int row;
+ public int width;
/**
***************
*** 44,53 ****
*/
public String toString() {
! return new ToStringBuilder(this).
! append("name", name).
! append("row", row).
! append("column", column).
! append("width", width).
! append("number", number).toString();
}
}
--- 89,96 ----
*/
public String toString() {
! return new ToStringBuilder(this).append("name", name).append("row", row)
! .append("column", column)
! .append("width", width)
! .append("number", number).toString();
}
}
Index: LineSegmentData.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/src/com/babeldoc/conversion/LineSegmentData.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** LineSegmentData.java 15 Mar 2003 23:45:31 -0000 1.2
--- LineSegmentData.java 27 Jun 2003 01:44:06 -0000 1.3
***************
*** 1,22 ****
! /*
! * $Header$
! * $DateTime: 2002/07/24 01:14:28 $
*
*
! * babeldoc: universal document processor
*
! * This program is free software; you can redistribute it and/or
! * modify it under the terms of the GNU General Public License
! * as published by the Free Software Foundation; either version 2
! * of the License, or (at your option) any later version.
*
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.babeldoc.conversion;
--- 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.conversion;
***************
*** 24,30 ****
import org.apache.commons.lang.builder.ToStringBuilder;
/**
! * Hold the configuration for each of the line segments. This one of the
! * two main data objects in the conversion process.
*
* @author Bmcdonald
--- 68,75 ----
import org.apache.commons.lang.builder.ToStringBuilder;
+
/**
! * Hold the configuration for each of the line segments. This one of the two
! * main data objects in the conversion process.
*
* @author Bmcdonald
***************
*** 32,43 ****
*/
public class LineSegmentData {
public String name;
- public int column;
- public int width;
- public int conversionType;
- public String value;
public String startGroup;
! public String endGroup;
public FieldData[] fields;
/**
--- 77,88 ----
*/
public class LineSegmentData {
+ public String endGroup;
public String name;
public String startGroup;
! public String value;
public FieldData[] fields;
+ public int column;
+ public int conversionType;
+ public int width;
/**
***************
*** 47,59 ****
*/
public String toString() {
! return new ToStringBuilder(this).
! append("name", name).
! append("column", column).
! append("width", width).
! append("conversionType", conversionType).
! append("value", value).
! append("startGroup", startGroup).
! append("endGroup", endGroup).
! append("fields", fields).toString();
}
}
--- 92,103 ----
*/
public String toString() {
! return new ToStringBuilder(this).append("name", name)
! .append("column", column)
! .append("width", width)
! .append("conversionType", conversionType)
! .append("value", value)
! .append("startGroup", startGroup)
! .append("endGroup", endGroup)
! .append("fields", fields).toString();
}
}
|
|
From: <tr...@us...> - 2003-06-27 01:44:10
|
Update of /cvsroot/babeldoc/babeldoc/modules/conversion
In directory sc8-pr-cvs1:/tmp/cvs-serv29412
Modified Files:
build.xml
Log Message:
Reformatted and changed the license header - also added javadoc comments.
Index: build.xml
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/conversion/build.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** build.xml 11 Jun 2003 11:03:19 -0000 1.7
--- build.xml 27 Jun 2003 01:44:06 -0000 1.8
***************
*** 77,91 ****
<target name="format">
- <echo message="Formatting ${Module}"/>
- <echo message="NOT! uncomment to make it work"/>
<!--
! uncomment to test it
! remove destdir attribute when you are happy with the result
<jalopy fileformat="${jalopy.fileformat}"
convention="${jalopy.convention}"
history="${jalopy.history}"
loglevel="${jalopy.loglevel}"
! threads="${jalopy.threads}"
! destdir="${base_dir}/tmp/format">
<fileset dir="./src">
<include name="**/*.java" />
--- 77,87 ----
<target name="format">
<!--
! <echo message="Formatting ${Module}"/>
<jalopy fileformat="${jalopy.fileformat}"
convention="${jalopy.convention}"
history="${jalopy.history}"
loglevel="${jalopy.loglevel}"
! threads="${jalopy.threads}">
<fileset dir="./src">
<include name="**/*.java" />
***************
*** 93,96 ****
</jalopy>
-->
! </target>
</project>
--- 89,92 ----
</jalopy>
-->
! </target>
</project>
|
|
From: <tr...@us...> - 2003-06-27 01:13:49
|
Update of /cvsroot/babeldoc/babeldoc/modules/babelfish
In directory sc8-pr-cvs1:/tmp/cvs-serv22842
Modified Files:
build.xml
Log Message:
Updated the formatting and license header in the babelfish module
Index: build.xml
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/babelfish/build.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** build.xml 11 Jun 2003 11:02:08 -0000 1.7
--- build.xml 27 Jun 2003 00:47:26 -0000 1.8
***************
*** 71,85 ****
<target name="format">
- <echo message="Formatting ${Module}"/>
- <echo message="NOT! uncomment to make it work"/>
<!--
! uncomment to test it
! remove destdir attribute when you are happy with the result
<jalopy fileformat="${jalopy.fileformat}"
convention="${jalopy.convention}"
history="${jalopy.history}"
loglevel="${jalopy.loglevel}"
! threads="${jalopy.threads}"
! destdir="${base_dir}/tmp/format">
<fileset dir="./src">
<include name="**/*.java" />
--- 71,81 ----
<target name="format">
<!--
! <echo message="Formatting ${Module}"/>
<jalopy fileformat="${jalopy.fileformat}"
convention="${jalopy.convention}"
history="${jalopy.history}"
loglevel="${jalopy.loglevel}"
! threads="${jalopy.threads}">
<fileset dir="./src">
<include name="**/*.java" />
***************
*** 87,90 ****
</jalopy>
-->
! </target>
</project>
--- 83,86 ----
</jalopy>
-->
! </target>
</project>
|
|
From: <tr...@us...> - 2003-06-27 00:49:51
|
Update of /cvsroot/babeldoc/babeldoc/modules/babelfish/src/com/babeldoc/babelfish In directory sc8-pr-cvs1:/tmp/cvs-serv22842/src/com/babeldoc/babelfish Modified Files: BabelfishTranslator.java Log Message: Updated the formatting and license header in the babelfish module Index: BabelfishTranslator.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/babelfish/src/com/babeldoc/babelfish/BabelfishTranslator.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BabelfishTranslator.java 22 May 2003 03:19:48 -0000 1.6 --- BabelfishTranslator.java 27 Jun 2003 00:47:26 -0000 1.7 *************** *** 1,29 **** ! /* ! * $Header$ ! * $DateTime$ * * ! * babeldoc: universal document processor * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.babeldoc.babelfish; import com.Ostermiller.util.StringTokenizer; import com.babeldoc.core.BabeldocCommand; import com.babeldoc.core.I18n; import com.babeldoc.core.LogService; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.OptionBuilder; --- 1,75 ---- ! /* ==================================================================== ! * 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.babelfish; import com.Ostermiller.util.StringTokenizer; + import com.babeldoc.core.BabeldocCommand; import com.babeldoc.core.I18n; import com.babeldoc.core.LogService; + import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.OptionBuilder; *************** *** 31,43 **** import java.io.*; import java.net.*; import java.util.Enumeration; import java.util.Properties; /** ! * Convert the resource bundle from english to a specified language. This is a rework ! * of the jBabel. http://alumni.cse.iitk.ac.in/~debajyoti.bera/jbabel.html. This tool ! * reads in the destination property file (if it exists) then it will merge the translated ! * values with the existing values. * * @author bmcdonald --- 77,93 ---- import java.io.*; + import java.net.*; + import java.util.Enumeration; import java.util.Properties; + /** ! * Convert the resource bundle from english to a specified language. This is a ! * rework of the jBabel. ! * http://alumni.cse.iitk.ac.in/~debajyoti.bera/jbabel.html. This tool reads ! * in the destination property file (if it exists) then it will merge the ! * translated values with the existing values. * * @author bmcdonald *************** *** 49,54 **** --- 99,108 ---- public static final String jTranslateEnd = "</div>"; + /** + * Creates a new BabelfishTranslator object. + */ public BabelfishTranslator() { } + /** * Process the commands on the command line *************** *** 61,74 **** /** ! * Print the usage instructions */ ! public void printUsage() { ! super.printUsage(); } /** ! * No finishing up processing here - not applicable. */ ! public void finishUp() { } --- 115,140 ---- /** ! * No finishing up processing here - not applicable. */ ! public void finishUp() { } /** ! * Make the from / to string ! * ! * @param from ! * @param to ! * ! * @return */ ! public static String makeFromTo(String from, String to) { ! return from + "_" + to; ! } ! ! /** ! * Print the usage instructions ! */ ! public void printUsage() { ! super.printUsage(); } *************** *** 81,182 **** super.setupCommandLine(options); ! options.addOption(OptionBuilder.isRequired().hasArg(). ! withDescription(I18n.get("babelfish.002")).withLongOpt("output").create('o')); ! options.addOption(OptionBuilder.isRequired().hasArg(). ! withDescription(I18n.get("babelfish.003")).withLongOpt("property").create('p')); ! options.addOption(OptionBuilder.isRequired().hasArg(). ! withDescription(I18n.get("babelfish.004")).withLongOpt("to").create('t')); ! options.addOption(OptionBuilder.isRequired(false).hasArg(false). ! withDescription(I18n.get("babelfish.005")).withLongOpt("merge").create('m')); } /** * * @param text * @param fromTo * @return * @throws IOException */ ! protected static String getQueryText(String text, String fromTo) throws IOException { ! //get the query string ready ! String encodedtext = URLEncoder.encode(text, "ISO-8859-1"); ! String requestString = new String("doit=done&tt=urltext&" + "urltext=" + encodedtext + "&url=" + URLEncoder.encode("http://", "ISO-8859-1") + "&" + "lp=" + fromTo); ! return requestString; } /** * * @return */ ! protected static URL getUrl() { ! try { ! return new URL(BABELFISH_URL); ! } catch (MalformedURLException e) { ! return null; } } /** ! * Translate the text from one language to another * ! * @param text ! * @param fromTo ! * @return ! * @throws IOException */ ! public static String translateText(String text, String fromTo) throws IOException { ! HttpURLConnection urlConn = getUrlConnection(getUrl()); ! BufferedReader reader = getPostResults(text, fromTo, urlConn); ! String resultString = getPostString(urlConn, reader); ! return extractTranslationResult(resultString); } /** ! * Make the from / to string * - * @param from - * @param to * @return */ ! public static String makeFromTo(String from, String to) { ! return from+"_"+to; } /** * - * @param urlConn - * @param reader * @return * @throws IOException */ ! private static String getPostString(HttpURLConnection urlConn, BufferedReader reader) throws IOException { ! int responseCode = urlConn.getResponseCode(); ! if (responseCode != HttpURLConnection.HTTP_OK) { ! System.out.println(I18n.get("babelfish.007", new Integer(responseCode))); ! throw new ConnectException("while translating"); ! } ! String resultString = new String(), inputLine; ! //Reads data ! while ((inputLine = reader.readLine()) != null) { ! resultString += inputLine; } - - reader.close(); - urlConn.disconnect(); - return resultString; } /** * * @param value * @param fromTo * @param urlConn * @return * @throws IOException */ ! private static BufferedReader getPostResults(String value, String fromTo, HttpURLConnection urlConn) throws IOException { String reqStr = getQueryText(value, fromTo); String reqLen = Integer.toString(reqStr.length()); --- 147,336 ---- super.setupCommandLine(options); ! options.addOption(OptionBuilder.isRequired().hasArg() ! .withDescription(I18n.get("babelfish.002")) ! .withLongOpt("output").create('o')); ! options.addOption(OptionBuilder.isRequired().hasArg() ! .withDescription(I18n.get("babelfish.003")) ! .withLongOpt("property").create('p')); ! options.addOption(OptionBuilder.isRequired().hasArg() ! .withDescription(I18n.get("babelfish.004")) ! .withLongOpt("to").create('t')); ! options.addOption(OptionBuilder.isRequired(false).hasArg(false) ! .withDescription(I18n.get("babelfish.005")) ! .withLongOpt("merge").create('m')); } /** + * Translate the entire properties file + * + * @param to + * @param propsFile + * @param output DOCUMENT ME! + * @param merge DOCUMENT ME! + * + * @throws IOException DOCUMENT ME! + */ + public static void translate(String to, String propsFile, String output, + boolean merge) throws IOException { + Properties props = new Properties(); + props.load(new FileInputStream(propsFile)); + + String fromTo = makeFromTo("en", to); + Properties translated = new Properties(); + File outputFile = new File(output); + loadExistingTranlations(merge, outputFile, output, translated); + translateAllValues(props, fromTo, translated); + writeTranslations(outputFile, translated); + } + + /** + * Translate the text from one language to another * * @param text * @param fromTo + * * @return + * * @throws IOException */ ! public static String translateText(String text, String fromTo) ! throws IOException { ! HttpURLConnection urlConn = getUrlConnection(getUrl()); ! ! BufferedReader reader = getPostResults(text, fromTo, urlConn); ! String resultString = getPostString(urlConn, reader); ! ! return extractTranslationResult(resultString); } /** + * Translate the possible + * + * @param value + * @param fromTo * * @return + * + * @throws IOException */ ! public static String translateTextLines(String value, String fromTo) ! throws IOException { ! String transValue = new String(); ! ! if (value.indexOf("\n") > 0) { ! StringTokenizer st = new StringTokenizer(value, "\n"); ! ! while (st.hasMoreTokens()) { ! String line = (String) st.next(); ! transValue += translateText(line, fromTo); ! ! if (st.hasMoreTokens()) { ! transValue += "\\n"; ! } ! } ! } else { ! transValue = translateText(value, fromTo); } + + return transValue; } /** ! * Execute the commandline * ! * @param commandLine */ ! public void execute(CommandLine commandLine) { ! String toLang = commandLine.getOptionValue('t'); ! String propsFile = commandLine.getOptionValue('p'); ! String output = commandLine.getOptionValue('o'); ! boolean merge = commandLine.hasOption('m'); ! try { ! translate(toLang, propsFile, output, merge); ! } catch (IOException e) { ! LogService.getInstance().logError("<<|>>", e); ! } } /** ! * Main routine ! * ! * @param args ! */ ! public static void main(String[] args) { ! new BabelfishTranslator(args); ! System.exit(0); ! } ! ! /** ! * Translate the natural language text from language to another language. ! * The from and to languages are given as the ISO codes, french = fr, etc. ! * ! * @param fromLang ! * @param toLang ! * @param text * * @return */ ! public static String translate(String fromLang, String toLang, String text) { ! String fromTo = BabelfishTranslator.makeFromTo(fromLang, toLang); ! ! try { ! return BabelfishTranslator.translateTextLines(text, fromTo); ! } catch (IOException e) { ! LogService.getInstance().logError(e); ! ! return ""; ! } } /** + * DOCUMENT ME! + * + * @param text + * @param fromTo * * @return + * * @throws IOException */ ! protected static String getQueryText(String text, String fromTo) ! throws IOException { ! //get the query string ready ! String encodedtext = URLEncoder.encode(text, "ISO-8859-1"); ! String requestString = new String("doit=done&tt=urltext&" + "urltext=" + ! encodedtext + "&url=" + URLEncoder.encode("http://", "ISO-8859-1") + ! "&" + "lp=" + fromTo); ! return requestString; ! } ! /** ! * DOCUMENT ME! ! * ! * @return ! */ ! protected static URL getUrl() { ! try { ! return new URL(BABELFISH_URL); ! } catch (MalformedURLException e) { ! return null; } } /** + * DOCUMENT ME! * * @param value * @param fromTo * @param urlConn + * * @return + * * @throws IOException */ ! private static BufferedReader getPostResults(String value, String fromTo, ! HttpURLConnection urlConn) throws IOException { String reqStr = getQueryText(value, fromTo); String reqLen = Integer.toString(reqStr.length()); *************** *** 190,204 **** POSTWriter.close(); ! BufferedReader reader = new BufferedReader(new InputStreamReader(urlConn.getInputStream())); return reader; } /** * * @param url * @return * @throws IOException */ ! private static HttpURLConnection getUrlConnection(URL url) throws IOException { HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(); --- 344,398 ---- POSTWriter.close(); ! BufferedReader reader = new BufferedReader(new InputStreamReader( ! urlConn.getInputStream())); ! return reader; } /** + * DOCUMENT ME! + * + * @param urlConn + * @param reader + * + * @return + * + * @throws IOException + * @throws ConnectException DOCUMENT ME! + */ + private static String getPostString(HttpURLConnection urlConn, + BufferedReader reader) throws IOException { + int responseCode = urlConn.getResponseCode(); + + if (responseCode != HttpURLConnection.HTTP_OK) { + System.out.println(I18n.get("babelfish.007", new Integer(responseCode))); + throw new ConnectException("while translating"); + } + + String resultString = new String(); + String inputLine; + + //Reads data + while ((inputLine = reader.readLine()) != null) { + resultString += inputLine; + } + + reader.close(); + urlConn.disconnect(); + + return resultString; + } + + /** + * DOCUMENT ME! * * @param url + * * @return + * * @throws IOException */ ! private static HttpURLConnection getUrlConnection(URL url) ! throws IOException { HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(); *************** *** 210,264 **** //set the content type etc. helped by Java Networking Tutorial urlConn.setRequestProperty("Accept-Language", "en-us"); ! urlConn.setRequestProperty("Content-type", "application/x-www-form-urlencoded"); urlConn.setRequestProperty("User-Agent", "BabelDoc0.9"); urlConn.setRequestProperty("Host", "world.altavista.com"); return urlConn; } /** * * @param resultString * @return */ ! private static String extractTranslationResult(String resultString) throws UnsupportedEncodingException { int firstIndex = resultString.indexOf(jTranslateStart); ! if (firstIndex == -1) return null; firstIndex = resultString.indexOf('>', firstIndex); int lastIndex = resultString.indexOf(jTranslateEnd, firstIndex); resultString = resultString.substring(firstIndex + 1, lastIndex); return URLDecoder.decode(resultString, "ISO-8859-1"); } /** ! * Translate the entire properties file * ! * @param to ! * @param propsFile */ ! public static void translate(String to, String propsFile, String output, boolean merge) ! throws IOException { ! Properties props = new Properties(); ! props.load(new FileInputStream(propsFile)); ! ! String fromTo = makeFromTo("en", to); ! Properties translated = new Properties(); ! File outputFile = new File(output); ! loadExistingTranlations(merge, outputFile, output, translated); ! translateAllValues(props, fromTo, translated); ! writeTranslations(outputFile, translated); ! } ! ! private static void writeTranslations(File outputFile, Properties translated) throws IOException { ! if(outputFile.exists()) { ! outputFile.delete(); ! } ! FileOutputStream fos = new FileOutputStream(outputFile); ! translated.store(fos, "Generated by: " + BabelfishTranslator.class.toString()); ! fos.close(); ! } ! ! private static void loadExistingTranlations(boolean merge, File outputFile, String output, Properties translated) throws IOException { ! if (merge&&outputFile.exists()) { FileInputStream fin = new FileInputStream(output); translated.load(fin); --- 404,453 ---- //set the content type etc. helped by Java Networking Tutorial urlConn.setRequestProperty("Accept-Language", "en-us"); ! urlConn.setRequestProperty("Content-type", ! "application/x-www-form-urlencoded"); urlConn.setRequestProperty("User-Agent", "BabelDoc0.9"); urlConn.setRequestProperty("Host", "world.altavista.com"); + return urlConn; } /** + * DOCUMENT ME! * * @param resultString + * * @return + * + * @throws UnsupportedEncodingException DOCUMENT ME! */ ! private static String extractTranslationResult(String resultString) ! throws UnsupportedEncodingException { int firstIndex = resultString.indexOf(jTranslateStart); ! ! if (firstIndex == -1) { return null; + } + firstIndex = resultString.indexOf('>', firstIndex); + int lastIndex = resultString.indexOf(jTranslateEnd, firstIndex); resultString = resultString.substring(firstIndex + 1, lastIndex); + return URLDecoder.decode(resultString, "ISO-8859-1"); } /** ! * Used to merge existing translations into new file with new translations. * ! * @param merge DOCUMENT ME! ! * @param outputFile DOCUMENT ME! ! * @param output DOCUMENT ME! ! * @param translated DOCUMENT ME! ! * ! * @throws IOException DOCUMENT ME! */ ! private static void loadExistingTranlations(boolean merge, File outputFile, ! String output, Properties translated) throws IOException { ! if (merge && outputFile.exists()) { FileInputStream fin = new FileInputStream(output); translated.load(fin); *************** *** 267,271 **** } ! private static void translateAllValues(Properties props, String fromTo, Properties translated) throws IOException { for (Enumeration e = props.keys(); e.hasMoreElements();) { String name = (String) e.nextElement(); --- 456,470 ---- } ! /** ! * Do the translation ! * ! * @param props DOCUMENT ME! ! * @param fromTo DOCUMENT ME! ! * @param translated DOCUMENT ME! ! * ! * @throws IOException DOCUMENT ME! ! */ ! private static void translateAllValues(Properties props, String fromTo, ! Properties translated) throws IOException { for (Enumeration e = props.keys(); e.hasMoreElements();) { String name = (String) e.nextElement(); *************** *** 273,279 **** // Only get the value if it does not exist already - do not overwrite the values ! if(!translated.containsKey(name)) { String transValue = translateTextLines(value, fromTo); System.out.println(name + "=" + transValue); if (transValue != null) { translated.setProperty(name, transValue); --- 472,479 ---- // Only get the value if it does not exist already - do not overwrite the values ! if (!translated.containsKey(name)) { String transValue = translateTextLines(value, fromTo); System.out.println(name + "=" + transValue); + if (transValue != null) { translated.setProperty(name, transValue); *************** *** 286,356 **** /** ! * Translate the possible ! * @param value ! * @param fromTo ! * @return ! * @throws IOException ! */ ! public static String translateTextLines(String value, String fromTo) throws IOException { ! String transValue = new String(); ! if (value.indexOf("\n") > 0) { ! StringTokenizer st = new StringTokenizer(value, "\n"); ! while (st.hasMoreTokens()) { ! String line = (String) st.next(); ! transValue += translateText(line, fromTo); ! if (st.hasMoreTokens()) { ! transValue += "\\n"; ! } ! } ! } else { ! transValue = translateText(value, fromTo); ! } ! return transValue; ! } ! ! /** ! * Execute the commandline * ! * @param commandLine ! */ ! public void execute(CommandLine commandLine) { ! String toLang = commandLine.getOptionValue('t'); ! String propsFile = commandLine.getOptionValue('p'); ! String output = commandLine.getOptionValue('o'); ! boolean merge = commandLine.hasOption('m'); ! ! try { ! translate(toLang, propsFile, output, merge); ! } catch (IOException e) { ! LogService.getInstance().logError("<<|>>", e); ! } ! } ! ! /** ! * Translate the natural language text from language to another language. The ! * from and to languages are given as the ISO codes, french = fr, etc. * ! * @param fromLang ! * @param toLang ! * @param text ! * @return */ ! public static String translate(String fromLang, String toLang, String text) { ! String fromTo = BabelfishTranslator.makeFromTo(fromLang, toLang); ! try { ! return BabelfishTranslator.translateTextLines(text, fromTo); ! } catch (IOException e) { ! LogService.getInstance().logError(e); ! return ""; } - } ! /** ! * Main routine ! * @param args ! */ ! public static void main(String[] args) { ! new BabelfishTranslator(args); ! System.exit(0); } } --- 486,506 ---- /** ! * Write the translations to disk * ! * @param outputFile DOCUMENT ME! ! * @param translated DOCUMENT ME! * ! * @throws IOException DOCUMENT ME! */ ! private static void writeTranslations(File outputFile, Properties translated) ! throws IOException { ! if (outputFile.exists()) { ! outputFile.delete(); } ! FileOutputStream fos = new FileOutputStream(outputFile); ! translated.store(fos, ! "Generated by: " + BabelfishTranslator.class.toString()); ! fos.close(); } } |
|
From: <tr...@us...> - 2003-06-27 00:49:45
|
Update of /cvsroot/babeldoc/babeldoc/modules/xslfo/src/com/babeldoc/xslfo/pipeline/stage In directory sc8-pr-cvs1:/tmp/cvs-serv21184/src/com/babeldoc/xslfo/pipeline/stage Modified Files: SvgTranscodePipelineStage.java XslFoTransformPipelineStage.java Log Message: Formatted the XSLFO module. Index: SvgTranscodePipelineStage.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/xslfo/src/com/babeldoc/xslfo/pipeline/stage/SvgTranscodePipelineStage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SvgTranscodePipelineStage.java 10 Jun 2003 00:01:31 -0000 1.2 --- SvgTranscodePipelineStage.java 27 Jun 2003 00:31:35 -0000 1.3 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/24 18:15:55 $ * * ! * babeldoc: universal document processor * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.babeldoc.xslfo.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.xslfo.pipeline.stage; *************** *** 28,31 **** --- 72,76 ---- import com.babeldoc.core.pipeline.*; import com.babeldoc.core.pipeline.command.PipelineFeeder; + import org.apache.batik.transcoder.Transcoder; import org.apache.batik.transcoder.TranscoderException; *************** *** 38,41 **** --- 83,87 ---- import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; + import java.util.ArrayList; import java.util.Collection; *************** *** 48,56 **** * @version 1.0 */ ! public class SvgTranscodePipelineStage ! extends PipelineStage { ! /** ! * Constants ! */ public static final String TRANSCODE = "transcode"; public static final String JPEG = "jpeg"; --- 94,99 ---- * @version 1.0 */ ! public class SvgTranscodePipelineStage extends PipelineStage { ! /** Constants */ public static final String TRANSCODE = "transcode"; public static final String JPEG = "jpeg"; *************** *** 66,104 **** public SvgTranscodePipelineStage() { super(new PipelineStageInfo() { ! public String getName() { ! return "SvgTranscode"; ! } ! public String getDescription() { ! return I18n.get("module.pipeline.stage.svgtranscode.0"); ! } ! public Collection getTypeSpecificOptions() { ! ArrayList options = new ArrayList(); ! options.add(new ConfigOption(TRANSCODE, ! new ValueListConfigOptionType(new String[]{JPEG, PNG, TIFF}), ! "png", true, I18n.get("module.pipeline.stage.svgtranscode.1"))); ! options.add(new ConfigOption ! (WIDTH, ! IConfigOptionType.INTEGER, ! null, false, I18n.get("module.pipeline.stage.svgtranscode.2"))); ! options.add(new ConfigOption ! (HEIGHT, ! IConfigOptionType.INTEGER, ! null, false, I18n.get("module.pipeline.stage.svgtranscode.3"))); ! options.add(new ConfigOption ! (QUALITY, ! IConfigOptionType.INTEGER, ! null, true, I18n.get("module.pipeline.stage.svgtranscode.4"))); ! return options; ! } ! }); } /** ! * pipeline stage. * * @return array of results */ public PipelineStageResult[] process() throws PipelineException { --- 109,144 ---- public SvgTranscodePipelineStage() { super(new PipelineStageInfo() { ! public String getName() { ! return "SvgTranscode"; ! } ! public String getDescription() { ! return I18n.get("module.pipeline.stage.svgtranscode.0"); ! } ! public Collection getTypeSpecificOptions() { ! ArrayList options = new ArrayList(); ! options.add(new ConfigOption(TRANSCODE, ! new ValueListConfigOptionType(new String[] { JPEG, PNG, TIFF }), ! "png", true, I18n.get("module.pipeline.stage.svgtranscode.1"))); ! options.add(new ConfigOption(WIDTH, IConfigOptionType.INTEGER, null, ! false, I18n.get("module.pipeline.stage.svgtranscode.2"))); ! options.add(new ConfigOption(HEIGHT, IConfigOptionType.INTEGER, null, ! false, I18n.get("module.pipeline.stage.svgtranscode.3"))); ! options.add(new ConfigOption(QUALITY, IConfigOptionType.INTEGER, ! null, true, I18n.get("module.pipeline.stage.svgtranscode.4"))); ! ! return options; ! } ! }); } /** ! * Convert the SVG document into a binary image * * @return array of results + * + * @throws PipelineException DOCUMENT ME! */ public PipelineStageResult[] process() throws PipelineException { *************** *** 109,113 **** // Create a new document ! PipelineDocument newDoc = new PipelineDocument(this.getDocument(), baos.toByteArray()); newDoc.setBinary(true); newDoc.setMimeType(getMimetype()); --- 149,154 ---- // Create a new document ! PipelineDocument newDoc = new PipelineDocument(this.getDocument(), ! baos.toByteArray()); newDoc.setBinary(true); newDoc.setMimeType(getMimetype()); *************** *** 117,135 **** } ! private ByteArrayOutputStream transcodeDocument(Transcoder transcoder) throws PipelineException { ! // Note that if we don't do this, relative URLs can not be resolved correctly! ! String url = com.babeldoc.core.ResourceLoader.getUrl((String) getDocument().get(PipelineFeeder.FILE_NAME)).toString(); ! TranscoderInput input = new TranscoderInput(new BufferedInputStream(this.getDocument().getInputStream())); ! input.setURI(url); ! ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); ! TranscoderOutput output = new TranscoderOutput(baos); ! try { ! transcoder.transcode(input, output); ! } catch (TranscoderException e) { ! throw new PipelineException(I18n.get("module.pipeline.stage.svgtranscode.8"), e); ! } ! return baos; ! } ! private String getMimetype() { String transcodeStr = this.getOptions(TRANSCODE); --- 158,166 ---- } ! /** ! * Get the mimetype from the destination image format. ! * ! * @return DOCUMENT ME! ! */ private String getMimetype() { String transcodeStr = this.getOptions(TRANSCODE); *************** *** 146,149 **** --- 177,187 ---- } + /** + * Get the transcoder - determined by the out image type + * + * @return Transcoder + * + * @throws PipelineException DOCUMENT ME! + */ private Transcoder getTranscoder() throws PipelineException { Transcoder transcoder; *************** *** 160,190 **** transcoder = new TIFFTranscoder(); } else { ! throw new PipelineException(I18n.get("module.pipeline.stage.svgtranscode.7")); } return transcoder; } private void trancoderHeigth(Transcoder transcoder) throws PipelineException { try { ! transcoder.addTranscodingHint(JPEGTranscoder.KEY_HEIGHT, new Float(this.getOptions(HEIGHT))); } catch (Exception e) { ! throw new PipelineException(I18n.get("module.pipeline.stage.svgtranscode.6"), e); } } ! private void transcoderWidth(Transcoder transcoder) throws PipelineException { try { ! transcoder.addTranscodingHint(JPEGTranscoder.KEY_WIDTH, new Float(this.getOptions(WIDTH))); ! } catch (Exception e) { ! throw new PipelineException(I18n.get("module.pipeline.stage.svgtranscode.5"), e); } } private void transcoderQuality(Transcoder transcoder) { int quality = 80; if (this.hasOption(QUALITY)) { quality = Integer.parseInt(this.getOptions(QUALITY)); } ! transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float((float) quality / 100)); } } --- 198,288 ---- transcoder = new TIFFTranscoder(); } else { ! throw new PipelineException(I18n.get( ! "module.pipeline.stage.svgtranscode.7")); } + return transcoder; } + /** + * Get the height of the output document + * + * @param transcoder object to apply the height hint to. + * + * @throws PipelineException DOCUMENT ME! + */ private void trancoderHeigth(Transcoder transcoder) throws PipelineException { try { ! transcoder.addTranscodingHint(JPEGTranscoder.KEY_HEIGHT, ! new Float(this.getOptions(HEIGHT))); } catch (Exception e) { ! throw new PipelineException(I18n.get( ! "module.pipeline.stage.svgtranscode.6"), e); } } ! /** ! * Transcode the document to an image ! * ! * @param transcoder Use this transcoder ! * ! * @return Image as an array of bytes ! * ! * @throws PipelineException DOCUMENT ME! ! */ ! private ByteArrayOutputStream transcodeDocument(Transcoder transcoder) ! throws PipelineException { ! // Note that if we don't do this, relative URLs can not be resolved correctly! ! String url = com.babeldoc.core.ResourceLoader.getUrl((String) getDocument() ! .get(PipelineFeeder.FILE_NAME)) ! .toString(); ! TranscoderInput input = new TranscoderInput(new BufferedInputStream( ! this.getDocument().getInputStream())); ! input.setURI(url); ! ! ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); ! TranscoderOutput output = new TranscoderOutput(baos); ! try { ! transcoder.transcode(input, output); ! } catch (TranscoderException e) { ! throw new PipelineException(I18n.get( ! "module.pipeline.stage.svgtranscode.8"), e); } + + return baos; } + /** + * Set the transcoder quality + * + * @param transcoder The transcoder in question + */ private void transcoderQuality(Transcoder transcoder) { int quality = 80; + if (this.hasOption(QUALITY)) { quality = Integer.parseInt(this.getOptions(QUALITY)); } ! ! transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, ! new Float((float) quality / 100)); ! } ! ! /** ! * Set the transcoder width ! * ! * @param transcoder The transcoder in questiom ! * ! * @throws PipelineException DOCUMENT ME! ! */ ! private void transcoderWidth(Transcoder transcoder) throws PipelineException { ! try { ! transcoder.addTranscodingHint(JPEGTranscoder.KEY_WIDTH, ! new Float(this.getOptions(WIDTH))); ! } catch (Exception e) { ! throw new PipelineException(I18n.get( ! "module.pipeline.stage.svgtranscode.5"), e); ! } } } Index: XslFoTransformPipelineStage.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/xslfo/src/com/babeldoc/xslfo/pipeline/stage/XslFoTransformPipelineStage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XslFoTransformPipelineStage.java 10 Jun 2003 00:01:31 -0000 1.2 --- XslFoTransformPipelineStage.java 27 Jun 2003 00:31:35 -0000 1.3 *************** *** 1,36 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/24 18:15:55 $ * * ! * babeldoc: universal document processor * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.babeldoc.xslfo.pipeline.stage; import com.babeldoc.core.I18n; import com.babeldoc.core.option.ConfigOption; import com.babeldoc.core.option.IConfigOptionType; import com.babeldoc.core.option.ValueListConfigOptionType; import com.babeldoc.core.pipeline.*; import org.apache.avalon.framework.logger.Logger; import org.apache.fop.apps.Driver; import org.xml.sax.InputSource; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.Collection; --- 1,85 ---- ! /* ==================================================================== ! * 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.xslfo.pipeline.stage; import com.babeldoc.core.I18n; + import com.babeldoc.core.LogService; import com.babeldoc.core.option.ConfigOption; import com.babeldoc.core.option.IConfigOptionType; import com.babeldoc.core.option.ValueListConfigOptionType; import com.babeldoc.core.pipeline.*; + import org.apache.avalon.framework.logger.Logger; + import org.apache.fop.apps.Driver; + import org.xml.sax.InputSource; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; + import java.util.ArrayList; import java.util.Collection; *************** *** 38,55 **** /** ! * A pipeline stage to do transformations. This stage uses the apache xml FOP engine ! * to the hard work. The XSL:FO data comes from the pipelinedocument. The output is ! * configurable. * * @author Bmcdonald * @version 1.0 */ ! public class XslFoTransformPipelineStage ! extends PipelineStage { ! /** ! * Constants ! */ ! public final static String OUTPUT_TYPE = "outputType"; ! public final static String BUFFER_SIZE = "bufferSize"; /** --- 87,101 ---- /** ! * A pipeline stage to do transformations. This stage uses the apache xml FOP ! * engine to the hard work. The XSL:FO data comes from the pipelinedocument. ! * The output is configurable. * * @author Bmcdonald * @version 1.0 */ ! public class XslFoTransformPipelineStage extends PipelineStage { ! /** Constants */ ! public static final String OUTPUT_TYPE = "outputType"; ! public static final String BUFFER_SIZE = "bufferSize"; /** *************** *** 58,82 **** public XslFoTransformPipelineStage() { super(new PipelineStageInfo() { ! public String getName() { ! return "XslFoTransform"; ! } ! public String getDescription() { ! return I18n.get("module.pipeline.stage.xslfotransform.0"); ! } ! public Collection getTypeSpecificOptions() { ! ArrayList options = new ArrayList(); ! options.add(new ConfigOption(OUTPUT_TYPE, ! new ValueListConfigOptionType(new String[]{"pdf", "pcl", "svg", "ps"}), ! "pdf", true, I18n.get("module.pipeline.stage.xslfotransform.1"))); ! options.add(new ConfigOption ! (OUTPUT_TYPE, ! IConfigOptionType.INTEGER, ! null, false, I18n.get("module.pipeline.stage.xslfotransform.2"))); ! return options; ! } ! }); } --- 104,128 ---- public XslFoTransformPipelineStage() { super(new PipelineStageInfo() { ! public String getName() { ! return "XslFoTransform"; ! } ! public String getDescription() { ! return I18n.get("module.pipeline.stage.xslfotransform.0"); ! } ! public Collection getTypeSpecificOptions() { ! ArrayList options = new ArrayList(); ! options.add(new ConfigOption(OUTPUT_TYPE, ! new ValueListConfigOptionType( ! new String[] { "pdf", "pcl", "svg", "ps" }), "pdf", true, ! I18n.get("module.pipeline.stage.xslfotransform.1"))); ! options.add(new ConfigOption(OUTPUT_TYPE, IConfigOptionType.INTEGER, ! null, false, I18n.get("module.pipeline.stage.xslfotransform.2"))); ! ! return options; ! } ! }); } *************** *** 85,89 **** * * @return ! * @throws com.babeldoc.core.pipeline.PipelineException */ public PipelineStageResult[] process() throws PipelineException { --- 131,136 ---- * * @return ! * ! * @throws PipelineException */ public PipelineStageResult[] process() throws PipelineException { *************** *** 120,124 **** try { InputSource xmlSource = new InputSource(new ByteArrayInputStream( ! this.getDocument().getBytes())); ByteArrayOutputStream baos = new ByteArrayOutputStream(bufsize); --- 167,171 ---- try { InputSource xmlSource = new InputSource(new ByteArrayInputStream( ! this.getDocument().getBytes())); ByteArrayOutputStream baos = new ByteArrayOutputStream(bufsize); *************** *** 132,136 **** // Create a new document ! PipelineDocument newDoc = new PipelineDocument(this.getDocument(), baos.toByteArray()); newDoc.setBinary(binary); newDoc.setMimeType(mimeType); --- 179,184 ---- // Create a new document ! PipelineDocument newDoc = new PipelineDocument(this.getDocument(), ! baos.toByteArray()); newDoc.setBinary(binary); newDoc.setMimeType(mimeType); *************** *** 147,222 **** /** * Just a facade to the avalon framework logger. * - * <p>Title: Babel</p> - * <p>Description: Universal Document Processor</p> - * <p>Copyright: Copyright (c) 2002</p> - * <p>Company: </p> * @author Bmcdonald * @version 1.0 */ class MyLogger implements Logger { ! // Methods ! public void debug(String string) { ! com.babeldoc.core.LogService.getInstance().logDebug(string); ! } ! ! public void debug(String string, Throwable throwable) { ! com.babeldoc.core.LogService.getInstance().logDebug(string); } public boolean isDebugEnabled() { ! return com.babeldoc.core.LogService.getInstance().isDebugEnabled(); } ! public void info(String string) { ! com.babeldoc.core.LogService.getInstance().logInfo(string); } ! public void info(String string, Throwable throwable) { ! com.babeldoc.core.LogService.getInstance().logInfo(string); } public boolean isInfoEnabled() { ! return com.babeldoc.core.LogService.getInstance().isInfoEnabled(); } ! public void warn(String string) { ! com.babeldoc.core.LogService.getInstance().logDebug(string); } ! public void warn(String string, Throwable throwable) { ! com.babeldoc.core.LogService.getInstance().logDebug(string); } ! public boolean isWarnEnabled() { ! return com.babeldoc.core.LogService.getInstance().isWarnEnabled(); } public void error(String string) { ! com.babeldoc.core.LogService.getInstance().logError(string, null); } public void error(String string, Throwable throwable) { ! com.babeldoc.core.LogService.getInstance().logError(string, throwable); ! } ! ! public boolean isErrorEnabled() { ! return com.babeldoc.core.LogService.getInstance().isErrorEnabled(); } public void fatalError(String string) { ! com.babeldoc.core.LogService.getInstance().logError(string, null); } public void fatalError(String string, Throwable throwable) { ! com.babeldoc.core.LogService.getInstance().logError(string, throwable); } ! public boolean isFatalErrorEnabled() { ! return com.babeldoc.core.LogService.getInstance().isErrorEnabled(); } ! public Logger getChildLogger(String string) { ! return null; } } --- 195,267 ---- /** * Just a facade to the avalon framework logger. + * * * @author Bmcdonald * @version 1.0 */ class MyLogger implements Logger { ! public Logger getChildLogger(String string) { ! return null; } public boolean isDebugEnabled() { ! return LogService.getInstance().isDebugEnabled(); } ! public boolean isErrorEnabled() { ! return LogService.getInstance().isErrorEnabled(); } ! public boolean isFatalErrorEnabled() { ! return LogService.getInstance().isErrorEnabled(); } public boolean isInfoEnabled() { ! return LogService.getInstance().isInfoEnabled(); } ! public boolean isWarnEnabled() { ! return LogService.getInstance().isWarnEnabled(); } ! // Methods ! public void debug(String string) { ! LogService.getInstance().logDebug(string); } ! public void debug(String string, Throwable throwable) { ! LogService.getInstance().logDebug(string); } public void error(String string) { ! LogService.getInstance().logError(string, null); } public void error(String string, Throwable throwable) { ! LogService.getInstance().logError(string, throwable); } public void fatalError(String string) { ! LogService.getInstance().logError(string, null); } public void fatalError(String string, Throwable throwable) { ! LogService.getInstance().logError(string, throwable); } ! public void info(String string) { ! LogService.getInstance().logInfo(string); } ! public void info(String string, Throwable throwable) { ! LogService.getInstance().logInfo(string); ! } ! ! public void warn(String string) { ! LogService.getInstance().logDebug(string); ! } ! ! public void warn(String string, Throwable throwable) { ! LogService.getInstance().logDebug(string); } } |
|
From: <tr...@us...> - 2003-06-27 00:49:13
|
Update of /cvsroot/babeldoc/babeldoc/modules/babelfish/src/com/babeldoc/babelfish/module In directory sc8-pr-cvs1:/tmp/cvs-serv22842/src/com/babeldoc/babelfish/module Modified Files: BabelfishModule.java Log Message: Updated the formatting and license header in the babelfish module Index: BabelfishModule.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/babelfish/src/com/babeldoc/babelfish/module/BabelfishModule.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BabelfishModule.java 22 May 2003 03:20:23 -0000 1.2 --- BabelfishModule.java 27 Jun 2003 00:47:26 -0000 1.3 *************** *** 1,26 **** ! /* ! * $Header$ ! * $DateTime$ * * ! * babeldoc: universal document processor * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.babeldoc.babelfish.module; import com.babeldoc.babelfish.BabelfishTranslator; import com.babeldoc.core.VariableProcessor; import com.babeldoc.core.module.BabeldocModule; --- 1,71 ---- ! /* ==================================================================== ! * 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.babelfish.module; import com.babeldoc.babelfish.BabelfishTranslator; + import com.babeldoc.core.VariableProcessor; import com.babeldoc.core.module.BabeldocModule; *************** *** 30,55 **** - /** ! * The babelfish babeldoc module registers a new velocity context ! * called "babelfish" to the VariableProcessor. * * @author unascribed * @version 1.0 */ ! ! public class BabelfishModule ! extends BabeldocModule { ! ! public final static String MODULE = "babelfish"; ! ! /** ! * The Name of the module is babelfish - and dont you forget it! ! * ! * @return ! */ ! public String getName() { ! return MODULE; ! } /** --- 75,87 ---- /** ! * The babelfish babeldoc module registers a new velocity context called ! * "babelfish" to the VariableProcessor. * * @author unascribed * @version 1.0 */ ! public class BabelfishModule extends BabeldocModule { ! public static final String MODULE = "babelfish"; /** *************** *** 61,72 **** Set set = new HashSet(); set.add("core"); return set; } /** ! * Gets called when the list of modules is processed. ! * Inserts a new velocity context for use by the velocity ! * processor. * */ public void initialize() { --- 93,112 ---- Set set = new HashSet(); set.add("core"); + return set; } /** ! * The Name of the module is babelfish - and dont you forget it! * + * @return + */ + public String getName() { + return MODULE; + } + + /** + * Gets called when the list of modules is processed. Inserts a new velocity + * context for use by the velocity processor. */ public void initialize() { |
|
From: <tr...@us...> - 2003-06-27 00:35:56
|
Update of /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/util In directory sc8-pr-cvs1:/tmp/cvs-serv21664/src/com/babeldoc/soap/pipeline/util Modified Files: SoapHelper.java Log Message: Formatted the soap module Index: SoapHelper.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/util/SoapHelper.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 |
|
From: <tr...@us...> - 2003-06-27 00:35:56
|
Update of /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/command In directory sc8-pr-cvs1:/tmp/cvs-serv21664/src/com/babeldoc/soap/pipeline/command Modified Files: SoapPipelineFeeder.java Log Message: Formatted the soap module Index: SoapPipelineFeeder.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/command/SoapPipelineFeeder.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 |
|
From: <tr...@us...> - 2003-06-27 00:35:56
|
Update of /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/servlet In directory sc8-pr-cvs1:/tmp/cvs-serv21664/src/com/babeldoc/soap/pipeline/servlet Modified Files: SoapPipelineFeeder.java Log Message: Formatted the soap module Index: SoapPipelineFeeder.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/servlet/SoapPipelineFeeder.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 |
|
From: <tr...@us...> - 2003-06-27 00:35:56
|
Update of /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/stage In directory sc8-pr-cvs1:/tmp/cvs-serv21664/src/com/babeldoc/soap/pipeline/stage Modified Files: SoapWriterPipelineStage.java Log Message: Formatted the soap module Index: SoapWriterPipelineStage.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/stage/SoapWriterPipelineStage.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 |
|
From: <tr...@us...> - 2003-06-27 00:35:54
|
Update of /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/module In directory sc8-pr-cvs1:/tmp/cvs-serv21664/src/com/babeldoc/soap/module Modified Files: SoapModule.java Log Message: Formatted the soap module Index: SoapModule.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/module/SoapModule.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 |
|
From: <tr...@us...> - 2003-06-27 00:35:50
|
Update of /cvsroot/babeldoc/babeldoc/modules/soap
In directory sc8-pr-cvs1:/tmp/cvs-serv21664
Modified Files:
build.xml
Log Message:
Formatted the soap module
Index: build.xml
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/soap/build.xml,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** build.xml 10 Jun 2003 15:55:35 -0000 1.10
--- build.xml 27 Jun 2003 00:35:45 -0000 1.11
***************
*** 96,99 ****
--- 96,100 ----
<target name="format">
+ <!--
<echo message="Formatting ${Module}"/>
<jalopy fileformat="${jalopy.fileformat}"
***************
*** 106,109 ****
</fileset>
</jalopy>
! </target>
</project>
--- 107,111 ----
</fileset>
</jalopy>
! -->
! </target>
</project>
|
|
From: <tr...@us...> - 2003-06-27 00:31:38
|
Update of /cvsroot/babeldoc/babeldoc/modules/xslfo
In directory sc8-pr-cvs1:/tmp/cvs-serv21184
Modified Files:
build.xml
Log Message:
Formatted the XSLFO module.
Index: build.xml
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/xslfo/build.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** build.xml 11 Jun 2003 11:03:21 -0000 1.4
--- build.xml 27 Jun 2003 00:31:35 -0000 1.5
***************
*** 18,24 ****
<echo message="Building ${Module}"/>
<mkdir dir="${module_path}"/>
! <javac
! destdir="${module_path}"
! srcdir="./src"
deprecation="${compile.deprecation}"
debug="${compile.debug}">
--- 18,24 ----
<echo message="Building ${Module}"/>
<mkdir dir="${module_path}"/>
! <javac
! destdir="${module_path}"
! srcdir="./src"
deprecation="${compile.deprecation}"
debug="${compile.debug}">
***************
*** 31,35 ****
</fileset>
<pathelement location="${base_dir}/support/ant/lib/junit.jar"/>
! </classpath>
</javac>
--- 31,35 ----
</fileset>
<pathelement location="${base_dir}/support/ant/lib/junit.jar"/>
! </classpath>
</javac>
***************
*** 77,94 ****
name="test">
<echo message="Testing ${Module}"/>
! </target>
!
<target name="format">
- <echo message="Formatting ${Module}"/>
- <echo message="NOT! uncomment to make it work"/>
<!--
! uncomment to test it
! remove destdir attribute when you are happy with the result
<jalopy fileformat="${jalopy.fileformat}"
convention="${jalopy.convention}"
history="${jalopy.history}"
loglevel="${jalopy.loglevel}"
! threads="${jalopy.threads}"
! destdir="${base_dir}/tmp/format">
<fileset dir="./src">
<include name="**/*.java" />
--- 77,90 ----
name="test">
<echo message="Testing ${Module}"/>
! </target>
!
<target name="format">
<!--
! <echo message="Formatting ${Module}"/>
<jalopy fileformat="${jalopy.fileformat}"
convention="${jalopy.convention}"
history="${jalopy.history}"
loglevel="${jalopy.loglevel}"
! threads="${jalopy.threads}">
<fileset dir="./src">
<include name="**/*.java" />
***************
*** 96,99 ****
</jalopy>
-->
! </target>
</project>
--- 92,95 ----
</jalopy>
-->
! </target>
</project>
|
|
From: <tr...@us...> - 2003-06-27 00:31:38
|
Update of /cvsroot/babeldoc/babeldoc/modules/xslfo/src/com/babeldoc/xslfo/module In directory sc8-pr-cvs1:/tmp/cvs-serv21184/src/com/babeldoc/xslfo/module Modified Files: XslFoModule.java Log Message: Formatted the XSLFO module. Index: XslFoModule.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/xslfo/src/com/babeldoc/xslfo/module/XslFoModule.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XslFoModule.java 23 May 2003 03:35:36 -0000 1.1 --- XslFoModule.java 27 Jun 2003 00:31:35 -0000 1.2 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime$ * * ! * babeldoc: universal document processor * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.babeldoc.xslfo.module; --- 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.xslfo.module; *************** *** 30,62 **** /** * The translation of the xml using xsl:formatting objects bring publishing ! * capabilities. This allows for very important document and imaging applications. * ! * @author bmcdonald * @version 1.0 */ ! ! public class XslFoModule ! extends BabeldocModule { ! ! public final static String MODULE = "xslfo"; /** ! * The Name of the module is babelfish - and dont you forget it! * * @return */ ! public String getName() { ! return MODULE; } /** ! * babelfish module only depends on core * * @return */ ! public Set getDependsOn() { ! Set set = new HashSet(); ! set.add("core"); ! return set; } } --- 74,105 ---- /** * The translation of the xml using xsl:formatting objects bring publishing ! * capabilities. This allows for very important document and imaging ! * applications. * ! * @author bmcdonald * @version 1.0 */ ! public class XslFoModule extends BabeldocModule { ! public static final String MODULE = "xslfo"; /** ! * babelfish module only depends on core * * @return */ ! public Set getDependsOn() { ! Set set = new HashSet(); ! set.add("core"); ! ! return set; } /** ! * The Name of the module is babelfish - and dont you forget it! * * @return */ ! public String getName() { ! return MODULE; } } |
|
From: <tr...@us...> - 2003-06-27 00:15:11
|
Update of /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/util In directory sc8-pr-cvs1:/tmp/cvs-serv19206/modules/soap/src/com/babeldoc/soap/pipeline/util Modified Files: SoapHelper.java Log Message: Updated the build system using an explicit modular ant task. This is better than the method previously employed which added "hidden" tasks to the build and clean etc targets. Additionally using a more robust module sorting algorithm. Index: SoapHelper.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/util/SoapHelper.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SoapHelper.java 22 May 2003 03:20:32 -0000 1.6 --- SoapHelper.java 27 Jun 2003 00:14:56 -0000 1.7 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime:$ * * ! * babeldoc: universal document processor * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.babeldoc.soap.pipeline.util; --- 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.soap.pipeline.util; *************** *** 24,38 **** import com.babeldoc.core.pipeline.PipelineDocument; import com.babeldoc.core.pipeline.stage.DomifyPipelineStage; import org.dom4j.Element; import org.dom4j.io.DOMReader; import org.dom4j.io.XMLWriter; import org.w3c.dom.Document; - import javax.xml.soap.*; import java.io.IOException; import java.io.StringWriter; import java.util.Iterator; import java.util.Vector; /** --- 68,87 ---- import com.babeldoc.core.pipeline.PipelineDocument; import com.babeldoc.core.pipeline.stage.DomifyPipelineStage; + import org.dom4j.Element; + import org.dom4j.io.DOMReader; import org.dom4j.io.XMLWriter; + import org.w3c.dom.Document; import java.io.IOException; import java.io.StringWriter; + import java.util.Iterator; import java.util.Vector; + import javax.xml.soap.*; + /** *************** *** 44,203 **** */ public class SoapHelper { ! //~ Methods ································································ ! ! /** ! * a helper function to extract a {@link SOAPFault} from a given ! * <code>SOAPMessage</code>. {@link #containsFault(SOAPMessage} should be ! * called before. ! * ! * @param message the message to get the fault from ! * ! * @return the <code>SOAPFault</code> or <code>null</code> if there isn't ! * any ! * ! * @throws SOAPException if the extraction of the message's body failed ! */ ! public static SOAPFault getFault(SOAPMessage message) ! throws SOAPException { ! SOAPPart sp = message.getSOAPPart(); ! SOAPEnvelope se = sp.getEnvelope(); ! SOAPBody sb = se.getBody(); ! ! return sb.getFault(); ! } ! /** ! * A helper function to add a {@link SOAPFault} to a given ! * <code>SOAPMessage</code>. ! * ! * @param message the <code>SOAPMessage</code> to add the fault to ! * ! * @return the {@link SOAPFault} object that was added or an existing one, ! * if there already was one. ! * ! * @throws SOAPException if there is an error ! */ ! public static SOAPFault addFault(SOAPMessage message) ! throws SOAPException { ! SOAPPart part = message.getSOAPPart(); ! SOAPEnvelope envelope = part.getEnvelope(); ! SOAPBody body = envelope.getBody(); ! if (body.hasFault()) { ! return body.getFault(); ! } ! return body.addFault(); } ! /** ! * attaches a {@link Document} to a {@link SOAPMessage} at the moment this ! * is done by putting it in the body of the message. The way this happens ! * depends on the implementation of the javax.xml API and should propably ! * be replaced by something different. ! * ! * @param message the message, to which the document shall be attached ! * @param document the document to attach ! * ! * @throws SOAPException a {@link SOAPException} if something goes wrong ! * ! * @see <a ! * href="http://access1.sun.com/techarticles/SOAPMessage.XML.html">this ! * article</a> ! */ ! public static void attachDocument(SOAPMessage message, Document document) ! throws SOAPException { ! SOAPPart sp = message.getSOAPPart(); ! SOAPEnvelope envelope = sp.getEnvelope(); ! SOAPBody body = envelope.getBody(); ! DOMReader dr = new DOMReader(); ! org.dom4j.Document d = dr.read(document); ! Element e = d.getRootElement(); ! // TODO test for namespace ! // TODO should the whole thing be implemented with attachments? ! // if (e.getNamespace()==Namespace.NO_NAMESPACE) { ! // e.addNamespace("babeldoc","http://www.babeldoc.com/"); ! // } ! ((Element) body).add(e); ! } ! /** ! * attaches a {@link PipelineDocument} to a {@link SOAPMessage} at the ! * moment this is done by putting it in the body of the message. The way ! * this happens depends on the implementation of the javax.xml API and ! * should propably be replaced by something different. ! * ! * @param message the message, to which the document shall be attached ! * @param document the document to attach ! * ! * @throws SOAPException a {@link SOAPException} if something goes wrong ! * ! * @see <a ! * href="http://access1.sun.com/techarticles/SOAPMessage.XML.html">this ! * article</a> ! */ ! public static void attachDocument(SOAPMessage message, ! PipelineDocument document) throws SOAPException { ! org.w3c.dom.Document doc = DomifyPipelineStage.parseToDom(document, ! false); ! attachDocument(message, doc); ! } ! /** ! * a helper function to check whether a given <code>SOAPMessage</code> ! * contains a {@link SOAPFault}. ! * ! * @param message the message to check ! * ! * @return <code>true</code> if a <code>SOAPFault</code> exists in this ! * message, <code> false</code> otherwise. ! * ! * @throws SOAPException if the extraction of the message's body failed ! */ ! public static boolean containsFault(SOAPMessage message) ! throws SOAPException { ! SOAPPart sp = message.getSOAPPart(); ! SOAPEnvelope se = sp.getEnvelope(); ! SOAPBody sb = se.getBody(); ! return (sb.hasFault()); ! } ! /** ! * gives all {@link PipelineDocument PipelineDocuments} that were attached ! * to the given message. ! * ! * @param message the message containing the documents ! * ! * @return an <code>Iterator</code> for the contained ! * <code>PipelineDocuments</code> ! * ! * @throws SOAPException if the extraction of the documents fails ! * @throws IOException if a document cannot be converted to xml ! */ ! public static Iterator detachDocuments(SOAPMessage message) ! throws SOAPException, IOException { ! Vector docs = new Vector(); ! SOAPPart part = message.getSOAPPart(); ! SOAPEnvelope envelope = part.getEnvelope(); ! SOAPBody body = envelope.getBody(); ! for (Iterator it = body.getChildElements(); it.hasNext();) { ! SOAPElement element = (SOAPElement) it.next(); ! Element domElement = (Element) element; ! StringWriter string = new StringWriter(); ! XMLWriter writer = new XMLWriter(string); ! writer.write(domElement); ! String xml = writer.toString(); ! com.babeldoc.core.pipeline.PipelineDocument pdoc = new com.babeldoc.core.pipeline.PipelineDocument(xml.getBytes()); ! pdoc.setMimeType("text/xml"); ! docs.add(pdoc); ! } ! return docs.iterator(); } } --- 93,248 ---- */ public class SoapHelper { ! /** ! * a helper function to extract a {@link SOAPFault} from a given ! * <code>SOAPMessage</code>. {@link #containsFault(SOAPMessage} should be ! * called before. ! * ! * @param message the message to get the fault from ! * ! * @return the <code>SOAPFault</code> or <code>null</code> if there isn't any ! * ! * @throws SOAPException if the extraction of the message's body failed ! */ ! public static SOAPFault getFault(SOAPMessage message) ! throws SOAPException { ! SOAPPart sp = message.getSOAPPart(); ! SOAPEnvelope se = sp.getEnvelope(); ! SOAPBody sb = se.getBody(); ! return sb.getFault(); ! } ! /** ! * A helper function to add a {@link SOAPFault} to a given ! * <code>SOAPMessage</code>. ! * ! * @param message the <code>SOAPMessage</code> to add the fault to ! * ! * @return the {@link SOAPFault} object that was added or an existing one, if ! * there already was one. ! * ! * @throws SOAPException if there is an error ! */ ! public static SOAPFault addFault(SOAPMessage message) ! throws SOAPException { ! SOAPPart part = message.getSOAPPart(); ! SOAPEnvelope envelope = part.getEnvelope(); ! SOAPBody body = envelope.getBody(); ! if (body.hasFault()) { ! return body.getFault(); } ! return body.addFault(); ! } ! /** ! * attaches a {@link Document} to a {@link SOAPMessage} at the moment this is ! * done by putting it in the body of the message. The way this happens ! * depends on the implementation of the javax.xml API and should propably be ! * replaced by something different. ! * ! * @param message the message, to which the document shall be attached ! * @param document the document to attach ! * ! * @throws SOAPException a {@link SOAPException} if something goes wrong ! * ! * @see <a ! * href="http://access1.sun.com/techarticles/SOAPMessage.XML.html">this ! * article</a> ! */ ! public static void attachDocument(SOAPMessage message, Document document) ! throws SOAPException { ! SOAPPart sp = message.getSOAPPart(); ! SOAPEnvelope envelope = sp.getEnvelope(); ! SOAPBody body = envelope.getBody(); ! DOMReader dr = new DOMReader(); ! org.dom4j.Document d = dr.read(document); ! Element e = d.getRootElement(); ! // TODO test for namespace ! // TODO should the whole thing be implemented with attachments? ! // if (e.getNamespace()==Namespace.NO_NAMESPACE) { ! // e.addNamespace("babeldoc","http://www.babeldoc.com/"); ! // } ! ((Element) body).add(e); ! } ! /** ! * attaches a {@link PipelineDocument} to a {@link SOAPMessage} at the moment ! * this is done by putting it in the body of the message. The way this ! * happens depends on the implementation of the javax.xml API and should ! * propably be replaced by something different. ! * ! * @param message the message, to which the document shall be attached ! * @param document the document to attach ! * ! * @throws SOAPException a {@link SOAPException} if something goes wrong ! * ! * @see <a ! * href="http://access1.sun.com/techarticles/SOAPMessage.XML.html">this ! * article</a> ! */ ! public static void attachDocument(SOAPMessage message, ! PipelineDocument document) throws SOAPException { ! org.w3c.dom.Document doc = DomifyPipelineStage.parseToDom(document, false); ! attachDocument(message, doc); ! } ! /** ! * a helper function to check whether a given <code>SOAPMessage</code> ! * contains a {@link SOAPFault}. ! * ! * @param message the message to check ! * ! * @return <code>true</code> if a <code>SOAPFault</code> exists in this ! * message, <code> false</code> otherwise. ! * ! * @throws SOAPException if the extraction of the message's body failed ! */ ! public static boolean containsFault(SOAPMessage message) ! throws SOAPException { ! SOAPPart sp = message.getSOAPPart(); ! SOAPEnvelope se = sp.getEnvelope(); ! SOAPBody sb = se.getBody(); ! return (sb.hasFault()); ! } ! /** ! * gives all {@link PipelineDocument PipelineDocuments} that were attached to ! * the given message. ! * ! * @param message the message containing the documents ! * ! * @return an <code>Iterator</code> for the contained ! * <code>PipelineDocuments</code> ! * ! * @throws SOAPException if the extraction of the documents fails ! * @throws IOException if a document cannot be converted to xml ! */ ! public static Iterator detachDocuments(SOAPMessage message) ! throws SOAPException, IOException { ! Vector docs = new Vector(); ! SOAPPart part = message.getSOAPPart(); ! SOAPEnvelope envelope = part.getEnvelope(); ! SOAPBody body = envelope.getBody(); ! for (Iterator it = body.getChildElements(); it.hasNext();) { ! SOAPElement element = (SOAPElement) it.next(); ! Element domElement = (Element) element; ! StringWriter string = new StringWriter(); ! XMLWriter writer = new XMLWriter(string); ! writer.write(domElement); ! String xml = writer.toString(); ! com.babeldoc.core.pipeline.PipelineDocument pdoc = new com.babeldoc.core.pipeline.PipelineDocument(xml.getBytes()); ! pdoc.setMimeType("text/xml"); ! docs.add(pdoc); } + + return docs.iterator(); + } } |
|
From: <tr...@us...> - 2003-06-27 00:15:11
|
Update of /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/command In directory sc8-pr-cvs1:/tmp/cvs-serv19206/modules/soap/src/com/babeldoc/soap/pipeline/command Modified Files: SoapPipelineFeeder.java Log Message: Updated the build system using an explicit modular ant task. This is better than the method previously employed which added "hidden" tasks to the build and clean etc targets. Additionally using a more robust module sorting algorithm. Index: SoapPipelineFeeder.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/command/SoapPipelineFeeder.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SoapPipelineFeeder.java 22 May 2003 03:20:31 -0000 1.8 --- SoapPipelineFeeder.java 27 Jun 2003 00:14:56 -0000 1.9 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime:$ * * ! * babeldoc: universal document processor * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.babeldoc.soap.pipeline.command; --- 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.soap.pipeline.command; *************** *** 24,42 **** import com.babeldoc.core.I18n; import com.babeldoc.core.LogService; import com.babeldoc.soap.pipeline.util.SoapHelper; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.Options; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import javax.xml.messaging.URLEndpoint; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.soap.*; - import java.io.IOException; - import java.util.Enumeration; - import java.util.Hashtable; --- 68,92 ---- import com.babeldoc.core.I18n; import com.babeldoc.core.LogService; + import com.babeldoc.soap.pipeline.util.SoapHelper; + import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.Options; + import org.w3c.dom.Document; + import org.xml.sax.InputSource; import org.xml.sax.SAXException; + import java.io.IOException; + + import java.util.Enumeration; + import java.util.Hashtable; + import javax.xml.messaging.URLEndpoint; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.soap.*; *************** *** 49,301 **** */ public class SoapPipelineFeeder extends com.babeldoc.core.BabeldocCommand { ! //~ Static variables/initializers ·········································· ! /* TODO should these things be configurable? how? */ ! /** constant: the uri */ ! public static final String URI = "urn:babeldoc"; ! /** constant: more of the uri */ ! public static final String CTX = "/babeldoc-soapfeed/"; ! /** constant: the dot feed */ ! public static final String DOT_FEED = ".feed"; ! /** constant: the soap action */ ! public static final String ACTION = ""; ! //~ Instance variables ····················································· ! /** instance: the host port */ ! private String hostport; ! /** instance: the pipeline to feed */ ! private String pipeline; ! /** instance: the attributes */ ! private Hashtable attributes; ! //~ Constructors ··························································· ! /** ! * Creates a new SoapPipelineFeeder object. ! * ! * @param args the command line arguments ! */ ! public SoapPipelineFeeder(String[] args) { ! super("soapfeed", I18n.get("soap.001"), args); ! } ! //~ Methods ································································ ! /** ! * Sets name of the pipeline to be used. ! * ! * @param pipeline the name of the pipeline ! */ ! public void setPipeline(String pipeline) { ! this.pipeline = pipeline; ! } ! /** ! * Gets the name of the pipeline that is used. ! * ! * @return the name of the pipeline ! */ ! public String getPipeline() { ! return pipeline; ! } ! /** ! * Sets the host and port part of the SOAP URL ! * ! * @param url a String in the form <host>:<port> ! */ ! public void setUrl(String url) { ! this.hostport = url; } ! /** ! * Gets the host and port part of the SOAP URL ! * ! * @return a String in the form <host>:<port> ! */ ! public String getUrl() { ! return hostport; } ! /** ! * execute the commandline. This must be overloaded to handle the command ! * line options ! * ! * @param commandLine the command line options that have been detectected ! */ ! public void execute(CommandLine commandLine) { ! super.execute(commandLine); ! ! String file = null; ! attributes = new Hashtable(); ! ! if (commandLine.hasOption('u')) { ! hostport = commandLine.getOptionValue('u'); ! } else { ! LogService.getInstance().logError(I18n.get("soap.005"), null); ! } ! ! if (commandLine.hasOption('f')) { ! file = commandLine.getOptionValue('f'); ! } else { ! LogService.getInstance().logError(I18n.get("soap.006"), null); ! } ! ! if (commandLine.hasOption('p')) { ! pipeline = commandLine.getOptionValue('p'); ! } else { ! LogService.getInstance().logError(I18n.get("soap.007"), null); ! } ! ! if (commandLine.hasOption('a')) { ! String namval = commandLine.getOptionValue('a'); ! String name = namval.substring(0, namval.indexOf('=')); ! String value = namval.substring(namval.indexOf('=') + 1); ! attributes.put(name, value); ! } ! ! run(file); } ! /** ! * Main routine ! * ! * @param args the command line arguments ! */ ! static public void main(String[] args) { ! new SoapPipelineFeeder(args); } ! /** ! * Run the soap client ! * ! * @param file ! */ ! public void run(String file) { ! try { ! // get soap body to include in the SOAP envelope ! InputSource xmlSource = new InputSource(com.babeldoc.core.ResourceLoader.getResourceStream( ! file)); ! run(xmlSource); ! } catch (Exception e) { ! e.printStackTrace(); ! } ! } ! /** ! * Run the soap client ! * ! * @param xmlSource ! */ ! public void run(InputSource xmlSource) ! throws SAXException, IOException, ParserConfigurationException, ! SOAPException { ! Document doc = getDocument(xmlSource); ! // create a message ! MessageFactory mf = MessageFactory.newInstance(); ! SOAPMessage message = mf.createMessage(); ! // add the document from the pipeline ! SoapHelper.attachDocument(message, doc); ! // this adds the standard headers ! if (message.saveRequired()) { ! message.saveChanges(); ! } ! // add the SOAPAction header ! MimeHeaders headers = message.getMimeHeaders(); ! headers.setHeader("SOAPAction", ACTION); ! // establish the connection ! String url = getSoapUrl(); ! URLEndpoint endPoint = new URLEndpoint(url); ! SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance(); ! SOAPConnection connection = scf.createConnection(); ! // send the message and write out the reply ! com.babeldoc.core.LogService.getInstance().logInfo(I18n.get("soap.003")); ! SOAPMessage reply = connection.call(message, endPoint); ! if (reply != null) { // just in case... ! reply.writeTo(System.out); ! System.out.println(); ! } ! com.babeldoc.core.LogService.getInstance().logInfo(I18n.get("soap.004")); ! // close the connection ! connection.close(); } ! /** ! * 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() ! .withDescription(com.babeldoc.core.I18n.get( ! "009007")).withLongOpt("pipeline").create('p')); ! options.addOption(OptionBuilder.isRequired().hasArg() ! .withDescription(com.babeldoc.core.I18n.get( ! "009008")).withLongOpt("file").create('f')); ! options.addOption(OptionBuilder.isRequired().hasArg() ! .withDescription(com.babeldoc.core.I18n.get( ! "009009")).withLongOpt("attribute").create('a')); ! options.addOption(OptionBuilder.isRequired().hasArg() ! .withDescription(com.babeldoc.core.I18n.get( ! "010007")).withLongOpt("hostport").create('u')); ! } ! /** ! * Return the document ! * ! * @param xmlSource ! * ! * @return document ! */ ! private Document getDocument(InputSource xmlSource) ! throws SAXException, IOException, ParserConfigurationException { ! DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); ! dfactory.setNamespaceAware(true); ! Document doc = dfactory.newDocumentBuilder().parse(xmlSource); ! return doc; ! } ! /** ! * Get the url to send the message ! * ! * @return the url ! */ ! private String getSoapUrl() { ! StringBuffer url = new StringBuffer("http://" + hostport + CTX + ! pipeline + DOT_FEED); ! if (attributes.size() > 0) { ! url.append("?"); ! for (Enumeration e = attributes.keys(); e.hasMoreElements();) { ! String name = (String) e.nextElement(); ! String value = (String) attributes.get(name); ! url.append(name + "=" + value + "&"); ! } ! url.append("dummy=dummy"); ! } ! return url.toString(); } } --- 99,352 ---- */ public class SoapPipelineFeeder extends com.babeldoc.core.BabeldocCommand { ! /* TODO should these things be configurable? how? */ ! /** constant: the uri */ ! public static final String URI = "urn:babeldoc"; ! /** constant: more of the uri */ ! public static final String CTX = "/babeldoc-soapfeed/"; ! /** constant: the dot feed */ ! public static final String DOT_FEED = ".feed"; ! /** constant: the soap action */ ! public static final String ACTION = ""; ! /** instance: the attributes */ ! private Hashtable attributes; ! /** instance: the host port */ ! private String hostport; ! /** instance: the pipeline to feed */ ! private String pipeline; ! /** ! * Creates a new SoapPipelineFeeder object. ! * ! * @param args the command line arguments ! */ ! public SoapPipelineFeeder(String[] args) { ! super("soapfeed", I18n.get("soap.001"), args); ! } ! /** ! * Sets name of the pipeline to be used. ! * ! * @param pipeline the name of the pipeline ! */ ! public void setPipeline(String pipeline) { ! this.pipeline = pipeline; ! } ! /** ! * Gets the name of the pipeline that is used. ! * ! * @return the name of the pipeline ! */ ! public String getPipeline() { ! return pipeline; ! } ! /** ! * Sets the host and port part of the SOAP URL ! * ! * @param url a String in the form <host>:<port> ! */ ! public void setUrl(String url) { ! this.hostport = url; ! } ! /** ! * Gets the host and port part of the SOAP URL ! * ! * @return a String in the form <host>:<port> ! */ ! public String getUrl() { ! return hostport; ! } ! /** ! * execute the commandline. This must be overloaded to handle the command ! * line options ! * ! * @param commandLine the command line options that have been detectected ! */ ! public void execute(CommandLine commandLine) { ! super.execute(commandLine); ! String file = null; ! attributes = new Hashtable(); ! if (commandLine.hasOption('u')) { ! hostport = commandLine.getOptionValue('u'); ! } else { ! LogService.getInstance().logError(I18n.get("soap.005"), null); } ! if (commandLine.hasOption('f')) { ! file = commandLine.getOptionValue('f'); ! } else { ! LogService.getInstance().logError(I18n.get("soap.006"), null); } ! if (commandLine.hasOption('p')) { ! pipeline = commandLine.getOptionValue('p'); ! } else { ! LogService.getInstance().logError(I18n.get("soap.007"), null); } ! if (commandLine.hasOption('a')) { ! String namval = commandLine.getOptionValue('a'); ! String name = namval.substring(0, namval.indexOf('=')); ! String value = namval.substring(namval.indexOf('=') + 1); ! attributes.put(name, value); } ! run(file); ! } ! /** ! * Main routine ! * ! * @param args the command line arguments ! */ ! public static void main(String[] args) { ! new SoapPipelineFeeder(args); ! } ! /** ! * Run the soap client ! * ! * @param file ! */ ! public void run(String file) { ! try { ! // get soap body to include in the SOAP envelope ! InputSource xmlSource = new InputSource(com.babeldoc.core.ResourceLoader.getResourceStream( ! file)); ! run(xmlSource); ! } catch (Exception e) { ! e.printStackTrace(); ! } ! } ! /** ! * Run the soap client ! * ! * @param xmlSource ! * ! * @throws SAXException DOCUMENT ME! ! * @throws IOException DOCUMENT ME! ! * @throws ParserConfigurationException DOCUMENT ME! ! * @throws SOAPException DOCUMENT ME! ! */ ! public void run(InputSource xmlSource) ! throws SAXException, IOException, ParserConfigurationException, ! SOAPException { ! Document doc = getDocument(xmlSource); ! // create a message ! MessageFactory mf = MessageFactory.newInstance(); ! SOAPMessage message = mf.createMessage(); ! // add the document from the pipeline ! SoapHelper.attachDocument(message, doc); ! // this adds the standard headers ! if (message.saveRequired()) { ! message.saveChanges(); ! } ! // add the SOAPAction header ! MimeHeaders headers = message.getMimeHeaders(); ! headers.setHeader("SOAPAction", ACTION); ! // establish the connection ! String url = getSoapUrl(); ! URLEndpoint endPoint = new URLEndpoint(url); ! SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance(); ! SOAPConnection connection = scf.createConnection(); ! // send the message and write out the reply ! com.babeldoc.core.LogService.getInstance().logInfo(I18n.get("soap.003")); ! SOAPMessage reply = connection.call(message, endPoint); ! if (reply != null) { // just in case... ! reply.writeTo(System.out); ! System.out.println(); } ! com.babeldoc.core.LogService.getInstance().logInfo(I18n.get("soap.004")); ! // close the connection ! connection.close(); ! } ! /** ! * 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() ! .withDescription(com.babeldoc.core.I18n.get( ! "009007")).withLongOpt("pipeline").create('p')); ! options.addOption(OptionBuilder.isRequired().hasArg() ! .withDescription(com.babeldoc.core.I18n.get( ! "009008")).withLongOpt("file").create('f')); ! options.addOption(OptionBuilder.isRequired().hasArg() ! .withDescription(com.babeldoc.core.I18n.get( ! "009009")).withLongOpt("attribute").create('a')); ! options.addOption(OptionBuilder.isRequired().hasArg() ! .withDescription(com.babeldoc.core.I18n.get( ! "010007")).withLongOpt("hostport").create('u')); ! } ! /** ! * Return the document ! * ! * @param xmlSource ! * ! * @return document ! * ! * @throws SAXException DOCUMENT ME! ! * @throws IOException DOCUMENT ME! ! * @throws ParserConfigurationException DOCUMENT ME! ! */ ! private Document getDocument(InputSource xmlSource) ! throws SAXException, IOException, ParserConfigurationException { ! DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); ! dfactory.setNamespaceAware(true); ! Document doc = dfactory.newDocumentBuilder().parse(xmlSource); ! return doc; ! } ! /** ! * Get the url to send the message ! * ! * @return the url ! */ ! private String getSoapUrl() { ! StringBuffer url = new StringBuffer("http://" + hostport + CTX + pipeline + ! DOT_FEED); ! if (attributes.size() > 0) { ! url.append("?"); ! for (Enumeration e = attributes.keys(); e.hasMoreElements();) { ! String name = (String) e.nextElement(); ! String value = (String) attributes.get(name); ! url.append(name + "=" + value + "&"); ! } ! ! url.append("dummy=dummy"); } + + return url.toString(); + } } |
|
From: <tr...@us...> - 2003-06-27 00:15:11
|
Update of /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/servlet In directory sc8-pr-cvs1:/tmp/cvs-serv19206/modules/soap/src/com/babeldoc/soap/pipeline/servlet Modified Files: SoapPipelineFeeder.java Log Message: Updated the build system using an explicit modular ant task. This is better than the method previously employed which added "hidden" tasks to the build and clean etc targets. Additionally using a more robust module sorting algorithm. Index: SoapPipelineFeeder.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/servlet/SoapPipelineFeeder.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SoapPipelineFeeder.java 22 May 2003 03:20:31 -0000 1.5 --- SoapPipelineFeeder.java 27 Jun 2003 00:14:56 -0000 1.6 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/24 18:15:55 $ * * ! * babeldoc: universal document processor * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.babeldoc.soap.pipeline.servlet; --- 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.soap.pipeline.servlet; *************** *** 25,30 **** --- 69,82 ---- import com.babeldoc.core.journal.JournalException; import com.babeldoc.core.journal.JournalFactory; + import com.babeldoc.soap.pipeline.util.SoapHelper; + import java.io.IOException; + + import java.util.Enumeration; + import java.util.Iterator; + import java.util.StringTokenizer; + import java.util.Vector; + import javax.servlet.ServletConfig; import javax.servlet.ServletException; *************** *** 33,42 **** import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.soap.*; ! import java.io.IOException; ! import java.util.Enumeration; ! import java.util.Iterator; ! import java.util.StringTokenizer; ! import java.util.Vector; /** --- 85,91 ---- import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import javax.xml.soap.*; ! /** *************** *** 46,243 **** * @version 1.0 */ ! public class SoapPipelineFeeder ! extends HttpServlet { ! ! public final static String DOT_FEED = ".feed"; ! MessageFactory msgFactory; ! public void init(ServletConfig servletConfig) throws ServletException { ! super.init(servletConfig); ! try { ! msgFactory = MessageFactory.newInstance(); ! } catch (SOAPException ex) { ! throw new ServletException("Unable to create message factory" ! + ex.getMessage()); ! } ! } ! ! /** * doGet - this is illegal - must only accept posts. * * @param request * @param response */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ! com.babeldoc.core.LogService.getInstance().logWarn(com.babeldoc.core.I18n.get("017004")); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); } ! /** ! * doPost This is where the action happens. Extract the soap envelope. ! * ! * @param request ! * @param response ! */ ! public void doPost(HttpServletRequest request, HttpServletResponse response) ! throws IOException, ServletException { ! //debugHeader(request); ! String pipeline = getPipeline(request); ! com.babeldoc.core.LogService.getInstance().logDebug( ! com.babeldoc.core.I18n.get("017006", pipeline)); ! if (pipeline != null) { ! if (request.getContentLength() > 0) { ! try { ! // Get all the headers from the HTTP request. ! MimeHeaders headers = getHeaders(request); ! // Get the body of the HTTP request. ! ServletInputStream is = request.getInputStream(); ! // Now internalize the contents of the HTTP request and ! // create a SOAPMessage ! SOAPMessage msg = msgFactory.createMessage(headers, is); ! // TODO create a real SOAP response ! IJournalTicket[] tickets = ! processSoapDocument(request, msg, pipeline); ! // if (tickets.length > 0) { ! StringBuffer buffer = new StringBuffer(); ! buffer.append("<tickets>\n"); ! for (int i = 0; i < tickets.length; ++i) { ! buffer.append( ! "<ticket>" + tickets[i].getId() + "</ticket>\n"); ! } ! buffer.append("</tickets>\n"); ! response.setStatus(HttpServletResponse.SC_OK); ! response.setContentType("text/xml"); ! // Need this to prevent Apache SOAP from gacking ! response.getWriter().write(buffer.toString()); ! // } else { ! // response.setStatus(HttpServletResponse.SC_NO_CONTENT); ! // } ! } catch (Exception e) { ! com.babeldoc.core.LogService.getInstance().logError(e); ! throw new ServletException( ! "JAXM POST failed " + e.getMessage(),e); ! } ! } else { ! // TODO send SOAPFault ! com.babeldoc.core.LogService.getInstance().logError( ! com.babeldoc.core.I18n.get("017001"), ! null); ! } ! } else { ! // TODO send SOAPFault ! com.babeldoc.core.LogService.getInstance().logError( ! com.babeldoc.core.I18n.get("017003"), ! null); ! } ! } /** ! * Get the pipeline name from the servlet request path * ! * @param request ! * @return ! * @throws javax.servlet.ServletException */ ! private String getPipeline(HttpServletRequest request) throws ServletException { ! String pipeline = request.getServletPath(); ! if (pipeline.endsWith(DOT_FEED)) { ! pipeline = pipeline.substring(1, pipeline.length() - DOT_FEED.length()); ! } else { ! throw new ServletException(com.babeldoc.core.I18n.get("012005")); } - return pipeline; } ! static MimeHeaders getHeaders(HttpServletRequest req) { ! Enumeration enum = req.getHeaderNames(); ! MimeHeaders headers = new MimeHeaders(); ! while (enum.hasMoreElements()) { ! String headerName = (String) enum.nextElement(); ! String headerValue = req.getHeader(headerName); ! StringTokenizer values = new StringTokenizer(headerValue, ","); ! while (values.hasMoreTokens()) ! headers.addHeader(headerName, values.nextToken().trim()); ! } ! return headers; ! } ! static void putHeaders(MimeHeaders headers, HttpServletResponse res) { ! Iterator it = headers.getAllHeaders(); ! while (it.hasNext()) { ! MimeHeader header = (MimeHeader) it.next(); ! String[] values = headers.getHeader(header.getName()); ! if (values.length == 1) ! res.setHeader(header.getName(), header.getValue()); ! else { ! StringBuffer concat = new StringBuffer(); ! int i = 0; ! while (i < values.length) { ! if (i != 0) ! concat.append(','); ! concat.append(values[i++]); ! } - res.setHeader(header.getName(), concat.toString()); - } - } - } - /** ! * Convert the dom document and and create a pipeline document and add it to the pipeline. * * @param request ! * @param doc ! * @param pipeline */ ! private IJournalTicket[] processSoapDocument(HttpServletRequest request, SOAPMessage msg, ! String pipeline) ! throws com.babeldoc.core.pipeline.PipelineException, JournalException, SOAPException, IOException { ! Vector vec = new Vector(); ! IJournalTicket[] tickets = null; ! ! for (Iterator it = SoapHelper.detachDocuments(msg); it.hasNext();) { ! ! com.babeldoc.core.pipeline.PipelineDocument pdoc = (com.babeldoc.core.pipeline.PipelineDocument)it.next(); ! ! // Apply the request parameters as document attributes ! for (Enumeration parms = request.getParameterNames(); parms.hasMoreElements();) { ! String name = (String) parms.nextElement(); ! String value = request.getParameter(name); ! pdoc.put(name, value); ! } ! try { ! // Get a ticket, add to vector and process ticket. ! IJournalTicket ticket = JournalFactory.getJournal().newTicket(); ! vec.add(ticket); ! com.babeldoc.core.pipeline.PipelineFactoryFactory.process(pipeline, pdoc, ticket, null); ! } catch (Exception e) { ! com.babeldoc.core.LogService.getInstance().logError("something went wrong",e); ! } } ! tickets = new IJournalTicket[vec.size()]; ! if (vec.size() > 0) { ! vec.copyInto((Object[]) tickets); ! } ! return tickets; } --- 95,268 ---- * @version 1.0 */ ! public class SoapPipelineFeeder extends HttpServlet { ! public static final String DOT_FEED = ".feed"; MessageFactory msgFactory; ! /** * doGet - this is illegal - must only accept posts. * * @param request * @param response + * + * @throws IOException DOCUMENT ME! + * @throws ServletException DOCUMENT ME! */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ! com.babeldoc.core.LogService.getInstance().logWarn(com.babeldoc.core.I18n.get( ! "017004")); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); } ! /** ! * doPost This is where the action happens. Extract the soap envelope. ! * ! * @param request ! * @param response ! * ! * @throws IOException DOCUMENT ME! ! * @throws ServletException DOCUMENT ME! ! */ ! public void doPost(HttpServletRequest request, HttpServletResponse response) ! throws IOException, ServletException { ! //debugHeader(request); ! String pipeline = getPipeline(request); ! com.babeldoc.core.LogService.getInstance().logDebug(com.babeldoc.core.I18n.get( ! "017006", pipeline)); ! if (pipeline != null) { ! if (request.getContentLength() > 0) { ! try { ! // Get all the headers from the HTTP request. ! MimeHeaders headers = getHeaders(request); ! // Get the body of the HTTP request. ! ServletInputStream is = request.getInputStream(); ! // Now internalize the contents of the HTTP request and ! // create a SOAPMessage ! SOAPMessage msg = msgFactory.createMessage(headers, is); ! // TODO create a real SOAP response ! IJournalTicket[] tickets = processSoapDocument(request, msg, pipeline); ! // if (tickets.length > 0) { ! StringBuffer buffer = new StringBuffer(); ! buffer.append("<tickets>\n"); ! for (int i = 0; i < tickets.length; ++i) { ! buffer.append("<ticket>" + tickets[i].getId() + "</ticket>\n"); ! } ! buffer.append("</tickets>\n"); ! response.setStatus(HttpServletResponse.SC_OK); ! response.setContentType("text/xml"); ! // Need this to prevent Apache SOAP from gacking ! response.getWriter().write(buffer.toString()); ! ! // } else { ! // response.setStatus(HttpServletResponse.SC_NO_CONTENT); ! // } ! } catch (Exception e) { ! com.babeldoc.core.LogService.getInstance().logError(e); ! throw new ServletException("JAXM POST failed " + e.getMessage(), e); ! } ! } else { ! // TODO send SOAPFault ! com.babeldoc.core.LogService.getInstance().logError(com.babeldoc.core.I18n.get( ! "017001"), null); ! } ! } else { ! // TODO send SOAPFault ! com.babeldoc.core.LogService.getInstance().logError(com.babeldoc.core.I18n.get( ! "017003"), null); ! } ! } /** ! * DOCUMENT ME! * ! * @param servletConfig DOCUMENT ME! ! * ! * @throws ServletException DOCUMENT ME! */ ! public void init(ServletConfig servletConfig) throws ServletException { ! super.init(servletConfig); ! ! try { ! msgFactory = MessageFactory.newInstance(); ! } catch (SOAPException ex) { ! throw new ServletException("Unable to create message factory" + ! ex.getMessage()); } } + static MimeHeaders getHeaders(HttpServletRequest req) { + Enumeration enum = req.getHeaderNames(); + MimeHeaders headers = new MimeHeaders(); ! while (enum.hasMoreElements()) { ! String headerName = (String) enum.nextElement(); ! String headerValue = req.getHeader(headerName); ! StringTokenizer values = new StringTokenizer(headerValue, ","); ! while (values.hasMoreTokens()) { ! headers.addHeader(headerName, values.nextToken().trim()); ! } ! } ! return headers; ! } ! static void putHeaders(MimeHeaders headers, HttpServletResponse res) { ! Iterator it = headers.getAllHeaders(); ! while (it.hasNext()) { ! MimeHeader header = (MimeHeader) it.next(); ! String[] values = headers.getHeader(header.getName()); ! if (values.length == 1) { ! res.setHeader(header.getName(), header.getValue()); ! } else { ! StringBuffer concat = new StringBuffer(); ! int i = 0; ! ! while (i < values.length) { ! if (i != 0) { ! concat.append(','); ! } ! ! concat.append(values[i++]); ! } ! ! res.setHeader(header.getName(), concat.toString()); ! } ! } ! } /** ! * Get the pipeline name from the servlet request path * * @param request ! * ! * @return ! * ! * @throws ServletException */ ! private String getPipeline(HttpServletRequest request) ! throws ServletException { ! String pipeline = request.getServletPath(); ! if (pipeline.endsWith(DOT_FEED)) { ! pipeline = pipeline.substring(1, pipeline.length() - DOT_FEED.length()); ! } else { ! throw new ServletException(com.babeldoc.core.I18n.get("012005")); } ! return pipeline; } *************** *** 253,265 **** // Traverse the HTTP headers and show them on the screen ! for (Enumeration enum = request.getHeaderNames(); ! enum.hasMoreElements();) { String header = (String) enum.nextElement(); String value = request.getHeader(header); ! com.babeldoc.core.LogService.getInstance().logDebug(" " + header + " = " + value); } com.babeldoc.core.LogService.getInstance().logDebug("-----------------------"); } } --- 278,344 ---- // Traverse the HTTP headers and show them on the screen ! for (Enumeration enum = request.getHeaderNames(); enum.hasMoreElements();) { String header = (String) enum.nextElement(); String value = request.getHeader(header); ! com.babeldoc.core.LogService.getInstance().logDebug(" " + header + ! " = " + value); } com.babeldoc.core.LogService.getInstance().logDebug("-----------------------"); + } + + /** + * Convert the dom document and and create a pipeline document and add it to + * the pipeline. + * + * @param request + * @param msg + * @param pipeline + * + * @return DOCUMENT ME! + * + * @throws com.babeldoc.core.pipeline.PipelineException DOCUMENT ME! + * @throws JournalException DOCUMENT ME! + * @throws SOAPException DOCUMENT ME! + * @throws IOException DOCUMENT ME! + */ + private IJournalTicket[] processSoapDocument(HttpServletRequest request, + SOAPMessage msg, String pipeline) + throws com.babeldoc.core.pipeline.PipelineException, JournalException, + SOAPException, IOException { + Vector vec = new Vector(); + IJournalTicket[] tickets = null; + + for (Iterator it = SoapHelper.detachDocuments(msg); it.hasNext();) { + com.babeldoc.core.pipeline.PipelineDocument pdoc = (com.babeldoc.core.pipeline.PipelineDocument) it.next(); + + // Apply the request parameters as document attributes + for (Enumeration parms = request.getParameterNames(); + parms.hasMoreElements();) { + String name = (String) parms.nextElement(); + String value = request.getParameter(name); + pdoc.put(name, value); + } + + try { + // Get a ticket, add to vector and process ticket. + IJournalTicket ticket = JournalFactory.getJournal().newTicket(); + vec.add(ticket); + com.babeldoc.core.pipeline.PipelineFactoryFactory.process(pipeline, + pdoc, ticket, null); + } catch (Exception e) { + com.babeldoc.core.LogService.getInstance().logError("something went wrong", + e); + } + } + + tickets = new IJournalTicket[vec.size()]; + + if (vec.size() > 0) { + vec.copyInto((Object[]) tickets); + } + + return tickets; } } |
Update of /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config
In directory sc8-pr-cvs1:/tmp/cvs-serv19206/modules/gui/src/com/babeldoc/gui/config
Modified Files:
BooleanConfigOptionComponent.java ConfigOptionComponent.java
ConfigOptionComponentFactory.java ConfigOptionPanel.java
DirectoryConfigOptionComponent.java
FilenameConfigOptionComponent.java
MultiLineConfigOptionComponent.java
StringConfigOptionComponent.java
ValueListConfigOptionComponent.java
Added Files:
ConfigOptionActionListener.java ConfigOptionFocusListener.java
ConfigOptionListenerBase.java
Removed Files:
ConfigOptionActionHandler.java
Log Message:
Updated the build system using an explicit modular ant task. This is better than the method previously employed which added "hidden" tasks to the build and clean etc targets. Additionally using a more robust module sorting algorithm.
--- NEW FILE: ConfigOptionActionListener.java ---
package com.babeldoc.gui.config;
import com.babeldoc.core.option.ConfigOption;
import javax.swing.*;
import java.awt.event.ActionListener;
/**
*
*/
public abstract class ConfigOptionActionListener
extends ConfigOptionListenerBase
implements ActionListener {
ConfigOptionActionListener(JComponent component, ConfigOption option) {
super(component, option);
}
}
--- NEW FILE: ConfigOptionFocusListener.java ---
package com.babeldoc.gui.config;
import com.babeldoc.core.option.ConfigOption;
import javax.swing.*;
import java.awt.event.FocusListener;
/**
* Base class for focus listener
*/
public abstract class ConfigOptionFocusListener
extends ConfigOptionListenerBase
implements FocusListener{
public ConfigOptionFocusListener(JComponent component, ConfigOption option) {
super(component, option);
}
}
--- NEW FILE: ConfigOptionListenerBase.java ---
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact ap...@ap....
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* Portions of this software are based upon public domain software
* originally written at the National Center for Supercomputing Applications,
* University of Illinois, Urbana-Champaign.
* ====================================================================
*
* Babeldoc: The Universal Document Processor
*
* $Header: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/ConfigOptionListenerBase.java,v 1.1 2003/06/27 00:14:55 triphop Exp $
* $DateTime$
* $Author: triphop $
*
*/
package com.babeldoc.gui.config;
import com.babeldoc.core.option.ConfigOption;
import java.awt.event.ActionListener;
import javax.swing.*;
/**
* Very lightweight listener that is used for
*/
public class ConfigOptionListenerBase {
private ConfigOption option;
private JComponent component;
/**
* Creates a new ConfigOptionListenerBase object.
*
* @param component DOCUMENT ME!
* @param option DOCUMENT ME!
*/
public ConfigOptionListenerBase(JComponent component, ConfigOption option) {
this.component = component;
this.option = option;
}
/**
* TODO: DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
public JComponent getComponent() {
return component;
}
/**
* TODO: DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
public ConfigOption getOption() {
return option;
}
}
Index: BooleanConfigOptionComponent.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/BooleanConfigOptionComponent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** BooleanConfigOptionComponent.java 11 Jun 2003 23:35:37 -0000 1.4
--- BooleanConfigOptionComponent.java 27 Jun 2003 00:14:55 -0000 1.5
***************
*** 70,73 ****
--- 70,74 ----
import java.awt.event.ActionEvent;
+ import java.awt.event.FocusEvent;
import java.util.Map;
***************
*** 118,127 ****
box = new JCheckBox();
box.setToolTipText(getOption().getDescription());
! box.addActionListener(new ConfigOptionActionHandler(box, this.getOption()) {
! public void actionPerformed(ActionEvent e) {
! boolean selected = ((JCheckBox) getComponent()).isSelected();
! getOption().setValue(Boolean.toString(selected));
! }
! });
}
--- 119,131 ----
box = new JCheckBox();
box.setToolTipText(getOption().getDescription());
! box.addFocusListener(new ConfigOptionFocusListener(box, this.getOption()) {
! public void focusGained(FocusEvent e) {
! }
!
! public void focusLost(FocusEvent e) {
! boolean selected = ((JCheckBox) getComponent()).isSelected();
! getOption().setValue(Boolean.toString(selected));
! }
! });
}
Index: ConfigOptionComponent.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/ConfigOptionComponent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ConfigOptionComponent.java 11 Jun 2003 23:35:37 -0000 1.4
--- ConfigOptionComponent.java 27 Jun 2003 00:14:55 -0000 1.5
***************
*** 104,115 ****
/**
- * Get the configuration data for the option. This is abstract as every
- * option can be different.
- *
- * @return
- */
- public abstract Map getConfigurationData();
-
- /**
* Set the focus on this component.
*/
--- 104,107 ----
***************
*** 131,140 ****
/**
! * Display the default value. This should be obtains from the configoption
*/
public abstract void displayConfigValue();
/**
! * display default value. This should be obtains from the configoption
*/
public abstract void displayDefault();
--- 123,132 ----
/**
! * Display the default value. This should be obtained from the configoption
*/
public abstract void displayConfigValue();
/**
! * display default value. This should be obtained from the configoption
*/
public abstract void displayDefault();
Index: ConfigOptionComponentFactory.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/ConfigOptionComponentFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ConfigOptionComponentFactory.java 11 Jun 2003 23:35:37 -0000 1.4
--- ConfigOptionComponentFactory.java 27 Jun 2003 00:14:55 -0000 1.5
***************
*** 98,103 ****
} else if (otype instanceof MultiLineConfigOptionType) {
return new MultiLineConfigOptionComponent(option);
! } else if (otype instanceof ComplexConfigOptionType) {
! return new ComplexConfigOptionComponent(option);
} else {
return new StringConfigOptionComponent(option);
--- 98,103 ----
} else if (otype instanceof MultiLineConfigOptionType) {
return new MultiLineConfigOptionComponent(option);
! // } else if (otype instanceof ComplexConfigOptionType) {
! // return new ComplexConfigOptionComponent(option);
} else {
return new StringConfigOptionComponent(option);
Index: ConfigOptionPanel.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/ConfigOptionPanel.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ConfigOptionPanel.java 12 Jun 2003 05:00:34 -0000 1.6
--- ConfigOptionPanel.java 27 Jun 2003 00:14:55 -0000 1.7
***************
*** 125,129 ****
ConfigOptionComponent configcomp = (ConfigOptionComponent) iterator.next();
! properties.putAll(configcomp.getConfigurationData());
}
--- 125,130 ----
ConfigOptionComponent configcomp = (ConfigOptionComponent) iterator.next();
! // TODO
! //properties.putAll(configcomp.getConfigurationData());
}
Index: DirectoryConfigOptionComponent.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/DirectoryConfigOptionComponent.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** DirectoryConfigOptionComponent.java 11 Jun 2003 23:35:37 -0000 1.5
--- DirectoryConfigOptionComponent.java 27 Jun 2003 00:14:55 -0000 1.6
***************
*** 110,114 ****
JButton button = new JButton("...");
! button.addActionListener(new ConfigOptionActionHandler(field, getOption()) {
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser();
--- 110,114 ----
JButton button = new JButton("...");
! button.addActionListener(new ConfigOptionActionListener(field, getOption()) {
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser();
Index: FilenameConfigOptionComponent.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/FilenameConfigOptionComponent.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** FilenameConfigOptionComponent.java 11 Jun 2003 23:35:37 -0000 1.5
--- FilenameConfigOptionComponent.java 27 Jun 2003 00:14:55 -0000 1.6
***************
*** 111,115 ****
JButton button = new JButton("...");
! button.addActionListener(new ConfigOptionActionHandler(field, getOption()) {
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser();
--- 111,115 ----
JButton button = new JButton("...");
! button.addActionListener(new ConfigOptionActionListener(field, getOption()) {
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser();
Index: MultiLineConfigOptionComponent.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/MultiLineConfigOptionComponent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** MultiLineConfigOptionComponent.java 11 Jun 2003 23:35:37 -0000 1.4
--- MultiLineConfigOptionComponent.java 27 Jun 2003 00:14:55 -0000 1.5
***************
*** 69,74 ****
--- 69,76 ----
import java.awt.*;
+ import java.awt.event.FocusEvent;
import javax.swing.*;
+ import javax.swing.text.JTextComponent;
***************
*** 107,110 ****
--- 109,119 ----
field.setToolTipText(getOption().getDescription());
field.setPreferredSize(new Dimension(1000, 50));
+ field.addFocusListener(new ConfigOptionFocusListener (field, this.getOption()) {
+ public void focusGained(FocusEvent e) {
+ }
+ public void focusLost(FocusEvent e) {
+ getOption().setValue(((JTextComponent)getComponent()).getText());
+ }
+ });
}
Index: StringConfigOptionComponent.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/StringConfigOptionComponent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** StringConfigOptionComponent.java 11 Jun 2003 23:35:37 -0000 1.4
--- StringConfigOptionComponent.java 27 Jun 2003 00:14:55 -0000 1.5
***************
*** 69,72 ****
--- 69,73 ----
import java.awt.*;
+ import java.awt.event.FocusEvent;
import java.util.Map;
***************
*** 125,128 ****
--- 126,136 ----
field.setText(getOption().getDefaultValue());
}
+ field.addFocusListener(new ConfigOptionFocusListener (field, this.getOption()) {
+ public void focusGained(FocusEvent e) {
+ }
+ public void focusLost(FocusEvent e) {
+ getOption().setValue(((JTextComponent)getComponent()).getText());
+ }
+ });
field.setToolTipText(getOption().getDescription());
Index: ValueListConfigOptionComponent.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/config/ValueListConfigOptionComponent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ValueListConfigOptionComponent.java 11 Jun 2003 23:35:37 -0000 1.4
--- ValueListConfigOptionComponent.java 27 Jun 2003 00:14:55 -0000 1.5
***************
*** 70,77 ****
--- 70,79 ----
import java.awt.*;
+ import java.awt.event.FocusEvent;
import java.util.Map;
import javax.swing.*;
+ import javax.swing.text.JTextComponent;
***************
*** 124,127 ****
--- 126,138 ----
combo.setSelectedItem(getOption().getDefaultValue());
}
+
+ combo.addFocusListener(new ConfigOptionFocusListener(combo, getOption()) {
+ public void focusGained(FocusEvent e) {
+ }
+
+ public void focusLost(FocusEvent e) {
+ getOption().setValue(((JComboBox)getComponent()).getSelectedItem());
+ }
+ });
combo.setToolTipText(getOption().getDescription());
--- ConfigOptionActionHandler.java DELETED ---
|
|
From: <tr...@us...> - 2003-06-27 00:15:10
|
Update of /cvsroot/babeldoc/babeldoc/support/src/com/babeldoc/bootstrap/ant
In directory sc8-pr-cvs1:/tmp/cvs-serv19206/support/src/com/babeldoc/bootstrap/ant
Modified Files:
ModuleFinder.java
Log Message:
Updated the build system using an explicit modular ant task. This is better than the method previously employed which added "hidden" tasks to the build and clean etc targets. Additionally using a more robust module sorting algorithm.
Index: ModuleFinder.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/support/src/com/babeldoc/bootstrap/ant/ModuleFinder.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ModuleFinder.java 24 Jun 2003 03:27:13 -0000 1.5
--- ModuleFinder.java 27 Jun 2003 00:14:56 -0000 1.6
***************
*** 46,49 ****
--- 46,53 ----
public static final String DEPENDS = "Depends";
+ private static final String CORE = "core";
+ private static final String VISITING = "VISITING";
+ private static final String VISITED = "VISITED";
+
private String moduleSearchPath = "";
private String modulesProperty = "";
***************
*** 92,117 ****
public void execute() throws BuildException {
try {
! if(moduleSearchPath==null) {
throw new BuildException("Must provide 'moduleSearchPath'");
! } else if(modulesProperty==null) {
throw new BuildException("Must provide 'modulesProperty'");
} else {
Map moduleMap = new HashMap();
! for(StringTokenizer st = new StringTokenizer(moduleSearchPath);st.hasMoreTokens();) {
String part = st.nextToken();
- // System.out.println("doing module directory: "+part);
File file = new File(part);
discoverModulesInPath(moduleMap, file);
}
! if(moduleMap.size() == 0) {
throw new BuildException("No moduleMap found!");
} else {
! BabeldocBuildModule [] modules = getSortedModules(moduleMap);
StringBuffer buffer = new StringBuffer();
boolean first = true;
! for(int i = 0; i < modules.length; ++i) {
String part = modules[i].path;
! if(first) {
first = false;
} else {
--- 96,120 ----
public void execute() throws BuildException {
try {
! if (moduleSearchPath == null) {
throw new BuildException("Must provide 'moduleSearchPath'");
! } else if (modulesProperty == null) {
throw new BuildException("Must provide 'modulesProperty'");
} else {
Map moduleMap = new HashMap();
! for (StringTokenizer st = new StringTokenizer(moduleSearchPath); st.hasMoreTokens();) {
String part = st.nextToken();
File file = new File(part);
discoverModulesInPath(moduleMap, file);
}
! if (moduleMap.size() == 0) {
throw new BuildException("No moduleMap found!");
} else {
! BabeldocBuildModule[] modules = getSortedModules(moduleMap);
StringBuffer buffer = new StringBuffer();
boolean first = true;
! for (int i = 0; i < modules.length; ++i) {
String part = modules[i].path;
! if (first) {
first = false;
} else {
***************
*** 123,141 ****
// Now handle the subdirectories.
! if(subdirectories!=null) {
! for(StringTokenizer st2 = new StringTokenizer(subdirectories); st2.hasMoreTokens();) {
buffer = new StringBuffer();
String dir = st2.nextToken();
first = true;
! for(int i = 0; i < modules.length; ++i) {
String part = modules[i].path;
! if(first) {
first = false;
} else {
buffer.append(File.pathSeparator);
}
! buffer.append(part+File.separatorChar+dir);
}
! String property = modulesProperty+"_"+dir;
project.setNewProperty(property, buffer.toString());
}
--- 126,144 ----
// Now handle the subdirectories.
! if (subdirectories != null) {
! for (StringTokenizer st2 = new StringTokenizer(subdirectories); st2.hasMoreTokens();) {
buffer = new StringBuffer();
String dir = st2.nextToken();
first = true;
! for (int i = 0; i < modules.length; ++i) {
String part = modules[i].path;
! if (first) {
first = false;
} else {
buffer.append(File.pathSeparator);
}
! buffer.append(part + File.separatorChar + dir);
}
! String property = modulesProperty + "_" + dir;
project.setNewProperty(property, buffer.toString());
}
***************
*** 150,153 ****
--- 153,169 ----
}
+ private static BuildException makeCircularException(String end, Stack stk) {
+ StringBuffer sb = new StringBuffer("Circular dependency: ");
+ sb.append(end);
+ String c;
+ do {
+ c = (String) stk.pop();
+ sb.append(" <- ");
+ sb.append(c);
+ } while (!c.equals(end));
+
+ return new BuildException(new String(sb));
+ }
+
/**
* Get an array of sorted modules. The first element in the array should be be
***************
*** 156,201 ****
* @return array of modules, sorted from least dependant to most.
*/
! private BabeldocBuildModule[] getSortedModules(Map moduleMap) {
! BabeldocBuildModule [] modules = new BabeldocBuildModule[moduleMap.size()];
! moduleMap.values().toArray(modules);
! for(int i = 0; i<modules.length; ++i ) {
! for(int j = 0; j<modules.length; ++j) {
! if(i==j) {
! continue;
! }
! BabeldocBuildModule mod1 = modules[i];
! BabeldocBuildModule mod2 = modules[j];
! if(!dependsOn(moduleMap, mod1, mod2)) {
! BabeldocBuildModule tmp = modules[i];
! modules[i] = modules[j];
! modules[j] = tmp;
! }
}
}
! return modules;
}
/**
! * Returns true if mod1 depends on mod2. This is a fairly expensive operation.
*
! * @param mod1 the lefthand argument
! * @param mod2 the righthand argument
! * @return wether left argument depends on the right argment
*/
! private boolean dependsOn(Map moduleMap, BabeldocBuildModule mod1, BabeldocBuildModule mod2) {
! if(mod1.depends!=null) {
! for(int i = 0; i < mod1.depends.length; ++i) {
! String depName = mod1.depends[i];
! if(depName.equals(mod2.name)) {
! return true;
! } else {
! BabeldocBuildModule depMod = (BabeldocBuildModule)moduleMap.get(depName);
! return dependsOn(moduleMap, depMod, mod2);
}
}
}
! return false;
}
--- 172,260 ----
* @return array of modules, sorted from least dependant to most.
*/
! private BabeldocBuildModule[] getSortedModules(Map moduleMap)
! throws BuildException {
! Collection ret = new ArrayList();
! Map state = new HashMap();
! Stack visiting = new Stack();
! /** Handle the core module - always first in list */
! state.put(CORE, VISITED);
! ret.add(moduleMap.get(CORE));
! /** Now iterate over each of the modules, sorting as we go */
! for (Iterator en = moduleMap.keySet().iterator(); en.hasNext();) {
! String currModuleName = (String)en.next();
! String currModuleState = (String) state.get(currModuleName);
!
! if (currModuleState == null) {
! treeSort(currModuleName, moduleMap, state, visiting, ret);
! } else if (currModuleState == VISITING) {
! throw new RuntimeException("Unexpected node in visiting state: " + currModuleName);
}
}
!
! return (BabeldocBuildModule[])ret.toArray(new BabeldocBuildModule[0]);
}
/**
! * Sort the nodes from the root node. This is a topographical sort
*
! * @param root
! * @param moduleMap
! * @param state
! * @param visiting
! * @param ret
! * @throws BuildException
*/
! private final void treeSort(String root, Map moduleMap, Map state, Stack visiting,
! Collection ret)
! throws BuildException {
! state.put(root, VISITING);
! visiting.push(root);
!
! BabeldocBuildModule module = (BabeldocBuildModule) moduleMap.get(root);
!
! // Make sure we exist
! if (module == null) {
! StringBuffer sb = new StringBuffer("Module `");
!
! sb.append(root);
! sb.append("' does not exist. ");
!
! visiting.pop();
! if (!visiting.empty()) {
! String parent = (String) visiting.peek();
!
! sb.append("It is used from module `");
! sb.append(parent);
! sb.append("'.");
! }
!
! throw new BuildException(new String(sb));
! }
!
! if(module.depends!=null) {
! for (int i = 0; i < module.depends.length; i++) {
! String currModuleName = module.depends[i];
! String currModuleState = (String) state.get(currModuleName);
!
! if (currModuleState == null) {
! // Not been visited
! treeSort(currModuleName, moduleMap, state, visiting, ret);
! } else if (currModuleState == VISITING) {
! // Currently visiting this node, so have a cycle
! throw makeCircularException(currModuleName, visiting);
}
}
}
!
! String p = (String) visiting.pop();
!
! if (root != p) {
! throw new RuntimeException("Unexpected internal error: expected to " + "pop " + root + " but got " + p);
! }
!
! state.put(root, VISITED);
! ret.add(module);
}
***************
*** 209,221 ****
*/
private void discoverModulesInPath(Map modules, File file)
! throws Exception{
! if(file.isDirectory()) {
File[] files = file.listFiles();
! for(int i = 0; i < files.length; ++i) {
discoverModulesInPath(modules, files[i]);
}
} else {
! if(BUILD_PROPERTIES.equals(file.getName())) {
// System.out.println("Analyzing file: "+file.toString());
Properties properties = new Properties();
--- 268,280 ----
*/
private void discoverModulesInPath(Map modules, File file)
! throws Exception {
! if (file.isDirectory()) {
File[] files = file.listFiles();
! for (int i = 0; i < files.length; ++i) {
discoverModulesInPath(modules, files[i]);
}
} else {
! if (BUILD_PROPERTIES.equals(file.getName())) {
// System.out.println("Analyzing file: "+file.toString());
Properties properties = new Properties();
***************
*** 224,233 ****
fis = new FileInputStream(file);
properties.load(fis);
! } catch(Exception e) {
throw e;
} finally {
fis.close();
}
! if(properties.containsKey(MODULE)) {
BabeldocBuildModule buildModule = makeBuildModule(properties, file);
modules.put(buildModule.name, buildModule);
--- 283,292 ----
fis = new FileInputStream(file);
properties.load(fis);
! } catch (Exception e) {
throw e;
} finally {
fis.close();
}
! if (properties.containsKey(MODULE)) {
BabeldocBuildModule buildModule = makeBuildModule(properties, file);
modules.put(buildModule.name, buildModule);
***************
*** 252,261 ****
String dependsList = properties.getProperty(DEPENDS);
! if(dependsList!=null) {
StringTokenizer st = new StringTokenizer(dependsList, " ,");
int numDepends = st.countTokens();
! if(numDepends>0) {
buildModule.depends = new String[numDepends];
! for(int i = 0; i < numDepends; ++i) {
buildModule.depends[i] = st.nextToken();
}
--- 311,320 ----
String dependsList = properties.getProperty(DEPENDS);
! if (dependsList != null) {
StringTokenizer st = new StringTokenizer(dependsList, " ,");
int numDepends = st.countTokens();
! if (numDepends > 0) {
buildModule.depends = new String[numDepends];
! for (int i = 0; i < numDepends; ++i) {
buildModule.depends[i] = st.nextToken();
}
***************
*** 269,273 ****
class BabeldocBuildModule {
String name;
! String [] depends;
String path;
--- 328,332 ----
class BabeldocBuildModule {
String name;
! String[] depends;
String path;
***************
*** 278,283 ****
sb.append(path);
sb.append(", depends: ");
! if(depends!=null) {
! for(int i = 0; i < depends.length; ++i) {
sb.append(depends[i]);
sb.append(", ");
--- 337,342 ----
sb.append(path);
sb.append(", depends: ");
! if (depends != null) {
! for (int i = 0; i < depends.length; ++i) {
sb.append(depends[i]);
sb.append(", ");
|
|
From: <tr...@us...> - 2003-06-27 00:15:09
|
Update of /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/stage In directory sc8-pr-cvs1:/tmp/cvs-serv19206/modules/soap/src/com/babeldoc/soap/pipeline/stage Modified Files: SoapWriterPipelineStage.java Log Message: Updated the build system using an explicit modular ant task. This is better than the method previously employed which added "hidden" tasks to the build and clean etc targets. Additionally using a more robust module sorting algorithm. Index: SoapWriterPipelineStage.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/pipeline/stage/SoapWriterPipelineStage.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SoapWriterPipelineStage.java 8 Jun 2003 18:23:46 -0000 1.8 --- SoapWriterPipelineStage.java 27 Jun 2003 00:14:56 -0000 1.9 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/24 18:15:55 $ * * ! * babeldoc: universal document processor * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.babeldoc.soap.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.soap.pipeline.stage; *************** *** 27,37 **** import com.babeldoc.core.option.IConfigOptionType; import com.babeldoc.core.pipeline.*; import com.babeldoc.soap.pipeline.util.SoapHelper; - import javax.xml.messaging.URLEndpoint; - import javax.xml.soap.*; import java.util.ArrayList; import java.util.Collection; /** --- 71,83 ---- import com.babeldoc.core.option.IConfigOptionType; import com.babeldoc.core.pipeline.*; + import com.babeldoc.soap.pipeline.util.SoapHelper; import java.util.ArrayList; import java.util.Collection; + import javax.xml.messaging.URLEndpoint; + import javax.xml.soap.*; + /** *************** *** 41,50 **** * @version 1.0 */ ! public class SoapWriterPipelineStage ! extends PipelineStage { ! ! public final static String SOAP_URL = "soapUrl"; ! public final static String SOAP_ACTION = "soapAction"; ! public final static String RESULT_STAGE = "resultStage"; /** --- 87,94 ---- * @version 1.0 */ ! public class SoapWriterPipelineStage extends PipelineStage { ! public static final String SOAP_URL = "soapUrl"; ! public static final String SOAP_ACTION = "soapAction"; ! public static final String RESULT_STAGE = "resultStage"; /** *************** *** 53,78 **** public SoapWriterPipelineStage() { super(new PipelineStageInfo() { ! public String getName() { ! return "SoapWriter"; ! } ! public String getDescription() { ! return I18n.get("soap.100"); ! } ! public Collection getTypeSpecificOptions() { ! ArrayList options = new ArrayList(); ! //add specific options ! options.add(new ConfigOption(SOAP_URL, IConfigOptionType.URL, null, ! false, I18n.get("soap.101"))); ! options.add(new ConfigOption(SOAP_ACTION, IConfigOptionType.STRING, ! null, false, I18n.get("soap.102"))); ! options.add(new ConfigOption(RESULT_STAGE, IConfigOptionType.STRING, ! null, true, I18n.get("soap.103"))); ! return options; ! } ! }); } --- 97,122 ---- public SoapWriterPipelineStage() { super(new PipelineStageInfo() { ! public String getName() { ! return "SoapWriter"; ! } ! public String getDescription() { ! return I18n.get("soap.100"); ! } ! public Collection getTypeSpecificOptions() { ! ArrayList options = new ArrayList(); ! //add specific options ! options.add(new ConfigOption(SOAP_URL, IConfigOptionType.URL, null, ! false, I18n.get("soap.101"))); ! options.add(new ConfigOption(SOAP_ACTION, IConfigOptionType.STRING, ! null, false, I18n.get("soap.102"))); ! options.add(new ConfigOption(RESULT_STAGE, IConfigOptionType.STRING, ! null, true, I18n.get("soap.103"))); ! return options; ! } ! }); } *************** *** 83,116 **** * @param soapAction * @param document */ public static String sendSoapMessage(String soapUrl, String soapAction, ! PipelineDocument document) throws Exception { ! // create a message ! MessageFactory mf = MessageFactory.newInstance(); ! SOAPMessage message = mf.createMessage(); ! ! // add the document from the pipeline ! SoapHelper.attachDocument(message,document); ! ! // add the SOAPAction header MimeHeaders headers = message.getMimeHeaders(); headers.addHeader("SOAPAction", soapAction); ! // establish the connection ! URLEndpoint endPoint = new URLEndpoint(soapUrl); ! SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance(); ! SOAPConnection connection = scf.createConnection(); ! ! // send the message and get the reply ! SOAPMessage reply = connection.call(message, endPoint); ! // close the connection ! connection.close(); ! ! // TODO process the reply ! // if (SoapHelper.containsFault(reply)) { ! // throw new Exception("soapFault") ! // } return null; } --- 127,163 ---- * @param soapAction * @param document + * + * @return DOCUMENT ME! + * + * @throws Exception DOCUMENT ME! */ public static String sendSoapMessage(String soapUrl, String soapAction, ! PipelineDocument document) throws Exception { ! // create a message ! MessageFactory mf = MessageFactory.newInstance(); ! SOAPMessage message = mf.createMessage(); ! ! // add the document from the pipeline ! SoapHelper.attachDocument(message, document); ! ! // add the SOAPAction header MimeHeaders headers = message.getMimeHeaders(); headers.addHeader("SOAPAction", soapAction); ! // establish the connection ! URLEndpoint endPoint = new URLEndpoint(soapUrl); ! SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance(); ! SOAPConnection connection = scf.createConnection(); ! // send the message and get the reply ! SOAPMessage reply = connection.call(message, endPoint); ! ! // close the connection ! connection.close(); + // TODO process the reply + // if (SoapHelper.containsFault(reply)) { + // throw new Exception("soapFault") + // } return null; } *************** *** 120,123 **** --- 167,172 ---- * * @return the name of the next stage in the pipe line or nothing + * + * @throws PipelineException DOCUMENT ME! */ public PipelineStageResult[] process() throws PipelineException { |
|
From: <tr...@us...> - 2003-06-27 00:15:08
|
Update of /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/module In directory sc8-pr-cvs1:/tmp/cvs-serv19206/modules/soap/src/com/babeldoc/soap/module Modified Files: SoapModule.java Log Message: Updated the build system using an explicit modular ant task. This is better than the method previously employed which added "hidden" tasks to the build and clean etc targets. Additionally using a more robust module sorting algorithm. Index: SoapModule.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/soap/src/com/babeldoc/soap/module/SoapModule.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SoapModule.java 22 May 2003 03:20:31 -0000 1.2 --- SoapModule.java 27 Jun 2003 00:14:55 -0000 1.3 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime$ * * ! * babeldoc: universal document processor * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.babeldoc.soap.module; --- 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.soap.module; *************** *** 31,51 **** * This is the soap module - please look around but dont touch. * ! * @author bmcdonald * @version 1.0 */ ! ! public class SoapModule ! extends BabeldocModule { ! ! public final static String MODULE = "soap"; ! ! /** ! * The Name of the module is soap - and dont you forget it! ! * ! * @return ! */ ! public String getName() { ! return MODULE; ! } /** --- 75,83 ---- * This is the soap module - please look around but dont touch. * ! * @author bmcdonald * @version 1.0 */ ! public class SoapModule extends BabeldocModule { ! public static final String MODULE = "soap"; /** *************** *** 58,62 **** --- 90,104 ---- set.add("core"); set.add("web"); + return set; + } + + /** + * The Name of the module is soap - and dont you forget it! + * + * @return + */ + public String getName() { + return MODULE; } } |
|
From: <tr...@us...> - 2003-06-27 00:15:07
|
Update of /cvsroot/babeldoc/babeldoc/support/ant/lib In directory sc8-pr-cvs1:/tmp/cvs-serv19206/support/ant/lib Modified Files: babeldoc_bootstrap.jar Log Message: Updated the build system using an explicit modular ant task. This is better than the method previously employed which added "hidden" tasks to the build and clean etc targets. Additionally using a more robust module sorting algorithm. Index: babeldoc_bootstrap.jar =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/support/ant/lib/babeldoc_bootstrap.jar,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 Binary files /tmp/cvsSaUPeO and /tmp/cvs2FWEds differ |
|
From: <tr...@us...> - 2003-06-27 00:15:06
|
Update of /cvsroot/babeldoc/babeldoc
In directory sc8-pr-cvs1:/tmp/cvs-serv19206
Modified Files:
build.xml
Log Message:
Updated the build system using an explicit modular ant task. This is better than the method previously employed which added "hidden" tasks to the build and clean etc targets. Additionally using a more robust module sorting algorithm.
Index: build.xml
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/build.xml,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** build.xml 11 Jun 2003 03:24:01 -0000 1.12
--- build.xml 27 Jun 2003 00:14:55 -0000 1.13
***************
*** 75,84 ****
name="declare"
description="Declare the babeldoc tasks">
- <taskdef name="babeldocdep"
- classname="com.babeldoc.bootstrap.ant.DependencyBuilder"/>
<taskdef name="modulefinder"
classname="com.babeldoc.bootstrap.ant.ModuleFinder"/>
<taskdef name="pathtrimmer"
classname="com.babeldoc.bootstrap.ant.PathTrimmer"/>
<taskdef name="jalopy"
classname="de.hunsicker.jalopy.plugin.ant.AntPlugin"/>
--- 75,84 ----
name="declare"
description="Declare the babeldoc tasks">
<taskdef name="modulefinder"
classname="com.babeldoc.bootstrap.ant.ModuleFinder"/>
<taskdef name="pathtrimmer"
classname="com.babeldoc.bootstrap.ant.PathTrimmer"/>
+ <taskdef name="moduleRunner"
+ classname="com.babeldoc.bootstrap.ant.ModuleRunnerTask"/>
<taskdef name="jalopy"
classname="de.hunsicker.jalopy.plugin.ant.AntPlugin"/>
***************
*** 97,106 ****
subdirectories="src build config"
/>
! <babeldocdep
! modulePropFiles="${babeldoc_modules}"
! modulesProperty="babeldoc_modules_sorted"
! targets="clean build deploy test format"
! />
! <echo message="Build order: ${babeldoc_modules_sorted}"/>
</target>
--- 97,105 ----
subdirectories="src build config"
/>
!
! <!--
! <echo message="${babeldoc_modules}"/>
! <echo message="${babeldoc_modules_src}"/>
! -->
</target>
***************
*** 110,114 ****
<!--
! javadocumention
-->
<target
--- 109,113 ----
<!--
! generate javadoc-umention
-->
<target
***************
*** 134,139 ****
<!--
! Dummy target - this has tasks added to it programmatically by
! setup_dependencies
-->
<target
--- 133,137 ----
<!--
! Clean target - call clean on all the modules
-->
<target
***************
*** 141,182 ****
depends="depends">
<delete dir="${build}"/>
</target>
- <!--
- Dummy target - this has tasks added to it programmatically by depends
- -->
<target
! name="build"
depends="depends">
- <echo message="Building Babeldoc in: ${base_dir}"/>
<mkdir dir="./build"/>
<mkdir dir="./build/lib"/>
<mkdir dir="./build/examples"/>
<mkdir dir="./build/readme"/>
</target>
<!--
! Dummy target - this has tasks added to it programmatically by depends
-->
<target
name="deploy"
! depends="depends"/>
<!--
! Dummy target - this has tasks added to it programmatically by depends
-->
<target
name="test"
depends="depends">
! <echo message="Testing Babeldoc in: ${base_dir}"/>
</target>
<!--
! Dummy target - this has tasks added to it programmatically by depends
-->
<target
name="format"
depends="depends">
! <echo message="Formatting Babeldoc in: ${base_dir}"/>
</target>
</project>
--- 139,196 ----
depends="depends">
<delete dir="${build}"/>
+ <moduleRunner target="clean" modules="${babeldoc_modules}"/>
</target>
<target
! name="setup"
depends="depends">
<mkdir dir="./build"/>
<mkdir dir="./build/lib"/>
<mkdir dir="./build/examples"/>
<mkdir dir="./build/readme"/>
+ <mkdir dir="./build/support"/>
+ <moduleRunner target="setup" modules="${babeldoc_modules}"/>
+ </target>
+ <!--
+ Build target - call build on all the modules
+ -->
+ <target
+ name="build"
+ depends="depends">
+ <available file="./build" type="dir" property="setup.done"/>
+ <fail message="Setup has not been run - run 'build setup' first" unless="setup.done"/>
+
+ <moduleRunner target="build" modules="${babeldoc_modules}"/>
</target>
<!--
! deploy target - call deploy on all the modules
-->
<target
name="deploy"
! depends="depends">
! <available file="./build" type="dir" property="setup.done"/>
! <fail message="Setup has not been run - run 'build setup' first" unless="setup.done"/>
! <moduleRunner target="deploy" modules="${babeldoc_modules}"/>
! </target>
<!--
! test target - call test on all the modules
-->
<target
name="test"
depends="depends">
! <available file="./build" type="dir" property="setup.done"/>
! <fail message="Setup has not been run - run 'build setup' first" unless="setup.done"/>
! <moduleRunner target="test" modules="${babeldoc_modules}"/>
</target>
<!--
! format target - call format on all the modules
-->
<target
name="format"
depends="depends">
! <moduleRunner target="format" modules="${babeldoc_modules}"/>
</target>
</project>
|