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 02:20:31
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal In directory sc8-pr-cvs1:/tmp/cvs-serv700/src/com/babeldoc/core/journal Modified Files: IJournal.java IJournalStatus.java IJournalTicket.java Journal.java JournalException.java JournalFactory.java JournalOperation.java JournalStatus.java JournalTest.java JournalTicket.java JournalType.java Log Message: reformatted and updated license header |
|
From: <tr...@us...> - 2003-06-27 02:20:31
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/config In directory sc8-pr-cvs1:/tmp/cvs-serv700/src/com/babeldoc/core/config Modified Files: ConfigService.java IConfig.java IConfigService.java Log Message: reformatted and updated license header |
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core In directory sc8-pr-cvs1:/tmp/cvs-serv700/src/com/babeldoc/core Modified Files: BabeldocCommand.java EnvironmentLoader.java GeneralException.java I18n.java INamed.java LogService.java Main.java NameValuePair.java Named.java Pair.java ResourceLoader.java RmiRegistry.java Type.java VariableProcessor.java VelocityUtilityContext.java Log Message: reformatted and updated license header |
|
From: <tr...@us...> - 2003-06-27 02:20:29
|
Update of /cvsroot/babeldoc/babeldoc/modules/core In directory sc8-pr-cvs1:/tmp/cvs-serv700 Modified Files: build.xml Log Message: reformatted and updated license header |
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/xml In directory sc8-pr-cvs1:/tmp/cvs-serv700/src/com/babeldoc/core/pipeline/xml Modified Files: IUnmarshaller.java XmlPipelineStageFactory.java XmlPipelineStageResolver.java XmlPipelineUnmarshaller.java Log Message: reformatted and updated license header Index: IUnmarshaller.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/xml/IUnmarshaller.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IUnmarshaller.java 15 Mar 2003 21:54:36 -0000 1.2 --- IUnmarshaller.java 27 Jun 2003 02:19:59 -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.core.pipeline.xml; - /** * Interface that all pipeline stage configuration unmarshallers --- 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.core.pipeline.xml; /** * Interface that all pipeline stage configuration unmarshallers *************** *** 33,47 **** /** ! * Get root configuration object * ! * @return */ ! public com.babeldoc.core.pipeline.PipelineStageConfig getRootConfig(); /** ! * Get the array of pipeline stage connections * ! * @return array of connections. */ ! public com.babeldoc.core.pipeline.PipelineStageConnection[] getPipelineStageConnections(); } --- 76,90 ---- /** ! * Get the array of pipeline stage connections * ! * @return array of connections. */ ! public com.babeldoc.core.pipeline.PipelineStageConnection[] getPipelineStageConnections(); /** ! * Get root configuration object * ! * @return */ ! public com.babeldoc.core.pipeline.PipelineStageConfig getRootConfig(); } Index: XmlPipelineStageFactory.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/xml/XmlPipelineStageFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** XmlPipelineStageFactory.java 8 Jun 2003 18:23:46 -0000 1.5 --- XmlPipelineStageFactory.java 27 Jun 2003 02:19:59 -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.core.pipeline.xml; --- 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.core.pipeline.xml; *************** *** 27,48 **** import java.io.IOException; import java.util.HashMap; import java.util.Map; /** ! * A xml based pipeline stage factory. Please see the schema in the readme/readme for the ! * pipeline definition xml. This is the preferred method for large pipeline stages. The ! * main issue with XML based pipeline configurations is that it cant participate in ! * configuration merging * * @author bmcdonald * @version 1.0 */ ! public class XmlPipelineStageFactory ! extends PipelineStageFactory { ! /** constant: Configuration constants */ ! public final static String XML_FILENAME = "configFile"; ! /** --- 71,91 ---- import java.io.IOException; + import java.util.HashMap; import java.util.Map; + /** ! * A xml based pipeline stage factory. Please see the schema in the ! * readme/readme for the pipeline definition xml. This is the preferred ! * method for large pipeline stages. The main issue with XML based pipeline ! * configurations is that it cant participate in configuration merging * * @author bmcdonald * @version 1.0 */ ! public class XmlPipelineStageFactory extends PipelineStageFactory { /** constant: Configuration constants */ ! public static final String XML_FILENAME = "configFile"; /** *************** *** 53,71 **** } - /** ! * Set the options. Once the the options have been set we can do the configuration ! * loving. * * @param options the hashtable of options. */ ! public void setOptions(Map options) ! throws PipelineException { super.setOptions(options); String fileName = (String) options.get(XML_FILENAME); try { setResolver(new XmlPipelineStageResolver(fileName)); ! } catch(IOException e) { throw new PipelineException(I18n.get("002001", fileName), e); } --- 96,115 ---- } /** ! * Set the options. Once the the options have been set we can do the ! * configuration loving. * * @param options the hashtable of options. + * + * @throws PipelineException DOCUMENT ME! */ ! public void setOptions(Map options) throws PipelineException { super.setOptions(options); String fileName = (String) options.get(XML_FILENAME); + try { setResolver(new XmlPipelineStageResolver(fileName)); ! } catch (IOException e) { throw new PipelineException(I18n.get("002001", fileName), e); } Index: XmlPipelineStageResolver.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/xml/XmlPipelineStageResolver.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** XmlPipelineStageResolver.java 29 May 2003 00:38:13 -0000 1.5 --- XmlPipelineStageResolver.java 27 Jun 2003 02:19:59 -0000 1.6 *************** *** 1,37 **** ! /* ! * $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.core.pipeline.xml; - import java.io.InputStream; - import java.io.FileNotFoundException; - import java.io.IOException; - import com.babeldoc.core.ResourceLoader; import com.babeldoc.core.pipeline.xml.digester.DigesterPipelineUnmarshaller; /** ! * An xml pipeline stage resolver. This resolver handles pipeline configurations ! * from an xml configuration file. Most of the resolver stuff is done by the simple ! * resolver. * * @author Bmcdonald --- 1,81 ---- ! /* ==================================================================== ! * The Apache Software License, Version 1.1 * + * Copyright (c) 2000 The Apache Software Foundation. All rights + * reserved. * ! * Redistribution and use in source and binary forms, with or without ! * modification, are permitted provided that the following conditions ! * are met: * ! * 1. Redistributions of source code must retain the above copyright ! * notice, this list of conditions and the following disclaimer. * ! * 2. Redistributions in binary form must reproduce the above copyright ! * notice, this list of conditions and the following disclaimer in ! * the documentation and/or other materials provided with the ! * distribution. ! * ! * 3. The end-user documentation included with the redistribution, ! * if any, must include the following acknowledgment: ! * "This product includes software developed by the ! * Apache Software Foundation (http://www.apache.org/)." ! * Alternately, this acknowledgment may appear in the software itself, ! * if and wherever such third-party acknowledgments normally appear. ! * ! * 4. The names "Apache" and "Apache Software Foundation" must ! * not be used to endorse or promote products derived from this ! * software without prior written permission. For written ! * permission, please contact ap...@ap.... ! * ! * 5. Products derived from this software may not be called "Apache", ! * nor may "Apache" appear in their name, without prior written ! * permission of the Apache Software Foundation. ! * ! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ! * SUCH DAMAGE. ! * ==================================================================== ! * ! * This software consists of voluntary contributions made by many ! * individuals on behalf of the Apache Software Foundation. For more ! * information on the Apache Software Foundation, please see ! * <http://www.apache.org/>. ! * ! * Portions of this software are based upon public domain software ! * originally written at the National Center for Supercomputing Applications, ! * University of Illinois, Urbana-Champaign. ! * ==================================================================== ! * ! * Babeldoc: The Universal Document Processor ! * ! * $Header$ ! * $DateTime$ ! * $Author$ * */ package com.babeldoc.core.pipeline.xml; import com.babeldoc.core.ResourceLoader; import com.babeldoc.core.pipeline.xml.digester.DigesterPipelineUnmarshaller; + import java.io.FileNotFoundException; + import java.io.IOException; + import java.io.InputStream; + /** ! * An xml pipeline stage resolver. This resolver handles pipeline ! * configurations from an xml configuration file. Most of the resolver stuff ! * is done by the simple resolver. * * @author Bmcdonald *************** *** 41,69 **** extends com.babeldoc.core.pipeline.PipelineStageResolver implements com.babeldoc.core.pipeline.IPipelineStageResolver { - /** * Set up the data for this resolver * * @param xmlFile */ ! public XmlPipelineStageResolver(String xmlFile) ! throws IOException { super(); InputStream resourceStream = ResourceLoader.getResourceStream(xmlFile); ! if (resourceStream == null) ! { throw new RuntimeException(new FileNotFoundException(xmlFile)); } // XmlPipelineUnmarshaller unmarshaller // = new XmlPipelineUnmarshaller(resourceStream); ! DigesterPipelineUnmarshaller unmarshaller ! = new DigesterPipelineUnmarshaller(resourceStream); setupConfigData(unmarshaller); } - /** ! * Operate on the data from the unmarshaller. This is really ! * mostly already handled. Need to create the stages hashtables too. * * @param unmarshaller --- 85,114 ---- extends com.babeldoc.core.pipeline.PipelineStageResolver implements com.babeldoc.core.pipeline.IPipelineStageResolver { /** * Set up the data for this resolver * * @param xmlFile + * + * @throws IOException DOCUMENT ME! + * @throws RuntimeException DOCUMENT ME! */ ! public XmlPipelineStageResolver(String xmlFile) throws IOException { super(); + InputStream resourceStream = ResourceLoader.getResourceStream(xmlFile); ! ! if (resourceStream == null) { throw new RuntimeException(new FileNotFoundException(xmlFile)); } + // XmlPipelineUnmarshaller unmarshaller // = new XmlPipelineUnmarshaller(resourceStream); ! DigesterPipelineUnmarshaller unmarshaller = new DigesterPipelineUnmarshaller(resourceStream); setupConfigData(unmarshaller); } /** ! * Operate on the data from the unmarshaller. This is really mostly already ! * handled. Need to create the stages hashtables too. * * @param unmarshaller *************** *** 71,77 **** protected void setupConfigData(IUnmarshaller unmarshaller) { stageConfig = unmarshaller.getRootConfig(); com.babeldoc.core.pipeline.PipelineStageConnection[] connections = unmarshaller.getPipelineStageConnections(); for (int i = 0; i < connections.length; ++i) { ! setupNextStages(connections[i].getSourceStage(), connections[i].getSinkStage()); } } --- 116,125 ---- protected void setupConfigData(IUnmarshaller unmarshaller) { stageConfig = unmarshaller.getRootConfig(); + com.babeldoc.core.pipeline.PipelineStageConnection[] connections = unmarshaller.getPipelineStageConnections(); + for (int i = 0; i < connections.length; ++i) { ! setupNextStages(connections[i].getSourceStage(), ! connections[i].getSinkStage()); } } Index: XmlPipelineUnmarshaller.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/xml/XmlPipelineUnmarshaller.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** XmlPipelineUnmarshaller.java 10 Apr 2003 15:32:23 -0000 1.3 --- XmlPipelineUnmarshaller.java 27 Jun 2003 02:19:59 -0000 1.4 *************** *** 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.core.pipeline.xml; --- 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.core.pipeline.xml; *************** *** 26,88 **** import org.xml.sax.helpers.DefaultHandler; - import javax.xml.parsers.SAXParser; - import javax.xml.parsers.SAXParserFactory; import java.io.File; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Stack; /** * Do not use this class - use the DigesterPipelineUnmarshaller instead. ! * ! * ! * Utility class to handle the decoding of pipeline xml documents to ! * the various data structures. Uses a stack algorithm to convert the data ! * from xml document to a set of datastructures. * * @author Bmcdonald * @version 1.0 * @deprecated */ ! class XmlPipelineUnmarshaller ! extends DefaultHandler ! implements IUnmarshaller { ! /** ! * XML Constants ! */ ! public final static String ENTRY_STAGE = "entry-stage"; ! public final static String OPTION_VALUE = "option-value"; ! public final static String OPTION_NAME = "option-name"; ! public final static String OPTION = "option"; ! public final static String CONNECTION = "connection"; ! public final static String SOURCE = "source"; ! public final static String SINK = "sink"; ! public final static String SUB_OPTION = "sub-option"; ! public final static String STAGE_INST = "stage-inst"; ! public final static String STAGE_NAME = "stage-name"; ! public final static String STAGE_TYPE = "stage-type"; ! public final static String STAGE_DESC = "stage-desc"; /** long term stuff */ com.babeldoc.core.pipeline.PipelineStageConfig pipelineStageConfig; - ArrayList connections; - - /** general stuff */ - String charData; /** Stack based operation */ Stack stack; int options; int suboptions; - boolean keepChars; /** ! * ! */ public XmlPipelineUnmarshaller() { this.connections = new ArrayList(); ! this.pipelineStageConfig = new com.babeldoc.core.pipeline.PipelineStageConfig("root"); stack = new Stack(); } --- 70,130 ---- import org.xml.sax.helpers.DefaultHandler; import java.io.File; import java.io.InputStream; + import java.util.ArrayList; import java.util.HashMap; import java.util.Stack; + import javax.xml.parsers.SAXParser; + import javax.xml.parsers.SAXParserFactory; + /** * Do not use this class - use the DigesterPipelineUnmarshaller instead. ! * Utility class to handle the decoding of pipeline xml documents to the ! * various data structures. Uses a stack algorithm to convert the data from ! * xml document to a set of datastructures. * * @author Bmcdonald * @version 1.0 + * * @deprecated */ ! class XmlPipelineUnmarshaller extends DefaultHandler implements IUnmarshaller { ! /** XML Constants */ ! public static final String ENTRY_STAGE = "entry-stage"; ! public static final String OPTION_VALUE = "option-value"; ! public static final String OPTION_NAME = "option-name"; ! public static final String OPTION = "option"; ! public static final String CONNECTION = "connection"; ! public static final String SOURCE = "source"; ! public static final String SINK = "sink"; ! public static final String SUB_OPTION = "sub-option"; ! public static final String STAGE_INST = "stage-inst"; ! public static final String STAGE_NAME = "stage-name"; ! public static final String STAGE_TYPE = "stage-type"; ! public static final String STAGE_DESC = "stage-desc"; ! ArrayList connections; /** long term stuff */ com.babeldoc.core.pipeline.PipelineStageConfig pipelineStageConfig; /** Stack based operation */ Stack stack; + + /** general stuff */ + String charData; + boolean keepChars; int options; int suboptions; /** ! * ! */ public XmlPipelineUnmarshaller() { this.connections = new ArrayList(); ! this.pipelineStageConfig = new com.babeldoc.core.pipeline.PipelineStageConfig( ! "root"); stack = new Stack(); } *************** *** 111,114 **** --- 153,157 ---- /** * Parse this inputsource to datastructures + * * @param source */ *************** *** 127,131 **** * * @return ! * @throws java.lang.Exception */ public static SAXParser getSAXParser() throws Exception { --- 170,175 ---- * * @return ! * ! * @throws Exception */ public static SAXParser getSAXParser() throws Exception { *************** *** 138,173 **** /** ! * Start processing an element * ! * @param namespaceUri ! * @param localName ! * @param qName ! * @param atts ! * @throws org.xml.sax.SAXException */ ! public void startElement(String namespaceUri, String localName, ! String qName, Attributes atts) throws SAXException { ! //System.out.println("StartElement: " + localName + "-" + qName); ! if (qName.equals(OPTION_VALUE) || qName.equals(OPTION_NAME) || ! qName.equals(ENTRY_STAGE) || qName.equals(SOURCE) || ! qName.equals(SINK) || qName.equals(STAGE_NAME) || ! qName.equals(STAGE_TYPE)) { ! this.keepChars = true; ! this.charData = ""; ! //System.out.println("keeping characters"); } else { ! this.keepChars = false; } } /** ! * Finish processing an element. This is where most of the hard work happens. ! * Lots of stack operations here. * * @param namespaceUri * @param localName * @param qName ! * @throws org.xml.sax.SAXException */ public void endElement(String namespaceUri, String localName, String qName) --- 182,236 ---- /** ! * Get the array of pipeline stage connections * ! * @return array of connections. */ ! public com.babeldoc.core.pipeline.PipelineStageConnection[] getPipelineStageConnections() { ! return (com.babeldoc.core.pipeline.PipelineStageConnection[]) (connections.toArray(new com.babeldoc.core.pipeline.PipelineStageConnection[0])); ! } ! /** ! * Get root configuration object ! * ! * @return DOCUMENT ME! ! */ ! public com.babeldoc.core.pipeline.PipelineStageConfig getRootConfig() { ! return this.pipelineStageConfig; ! } ! ! /** ! * Catch characters in the input stream and remember them in the charData ! * variable ! * ! * @param ch ! * @param start ! * @param length ! * ! * @throws SAXException ! */ ! public void characters(char[] ch, int start, int length) ! throws SAXException { ! //System.out.println("characters: "+start+"-"+length+": "+ch+); ! if (!keepChars) { ! charData = new String(ch, start, length); //.trim(); } else { ! String newCharData = new String(ch, start, length); //.trim(); ! ! //System.out.println(">>"+newCharData+"<<"); ! charData += newCharData; } + + //System.out.println(">>"+charData+"<<"); } /** ! * Finish processing an element. This is where most of the hard work ! * happens. Lots of stack operations here. * * @param namespaceUri * @param localName * @param qName ! * ! * @throws SAXException */ public void endElement(String namespaceUri, String localName, String qName) *************** *** 177,183 **** pipelineStageConfig.setValue(this.charData); } else if (qName.equals(CONNECTION)) { ! HashMap hash = com.babeldoc.core.Pair.getMap(new com.babeldoc.core.Pair[]{ ! (com.babeldoc.core.Pair) stack.pop(), (com.babeldoc.core.Pair) stack.pop() ! }); String source = (String) hash.get(SOURCE); String sink = (String) hash.get(SINK); --- 240,244 ---- pipelineStageConfig.setValue(this.charData); } else if (qName.equals(CONNECTION)) { ! HashMap hash = com.babeldoc.core.Pair.getMap(new com.babeldoc.core.Pair[] { (com.babeldoc.core.Pair) stack.pop(), (com.babeldoc.core.Pair) stack.pop() }); String source = (String) hash.get(SOURCE); String sink = (String) hash.get(SINK); *************** *** 185,189 **** if (source != null) { //System.out.println("Connection from "+sourceStage+" to "+sinkStage); ! connections.add(new com.babeldoc.core.pipeline.PipelineStageConnection(source, sink)); } else { throw new SAXException(com.babeldoc.core.I18n.get("018001")); --- 246,251 ---- if (source != null) { //System.out.println("Connection from "+sourceStage+" to "+sinkStage); ! connections.add(new com.babeldoc.core.pipeline.PipelineStageConnection( ! source, sink)); } else { throw new SAXException(com.babeldoc.core.I18n.get("018001")); *************** *** 192,196 **** com.babeldoc.core.pipeline.PipelineStageConfig optionConfig = new com.babeldoc.core.pipeline.PipelineStageConfig(); HashMap hash = new HashMap(); ! suboptions += 2; // Account for the name/value for this config object while (--suboptions >= 0) { --- 254,258 ---- com.babeldoc.core.pipeline.PipelineStageConfig optionConfig = new com.babeldoc.core.pipeline.PipelineStageConfig(); HashMap hash = new HashMap(); ! suboptions += 2; // Account for the name/value for this config object while (--suboptions >= 0) { *************** *** 216,222 **** suboptions = 0; } else if (qName.equals(SUB_OPTION)) { ! HashMap hash = com.babeldoc.core.Pair.getMap(new com.babeldoc.core.Pair[]{ ! (com.babeldoc.core.Pair) stack.pop(), (com.babeldoc.core.Pair) stack.pop() ! }); String name = (String) hash.get(OPTION_NAME); String value = (String) hash.get(OPTION_VALUE); --- 278,282 ---- suboptions = 0; } else if (qName.equals(SUB_OPTION)) { ! HashMap hash = com.babeldoc.core.Pair.getMap(new com.babeldoc.core.Pair[] { (com.babeldoc.core.Pair) stack.pop(), (com.babeldoc.core.Pair) stack.pop() }); String name = (String) hash.get(OPTION_NAME); String value = (String) hash.get(OPTION_VALUE); *************** *** 251,270 **** String stageDesc = (String) hash.get(STAGE_DESC); ! if ((stageName != null) && (stageType != null) && ! (stageDesc != null)) { stageConfig.setName(stageName); stageConfig.put(com.babeldoc.core.pipeline.PipelineStageConfig.STAGE_TYPE, ! new com.babeldoc.core.pipeline.PipelineStageConfig(com.babeldoc.core.pipeline.PipelineStageConfig.STAGE_TYPE, ! stageType)); stageConfig.put(com.babeldoc.core.pipeline.PipelineStageConfig.STAGE_DESC, ! new com.babeldoc.core.pipeline.PipelineStageConfig(com.babeldoc.core.pipeline.PipelineStageConfig.STAGE_DESC, ! stageDesc)); //Add it to the this.pipelineStageConfig.put(stageName, stageConfig); } else { ! com.babeldoc.core.LogService.getInstance().logError("Stagename: " + stageName + ! " stagetype: " + stageType + " stageDesc: " + stageDesc, ! null); throw new SAXException(com.babeldoc.core.I18n.get("018002")); } --- 311,329 ---- String stageDesc = (String) hash.get(STAGE_DESC); ! if ((stageName != null) && (stageType != null) && (stageDesc != null)) { stageConfig.setName(stageName); stageConfig.put(com.babeldoc.core.pipeline.PipelineStageConfig.STAGE_TYPE, ! new com.babeldoc.core.pipeline.PipelineStageConfig( ! com.babeldoc.core.pipeline.PipelineStageConfig.STAGE_TYPE, stageType)); stageConfig.put(com.babeldoc.core.pipeline.PipelineStageConfig.STAGE_DESC, ! new com.babeldoc.core.pipeline.PipelineStageConfig( ! com.babeldoc.core.pipeline.PipelineStageConfig.STAGE_DESC, stageDesc)); //Add it to the this.pipelineStageConfig.put(stageName, stageConfig); } else { ! com.babeldoc.core.LogService.getInstance().logError("Stagename: " + ! stageName + " stagetype: " + stageType + " stageDesc: " + stageDesc, ! null); throw new SAXException(com.babeldoc.core.I18n.get("018002")); } *************** *** 272,276 **** //Do nothing for these guys else if (qName.equals("dynamic") || qName.equals("pipeline") || ! qName.equals("static") || qName.equals("stage-defn")) { } //All the rest - stack 'em --- 331,335 ---- //Do nothing for these guys else if (qName.equals("dynamic") || qName.equals("pipeline") || ! qName.equals("static") || qName.equals("stage-defn")) { } //All the rest - stack 'em *************** *** 281,327 **** /** ! * Catch characters in the input stream and remember them in the charData variable * ! * @param ch ! * @param start ! * @param length ! * @throws org.xml.sax.SAXException */ ! public void characters(char[] ch, int start, int length) ! throws SAXException { ! //System.out.println("characters: "+start+"-"+length+": "+ch+); ! if (!keepChars) { ! charData = new String(ch, start, length); //.trim(); } else { ! String newCharData = new String(ch, start, length); //.trim(); ! ! //System.out.println(">>"+newCharData+"<<"); ! charData += newCharData; } - - //System.out.println(">>"+charData+"<<"); } /** ! * Get the array of pipeline stage connections * ! * @return array of connections. ! */ ! public com.babeldoc.core.pipeline.PipelineStageConnection[] getPipelineStageConnections() { ! return (com.babeldoc.core.pipeline.PipelineStageConnection[]) (connections.toArray(new com.babeldoc.core.pipeline.PipelineStageConnection[0])); ! } ! ! /** ! * Get root configuration object */ ! public com.babeldoc.core.pipeline.PipelineStageConfig getRootConfig() { ! return this.pipelineStageConfig; ! } ! public static void main(String[] args) { ! if (args.length == 0) { ! new XmlPipelineUnmarshaller(System.in); } else { ! new XmlPipelineUnmarshaller(args[0]); } } --- 340,378 ---- /** ! * TODO: DOCUMENT ME! * ! * @param args DOCUMENT ME! */ ! public static void main(String[] args) { ! if (args.length == 0) { ! new XmlPipelineUnmarshaller(System.in); } else { ! new XmlPipelineUnmarshaller(args[0]); } } /** ! * Start processing an element * ! * @param namespaceUri ! * @param localName ! * @param qName ! * @param atts ! * ! * @throws SAXException */ ! public void startElement(String namespaceUri, String localName, String qName, ! Attributes atts) throws SAXException { ! //System.out.println("StartElement: " + localName + "-" + qName); ! if (qName.equals(OPTION_VALUE) || qName.equals(OPTION_NAME) || ! qName.equals(ENTRY_STAGE) || qName.equals(SOURCE) || ! qName.equals(SINK) || qName.equals(STAGE_NAME) || ! qName.equals(STAGE_TYPE)) { ! this.keepChars = true; ! this.charData = ""; ! //System.out.println("keeping characters"); } else { ! this.keepChars = false; } } |
|
From: <tr...@us...> - 2003-06-27 02:20:03
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/service In directory sc8-pr-cvs1:/tmp/cvs-serv700/src/com/babeldoc/core/service Modified Files: ServiceException.java ServiceFactory.java Log Message: reformatted and updated license header Index: ServiceException.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/service/ServiceException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ServiceException.java 15 Mar 2003 22:54:11 -0000 1.2 --- ServiceException.java 27 Jun 2003 02:20:00 -0000 1.3 *************** *** 1,26 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/21 17:01:20 $ * * ! * 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.core.service; - /** * Handling service exceptions. This is straight specialization of --- 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.core.service; /** * Handling service exceptions. This is straight specialization of *************** *** 30,36 **** * @version 1.0 */ ! public class ServiceException ! extends com.babeldoc.core.GeneralException { ! /** * Service exception --- 73,77 ---- * @version 1.0 */ ! public class ServiceException extends com.babeldoc.core.GeneralException { /** * Service exception *************** *** 54,58 **** /** * Service exception - * */ public ServiceException() { --- 95,98 ---- Index: ServiceFactory.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/service/ServiceFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ServiceFactory.java 22 May 2003 03:20:29 -0000 1.5 --- ServiceFactory.java 27 Jun 2003 02:20:00 -0000 1.6 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/21 17:01:20 $ * * ! * 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.core.service; --- 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.core.service; *************** *** 29,37 **** import java.util.Iterator; /** ! * Simple name to object mapping. This is a critical part of the system ! * and it allows for names to be associated with classes in various ! * decoupled ways. The various Types provide an easy look into this ! * service system. * * @author bmcdonald --- 73,81 ---- import java.util.Iterator; + /** ! * Simple name to object mapping. This is a critical part of the system and it ! * allows for names to be associated with classes in various decoupled ways. ! * The various Types provide an easy look into this service system. * * @author bmcdonald *************** *** 39,50 **** */ public class ServiceFactory { ! /** ! * Configuration constants ! */ public static String CONFIG_NAME = "service/query"; ! /** ! * singleton configuration ! */ private static ServiceFactory instance = null; --- 83,90 ---- */ public class ServiceFactory { ! /** Configuration constants */ public static String CONFIG_NAME = "service/query"; ! /** singleton configuration */ private static ServiceFactory instance = null; *************** *** 56,98 **** /** ! * Get the singleton reference ! */ ! protected static ServiceFactory getInstance() { ! if (instance == null) { ! instance = new ServiceFactory(); ! } ! return instance; ! } ! ! /** ! * get the service class for the service name. * - * @param name of the service * @return - * @throws ServiceException */ ! public static Class getServiceClass(String name) ! throws ServiceException { ! String classname = ConfigService.getString(CONFIG_NAME, name); ! if (classname == null) { ! throw new ServiceException(I18n.get("000043", name), null); } ! return com.babeldoc.core.ResourceLoader.getClass(classname); } /** ! * Get the instantiated service object for the service name. This ! * object must have a default (no-argument) constructor or this will ! * fail. * * @param name * @return instantiated object (must have a null constructor) * @throws ServiceException */ ! public static Object getService(String name) ! throws ServiceException { try { Class theClass = getServiceClass(name); Object service = theClass.newInstance(); return service; } catch (Exception e) { --- 96,145 ---- /** ! * Return all services of the given type. This is used to discover all ! * relevant named services for display, iteration purposes. ! * ! * @param serviceType hashmap of matching services. * * @return */ ! public static HashMap getAllServices(String serviceType) { ! //put dot at the end of type to get prefix ! if (!serviceType.endsWith(".")) { ! serviceType = serviceType + "."; } ! ! IConfig serviceConfig = ConfigService.getInstance().getConfig(CONFIG_NAME); ! HashMap services = new HashMap(); ! Iterator keys = serviceConfig.keys().iterator(); ! ! while (keys.hasNext()) { ! String key = (String) keys.next(); ! ! //if key starts with service name then it is of that type ! if (key.startsWith(serviceType)) { ! //put it without prefix ! services.put(key.substring(serviceType.length()), ! serviceConfig.getString(key)); ! } ! } ! ! return services; } /** ! * Get the instantiated service object for the service name. This object ! * must have a default (no-argument) constructor or this will fail. * * @param name + * * @return instantiated object (must have a null constructor) + * * @throws ServiceException */ ! public static Object getService(String name) throws ServiceException { try { Class theClass = getServiceClass(name); Object service = theClass.newInstance(); + return service; } catch (Exception e) { *************** *** 102,129 **** /** ! * Return all services of the given type. This is used to ! * discover all relevant named services for display, iteration ! * purposes. * - * @param serviceType hashmap of matching services. * @return */ ! public static HashMap getAllServices(String serviceType) { ! //put dot at the end of type to get prefix ! if (!serviceType.endsWith(".")) { ! serviceType = serviceType + "."; } ! IConfig serviceConfig = ConfigService.getInstance().getConfig(CONFIG_NAME); ! HashMap services = new HashMap(); ! Iterator keys = serviceConfig.keys().iterator(); ! while (keys.hasNext()) { ! String key = (String) keys.next(); ! //if key starts with service name then it is of that type ! if (key.startsWith(serviceType)) { ! //put it without prefix ! services.put(key.substring(serviceType.length()), serviceConfig.getString(key)); ! } } ! return services; } } --- 149,181 ---- /** ! * get the service class for the service name. ! * ! * @param name of the service * * @return + * + * @throws ServiceException */ ! public static Class getServiceClass(String name) throws ServiceException { ! String classname = ConfigService.getString(CONFIG_NAME, name); ! ! if (classname == null) { ! throw new ServiceException(I18n.get("000043", name), null); } ! ! return com.babeldoc.core.ResourceLoader.getClass(classname); ! } ! ! /** ! * Get the singleton reference ! * ! * @return DOCUMENT ME! ! */ ! protected static ServiceFactory getInstance() { ! if (instance == null) { ! instance = new ServiceFactory(); } ! ! return instance; } } |
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/user/simple In directory sc8-pr-cvs1:/tmp/cvs-serv700/src/com/babeldoc/core/user/simple Modified Files: SimpleUserContext.java SimpleUserFactory.java SimpleUserResourceFactory.java Log Message: reformatted and updated license header Index: SimpleUserContext.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/user/simple/SimpleUserContext.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SimpleUserContext.java 15 Mar 2003 22:54:13 -0000 1.2 --- SimpleUserContext.java 27 Jun 2003 02:20:00 -0000 1.3 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/21 17:01:20 $ * * ! * 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.core.user.simple; --- 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.core.user.simple; *************** *** 24,27 **** --- 68,72 ---- import com.babeldoc.core.user.UserContext; + /** * A very simplistic user context. *************** *** 30,38 **** * @version 1.0 */ ! public class SimpleUserContext ! extends UserContext { ! private SimpleUserFactory manager; public SimpleUserContext(SimpleUserFactory manager, String name) { this.manager = manager; --- 75,87 ---- * @version 1.0 */ ! public class SimpleUserContext extends UserContext { private SimpleUserFactory manager; + /** + * Creates a new SimpleUserContext object. + * + * @param manager DOCUMENT ME! + * @param name DOCUMENT ME! + */ public SimpleUserContext(SimpleUserFactory manager, String name) { this.manager = manager; *************** *** 47,49 **** super.setAuthenticated(authenticated); } ! } \ No newline at end of file --- 96,98 ---- super.setAuthenticated(authenticated); } ! } Index: SimpleUserFactory.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/user/simple/SimpleUserFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SimpleUserFactory.java 15 Mar 2003 22:54:13 -0000 1.2 --- SimpleUserFactory.java 27 Jun 2003 02:20:00 -0000 1.3 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/21 17:01:20 $ * * ! * 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.core.user.simple; --- 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.core.user.simple; *************** *** 25,28 **** --- 69,73 ---- import com.babeldoc.core.user.*; + /** * Desperately simple user manager. This should not be used in any kind of *************** *** 32,72 **** * @version 1.0 */ ! public class SimpleUserFactory ! implements IUserFactory { ! /** constant: configuration name */ public static final String CONFIG_NAME = "user/simple/factory"; /** constant: the globalPreference prefix */ public static final String GLB_PREF_PREFIX = "globalPrefix."; /** constant: the orgPreference prefix */ public static final String ORG_PREF_PREFIX = "orgPrefix."; /** constant: the user Preference prefix */ public static final String USR_PREF_PREFIX = "usrPrefix."; /** constant: the glue */ public static final String GLUE = "."; /** ! * Get user context object. ! * get a user context object for the named user. This ! * opject is by default unauthenticated. * @param name the name of the user * @return usercontext */ ! public IUserContext getUserContext(String name) ! throws UserException { ! com.babeldoc.core.LogService.getInstance().logDebug( ! "[SimpleUserManager.getUserContext]: getting context for user: " + name); if (name.startsWith("z")) { throw new UserException("[getUserContext] invalid user"); } return new SimpleUserContext(this, name); } /** ! * Get user context object. ! * get a user context object for the named user. This ! * opject is by default unauthenticated. * @param name the name of the user * @return usercontext */ public IUserContext getUserContext(String name, IUserCredential credential) --- 77,180 ---- * @version 1.0 */ ! public class SimpleUserFactory implements IUserFactory { /** constant: configuration name */ public static final String CONFIG_NAME = "user/simple/factory"; + /** constant: the globalPreference prefix */ public static final String GLB_PREF_PREFIX = "globalPrefix."; + /** constant: the orgPreference prefix */ public static final String ORG_PREF_PREFIX = "orgPrefix."; + /** constant: the user Preference prefix */ public static final String USR_PREF_PREFIX = "usrPrefix."; + /** constant: the glue */ public static final String GLUE = "."; /** ! * Get the global preference string for the organization. This uses the ! * configuration data for the simple user factory. ! * ! * @param key ! * ! * @return preference string ! * ! * @throws UserException DOCUMENT ME! ! */ ! public String getGlobalPreference(String key) throws UserException { ! StringBuffer sbuf = new StringBuffer(ORG_PREF_PREFIX); ! sbuf.append(key); ! ! return ConfigService.getString(CONFIG_NAME, sbuf.toString()); ! } ! ! /** ! * Get organization object. get a user context object for the named user. ! * This object is by default unauthenticated. If the user is not found, the ! * context object is null. ! * ! * @param name the name of the organization ! * ! * @return usercontext - null if username not found. ! * ! * @throws UserException DOCUMENT ME! ! */ ! public IOrganization getOrganization(String name) throws UserException { ! throw new UserException("Not implemented"); ! } ! ! /** ! * Get the preference string for the organization. This uses the ! * configuration data for the simple user factory. ! * ! * @param org the org to get preference ! * @param key ! * ! * @return preference string ! * ! * @throws UserException DOCUMENT ME! ! */ ! public String getOrganizationPreference(IOrganization org, String key) ! throws UserException { ! StringBuffer sbuf = new StringBuffer(ORG_PREF_PREFIX); ! sbuf.append(org.toString()); ! sbuf.append(GLUE); ! sbuf.append(key); ! ! return ConfigService.getString(CONFIG_NAME, sbuf.toString()); ! } ! ! /** ! * Get user context object. get a user context object for the named user. ! * This opject is by default unauthenticated. ! * * @param name the name of the user + * * @return usercontext + * + * @throws UserException DOCUMENT ME! */ ! public IUserContext getUserContext(String name) throws UserException { ! com.babeldoc.core.LogService.getInstance().logDebug("[SimpleUserManager.getUserContext]: getting context for user: " + ! name); ! if (name.startsWith("z")) { throw new UserException("[getUserContext] invalid user"); } + return new SimpleUserContext(this, name); } /** ! * Get user context object. get a user context object for the named user. ! * This opject is by default unauthenticated. ! * * @param name the name of the user + * @param credential DOCUMENT ME! + * * @return usercontext + * + * @throws UserException DOCUMENT ME! */ public IUserContext getUserContext(String name, IUserCredential credential) *************** *** 78,86 **** --- 186,217 ---- /** + * Get the preference string for the user. This uses the configuration data + * for the simple user factory. + * + * @param user the user to get preference + * @param key the reference to the preference + * + * @return preference string + * + * @throws UserException DOCUMENT ME! + */ + public String getUserPreference(IUser user, String key) + throws UserException { + StringBuffer sbuf = new StringBuffer(USR_PREF_PREFIX); + sbuf.append(user.toString()); + sbuf.append(GLUE); + sbuf.append(key); + + return ConfigService.getString(CONFIG_NAME, sbuf.toString()); + } + + /** * Authenticate this user. Uses a simple password * * @param context * @param credential + * * @return + * * @throws UserException */ *************** *** 95,122 **** /** ! * <strong>createUser</strong> ! * ! * create a user with credentials. Migrate to Interface * ! * @param user the user ! * @param credential the users credentials ! * @throws com.babeldoc.core.user.UserException ! * @throws com.babeldoc.core.user.UserCreateException ! */ ! public IUserContext createUser(IUser user, IUserCredential credential) ! throws UserException, UserCreateException { ! throw new UserException("Not implemented"); ! } ! ! /** ! * Get organization object. ! * get a user context object for the named user. This ! * object is by default unauthenticated. If the user ! * is not found, the context object is null. * ! * @param name the name of the organization ! * @return usercontext - null if username not found. */ ! public IOrganization getOrganization(String name) throws UserException { throw new UserException("Not implemented"); --- 226,237 ---- /** ! * Create a name/value preference in the global list. * ! * @param key the preference key ! * @param value the preference value * ! * @throws UserException DOCUMENT ME! */ ! public void createGlobalPreference(String key, String value) throws UserException { throw new UserException("Not implemented"); *************** *** 124,212 **** /** ! * <strong>createOrganization</strong> ! * ! * create an organization - migrate to interface in due time. * * @param org the organization ! * @throws com.babeldoc.core.user.UserException ! */ ! public IOrganization createOrganization(IOrganization org, IOrganization parent) ! throws UserException, UserCreateException { ! throw new UserException("Not implemented"); ! } ! ! ! /** ! * <strong>deleteUser</strong> * ! * delete a user * ! * @param user the user ! * @throws com.babeldoc.core.user.UserException */ ! public void deleteUser(IUser user) ! throws UserException { throw new UserException("Not implemented"); } /** ! * <strong>deleteOrganization</strong> * ! * delete an organization * ! * @param organization the organization ! * @throws com.babeldoc.core.user.UserException */ ! public void deleteOrganization(IOrganization organization) ! throws UserException { throw new UserException("Not implemented"); } /** ! * Get the preference string for the user. This uses the configuration data for the ! * simple user factory. * ! * @param user the user to get preference ! * @param key the reference to the preference ! * @return preference string ! */ ! public String getUserPreference(IUser user, String key) ! throws UserException { ! StringBuffer sbuf = new StringBuffer(USR_PREF_PREFIX); ! sbuf.append(user.toString()); ! sbuf.append(GLUE); ! sbuf.append(key); ! return ConfigService.getString(CONFIG_NAME, sbuf.toString()); ! } ! ! /** ! * Get the preference string for the organization. This uses the configuration data for the ! * simple user factory. * ! * @param org the org to get preference ! * @param key ! * @return preference string ! */ ! public String getOrganizationPreference(IOrganization org, String key) ! throws UserException { ! StringBuffer sbuf = new StringBuffer(ORG_PREF_PREFIX); ! sbuf.append(org.toString()); ! sbuf.append(GLUE); ! sbuf.append(key); ! return ConfigService.getString(CONFIG_NAME, sbuf.toString()); ! } ! ! /** ! * Get the global preference string for the organization. This uses the configuration data for the ! * simple user factory. * ! * @param key ! * @return preference string */ ! public String getGlobalPreference(String key) ! throws UserException { ! StringBuffer sbuf = new StringBuffer(ORG_PREF_PREFIX); ! sbuf.append(key); ! return ConfigService.getString(CONFIG_NAME, sbuf.toString()); } --- 239,287 ---- /** ! * <strong>createOrganization</strong> create an organization - migrate to ! * interface in due time. * * @param org the organization ! * @param parent DOCUMENT ME! * ! * @return DOCUMENT ME! * ! * @throws UserException ! * @throws UserCreateException DOCUMENT ME! */ ! public IOrganization createOrganization(IOrganization org, ! IOrganization parent) throws UserException, UserCreateException { throw new UserException("Not implemented"); } /** ! * Create a name/value preference for this user. * ! * @param org the organization ! * @param key the preference key ! * @param value the preference value * ! * @throws UserException DOCUMENT ME! */ ! public void createOrganizationPreference(IOrganization org, String key, ! String value) throws UserException { throw new UserException("Not implemented"); } /** ! * <strong>createUser</strong> create a user with credentials. Migrate to ! * Interface * ! * @param user the user ! * @param credential the users credentials * ! * @return DOCUMENT ME! * ! * @throws UserException ! * @throws UserCreateException */ ! public IUserContext createUser(IUser user, IUserCredential credential) ! throws UserException, UserCreateException { ! throw new UserException("Not implemented"); } *************** *** 217,220 **** --- 292,297 ---- * @param key the preference key * @param value the preference value + * + * @throws UserException DOCUMENT ME! */ public void createUserPreference(IUser user, String key, String value) *************** *** 224,246 **** /** ! * Create a name/value preference for this user. * ! * @param org the organization ! * @param key the preference key ! * @param value the preference value */ ! public void createOrganizationPreference(IOrganization org, String key, String value) ! throws UserException { throw new UserException("Not implemented"); } /** ! * Create a name/value preference in the global list. * ! * @param key the preference key ! * @param value the preference value */ ! ! public void createGlobalPreference(String key, String value) throws UserException { throw new UserException("Not implemented"); --- 301,322 ---- /** ! * Delete the global preference string. * ! * @param key ! * ! * @throws UserException DOCUMENT ME! */ ! public void deleteGlobalPreference(String key) throws UserException { throw new UserException("Not implemented"); } /** ! * <strong>deleteOrganization</strong> delete an organization * ! * @param organization the organization ! * ! * @throws UserException */ ! public void deleteOrganization(IOrganization organization) throws UserException { throw new UserException("Not implemented"); *************** *** 248,257 **** /** ! * Delete the preference from the preferences table for user and key * ! * @param user the user to get preference ! * @param key the reference to the preference */ ! public void deleteUserPreference(IUser user, String key) throws UserException { throw new UserException("Not implemented"); --- 324,335 ---- /** ! * delete the preference string for the organization. * ! * @param org the organization ! * @param key to delete ! * ! * @throws UserException DOCUMENT ME! */ ! public void deleteOrganizationPreference(IOrganization org, String key) throws UserException { throw new UserException("Not implemented"); *************** *** 259,278 **** /** ! * delete the preference string for the organization. * ! * @param org the organization ! * @param key to delete */ ! public void deleteOrganizationPreference(IOrganization org, String key) ! throws UserException { throw new UserException("Not implemented"); } /** ! * Delete the global preference string. * ! * @param key */ ! public void deleteGlobalPreference(String key) throws UserException { throw new UserException("Not implemented"); --- 337,359 ---- /** ! * <strong>deleteUser</strong> delete a user * ! * @param user the user ! * ! * @throws UserException */ ! public void deleteUser(IUser user) throws UserException { throw new UserException("Not implemented"); } /** ! * Delete the preference from the preferences table for user and key * ! * @param user the user to get preference ! * @param key the reference to the preference ! * ! * @throws UserException DOCUMENT ME! */ ! public void deleteUserPreference(IUser user, String key) throws UserException { throw new UserException("Not implemented"); Index: SimpleUserResourceFactory.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/user/simple/SimpleUserResourceFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SimpleUserResourceFactory.java 15 Mar 2003 22:54:13 -0000 1.2 --- SimpleUserResourceFactory.java 27 Jun 2003 02:20:00 -0000 1.3 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/21 17:01:20 $ * * ! * 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.core.user.simple; --- 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.core.user.simple; *************** *** 24,27 **** --- 68,72 ---- import com.babeldoc.core.user.*; + /** * SimpleResourceManager - class to manager user resouces. *************** *** 30,78 **** * @version 1.0 */ ! public class SimpleUserResourceFactory ! implements IUserResourceFactory { ! ! /** ! * Get the named user resource ! * @param name the name of the resource ! * @return the associated resource. ! */ ! public UserResource getUserResource(String name) { ! return new UserResource(name); ! } ! /** ! * Must this resource be authenticated? This is a default operation - you will need ! * to provide a decent implementation. * ! * @param resource that may need to be authenticated ! * @return true - user needs to log on, false - access allowed. */ ! public boolean mustAuthenticate(UserResource resource) { ! ! // handle velocity macro pages. ! if (resource.getName().indexOf(".vm") > 0) { ! if (resource.getName().indexOf('/') == resource.getName().lastIndexOf('/')) { ! return false; ! } ! } return true; } /** ! * Can this user access this resource ! * @param user the user in question. ! * @param the resource in question. */ ! public boolean isAuthorized(IUserContext user, UserResource resource) { ! return true; } /** ! * addResource ! * Add a resource for a user. * * @param userResource * @param user */ public void addResource(UserResource userResource, IUser user) --- 75,109 ---- * @version 1.0 */ ! public class SimpleUserResourceFactory implements IUserResourceFactory { /** ! * Can this user access this resource * ! * @param user the user in question. ! * @param resource resource in question. ! * ! * @return DOCUMENT ME! */ ! public boolean isAuthorized(IUserContext user, UserResource resource) { return true; } /** ! * Get the named user resource ! * ! * @param name the name of the resource ! * ! * @return the associated resource. */ ! public UserResource getUserResource(String name) { ! return new UserResource(name); } /** ! * addResource Add a resource for a user. * * @param userResource * @param user + * + * @throws UserException DOCUMENT ME! */ public void addResource(UserResource userResource, IUser user) *************** *** 82,92 **** /** ! * addResource ! * Add a resource for an organization. * * @param userResource * @param organization */ - public void addResource(UserResource userResource, IOrganization organization) throws UserException { --- 113,123 ---- /** ! * addResource Add a resource for an organization. * * @param userResource * @param organization + * + * @throws UserException DOCUMENT ME! */ public void addResource(UserResource userResource, IOrganization organization) throws UserException { *************** *** 98,105 **** --- 129,157 ---- * * @param userResource + * + * @throws UserException DOCUMENT ME! */ public void deleteResource(UserResource userResource) throws UserException { throw new UserException("Not implemented"); + } + + /** + * Must this resource be authenticated? This is a default operation - you + * will need to provide a decent implementation. + * + * @param resource that may need to be authenticated + * + * @return true - user needs to log on, false - access allowed. + */ + public boolean mustAuthenticate(UserResource resource) { + // handle velocity macro pages. + if (resource.getName().indexOf(".vm") > 0) { + if (resource.getName().indexOf('/') == resource.getName().lastIndexOf('/')) { + return false; + } + } + + return true; } } |
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/resource
In directory sc8-pr-cvs1:/tmp/cvs-serv700/src/com/babeldoc/core/resource
Modified Files:
IResource.java Resource.java ResourceException.java
ResourceFactory.java ResourceType.java
Log Message:
reformatted and updated license header
Index: IResource.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/resource/IResource.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** IResource.java 15 Mar 2003 22:54:11 -0000 1.2
--- IResource.java 27 Jun 2003 02:19:59 -0000 1.3
***************
*** 1,51 ****
! /*
! * $Header$
! * $DateTime: 2002/07/21 17:01:20 $
*
*
! * 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.core.resource;
-
/**
! * Interface for connection managers. Primarily to be used by connection pools etc.
! *
! * CONTRACT: The setName method will be called with a non-null string (the name of this
! * resource) before any connections are manipulated. This is essential to the health and
! * sanity of the system.
*
* @author Bmcdonald
* @version 1.0
*/
! public interface IResource
! extends com.babeldoc.core.INamed {
!
/**
! * Check out a connection from this manager.
! * @return the checked out connection
*/
! public Object checkOut()
! throws ResourceException;
/**
! * Check back in a checked out connection
! * @param object
*/
! public void checkIn(Object object)
! throws ResourceException;
! }
\ No newline at end of file
--- 1,91 ----
! /* ====================================================================
! * The Apache Software License, Version 1.1
*
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
*
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
*
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
*
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Apache" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact ap...@ap....
! *
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
! *
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
! *
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
! *
! * Portions of this software are based upon public domain software
! * originally written at the National Center for Supercomputing Applications,
! * University of Illinois, Urbana-Champaign.
! * ====================================================================
! *
! * Babeldoc: The Universal Document Processor
! *
! * $Header$
! * $DateTime$
! * $Author$
*
*/
package com.babeldoc.core.resource;
/**
! * Interface for connection managers. Primarily to be used by connection pools
! * etc. CONTRACT: The setName method will be called with a non-null string
! * (the name of this resource) before any connections are manipulated. This
! * is essential to the health and sanity of the system.
*
* @author Bmcdonald
* @version 1.0
*/
! public interface IResource extends com.babeldoc.core.INamed {
/**
! * Check back in a checked out connection
! *
! * @param object
*/
! public void checkIn(Object object) throws ResourceException;
/**
! * Check out a connection from this manager.
! *
! * @return the checked out connection
*/
! public Object checkOut() throws ResourceException;
! }
Index: Resource.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/resource/Resource.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Resource.java 8 Apr 2003 02:34:08 -0000 1.4
--- Resource.java 27 Jun 2003 02:19:59 -0000 1.5
***************
*** 1,22 ****
! /*
! * $Header$
! * $DateTime: 2002/07/21 17:01:20 $
*
*
! * 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.core.resource;
--- 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.core.resource;
***************
*** 25,28 ****
--- 69,73 ----
import com.babeldoc.core.config.IConfig;
+
/**
* Most elementary implementer of IResource - abstract in fact, just to handle
***************
*** 32,58 ****
* @version 1.0
*/
!
! public abstract class Resource
! extends com.babeldoc.core.Named
implements IResource {
!
! /**
! * Constants - will move to confserver when needs to be done.
! */
public static String CONFIG_FILENAME = "resource/";
! /**
! * Configuration stuff
! */
private IConfig config;
/**
* Get the config object
*/
protected IConfig getConfig() {
if (config == null) {
! config = ConfigService.getInstance().
! getConfig(CONFIG_FILENAME + getName());
}
return config;
}
--- 77,99 ----
* @version 1.0
*/
! public abstract class Resource extends com.babeldoc.core.Named
implements IResource {
! /** Constants - will move to confserver when needs to be done. */
public static String CONFIG_FILENAME = "resource/";
! /** Configuration stuff */
private IConfig config;
/**
* Get the config object
+ *
+ * @return DOCUMENT ME!
*/
protected IConfig getConfig() {
if (config == null) {
! config = ConfigService.getInstance().getConfig(CONFIG_FILENAME +
! getName());
}
+
return config;
}
Index: ResourceException.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/resource/ResourceException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ResourceException.java 15 Mar 2003 22:54:11 -0000 1.2
--- ResourceException.java 27 Jun 2003 02:19:59 -0000 1.3
***************
*** 1,35 ****
! /*
! * $Header$
! * $DateTime: 2002/07/21 17:01:20 $
*
*
! * 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.core.resource;
-
/**
! * Deliverer of (bad) news related to resource issues. Read the err log messages.
*
* @author Bmcdonald
* @version 1.0
*/
! public class ResourceException
! extends com.babeldoc.core.GeneralException {
!
/**
* Constructor
--- 1,77 ----
! /* ====================================================================
! * The Apache Software License, Version 1.1
*
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
*
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
*
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
*
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Apache" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact ap...@ap....
! *
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
! *
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
! *
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
! *
! * Portions of this software are based upon public domain software
! * originally written at the National Center for Supercomputing Applications,
! * University of Illinois, Urbana-Champaign.
! * ====================================================================
! *
! * Babeldoc: The Universal Document Processor
! *
! * $Header$
! * $DateTime$
! * $Author$
*
*/
package com.babeldoc.core.resource;
/**
! * Deliverer of (bad) news related to resource issues. Read the err log
! * messages.
*
* @author Bmcdonald
* @version 1.0
*/
! public class ResourceException extends com.babeldoc.core.GeneralException {
/**
* Constructor
Index: ResourceFactory.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/resource/ResourceFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ResourceFactory.java 22 May 2003 03:20:29 -0000 1.4
--- ResourceFactory.java 27 Jun 2003 02:19:59 -0000 1.5
***************
*** 1,24 ****
! /*
! * $Header$
! * $DateTime: 2002/07/21 17:01:20 $
*
*
! * 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.core.resource;
--- 1,67 ----
! /* ====================================================================
! * The Apache Software License, Version 1.1
*
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
*
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
*
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
*
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Apache" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact ap...@ap....
! *
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
! *
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
! *
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
! *
! * Portions of this software are based upon public domain software
! * originally written at the National Center for Supercomputing Applications,
! * University of Illinois, Urbana-Champaign.
! * ====================================================================
! *
! * Babeldoc: The Universal Document Processor
! *
! * $Header$
! * $DateTime$
! * $Author$
*
*/
package com.babeldoc.core.resource;
***************
*** 26,29 ****
--- 69,73 ----
import com.babeldoc.core.LogService;
import com.babeldoc.core.config.ConfigService;
+
import org.apache.commons.collections.LRUMap;
***************
*** 31,54 ****
import java.util.Map;
/**
* Resource factory finds named resources. Looks in the classpath for the
! * classname of the named resource and instantiates it. The guts of the processing
! * individual resources. For now resource can be checked in or out - thats it. more
! * later.
*
* @author Bmcdonald
* @version 1.0
*/
-
public class ResourceFactory {
! public final static int NUM_LRU = 100;
! /** constants for the configuration stuff */
! public final static String TYPE = "type";
! public final static String RESOURCE = "resource";
! /**
! * holds singleton reference
! */
private static ResourceFactory instance = new ResourceFactory();
--- 75,96 ----
import java.util.Map;
+
/**
* Resource factory finds named resources. Looks in the classpath for the
! * classname of the named resource and instantiates it. The guts of the
! * processing individual resources. For now resource can be checked in or out
! * - thats it. more later.
*
* @author Bmcdonald
* @version 1.0
*/
public class ResourceFactory {
! public static final int NUM_LRU = 100;
! /** constants for the configuration stuff */
! public static final String TYPE = "type";
! public static final String RESOURCE = "resource";
! /** holds singleton reference */
private static ResourceFactory instance = new ResourceFactory();
***************
*** 57,65 ****
/**
! * Constructor is private since this is a singleton. This
! * constructor sets up the resources.
*/
private ResourceFactory() {
! /** Scanner configuration */
resources = Collections.synchronizedMap(new LRUMap(NUM_LRU));
}
--- 99,109 ----
/**
! * Constructor is private since this is a singleton. This constructor sets
! * up the resources.
*/
private ResourceFactory() {
! /**
! * Scanner configuration
! */
resources = Collections.synchronizedMap(new LRUMap(NUM_LRU));
}
***************
*** 75,93 ****
/**
! * Get a named resource object. Must be synchronized to disallow the access and possible
! * creation of a new resource
*
* @return the sqlconnectionmanager object
*/
! public synchronized static IResource getResource(String name) {
// LogService.getInstance().logDebug("[ResourceFactory.getResource]: getting resource \""+name+"\"");
IResource resource = (IResource) getInstance().resources.get(name);
if (resource == null) {
// LogService.getInstance().logDebug("[ResourceFactory.getResource] resource not cached, creating");
try {
String typeName = ConfigService.getString(RESOURCE + "/" + name, TYPE);
// LogService.getInstance().logDebug("[ResourceFactory.getResource]: Type: \""+typeName+"\"");
if (typeName != null) {
Class classObj = ResourceType.getResourceType(typeName).getTypeClass();
if (classObj != null) {
resource = (Resource) classObj.newInstance();
--- 119,142 ----
/**
! * Get a named resource object. Must be synchronized to disallow the access
! * and possible creation of a new resource
! *
! * @param name DOCUMENT ME!
*
* @return the sqlconnectionmanager object
*/
! public static synchronized IResource getResource(String name) {
// LogService.getInstance().logDebug("[ResourceFactory.getResource]: getting resource \""+name+"\"");
IResource resource = (IResource) getInstance().resources.get(name);
+
if (resource == null) {
// LogService.getInstance().logDebug("[ResourceFactory.getResource] resource not cached, creating");
try {
String typeName = ConfigService.getString(RESOURCE + "/" + name, TYPE);
+
// LogService.getInstance().logDebug("[ResourceFactory.getResource]: Type: \""+typeName+"\"");
if (typeName != null) {
Class classObj = ResourceType.getResourceType(typeName).getTypeClass();
+
if (classObj != null) {
resource = (Resource) classObj.newInstance();
***************
*** 104,108 ****
}
}
return resource;
}
! }
\ No newline at end of file
--- 153,158 ----
}
}
+
return resource;
}
! }
Index: ResourceType.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/resource/ResourceType.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ResourceType.java 8 Apr 2003 00:01:05 -0000 1.3
--- ResourceType.java 27 Jun 2003 02:19:59 -0000 1.4
***************
*** 1,22 ****
! /*
! * $Header$
! * $DateTime: 2002/07/21 17:01:20 $
*
*
! * 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.core.resource;
--- 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.core.resource;
***************
*** 24,55 ****
import com.babeldoc.core.Type;
/**
! * Characterize the type of resource. This type maps to a name and a class to actually
! * provide a concrete implementation.
! *
! * TODO: Implement this in terms of Type
*
* @author Bmcdonald
* @version 1.0
*/
! public class ResourceType
! extends Type {
! /**
! * Service prefix
! */
public static String SERVICE_PREFIX = "Resource";
-
- /**
- * Get the service prefix for this type.
- *
- * @return
- */
- public String getServicePrefix() {
- return SERVICE_PREFIX;
- }
-
/**
* Private constructor - do not use this - use the constants above.
*/
private ResourceType(String resourceType) {
--- 68,88 ----
import com.babeldoc.core.Type;
+
/**
! * Characterize the type of resource. This type maps to a name and a class to
! * actually provide a concrete implementation. TODO: Implement this in terms
! * of Type
*
* @author Bmcdonald
* @version 1.0
*/
! public class ResourceType extends Type {
! /** Service prefix */
public static String SERVICE_PREFIX = "Resource";
/**
* Private constructor - do not use this - use the constants above.
+ *
+ * @param resourceType DOCUMENT ME!
*/
private ResourceType(String resourceType) {
***************
*** 61,68 ****
--- 94,111 ----
*
* @param resourceType
+ *
* @return
*/
public static ResourceType getResourceType(String resourceType) {
return new ResourceType(resourceType);
+ }
+
+ /**
+ * Get the service prefix for this type.
+ *
+ * @return
+ */
+ public String getServicePrefix() {
+ return SERVICE_PREFIX;
}
}
|
|
From: <tr...@us...> - 2003-06-27 02:20:02
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/error In directory sc8-pr-cvs1:/tmp/cvs-serv700/src/com/babeldoc/core/pipeline/error Modified Files: RedirectErrorHandler.java Log Message: reformatted and updated license header Index: RedirectErrorHandler.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/error/RedirectErrorHandler.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RedirectErrorHandler.java 22 May 2003 03:20:28 -0000 1.3 --- RedirectErrorHandler.java 27 Jun 2003 02:19:59 -0000 1.4 *************** *** 1,23 **** ! /* ! * $Header$ ! * $DateTime$ * * ! * babeldoc: universal document processor ! * Copyright (C) 2002 Dejan Krsmanovic. * ! * 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.core.pipeline.error; --- 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.core.pipeline.error; *************** *** 27,40 **** import com.babeldoc.core.pipeline.PipelineException; /** ! * This is a redirecting error handler - it does nothing by default. Its use is ! * forgotten by me as I write this comment. * * @author bmcdonald * @version 1.0 */ ! public class RedirectErrorHandler ! implements IPipelineStageErrorHandler { ! public boolean handlePipelineStageError(IPipelineStage stage, PipelineException pe) { return false; } --- 70,92 ---- import com.babeldoc.core.pipeline.PipelineException; + /** ! * This is a redirecting error handler - it does nothing by default. Its use ! * is forgotten by me as I write this comment. * * @author bmcdonald * @version 1.0 */ ! public class RedirectErrorHandler implements IPipelineStageErrorHandler { ! /** ! * TODO: DOCUMENT ME! ! * ! * @param stage DOCUMENT ME! ! * @param pe DOCUMENT ME! ! * ! * @return DOCUMENT ME! ! */ ! public boolean handlePipelineStageError(IPipelineStage stage, ! PipelineException pe) { return false; } |
|
From: <tr...@us...> - 2003-06-27 02:20:02
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/simple In directory sc8-pr-cvs1:/tmp/cvs-serv700/src/com/babeldoc/core/pipeline/simple Modified Files: SimplePipelineStageFactory.java SimplePipelineStageResolver.java Log Message: reformatted and updated license header Index: SimplePipelineStageFactory.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/simple/SimplePipelineStageFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SimplePipelineStageFactory.java 8 Jun 2003 18:23:46 -0000 1.3 --- SimplePipelineStageFactory.java 27 Jun 2003 02:19:59 -0000 1.4 *************** *** 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.core.pipeline.simple; --- 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.core.pipeline.simple; *************** *** 24,52 **** import com.babeldoc.core.config.ConfigService; import com.babeldoc.core.config.IConfig; - import com.babeldoc.core.pipeline.PipelineStageFactory; import com.babeldoc.core.pipeline.IPipelineStageFactory; import java.util.Map; /** ! * This is a simple implementation of a pipeline stage factory - it uses the configuration ! * server to resolve pipelinestage names to objects. Most of the hard work / specific ! * work is performed by the SimplePipelineResolver. * * @author Bmcdonald * @version 1.0 */ ! public class SimplePipelineStageFactory ! extends PipelineStageFactory implements IPipelineStageFactory { /** ! * Configuration constants ! */ ! public final static String CONFIG_FILENAME = "configFile"; ! ! /** ! * Set the options. Extract the name of the configuration file ! * and then do the setup. * * @param options --- 68,93 ---- import com.babeldoc.core.config.ConfigService; import com.babeldoc.core.config.IConfig; import com.babeldoc.core.pipeline.IPipelineStageFactory; + import com.babeldoc.core.pipeline.PipelineStageFactory; import java.util.Map; + /** ! * This is a simple implementation of a pipeline stage factory - it uses the ! * configuration server to resolve pipelinestage names to objects. Most of ! * the hard work / specific work is performed by the SimplePipelineResolver. * * @author Bmcdonald * @version 1.0 */ ! public class SimplePipelineStageFactory extends PipelineStageFactory implements IPipelineStageFactory { + /** Configuration constants */ + public static final String CONFIG_FILENAME = "configFile"; /** ! * Set the options. Extract the name of the configuration file and then do ! * the setup. * * @param options *************** *** 54,59 **** public void setOptions(Map options) { String configFile = (String) options.get(CONFIG_FILENAME); ! IConfig config = ConfigService.getInstance(). ! getConfig(configFile); setResolver(new SimplePipelineStageResolver(config)); } --- 95,99 ---- public void setOptions(Map options) { String configFile = (String) options.get(CONFIG_FILENAME); ! IConfig config = ConfigService.getInstance().getConfig(configFile); setResolver(new SimplePipelineStageResolver(config)); } Index: SimplePipelineStageResolver.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/simple/SimplePipelineStageResolver.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SimplePipelineStageResolver.java 8 Jun 2003 18:28:56 -0000 1.3 --- SimplePipelineStageResolver.java 27 Jun 2003 02:19:59 -0000 1.4 *************** *** 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.core.pipeline.simple; import com.Ostermiller.util.StringTokenizer; import com.babeldoc.core.config.IConfig; import com.babeldoc.core.pipeline.IPipelineStageResolver; --- 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.core.pipeline.simple; import com.Ostermiller.util.StringTokenizer; + import com.babeldoc.core.config.IConfig; import com.babeldoc.core.pipeline.IPipelineStageResolver; *************** *** 30,51 **** import java.util.Iterator; /** * The SimplePipelineResolver class to resolve references for pipeline factory ! * and the pipeline stages in a sytstem independant fashion. This pipeline configuration ! * is stored in configuration property objects. Most of the work in this class is the ! * transformation of the configuration information into pipeline configuration information. * * @author Bmcdonald * @version 1.0 */ ! public class SimplePipelineStageResolver ! extends PipelineStageResolver implements IPipelineStageResolver { ! ! /** ! * configuration constants ! */ ! public final static String CONNECTION = "connection"; ! public final static String GLUE = "."; /** --- 75,94 ---- import java.util.Iterator; + /** * The SimplePipelineResolver class to resolve references for pipeline factory ! * and the pipeline stages in a sytstem independant fashion. This pipeline ! * configuration is stored in configuration property objects. Most of the ! * work in this class is the transformation of the configuration information ! * into pipeline configuration information. * * @author Bmcdonald * @version 1.0 */ ! public class SimplePipelineStageResolver extends PipelineStageResolver implements IPipelineStageResolver { ! /** configuration constants */ ! public static final String CONNECTION = "connection"; ! public static final String GLUE = "."; /** *************** *** 67,73 **** /** ! * Load the configuration data for this pipeline into the ! * three hashtables: name - class name mappings, stage and ! * next stage mappings and the configuration information. * * @param config --- 110,116 ---- /** ! * Load the configuration data for this pipeline into the three hashtables: ! * name - class name mappings, stage and next stage mappings and the ! * configuration information. * * @param config *************** *** 75,78 **** --- 118,122 ---- protected void setupConfigData(IConfig config) { stageConfig = new PipelineStageConfig("root"); + for (Iterator keys = config.keys().iterator(); keys.hasNext();) { String key = (String) keys.next(); *************** *** 88,92 **** // Also handle connections else if (key.endsWith(NEXT_STAGE)) { ! String source = key.substring(0, key.length() - NEXT_STAGE.length() - 1); setupNextStages(source, value); } else if (key.equals(ENTRY_STAGE)) { --- 132,137 ---- // Also handle connections else if (key.endsWith(NEXT_STAGE)) { ! String source = key.substring(0, key.length() - NEXT_STAGE.length() - ! 1); setupNextStages(source, value); } else if (key.equals(ENTRY_STAGE)) { *************** *** 103,106 **** --- 148,152 ---- int i = 1; + while (st.hasMoreTokens()) { String token = st.nextToken(); *************** *** 109,112 **** --- 155,159 ---- working.put(token, new PipelineStageConfig(token)); } + working = working.get(token); |
|
From: <tr...@us...> - 2003-06-27 02:20:01
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/compiler
In directory sc8-pr-cvs1:/tmp/cvs-serv700/src/com/babeldoc/core/pipeline/compiler
Modified Files:
PipelineClassLoader.java PipelineStageCompiler.java
Log Message:
reformatted and updated license header
Index: PipelineClassLoader.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/compiler/PipelineClassLoader.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** PipelineClassLoader.java 24 Feb 2003 22:46:54 -0000 1.1.1.1
--- PipelineClassLoader.java 27 Jun 2003 02:19:59 -0000 1.2
***************
*** 1,43 ****
! /*
! * $Header$
! * $DateTime$
*
*
! * babeldoc: universal document processor
! * Copyright (C) 2002 Bruce McDonald, Elogex Inc.
*
! * 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.core.pipeline.compiler;
-
/**
* <strong>PipelineClassLoader</strong>
*
- * <p>This is pipeline classloader for getting the created classes. Now if the
- * class does not exist, then this will delegate (to where?) to create the classes
- * using bcel</p>
- *
- * <p>Title: Babel</p>
- * <p>Description: Universal Document Processor</p>
- * <p>Copyright: Copyright (c) 2002</p>
- * <p>Company: </p>
* @author Bmcdonald
* @version 1.0
*/
! public class PipelineClassLoader
! extends ClassLoader {
/** instance: the name of the pipeline "package" */
private String namespace;
--- 1,98 ----
! /* ====================================================================
! * The Apache Software License, Version 1.1
*
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
*
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
*
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
*
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Apache" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact ap...@ap....
! *
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
! *
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
! *
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
! *
! * Portions of this software are based upon public domain software
! * originally written at the National Center for Supercomputing Applications,
! * University of Illinois, Urbana-Champaign.
! * ====================================================================
! *
! * Babeldoc: The Universal Document Processor
! *
! * $Header$
! * $DateTime$
! * $Author$
*
*/
package com.babeldoc.core.pipeline.compiler;
/**
* <strong>PipelineClassLoader</strong>
+ *
+ * <p>
+ * This is pipeline classloader for getting the created classes. Now if the
+ * class does not exist, then this will delegate (to where?) to create the
+ * classes using bcel
+ * </p>
+ *
+ * <p>
+ * Title: Babel
+ * </p>
+ *
+ * <p>
+ * Description: Universal Document Processor
+ * </p>
+ *
+ * <p>
+ * Copyright: Copyright (c) 2002
+ * </p>
+ *
+ * <p>
+ * Company:
+ * </p>
*
* @author Bmcdonald
* @version 1.0
*/
! public class PipelineClassLoader extends ClassLoader {
/** instance: the name of the pipeline "package" */
private String namespace;
***************
*** 58,94 ****
/**
! * Load the pipeline stage factory using the configured namespace. If the class
! * is not defined, then compile and define it and create an instance of it.
*
* @param name
* @return
*/
! public com.babeldoc.core.pipeline.IPipelineStageFactory getCompiledPipelineStageFactory(com.babeldoc.core.pipeline.PipelineFactory pFactory,
! String name) {
name += getNamespace();
! com.babeldoc.core.LogService.getInstance().logDebug("[PipelineClassLoader.getCompiledPipelineStageFactory] Getting \"" + name + "\"");
Class classObject = this.loadClass(name);
if (classObject == null) {
com.babeldoc.core.LogService.getInstance().logDebug("[PipelineClassLoader.getCompiledPipelineStageFactory] got null, creating");
byte[] data = compileFactory(pFactory, name);
classObject = defineClass(name, data, 0, data.length);
}
try {
return (com.babeldoc.core.pipeline.IPipelineStageFactory) (classObject.newInstance());
} catch (Exception e) {
! com.babeldoc.core.LogService.getInstance().logError("Exception creating compiled stage factory", e);
}
return null;
}
/**
* Load the class
*
* @param name the name of the pipeline to load.
* @return the class
*/
public synchronized Class loadClass(String name) {
Class c = findLoadedClass(name);
if (c != null) {
return c;
--- 113,170 ----
/**
! * Load the pipeline stage factory using the configured namespace. If the
! * class is not defined, then compile and define it and create an instance
! * of it.
*
+ * @param pFactory DOCUMENT ME!
* @param name
+ *
* @return
*/
! public com.babeldoc.core.pipeline.IPipelineStageFactory getCompiledPipelineStageFactory(
! com.babeldoc.core.pipeline.PipelineFactory pFactory, String name) {
name += getNamespace();
! com.babeldoc.core.LogService.getInstance().logDebug("[PipelineClassLoader.getCompiledPipelineStageFactory] Getting \"" +
! name + "\"");
!
Class classObject = this.loadClass(name);
+
if (classObject == null) {
com.babeldoc.core.LogService.getInstance().logDebug("[PipelineClassLoader.getCompiledPipelineStageFactory] got null, creating");
+
byte[] data = compileFactory(pFactory, name);
classObject = defineClass(name, data, 0, data.length);
}
+
try {
return (com.babeldoc.core.pipeline.IPipelineStageFactory) (classObject.newInstance());
} catch (Exception e) {
! com.babeldoc.core.LogService.getInstance().logError("Exception creating compiled stage factory",
! e);
}
+
return null;
}
/**
+ * Get the namespace
+ *
+ * @return
+ */
+ public String getNamespace() {
+ return namespace;
+ }
+
+ /**
* Load the class
*
* @param name the name of the pipeline to load.
+ *
* @return the class
*/
public synchronized Class loadClass(String name) {
Class c = findLoadedClass(name);
+
if (c != null) {
return c;
***************
*** 99,107 ****
/**
! * Make the class using bcel
*
! * for the name, factory
*/
! protected byte[] compileFactory(com.babeldoc.core.pipeline.PipelineFactory pFactory, String name) {
/*
LogService.getInstance().logDebug("[PipelineClassLoader.compileFactory] Creating synthetic class");
--- 175,187 ----
/**
! * Make the class using bcel for the name, factory
*
! * @param pFactory DOCUMENT ME!
! * @param name DOCUMENT ME!
! *
! * @return DOCUMENT ME!
*/
! protected byte[] compileFactory(
! com.babeldoc.core.pipeline.PipelineFactory pFactory, String name) {
/*
LogService.getInstance().logDebug("[PipelineClassLoader.compileFactory] Creating synthetic class");
***************
*** 126,138 ****
*/
return null;
- }
-
- /**
- * Get the namespace
- *
- * @return
- */
- public String getNamespace() {
- return namespace;
}
}
--- 206,209 ----
Index: PipelineStageCompiler.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/compiler/PipelineStageCompiler.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** PipelineStageCompiler.java 24 Feb 2003 22:46:54 -0000 1.1.1.1
--- PipelineStageCompiler.java 27 Jun 2003 02:19:59 -0000 1.2
***************
*** 1,23 ****
! /*
! * $Header$
! * $DateTime$
*
*
! * babeldoc: universal document processor
! * Copyright (C) 2002 Bruce McDonald, Elogex Inc.
*
! * 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.core.pipeline.compiler;
--- 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.core.pipeline.compiler;
***************
*** 30,42 ****
import java.util.HashMap;
/**
! * <strong>PipelineStageCompiler</strong>
! * This class used to do pipeline stage compilation.
! * .
*
- * <p>Title: Babel</p>
- * <p>Description: Universal Document Processor</p>
- * <p>Copyright: Copyright (c) 2002</p>
- * <p>Company: </p>
* @author Bmcdonald
* @version 1.0
--- 73,97 ----
import java.util.HashMap;
+
/**
! * <strong>PipelineStageCompiler</strong> This class used to do pipeline stage
! * compilation. .
! *
! * <p>
! * Title: Babel
! * </p>
! *
! * <p>
! * Description: Universal Document Processor
! * </p>
! *
! * <p>
! * Copyright: Copyright (c) 2002
! * </p>
! *
! * <p>
! * Company:
! * </p>
*
* @author Bmcdonald
* @version 1.0
***************
*** 45,63 ****
/** constant: the name of the configuration */
public static final String CONFIG_NAME = "pipeline/compiler";
/** constant: the name of the namespace property key */
public static final String NAMESPACE = "namespace";
/** constant: the name of the namespace property key */
public static final String COMPILER = "compile";
/** instance: hashmap of the class loaders out there */
HashMap loaders = null;
/** instance: temporary measure - single class loader for all pipelines */
PipelineClassLoader loader = null;
-
- /** static: the singleton reference */
- private static PipelineStageCompiler pipelineStageCompiler = null;
-
/**
* Private constructor. If the compiler is set to active, initialize.
--- 100,119 ----
/** constant: the name of the configuration */
public static final String CONFIG_NAME = "pipeline/compiler";
+
/** constant: the name of the namespace property key */
public static final String NAMESPACE = "namespace";
+
/** constant: the name of the namespace property key */
public static final String COMPILER = "compile";
+ /** static: the singleton reference */
+ private static PipelineStageCompiler pipelineStageCompiler = null;
/** instance: hashmap of the class loaders out there */
HashMap loaders = null;
+
/** instance: temporary measure - single class loader for all pipelines */
PipelineClassLoader loader = null;
/**
* Private constructor. If the compiler is set to active, initialize.
***************
*** 66,76 ****
private PipelineStageCompiler() {
String compile = ConfigService.getString(CONFIG_NAME, COMPILER);
! if (compile != null && compile.equalsIgnoreCase("yes")) {
//loaders = new HashMap();
String namespace = ConfigService.getString(CONFIG_NAME, NAMESPACE);
if (namespace == null) {
namespace = "pipeline";
}
! LogService.getInstance().logDebug("[PipelineStageCompiler.PipelineStageCompiler] creating class loader \"" + namespace + "\"");
loader = new PipelineClassLoader(namespace);
}
--- 122,136 ----
private PipelineStageCompiler() {
String compile = ConfigService.getString(CONFIG_NAME, COMPILER);
!
! if ((compile != null) && compile.equalsIgnoreCase("yes")) {
//loaders = new HashMap();
String namespace = ConfigService.getString(CONFIG_NAME, NAMESPACE);
+
if (namespace == null) {
namespace = "pipeline";
}
!
! LogService.getInstance().logDebug("[PipelineStageCompiler.PipelineStageCompiler] creating class loader \"" +
! namespace + "\"");
loader = new PipelineClassLoader(namespace);
}
***************
*** 80,83 ****
--- 140,144 ----
* Get the pipeline stage factory
*
+ * @return DOCUMENT ME!
*/
public static PipelineStageCompiler getInstance() {
***************
*** 85,88 ****
--- 146,150 ----
pipelineStageCompiler = new PipelineStageCompiler();
}
+
return pipelineStageCompiler;
}
***************
*** 93,104 ****
* @param pFactory the factory of the pipeline
* @param name the name of pipelinestage factory
* @return
*/
! public IPipelineStageFactory getPipelineStageFactory(PipelineFactory pFactory,
! String name) {
if (loader != null) {
return loader.getCompiledPipelineStageFactory(pFactory, name);
} else {
LogService.getInstance().logDebug("[PipelineStageCompiler.PipelineStageCompiler] No loader - aborting");
return null;
}
--- 155,168 ----
* @param pFactory the factory of the pipeline
* @param name the name of pipelinestage factory
+ *
* @return
*/
! public IPipelineStageFactory getPipelineStageFactory(
! PipelineFactory pFactory, String name) {
if (loader != null) {
return loader.getCompiledPipelineStageFactory(pFactory, name);
} else {
LogService.getInstance().logDebug("[PipelineStageCompiler.PipelineStageCompiler] No loader - aborting");
+
return null;
}
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/module
In directory sc8-pr-cvs1:/tmp/cvs-serv700/src/com/babeldoc/core/module
Modified Files:
BabeldocModule.java BabeldocModuleCommand.java
BabeldocModuleList.java CoreModule.java
Log Message:
reformatted and updated license header
Index: BabeldocModule.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/module/BabeldocModule.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** BabeldocModule.java 22 May 2003 03:20:26 -0000 1.14
--- BabeldocModule.java 27 Jun 2003 02:19:58 -0000 1.15
***************
*** 1,35 ****
package com.babeldoc.core.module;
import java.io.Serializable;
import java.util.Set;
/**
! * Created by IntelliJ IDEA.
! * User: bruce
! * Date: May 18, 2003
! * Time: 7:27:57 PM
! * To change this template use Options | File Templates.
*/
! abstract public class BabeldocModule
! implements Serializable {
/**
! * Return the name of the module. This must be unique. The name must not contain any
! * periods, punctations symbols. Be safe and use letters and numbers.
*
* @return
*/
! abstract public String getName();
/**
! * Return the set of names of modules that this module depends on. If this module does not depend
! * on return a null set or a null object.
*
* @return
*/
! abstract public Set getDependsOn();
! /**
! * A do-nothing initializer - override with real code to do something when the module
! * is loaded into the system.
*/
public void initialize() {
--- 1,99 ----
+ /* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact ap...@ap....
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ * Portions of this software are based upon public domain software
+ * originally written at the National Center for Supercomputing Applications,
+ * University of Illinois, Urbana-Champaign.
+ * ====================================================================
+ *
+ * Babeldoc: The Universal Document Processor
+ *
+ * $Header$
+ * $DateTime$
+ * $Author$
+ *
+ */
package com.babeldoc.core.module;
import java.io.Serializable;
+
import java.util.Set;
+
/**
! * Created by IntelliJ IDEA. User: bruce Date: May 18, 2003 Time: 7:27:57 PM To
! * change this template use Options | File Templates.
*/
! public abstract class BabeldocModule implements Serializable {
/**
! * Return the set of names of modules that this module depends on. If this
! * module does not depend on return a null set or a null object.
*
* @return
*/
! public abstract Set getDependsOn();
/**
! * Return the name of the module. This must be unique. The name must not
! * contain any periods, punctations symbols. Be safe and use letters and
! * numbers.
*
* @return
*/
! public abstract String getName();
! /**
! * A do-nothing initializer - override with real code to do something when
! * the module is loaded into the system.
*/
public void initialize() {
***************
*** 37,42 ****
/**
! * A do-nothing unloader - override with real code to do something when the module
! * is unloaded from the system.
*/
public void unload() {
--- 101,106 ----
/**
! * A do-nothing unloader - override with real code to do something when the
! * module is unloaded from the system.
*/
public void unload() {
Index: BabeldocModuleCommand.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/module/BabeldocModuleCommand.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** BabeldocModuleCommand.java 22 May 2003 03:20:26 -0000 1.13
--- BabeldocModuleCommand.java 27 Jun 2003 02:19:58 -0000 1.14
***************
*** 1,20 ****
! /*
! * $Header$
*
! * 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.core.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.core.module;
***************
*** 22,25 ****
--- 68,72 ----
import com.babeldoc.core.BabeldocCommand;
import com.babeldoc.core.I18n;
+
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder;
***************
*** 28,116 ****
import java.util.Set;
/**
! * Command class to access and browse the babeldoc modules from the command line
*
* @author bruce
*/
public class BabeldocModuleCommand extends BabeldocCommand {
! /**
! * Main routine
! * @param args
! */
! public static void main(String[] args) {
! new BabeldocModuleCommand(args);
! System.exit(0);
! }
!
! /**
! * Setup the babeldoc command class
! *
! * @param args the command line arguments
! */
! public BabeldocModuleCommand(String[] args) {
! super("module", I18n.get("core.module.command.desc"), args);
! }
! /**
! * Setup the command line arguments
! *
! * @param options the commandline options to look for
! */
! public void setupCommandLine(Options options) {
! super.setupCommandLine(options);
! options.addOption(OptionBuilder.isRequired(false).hasArg(false).withDescription(I18n.get("core.module.command.option.list")).create('l'));
! options.addOption(OptionBuilder.isRequired(false).hasArg(false).withDescription(I18n.get("core.module.command.option.create")).create('c'));
! options.addOption(OptionBuilder.isRequired(false).hasArg(false).withDescription(I18n.get("core.module.command.option.delete")).create('d'));
! }
! /**
! * process and execute the commandline and
! *
! * @param commandLine the command line
! */
! public void execute(CommandLine commandLine) {
! if (commandLine.hasOption('l')) {
! listModules();
! } else if(commandLine.hasOption("c")) {
// createCache();
! } else if(commandLine.hasOption("d")) {
// deleteCache();
! } else {
! printUsage();
! }
! }
!
! /**
! * Get the set of strings as a csv string.
! *
! * @param depSet
! * @return
! */
! private String getDependantsAsCVS(Set depSet) {
! String[] depsArray = new String[depSet.size()];
! depSet.toArray(depsArray);
! StringBuffer deps = new StringBuffer();
! for(int j = 0; j < depsArray.length; ++j) {
! if(j!=0) {
! deps.append(", ").append(depsArray[j]);
! } else {
! deps.append(depsArray[j]);
! }
! }
! return deps.toString();
! }
! /**
! * List the currently load modules in the system
! */
! public void listModules() {
! BabeldocModule [] modules = BabeldocModuleList.getInstance().getSortedModules();
! for(int i = 0; i < modules.length; ++i) {
BabeldocModule module = modules[i];
String deps = getDependantsAsCVS(module.getDependsOn());
System.out.println(I18n.get("core.module.command.list.output",
! module.getName(), deps));
}
! }
}
--- 75,177 ----
import java.util.Set;
+
/**
! * Command class to access and browse the babeldoc modules from the command
! * line
*
* @author bruce
*/
public class BabeldocModuleCommand extends BabeldocCommand {
! /**
! * Setup the babeldoc command class
! *
! * @param args the command line arguments
! */
! public BabeldocModuleCommand(String[] args) {
! super("module", I18n.get("core.module.command.desc"), args);
! }
! /**
! * Main routine
! *
! * @param args
! */
! public static void main(String[] args) {
! new BabeldocModuleCommand(args);
! System.exit(0);
! }
! /**
! * process and execute the commandline and
! *
! * @param commandLine the command line
! */
! public void execute(CommandLine commandLine) {
! if (commandLine.hasOption('l')) {
! listModules();
! } else if (commandLine.hasOption("c")) {
// createCache();
! } else if (commandLine.hasOption("d")) {
// deleteCache();
! } else {
! printUsage();
! }
! }
! /**
! * List the currently load modules in the system
! */
! public void listModules() {
! BabeldocModule[] modules = BabeldocModuleList.getInstance()
! .getSortedModules();
! for (int i = 0; i < modules.length; ++i) {
BabeldocModule module = modules[i];
String deps = getDependantsAsCVS(module.getDependsOn());
System.out.println(I18n.get("core.module.command.list.output",
! module.getName(), deps));
}
! }
!
! /**
! * Setup the command line arguments
! *
! * @param options the commandline options to look for
! */
! public void setupCommandLine(Options options) {
! super.setupCommandLine(options);
! options.addOption(OptionBuilder.isRequired(false).hasArg(false)
! .withDescription(I18n.get(
! "core.module.command.option.list")).create('l'));
! options.addOption(OptionBuilder.isRequired(false).hasArg(false)
! .withDescription(I18n.get(
! "core.module.command.option.create")).create('c'));
! options.addOption(OptionBuilder.isRequired(false).hasArg(false)
! .withDescription(I18n.get(
! "core.module.command.option.delete")).create('d'));
! }
!
! /**
! * Get the set of strings as a csv string.
! *
! * @param depSet
! *
! * @return
! */
! private String getDependantsAsCVS(Set depSet) {
! String[] depsArray = new String[depSet.size()];
! depSet.toArray(depsArray);
!
! StringBuffer deps = new StringBuffer();
!
! for (int j = 0; j < depsArray.length; ++j) {
! if (j != 0) {
! deps.append(", ").append(depsArray[j]);
! } else {
! deps.append(depsArray[j]);
! }
! }
!
! return deps.toString();
! }
}
Index: BabeldocModuleList.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/module/BabeldocModuleList.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BabeldocModuleList.java 21 May 2003 01:49:45 -0000 1.2
--- BabeldocModuleList.java 27 Jun 2003 02:19:58 -0000 1.3
***************
*** 1,20 ****
! /*
! * $Header$
*
! * 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.core.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.core.module;
***************
*** 27,44 ****
import java.util.Map;
/**
! * The BabeldocModuleList is the main controller to discover and manipulate the list of
! * modules in babeldoc. Each module must provide an implementation of the IBabeldocModule
! * interface. This is specified as a jar service. There is a tie-in with the build process in
! * that the name of the module must match the name returned by the getName method. This is important.
* <p>
* This is a singleton class. There is an static instance.
*/
public class BabeldocModuleList {
/** Instance variable */
private static BabeldocModuleList instance = null;
!
private Map map = new HashMap();
- BabeldocModule [] modules = null;
/**
--- 73,93 ----
import java.util.Map;
+
/**
! * The BabeldocModuleList is the main controller to discover and manipulate the
! * list of modules in babeldoc. Each module must provide an implementation of
! * the IBabeldocModule interface. This is specified as a jar service. There
! * is a tie-in with the build process in that the name of the module must
! * match the name returned by the getName method. This is important.
! *
* <p>
* This is a singleton class. There is an static instance.
+ * </p>
*/
public class BabeldocModuleList {
/** Instance variable */
private static BabeldocModuleList instance = null;
! BabeldocModule[] modules = null;
private Map map = new HashMap();
/**
***************
*** 49,72 ****
}
/**
! * Load the module list using the jakarta-discovery services methods. Initialize the modules
! * as we go.
*/
! private void loadDynamicModules() {
! for(Enumeration i = Service.providers(BabeldocModule.class);i.hasMoreElements();) {
! BabeldocModule module = (BabeldocModule)i.nextElement();
! // System.out.println("Module found: "+module.getName());
! addModule(module);
}
}
/**
! * Add the module to the list of modules
! * @param module
*/
! public void addModule(BabeldocModule module) {
! module.initialize();
! map.put(module.getName(), module);
! modules = null; // Set the cached list of modules to null.
}
--- 98,136 ----
}
+ /*
+ private String printOutArrayList(IBabeldocModule [] list) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("[ ");
+ for(int i = 0; i < list.length; ++i) {
+ buffer.append((list[i].getName()+" "));
+ }
+ buffer.append("]");
+
+ return buffer.toString();
+ }
+ */
+
/**
! * Get the instance variable. Instantiate the object if necessary.
! *
! * @return
*/
! public static BabeldocModuleList getInstance() {
! if (instance == null) {
! instance = new BabeldocModuleList();
}
+
+ return instance;
}
/**
! * Get the module with the name, depName
! *
! * @param depName
! *
! * @return
*/
! public BabeldocModule getModule(String depName) {
! return (BabeldocModule) this.map.get(depName);
}
***************
*** 76,93 ****
* @return array of babeldoc modules
*/
! public BabeldocModule [] getSortedModules() {
! if(modules==null) {
modules = new BabeldocModule[map.size()];
map.values().toArray(modules);
! for(int i = 0; i<modules.length; ++i ) {
! for(int j = 0; j<modules.length; ++j) {
! if(i==j) {
continue;
}
BabeldocModule mod1 = modules[i];
BabeldocModule mod2 = modules[j];
! if(dependsOn(mod1, mod2)) {
BabeldocModule tmp = modules[i];
modules[i] = modules[j];
--- 140,158 ----
* @return array of babeldoc modules
*/
! public BabeldocModule[] getSortedModules() {
! if (modules == null) {
modules = new BabeldocModule[map.size()];
map.values().toArray(modules);
! for (int i = 0; i < modules.length; ++i) {
! for (int j = 0; j < modules.length; ++j) {
! if (i == j) {
continue;
}
+
BabeldocModule mod1 = modules[i];
BabeldocModule mod2 = modules[j];
! if (dependsOn(mod1, mod2)) {
BabeldocModule tmp = modules[i];
modules[i] = modules[j];
***************
*** 97,158 ****
}
}
return modules;
}
/**
! * Returns true if mod1 depends on mod2. This is a fairly expensive operation.
*
* @param mod1
* @param mod2
* @return
*/
private boolean dependsOn(BabeldocModule mod1, BabeldocModule mod2) {
! if(mod1.getDependsOn()!=null) {
! for(Iterator iter = mod1.getDependsOn().iterator(); iter.hasNext();) {
! String depName = (String)iter.next();
! if(depName.equals(mod2.getName())) {
return true;
} else {
BabeldocModule depMod = getModule(depName);
return dependsOn(depMod, mod2);
}
}
}
return false;
}
/**
! * Get the module with the name, depName
! *
! * @param depName
! * @return
*/
! public BabeldocModule getModule(String depName) {
! return (BabeldocModule)this.map.get(depName);
! }
!
! /*
! private String printOutArrayList(IBabeldocModule [] list) {
! StringBuffer buffer = new StringBuffer();
! buffer.append("[ ");
! for(int i = 0; i < list.length; ++i) {
! buffer.append((list[i].getName()+" "));
! }
! buffer.append("]");
!
! return buffer.toString();
! }
! */
! /**
! * Get the instance variable. Instantiate the object if necessary.
! *
! * @return
! */
! public static BabeldocModuleList getInstance() {
! if(instance==null) {
! instance = new BabeldocModuleList();
}
- return instance;
}
--- 162,219 ----
}
}
+
return modules;
}
/**
! * Add the module to the list of modules
! *
! * @param module
! */
! public void addModule(BabeldocModule module) {
! module.initialize();
! map.put(module.getName(), module);
! modules = null; // Set the cached list of modules to null.
! }
!
! /**
! * Returns true if mod1 depends on mod2. This is a fairly expensive
! * operation.
*
* @param mod1
* @param mod2
+ *
* @return
*/
private boolean dependsOn(BabeldocModule mod1, BabeldocModule mod2) {
! if (mod1.getDependsOn() != null) {
! for (Iterator iter = mod1.getDependsOn().iterator(); iter.hasNext();) {
! String depName = (String) iter.next();
!
! if (depName.equals(mod2.getName())) {
return true;
} else {
BabeldocModule depMod = getModule(depName);
+
return dependsOn(depMod, mod2);
}
}
}
+
return false;
}
/**
! * Load the module list using the jakarta-discovery services methods.
! * Initialize the modules as we go.
*/
! private void loadDynamicModules() {
! for (Enumeration i = Service.providers(BabeldocModule.class);
! i.hasMoreElements();) {
! BabeldocModule module = (BabeldocModule) i.nextElement();
! // System.out.println("Module found: "+module.getName());
! addModule(module);
}
}
Index: CoreModule.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/module/CoreModule.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CoreModule.java 21 May 2003 01:31:54 -0000 1.1
--- CoreModule.java 27 Jun 2003 02:19:58 -0000 1.2
***************
*** 1,20 ****
! /*
! * $Header$
*
! * 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.core.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.core.module;
***************
*** 22,39 ****
import java.util.Set;
/**
! * Created by IntelliJ IDEA.
! * User: bruce
! * Date: May 18, 2003
! * Time: 5:55:27 PM
! * To change this template use Options | File Templates.
*/
! public class CoreModule extends BabeldocModule{
! public String getName() {
! return "core";
! }
!
public Set getDependsOn() {
return null;
}
}
--- 68,93 ----
import java.util.Set;
+
/**
! * Created by IntelliJ IDEA. User: bruce Date: May 18, 2003 Time: 5:55:27 PM To
! * change this template use Options | File Templates.
*/
! public class CoreModule extends BabeldocModule {
! /**
! * TODO: DOCUMENT ME!
! *
! * @return DOCUMENT ME!
! */
public Set getDependsOn() {
return null;
+ }
+
+ /**
+ * TODO: DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public String getName() {
+ return "core";
}
}
|
|
From: <tr...@us...> - 2003-06-27 02:09:24
|
Update of /cvsroot/babeldoc/babeldoc/modules/web/src/com/babeldoc/web/pipeline/servlet In directory sc8-pr-cvs1:/tmp/cvs-serv32148/src/com/babeldoc/web/pipeline/servlet Modified Files: HttpPostPipelineFeeder.java Log Message: Reformatted and added new license header Index: HttpPostPipelineFeeder.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/web/src/com/babeldoc/web/pipeline/servlet/HttpPostPipelineFeeder.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HttpPostPipelineFeeder.java 27 May 2003 03:04:57 -0000 1.4 --- HttpPostPipelineFeeder.java 27 Jun 2003 02:09:21 -0000 1.5 *************** *** 1,28 **** ! /* ! * $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.web.pipeline.servlet; import com.babeldoc.core.I18n; import com.babeldoc.core.LogService; - import com.babeldoc.core.EnvironmentLoader; import com.babeldoc.core.journal.IJournalTicket; import com.babeldoc.core.journal.JournalException; --- 1,72 ---- ! /* ==================================================================== ! * 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.web.pipeline.servlet; + import com.babeldoc.core.EnvironmentLoader; import com.babeldoc.core.I18n; import com.babeldoc.core.LogService; import com.babeldoc.core.journal.IJournalTicket; import com.babeldoc.core.journal.JournalException; *************** *** 31,43 **** import com.babeldoc.core.pipeline.feeder.*; - import javax.servlet.ServletException; - import javax.servlet.http.HttpServlet; - import javax.servlet.http.HttpServletRequest; - import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; /** * Simple Http Servlet for receiving messages. --- 75,90 ---- import com.babeldoc.core.pipeline.feeder.*; import java.io.IOException; + import java.util.Enumeration; import java.util.HashMap; import java.util.Map; + import javax.servlet.ServletException; + import javax.servlet.http.HttpServlet; + import javax.servlet.http.HttpServletRequest; + import javax.servlet.http.HttpServletResponse; + + /** * Simple Http Servlet for receiving messages. *************** *** 46,65 **** * @version 1.0 */ ! public class HttpPostPipelineFeeder ! extends HttpServlet { ! ! public final static String PIPELINE = "pipeline"; ! public final static String DOCUMENT = "document"; ! public final static String FEEDER = "feeder"; ! public final static String TOP_FORM = "top-form.html"; ! public final static String BOTTOM_FORM = "bottom-form.html"; ! ! /** ! * ! * @throws ServletException ! */ ! public void init() throws ServletException { ! EnvironmentLoader.loadEnvironment(); ! } /** --- 93,102 ---- * @version 1.0 */ ! public class HttpPostPipelineFeeder extends HttpServlet { ! public static final String PIPELINE = "pipeline"; ! public static final String DOCUMENT = "document"; ! public static final String FEEDER = "feeder"; ! public static final String TOP_FORM = "top-form.html"; ! public static final String BOTTOM_FORM = "bottom-form.html"; /** *************** *** 68,83 **** * @param request * @param response */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - response.setContentType("text/html"); String topform = com.babeldoc.core.ResourceLoader.getResourceString(TOP_FORM); String bottomform = com.babeldoc.core.ResourceLoader.getResourceString(BOTTOM_FORM); response.getWriter().write(topform); String[] pnames = PipelineFactoryFactory.getAllPipelineNames(); for (int i = 0; i < pnames.length; ++i) { response.getWriter().write("<OPTION>" + pnames[i]); } response.getWriter().write(bottomform); } --- 105,126 ---- * @param request * @param response + * + * @throws IOException DOCUMENT ME! + * @throws ServletException DOCUMENT ME! */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); + String topform = com.babeldoc.core.ResourceLoader.getResourceString(TOP_FORM); String bottomform = com.babeldoc.core.ResourceLoader.getResourceString(BOTTOM_FORM); response.getWriter().write(topform); + String[] pnames = PipelineFactoryFactory.getAllPipelineNames(); + for (int i = 0; i < pnames.length; ++i) { response.getWriter().write("<OPTION>" + pnames[i]); } + response.getWriter().write(bottomform); } *************** *** 88,91 **** --- 131,137 ---- * @param request * @param response + * + * @throws IOException DOCUMENT ME! + * @throws ServletException DOCUMENT ME! */ public void doPost(HttpServletRequest request, HttpServletResponse response) *************** *** 94,157 **** String pipeline = getPipeline(request); LogService.getInstance().logDebug("pipeline: " + pipeline); if (pipeline != null) { try { byte[] docbytes = getPipelineDocument(request); if (docbytes == null) { // Error occured LogService.getInstance().logError(I18n.get("web.101"), null); } else { ! IJournalTicket ticket = processPipelineDocument(request, docbytes, pipeline); response.setContentType("text/html"); ! response.getWriter().write("<html><body>" + I18n.get("web.105", ticket) + "</body></html>\n"); } } catch (Exception e) { LogService.getInstance().logError(e); response.setContentType("text/html"); ! response.getWriter().write("<html><body>" + I18n.get("web.102") + "</body></html>\n"); } } else { ! LogService.getInstance().logError("[HttpPostPipelineFeeder] " + I18n.get("web.103"), null); response.setContentType("text/html"); ! response.getWriter().write("<html><body>" + I18n.get("web.103") + "</body></html>\n"); } } /** ! * Get the pipeline name from the servlet request path * ! * @param request ! * @return ! * @throws javax.servlet.ServletException */ ! private String getPipeline(HttpServletRequest request) ! throws ServletException { ! return request.getParameter(PIPELINE); } /** ! * Convert the dom document and and create a pipeline document and add it to the pipeline. * * @param request ! * @param docbytes ! * @param pipeline */ ! private IJournalTicket processPipelineDocument(HttpServletRequest request, byte[] docbytes, ! String pipeline) ! throws PipelineException, JournalException { ! ! Map map = new HashMap(); ! // Apply the request parameters as document attributes ! for (Enumeration parms = request.getParameterNames(); parms.hasMoreElements();) { ! String name = (String) parms.nextElement(); ! ! if (!(name.equals(DOCUMENT) || name.equals(PIPELINE))) { ! map.put(name, request.getParameter(name)); ! } ! } ! ! // Get a ticket, add to vector and process ticket. ! FeedDocument feedDoc = new FeedDocument(pipeline, docbytes, map, false, false); ! new SynchronousFeeder().process(feedDoc); ! return feedDoc.getTicket(); } --- 140,194 ---- String pipeline = getPipeline(request); LogService.getInstance().logDebug("pipeline: " + pipeline); + if (pipeline != null) { try { byte[] docbytes = getPipelineDocument(request); + if (docbytes == null) { // Error occured LogService.getInstance().logError(I18n.get("web.101"), null); } else { ! IJournalTicket ticket = processPipelineDocument(request, docbytes, ! pipeline); response.setContentType("text/html"); ! response.getWriter().write("<html><body>" + ! I18n.get("web.105", ticket) + "</body></html>\n"); } } catch (Exception e) { LogService.getInstance().logError(e); response.setContentType("text/html"); ! response.getWriter().write("<html><body>" + I18n.get("web.102") + ! "</body></html>\n"); } } else { ! LogService.getInstance().logError("[HttpPostPipelineFeeder] " + ! I18n.get("web.103"), null); response.setContentType("text/html"); ! response.getWriter().write("<html><body>" + I18n.get("web.103") + ! "</body></html>\n"); } } /** ! * DOCUMENT ME! * ! * @throws ServletException */ ! public void init() throws ServletException { ! EnvironmentLoader.loadEnvironment(); } /** ! * Get the pipeline name from the servlet request path * * @param request ! * ! * @return ! * ! * @throws ServletException */ ! private String getPipeline(HttpServletRequest request) ! throws ServletException { ! return request.getParameter(PIPELINE); } *************** *** 160,169 **** * * @param request * @return document */ private byte[] getPipelineDocument(HttpServletRequest request) throws IOException { - String doc = request.getParameter(DOCUMENT); return doc.getBytes(); } --- 197,209 ---- * * @param request + * * @return document + * + * @throws IOException DOCUMENT ME! */ private byte[] getPipelineDocument(HttpServletRequest request) throws IOException { String doc = request.getParameter(DOCUMENT); + return doc.getBytes(); } *************** *** 180,185 **** // 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); --- 220,224 ---- // 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); *************** *** 189,192 **** --- 228,267 ---- System.out.println("-----------------------"); + } + + /** + * Convert the dom document and and create a pipeline document and add it to + * the pipeline. + * + * @param request + * @param docbytes + * @param pipeline + * + * @return DOCUMENT ME! + * + * @throws PipelineException DOCUMENT ME! + * @throws JournalException DOCUMENT ME! + */ + private IJournalTicket processPipelineDocument(HttpServletRequest request, + byte[] docbytes, String pipeline) + throws PipelineException, JournalException { + Map map = new HashMap(); + + // Apply the request parameters as document attributes + for (Enumeration parms = request.getParameterNames(); + parms.hasMoreElements();) { + String name = (String) parms.nextElement(); + + if (!(name.equals(DOCUMENT) || name.equals(PIPELINE))) { + map.put(name, request.getParameter(name)); + } + } + + // Get a ticket, add to vector and process ticket. + FeedDocument feedDoc = new FeedDocument(pipeline, docbytes, map, false, + false); + new SynchronousFeeder().process(feedDoc); + + return feedDoc.getTicket(); } } |
|
From: <tr...@us...> - 2003-06-27 02:09:24
|
Update of /cvsroot/babeldoc/babeldoc/modules/web/src/com/babeldoc/web/main In directory sc8-pr-cvs1:/tmp/cvs-serv32148/src/com/babeldoc/web/main Modified Files: ConsoleServlet.java Log Message: Reformatted and added new license header Index: ConsoleServlet.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/web/src/com/babeldoc/web/main/ConsoleServlet.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ConsoleServlet.java 27 May 2003 03:04:57 -0000 1.7 --- ConsoleServlet.java 27 Jun 2003 02:09:21 -0000 1.8 *************** *** 1,29 **** ! /* ! * $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.web.main; import com.babeldoc.core.I18n; import com.babeldoc.core.user.*; import com.babeldoc.web.context.BabelContext; import org.apache.velocity.Template; import org.apache.velocity.app.Velocity; --- 1,74 ---- ! /* ==================================================================== ! * The Apache Software License, Version 1.1 * + * Copyright (c) 2000 The Apache Software Foundation. All rights + * reserved. * ! * Redistribution and use in source and binary forms, with or without ! * modification, are permitted provided that the following conditions ! * are met: * ! * 1. Redistributions of source code must retain the above copyright ! * notice, this list of conditions and the following disclaimer. * ! * 2. Redistributions in binary form must reproduce the above copyright ! * notice, this list of conditions and the following disclaimer in ! * the documentation and/or other materials provided with the ! * distribution. ! * ! * 3. The end-user documentation included with the redistribution, ! * if any, must include the following acknowledgment: ! * "This product includes software developed by the ! * Apache Software Foundation (http://www.apache.org/)." ! * Alternately, this acknowledgment may appear in the software itself, ! * if and wherever such third-party acknowledgments normally appear. ! * ! * 4. The names "Apache" and "Apache Software Foundation" must ! * not be used to endorse or promote products derived from this ! * software without prior written permission. For written ! * permission, please contact ap...@ap.... ! * ! * 5. Products derived from this software may not be called "Apache", ! * nor may "Apache" appear in their name, without prior written ! * permission of the Apache Software Foundation. ! * ! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ! * SUCH DAMAGE. ! * ==================================================================== ! * ! * This software consists of voluntary contributions made by many ! * individuals on behalf of the Apache Software Foundation. For more ! * information on the Apache Software Foundation, please see ! * <http://www.apache.org/>. ! * ! * Portions of this software are based upon public domain software ! * originally written at the National Center for Supercomputing Applications, ! * University of Illinois, Urbana-Champaign. ! * ==================================================================== ! * ! * Babeldoc: The Universal Document Processor ! * ! * $Header$ ! * $DateTime$ ! * $Author$ * */ package com.babeldoc.web.main; import com.babeldoc.core.I18n; import com.babeldoc.core.user.*; + import com.babeldoc.web.context.BabelContext; + import org.apache.velocity.Template; import org.apache.velocity.app.Velocity; *************** *** 33,124 **** import org.apache.velocity.servlet.VelocityServlet; import javax.servlet.ServletConfig; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; ! import java.io.FileNotFoundException; ! import java.io.IOException; ! import java.util.Properties; /** * <strong>VelocityServlet</strong> ! * ! * <p>provides a means to display velocity templates. This is a centerpiece of the babeldoc web. ! * This does what is needed to get the user context based on loging information.</p> * * @author Bmcdonald * @version 1.0 */ ! public class ConsoleServlet ! extends VelocityServlet { ! /** constant: velocity standard templates */ ! final static String ERR_PARSE = "/error/parse.vm"; /** constant: velocity standard templates */ ! final static String ERR_NOTFOUND = "/error/notfound.vm"; /** constant: velocity standard templates */ ! final static String ERR_AUTHENTICATE = "/error/authentication.vm"; /** constant: velocity standard templates */ ! final static String LOGON_PAGE = "/logon.vm"; /** constant: onfiguration name */ ! final static String CONFIG_NAME = "web/mapping"; /** constant: Context user information */ ! final static String USER_CONTEXT = "userContext"; /** constant: Context user information */ ! final static String LOGON_BOUNCE = "logonBounce"; /** constant: parameters */ ! final static String PARM_NAME = "name"; /** constant: parameters */ ! final static String PARM_PASSWORD = "password"; /** ! * A fancier version of loadConfiguration(), this will ! * set the log file to be off of the webapp root, and ! * will do the same with the file loader paths * ! * @param config the servlet configuration passed by the container ! * @return the converted properties */ ! protected Properties loadConfiguration(ServletConfig config) ! throws IOException, FileNotFoundException { ! Properties p = new Properties(); ! String path = config.getServletContext().getRealPath("/"); ! if (path == null) { ! System.out.println(" SampleServlet.loadConfiguration() : unable to " ! + "get the current webapp root. Using '/'. Please fix."); ! path = "/"; } - p.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, path); - p.setProperty("runtime.log", path + "velocity.log"); ! com.babeldoc.core.EnvironmentLoader.loadEnvironment(); ! System.out.println(p.toString()); ! return p; } /** ! * Process the security: authorization and authentication issues ! * with this request. Return the template to return * * @param request * @return string to the template. ! * @throws com.babeldoc.core.user.UserException */ protected String handleSecurity(HttpServletRequest request) throws UserException { - HttpSession session = request.getSession(true); String path = request.getServletPath(); System.out.println("Context path: " + request.getContextPath()); System.out.println("Servet path: " + path); UserResource resource = UserResourceFactory.getInstance().getUserResource(path); IUserContext userContext = (IUserContext) session.getAttribute(USER_CONTEXT); ! com.babeldoc.core.LogService.getInstance().logDebug(com.babeldoc.core.I18n.get("web.002") + userContext); ! if (userContext == null && UserResourceFactory.getInstance().mustAuthenticate(resource)) { ! com.babeldoc.core.LogService.getInstance().logDebug(com.babeldoc.core.I18n.get("web.003")); // If we are in process of logging in. if (request.getSession(true).getAttribute(LOGON_BOUNCE) != null) { --- 78,213 ---- import org.apache.velocity.servlet.VelocityServlet; + import java.io.FileNotFoundException; + import java.io.IOException; + + import java.util.Properties; + import javax.servlet.ServletConfig; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; ! /** * <strong>VelocityServlet</strong> ! * ! * <p> ! * provides a means to display velocity templates. This is a centerpiece of ! * the babeldoc web. This does what is needed to get the user context based on ! * loging information. ! * </p> * * @author Bmcdonald * @version 1.0 */ ! public class ConsoleServlet extends VelocityServlet { /** constant: velocity standard templates */ ! static final String ERR_PARSE = "/error/parse.vm"; ! /** constant: velocity standard templates */ ! static final String ERR_NOTFOUND = "/error/notfound.vm"; ! /** constant: velocity standard templates */ ! static final String ERR_AUTHENTICATE = "/error/authentication.vm"; ! /** constant: velocity standard templates */ ! static final String LOGON_PAGE = "/logon.vm"; ! /** constant: onfiguration name */ ! static final String CONFIG_NAME = "web/mapping"; ! /** constant: Context user information */ ! static final String USER_CONTEXT = "userContext"; ! /** constant: Context user information */ ! static final String LOGON_BOUNCE = "logonBounce"; /** constant: parameters */ ! static final String PARM_NAME = "name"; ! /** constant: parameters */ ! static final String PARM_PASSWORD = "password"; /** ! * main routine to handle a request. Called by VelocityServlet, your ! * responsibility as programmer is to simply return a valid Template * ! * @param request ! * @param response ! * @param ctx Velocity context to use ! * ! * @return template to be used for the response. */ + public Template handleRequest(HttpServletRequest request, + HttpServletResponse response, Context ctx) { + Template outty = null; ! try { ! HttpSession session = request.getSession(true); ! String path = handleSecurity(request); ! ctx.put("babel", new BabelContext(request, response, ctx)); ! ctx.put("util", new com.babeldoc.core.VelocityUtilityContext()); ! ctx.put("session", session); ! ctx.put("user", session.getAttribute(USER_CONTEXT)); ! if (path.startsWith("/")) { ! path = path.substring(1); ! } ! System.out.println("Trying to get: " + path); ! ! // outty = getTemplate(request.getContextPath()+path); ! outty = getTemplate(path); ! } catch (ParseErrorException pee) { ! com.babeldoc.core.LogService.getInstance().logError(I18n.get("web.005"), ! pee); ! ! try { ! outty = getTemplate(ERR_PARSE); ! } catch (Exception e) { ! } ! } catch (ResourceNotFoundException rnfe) { ! com.babeldoc.core.LogService.getInstance().logError(com.babeldoc.core.I18n.get( ! "web.006"), rnfe); ! ! try { ! outty = getTemplate(ERR_NOTFOUND); ! } catch (Exception e) { ! } ! } catch (Exception e) { ! com.babeldoc.core.LogService.getInstance().logError(com.babeldoc.core.I18n.get( ! "000001"), e); } ! return outty; } /** ! * Process the security: authorization and authentication issues with this ! * request. Return the template to return * * @param request + * * @return string to the template. ! * ! * @throws UserException */ protected String handleSecurity(HttpServletRequest request) throws UserException { HttpSession session = request.getSession(true); String path = request.getServletPath(); System.out.println("Context path: " + request.getContextPath()); System.out.println("Servet path: " + path); + UserResource resource = UserResourceFactory.getInstance().getUserResource(path); IUserContext userContext = (IUserContext) session.getAttribute(USER_CONTEXT); ! com.babeldoc.core.LogService.getInstance().logDebug(com.babeldoc.core.I18n.get( ! "web.002") + userContext); ! ! if ((userContext == null) && ! UserResourceFactory.getInstance().mustAuthenticate(resource)) { ! com.babeldoc.core.LogService.getInstance().logDebug(com.babeldoc.core.I18n.get( ! "web.003")); ! // If we are in process of logging in. if (request.getSession(true).getAttribute(LOGON_BOUNCE) != null) { *************** *** 126,138 **** String password = request.getParameter("password"); ! if (name != null && password != null) { userContext = UserFactory.getInstance().getUserContext(name); if (UserFactory.getInstance().authenticate(userContext, ! new PasswordUserCredential(password))) { ! com.babeldoc.core.LogService.getInstance().logDebug(com.babeldoc.core.I18n.get("web.004")); request.getSession().setAttribute(USER_CONTEXT, userContext); ! com.babeldoc.core.LogService.getInstance().logDebug(com.babeldoc.core.I18n.get("web.004")); path = (String) request.getSession().getAttribute(LOGON_BOUNCE); } else { --- 215,229 ---- String password = request.getParameter("password"); ! if ((name != null) && (password != null)) { userContext = UserFactory.getInstance().getUserContext(name); if (UserFactory.getInstance().authenticate(userContext, ! new PasswordUserCredential(password))) { ! com.babeldoc.core.LogService.getInstance().logDebug(com.babeldoc.core.I18n.get( ! "web.004")); request.getSession().setAttribute(USER_CONTEXT, userContext); ! com.babeldoc.core.LogService.getInstance().logDebug(com.babeldoc.core.I18n.get( ! "web.004")); path = (String) request.getSession().getAttribute(LOGON_BOUNCE); } else { *************** *** 142,198 **** path = ERR_AUTHENTICATE; } session.removeAttribute(LOGON_BOUNCE); } else { session.setAttribute(LOGON_BOUNCE, path); ! com.babeldoc.core.LogService.getInstance().logDebug("LOGON_BOUNCE: " + path); path = LOGON_PAGE; } } return path; } /** ! * main routine to handle a request. Called by ! * VelocityServlet, your responsibility as programmer ! * is to simply return a valid Template * ! * @param request ! * @param response ! * @param ctx Velocity context to use ! * @return template to be used for the response. */ ! public Template handleRequest(HttpServletRequest request, ! HttpServletResponse response, Context ctx) { ! Template outty = null; ! try { ! HttpSession session = request.getSession(true); ! String path = handleSecurity(request); ! ctx.put("babel", new BabelContext(request, response, ctx)); ! ctx.put("util", new com.babeldoc.core.VelocityUtilityContext()); ! ctx.put("session", session); ! ctx.put("user", session.getAttribute(USER_CONTEXT)); ! if (path.startsWith("/")) { ! path = path.substring(1); ! } ! System.out.println("Trying to get: " + path); ! // outty = getTemplate(request.getContextPath()+path); ! outty = getTemplate(path); ! } catch (ParseErrorException pee) { ! com.babeldoc.core.LogService.getInstance().logError(I18n.get("web.005"), pee); ! try { ! outty = getTemplate(ERR_PARSE); ! } catch (Exception e) { ! } ! } catch (ResourceNotFoundException rnfe) { ! com.babeldoc.core.LogService.getInstance().logError(com.babeldoc.core.I18n.get("web.006"), rnfe); ! try { ! outty = getTemplate(ERR_NOTFOUND); ! } catch (Exception e) { ! } ! } catch (Exception e) { ! com.babeldoc.core.LogService.getInstance().logError(com.babeldoc.core.I18n.get("000001"), e); } ! return outty; } } --- 233,278 ---- path = ERR_AUTHENTICATE; } + session.removeAttribute(LOGON_BOUNCE); } else { session.setAttribute(LOGON_BOUNCE, path); ! com.babeldoc.core.LogService.getInstance().logDebug("LOGON_BOUNCE: " + ! path); path = LOGON_PAGE; } } + return path; } /** ! * A fancier version of loadConfiguration(), this will set the log file to be ! * off of the webapp root, and will do the same with the file loader paths * ! * @param config the servlet configuration passed by the container ! * ! * @return the converted properties ! * ! * @throws IOException DOCUMENT ME! ! * @throws FileNotFoundException DOCUMENT ME! */ ! protected Properties loadConfiguration(ServletConfig config) ! throws IOException, FileNotFoundException { ! Properties p = new Properties(); ! String path = config.getServletContext().getRealPath("/"); ! if (path == null) { ! System.out.println(" SampleServlet.loadConfiguration() : unable to " + ! "get the current webapp root. Using '/'. Please fix."); ! path = "/"; } ! ! p.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, path); ! p.setProperty("runtime.log", path + "velocity.log"); ! ! com.babeldoc.core.EnvironmentLoader.loadEnvironment(); ! System.out.println(p.toString()); ! ! return p; } } |
|
From: <tr...@us...> - 2003-06-27 02:09:24
|
Update of /cvsroot/babeldoc/babeldoc/modules/web/src/com/babeldoc/web/module In directory sc8-pr-cvs1:/tmp/cvs-serv32148/src/com/babeldoc/web/module Modified Files: WebModule.java Log Message: Reformatted and added new license header Index: WebModule.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/web/src/com/babeldoc/web/module/WebModule.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WebModule.java 22 May 2003 03:20:33 -0000 1.2 --- WebModule.java 27 Jun 2003 02:09:21 -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.web.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.web.module; *************** *** 31,61 **** * This is the sql module - please look around but dont touch. * ! * @author bmcdonald * @version 1.0 */ ! ! public class WebModule ! extends BabeldocModule { ! ! public final static String MODULE = "web"; /** ! * The Name of the module is sql - and dont you forget it! * * @return */ ! public String getName() { ! return MODULE; } /** ! * web module only depends on core * * @return */ ! public Set getDependsOn() { ! Set set = new HashSet(); ! set.add("core"); ! return set; } } --- 75,103 ---- * This is the sql module - please look around but dont touch. * ! * @author bmcdonald * @version 1.0 */ ! public class WebModule extends BabeldocModule { ! public static final String MODULE = "web"; /** ! * web module only depends on core * * @return */ ! public Set getDependsOn() { ! Set set = new HashSet(); ! set.add("core"); ! ! return set; } /** ! * The Name of the module is sql - and dont you forget it! * * @return */ ! public String getName() { ! return MODULE; } } |
|
From: <tr...@us...> - 2003-06-27 02:09:23
|
Update of /cvsroot/babeldoc/babeldoc/modules/web
In directory sc8-pr-cvs1:/tmp/cvs-serv32148
Modified Files:
build.xml
Log Message:
Reformatted and added new license header
Index: build.xml
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/web/build.xml,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** build.xml 11 Jun 2003 11:03:21 -0000 1.14
--- build.xml 27 Jun 2003 02:09:20 -0000 1.15
***************
*** 158,172 ****
<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" />
--- 158,168 ----
<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" />
***************
*** 174,177 ****
</jalopy>
-->
! </target>
</project>
--- 170,173 ----
</jalopy>
-->
! </target>
</project>
|
|
From: <tr...@us...> - 2003-06-27 02:06:02
|
Update of /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/resource In directory sc8-pr-cvs1:/tmp/cvs-serv31771/src/com/babeldoc/sql/resource Modified Files: PooledJdbc.java SimpleJdbc.java Log Message: Reformatted and updated license header Index: PooledJdbc.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/resource/PooledJdbc.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PooledJdbc.java 15 Mar 2003 23:45:36 -0000 1.2 --- PooledJdbc.java 27 Jun 2003 02:05:59 -0000 1.3 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/21 17:01:20 $ * * ! * 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.sql.resource; --- 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.sql.resource; *************** *** 24,27 **** --- 68,72 ---- import com.babeldoc.core.resource.Resource; import com.babeldoc.core.resource.ResourceException; + import org.apache.commons.dbcp.ConnectionFactory; import org.apache.commons.dbcp.DriverManagerConnectionFactory; *************** *** 34,90 **** import java.sql.DriverManager; /** ! * The pooled driver. This driver uses the jakarta-commons pooling infrastructre ! * and is quite efficient. Use this, not the simple jdbc resource. * * @author Bmcdonald * @version 1.0 */ ! public class PooledJdbc ! extends Resource { ! ! /** ! * the connection pool stuff. ! */ private static PoolingDriver driver = new PoolingDriver(); ! /** ! * the user and database url stuff. ! */ private static String DB_USER = "dbUser"; private static String DB_PASSWD = "dbPassword"; private static String DB_URL = "dbUrl"; ! /** ! * Jdbc variables ! */ private String dbName; private String dbPasswd; private String dbUrl; - public void setupDriver(String connectURI) - throws Exception { - ObjectPool connectionPool = new GenericObjectPool(null); - ConnectionFactory connectionFactory = new - DriverManagerConnectionFactory(connectURI, dbName, dbPasswd); - PoolableConnectionFactory poolableConnectionFactory = - new PoolableConnectionFactory(connectionFactory, connectionPool, null, null, false, true); - driver.registerPool(getName(), connectionPool); - - // convert to the url that talks to the connection pool - dbUrl = "jdbc:apache:commons:dbcp:" + getName(); - } - /** ! * Setup the jdbc stuff */ ! private void setupJdbc() ! throws Exception { try { ! dbName = getConfig().getString(DB_USER); ! dbPasswd = getConfig().getString(DB_PASSWD); ! setupDriver(getConfig().getString(DB_URL)); ! } catch (Exception x) { ! com.babeldoc.core.LogService.getInstance().logError(x); } } --- 79,117 ---- import java.sql.DriverManager; + /** ! * The pooled driver. This driver uses the jakarta-commons pooling ! * infrastructre and is quite efficient. Use this, not the simple jdbc ! * resource. * * @author Bmcdonald * @version 1.0 */ ! public class PooledJdbc extends Resource { ! /** the connection pool stuff. */ private static PoolingDriver driver = new PoolingDriver(); ! /** the user and database url stuff. */ private static String DB_USER = "dbUser"; private static String DB_PASSWD = "dbPassword"; private static String DB_URL = "dbUrl"; ! /** Jdbc variables */ private String dbName; private String dbPasswd; private String dbUrl; /** ! * Checkin this connection ! * ! * @param connection ! * ! * @throws ResourceException */ ! public synchronized void checkIn(Object connection) throws ResourceException { try { ! ((Connection) connection).close(); ! } catch (Exception e) { ! throw new ResourceException("[ResourceException.checkIn]", e); } } *************** *** 94,101 **** * * @return the connection ! * @throws com.babeldoc.core.resource.ResourceException */ ! public synchronized Object checkOut() ! throws ResourceException { try { // if we have no dbUrl, setup jdbc NOW --- 121,128 ---- * * @return the connection ! * ! * @throws ResourceException */ ! public synchronized Object checkOut() throws ResourceException { try { // if we have no dbUrl, setup jdbc NOW *************** *** 103,106 **** --- 130,134 ---- setupJdbc(); } + return DriverManager.getConnection(dbUrl, dbName, dbPasswd); } catch (Exception e) { *************** *** 110,123 **** /** ! * Checkin this connection ! * @param connection ! * @throws com.babeldoc.core.resource.ResourceException */ ! public synchronized void checkIn(Object connection) ! throws ResourceException { try { ! ((Connection) connection).close(); ! } catch (Exception e) { ! throw new ResourceException("[ResourceException.checkIn]", e); } } --- 138,171 ---- /** ! * TODO: DOCUMENT ME! ! * ! * @param connectURI DOCUMENT ME! ! * ! * @throws Exception DOCUMENT ME! */ ! public void setupDriver(String connectURI) throws Exception { ! ObjectPool connectionPool = new GenericObjectPool(null); ! ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(connectURI, ! dbName, dbPasswd); ! PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, ! connectionPool, null, null, false, true); ! driver.registerPool(getName(), connectionPool); ! ! // convert to the url that talks to the connection pool ! dbUrl = "jdbc:apache:commons:dbcp:" + getName(); ! } ! ! /** ! * Setup the jdbc stuff ! * ! * @throws Exception DOCUMENT ME! ! */ ! private void setupJdbc() throws Exception { try { ! dbName = getConfig().getString(DB_USER); ! dbPasswd = getConfig().getString(DB_PASSWD); ! setupDriver(getConfig().getString(DB_URL)); ! } catch (Exception x) { ! com.babeldoc.core.LogService.getInstance().logError(x); } } Index: SimpleJdbc.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/resource/SimpleJdbc.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SimpleJdbc.java 15 Mar 2003 23:45:36 -0000 1.2 --- SimpleJdbc.java 27 Jun 2003 02:05:59 -0000 1.3 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/21 17:01:20 $ * * ! * 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.sql.resource; --- 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.sql.resource; *************** *** 28,72 **** import java.sql.DriverManager; /** ! * How to get connections using the simplest jdbc code, etc. This merely creates ! * new connections every time the resource is checked out. Not too good especially ! * for drives / databases that have a limited number of connections like Oracle. ! * Use the Pooled driver instead. * * @author Bmcdonald * @version 1.0 */ ! public class SimpleJdbc ! extends Resource { ! ! public final static String DB_USER = "dbUser"; ! public final static String DB_PASSWD = "dbPassword"; ! public final static String DB_DRIVER = "dbDriver"; ! public final static String DB_URL = "dbUrl"; ! /** ! * Jdbc variables ! */ private String dbName; private String dbPasswd; - private String dbDriver; private String dbUrl; /** ! * Setup the jdbc stuff */ ! private void setupJdbc() { try { ! dbName = getConfig().getString(DB_USER); ! dbPasswd = getConfig().getString(DB_PASSWD); ! dbDriver = getConfig().getString(DB_DRIVER); ! dbUrl = getConfig().getString(DB_URL); ! ! if (dbName != null && dbPasswd != null && dbDriver != null && dbUrl != null) { ! Class.forName(dbDriver).newInstance(); ! } ! } catch (Exception x) { ! com.babeldoc.core.LogService.getInstance().logError(x); ! dbUrl = null; } } --- 72,109 ---- import java.sql.DriverManager; + /** ! * How to get connections using the simplest jdbc code, etc. This merely ! * creates new connections every time the resource is checked out. Not too ! * good especially for drives / databases that have a limited number of ! * connections like Oracle. Use the Pooled driver instead. * * @author Bmcdonald * @version 1.0 */ ! public class SimpleJdbc extends Resource { ! public static final String DB_USER = "dbUser"; ! public static final String DB_PASSWD = "dbPassword"; ! public static final String DB_DRIVER = "dbDriver"; ! public static final String DB_URL = "dbUrl"; ! private String dbDriver; ! /** Jdbc variables */ private String dbName; private String dbPasswd; private String dbUrl; /** ! * Checkin this connection ! * ! * @param connection ! * ! * @throws ResourceException */ ! public synchronized void checkIn(Object connection) throws ResourceException { try { ! ((Connection) connection).close(); ! } catch (Exception e) { ! throw new ResourceException("[ResourceException.checkIn]", e); } } *************** *** 76,83 **** * * @return the connection ! * @throws com.babeldoc.core.resource.ResourceException */ ! public synchronized Object checkOut() ! throws ResourceException { try { // if we have no dbUrl, setup jdbc NOW --- 113,120 ---- * * @return the connection ! * ! * @throws ResourceException */ ! public synchronized Object checkOut() throws ResourceException { try { // if we have no dbUrl, setup jdbc NOW *************** *** 85,88 **** --- 122,126 ---- setupJdbc(); } + return DriverManager.getConnection(dbUrl, dbName, dbPasswd); } catch (Exception e) { *************** *** 92,106 **** /** ! * Checkin this connection ! * ! * @param connection ! * @throws com.babeldoc.core.resource.ResourceException */ ! public synchronized void checkIn(Object connection) ! throws ResourceException { try { ! ((Connection) connection).close(); ! } catch (Exception e) { ! throw new ResourceException("[ResourceException.checkIn]", e); } } --- 130,149 ---- /** ! * Setup the jdbc stuff */ ! private void setupJdbc() { try { ! dbName = getConfig().getString(DB_USER); ! dbPasswd = getConfig().getString(DB_PASSWD); ! dbDriver = getConfig().getString(DB_DRIVER); ! dbUrl = getConfig().getString(DB_URL); ! ! if ((dbName != null) && (dbPasswd != null) && (dbDriver != null) && ! (dbUrl != null)) { ! Class.forName(dbDriver).newInstance(); ! } ! } catch (Exception x) { ! com.babeldoc.core.LogService.getInstance().logError(x); ! dbUrl = null; } } |
|
From: <tr...@us...> - 2003-06-27 02:06:02
|
Update of /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/pipeline/stage In directory sc8-pr-cvs1:/tmp/cvs-serv31771/src/com/babeldoc/sql/pipeline/stage Modified Files: SqlEnrichPipelineStage.java SqlWriterPipelineStage.java Log Message: Reformatted and updated license header Index: SqlEnrichPipelineStage.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/pipeline/stage/SqlEnrichPipelineStage.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SqlEnrichPipelineStage.java 8 Jun 2003 18:23:47 -0000 1.11 --- SqlEnrichPipelineStage.java 27 Jun 2003 02:05:59 -0000 1.12 *************** *** 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.sql.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.sql.pipeline.stage; *************** *** 37,40 **** --- 81,85 ---- import java.sql.*; + import java.util.ArrayList; import java.util.Collection; *************** *** 44,68 **** /** ! * Pipeline stage to enrich a document using sql statements. This pipeline stage ! * provides two methods for getting sql results into document attributes. ! * ! * 1. The attribute names and values are derived from the results of sql statements ! * in that the name of the attribute is the name of a column or label and the value is ! * value of that column or label. ! * 2. Each attribute is associated with a sql statement and its value is the first column and * first row of the resultset. * ! * @author Dejan Krsmanovic <a href="mailto:dej...@ya...">dej...@ya...</a> * @version 1.0 */ public class SqlEnrichPipelineStage extends PipelineStage { ! /** ! * constants ! */ ! public final static String ATTRIBUTE_SQL = "attributeSql"; ! public final static String SQL_SCRIPT = "sqlScript"; ! public final static String RESOURCE_NAME = "resourceName"; ! public final static String DEFAULT_VALUE = "defaultValue"; //Connection pool --- 89,110 ---- /** ! * Pipeline stage to enrich a document using sql statements. This pipeline ! * stage provides two methods for getting sql results into document ! * attributes. 1. The attribute names and values are derived from the results ! * of sql statements in that the name of the attribute is the name of a column ! * or label and the value is value of that column or label. 2. Each attribute ! * is associated with a sql statement and its value is the first column and * first row of the resultset. * ! * @author Dejan Krsmanovic * @version 1.0 */ public class SqlEnrichPipelineStage extends PipelineStage { ! /** constants */ ! public static final String ATTRIBUTE_SQL = "attributeSql"; ! public static final String SQL_SCRIPT = "sqlScript"; ! public static final String RESOURCE_NAME = "resourceName"; ! public static final String DEFAULT_VALUE = "defaultValue"; //Connection pool *************** *** 74,106 **** public SqlEnrichPipelineStage() { super(new PipelineStageInfo() { ! public String getName() { ! return "SqlEnrich"; ! } ! public String getDescription() { ! return I18n.get("sql.100"); ! } ! public Collection getTypeSpecificOptions() { ! ArrayList options = new ArrayList(); ! options.add(new ConfigOption(RESOURCE_NAME, IConfigOptionType.STRING, ! null, true, I18n.get("sql.101"))); ! IConfigOptionType attrs = new ComplexConfigOptionType( new ConfigOption[] { ! new ConfigOption(ATTRIBUTE_SQL, IConfigOptionType.STRING, null, false, I18n.get("sql.102")) ! }); ! IConfigOptionType scripts = new ComplexConfigOptionType( new ConfigOption[] { ! new ConfigOption(SQL_SCRIPT, IConfigOptionType.MULTI, null, false, I18n.get("sql.106")) ! }); ! options.add(new ConfigOption(ATTRIBUTE_SQL, attrs, ! null, false, I18n.get("sql.102"))); ! options.add(new ConfigOption(SQL_SCRIPT, scripts, ! null, false, I18n.get("sql.106"))); ! return options; } ! }); } --- 116,213 ---- public SqlEnrichPipelineStage() { super(new PipelineStageInfo() { ! public String getName() { ! return "SqlEnrich"; ! } ! public String getDescription() { ! return I18n.get("sql.100"); ! } ! public Collection getTypeSpecificOptions() { ! ArrayList options = new ArrayList(); ! options.add(new ConfigOption(RESOURCE_NAME, IConfigOptionType.STRING, ! null, true, I18n.get("sql.101"))); ! IConfigOptionType attrs = new ComplexConfigOptionType(new ConfigOption[] { new ConfigOption( ! ATTRIBUTE_SQL, IConfigOptionType.STRING, null, false, ! I18n.get("sql.102")) }); ! IConfigOptionType scripts = new ComplexConfigOptionType(new ConfigOption[] { new ConfigOption( ! SQL_SCRIPT, IConfigOptionType.MULTI, null, false, ! I18n.get("sql.106")) }); ! options.add(new ConfigOption(ATTRIBUTE_SQL, attrs, null, false, ! I18n.get("sql.102"))); ! options.add(new ConfigOption(SQL_SCRIPT, scripts, null, false, ! I18n.get("sql.106"))); ! return options; ! } ! }); ! } ! ! /** ! * execute the sql statement and convert to a hashmap of name/value pairs. ! * Each name is the column/label of the result and the value is the value ! * for its corresponding column/label. ! * ! * @param sqlStatement ! * ! * @return hashmap of name/value pairs ! * ! * @throws PipelineException ! */ ! public HashMap getValuesFromSql(String sqlStatement) ! throws PipelineException { ! Connection conn = null; ! Statement stmt = null; ! ResultSet rs = null; ! HashMap values = new HashMap(); ! ! try { ! conn = getConnection(); ! stmt = conn.createStatement(); ! LogService.getInstance().logDebug("Executing statement: " + sqlStatement); ! rs = stmt.executeQuery(sqlStatement); ! ! //Assume that statement returned only one record with one column ! //Others will be ignored ! if (rs.next()) { ! ResultSetMetaData metaData = rs.getMetaData(); ! ! for (int i = 1, count = metaData.getColumnCount(); i <= count; i++) { ! String name = metaData.getColumnLabel(i); ! Object value = rs.getObject(i); ! values.put(name, value); ! } } ! } catch (ResourceException e) { ! throw new PipelineException(I18n.get("sql.103"), e); ! } catch (SQLException e) { ! throw new PipelineException(I18n.get("sql.104", sqlStatement), e); ! } finally { ! try { ! if (rs != null) { ! rs.close(); ! } ! } catch (Exception ignoreThis) { ! } ! ! try { ! if (stmt != null) { ! stmt.close(); ! } ! } catch (Exception ignoreThis) { ! } ! ! try { ! if (conn != null) { ! resource.checkIn(conn); ! } ! } catch (Exception ignoreThis) { ! } ! } ! ! return values; } *************** *** 109,118 **** * * @return set of results from the processing */ public PipelineStageResult[] process() throws PipelineException { - // Check that the resource is set ! if (! hasOption(RESOURCE_NAME)) ! { throw new PipelineException(I18n.get("sql.201")); } --- 216,225 ---- * * @return set of results from the processing + * + * @throws PipelineException DOCUMENT ME! */ public PipelineStageResult[] process() throws PipelineException { // Check that the resource is set ! if (!hasOption(RESOURCE_NAME)) { throw new PipelineException(I18n.get("sql.201")); } *************** *** 120,124 **** //First process scripts //Get all sql scripts ! NameValuePair[] sqlScripts = this.getOptionList(new String[]{SQL_SCRIPT}); String defaultValue = this.getOptions(DEFAULT_VALUE); --- 227,231 ---- //First process scripts //Get all sql scripts ! NameValuePair[] sqlScripts = this.getOptionList(new String[] { SQL_SCRIPT }); String defaultValue = this.getOptions(DEFAULT_VALUE); *************** *** 146,150 **** getDocument().put(name, value); ! LogService.getInstance().logDebug("Adding new attribute: "+name+"=" + value); } } --- 253,258 ---- getDocument().put(name, value); ! LogService.getInstance().logDebug("Adding new attribute: " + name + ! "=" + value); } } *************** *** 153,159 **** //Now process attribute scripts ! NameValuePair[] attributes = this.getOptionList(new String[]{ATTRIBUTE_SQL}); ! if (sqlScripts == null && attributes == null) ! { throw new PipelineException(I18n.get("sql.202")); } --- 261,267 ---- //Now process attribute scripts ! NameValuePair[] attributes = this.getOptionList(new String[] { ATTRIBUTE_SQL }); ! ! if ((sqlScripts == null) && (attributes == null)) { throw new PipelineException(I18n.get("sql.202")); } *************** *** 171,175 **** getDocument().put(varname, value); ! LogService.getInstance().logDebug("Adding new attribute: "+varname+"="+value); } } --- 279,284 ---- getDocument().put(varname, value); ! LogService.getInstance().logDebug("Adding new attribute: " + varname + ! "=" + value); } } *************** *** 179,186 **** --- 288,318 ---- /** + * Get the named resource name from the resource factory + * + * @return + * + * @throws PipelineException + * @throws ResourceException + */ + private Connection getConnection() + throws ResourceException { + if (resource == null) { + resource = ResourceFactory.getResource(this.getOptions(RESOURCE_NAME)); + } + + if (resource == null) { + throw new ResourceException(I18n.get("sql.103")); + } + + return ((Connection) resource.checkOut()); + } + + /** * Execute the sql statement and return the results. * * @param sqlStatement + * * @return + * * @throws PipelineException */ *************** *** 232,318 **** return result; } - } - - /** - * Get the named resource name from the resource factory - * - * @return - * @throws PipelineException - * @throws ResourceException - */ - private Connection getConnection() - throws PipelineException, ResourceException { - if (resource == null) { - resource = ResourceFactory.getResource(this.getOptions(RESOURCE_NAME)); - } - if (resource == null) - { - throw new ResourceException(I18n.get("sql.103")); - } - - return ((Connection) resource.checkOut()); - } - - /** - * execute the sql statement and convert to a hashmap of name/value pairs. - * Each name is the column/label of the result and the value is the value for - * its corresponding column/label. - * - * @param sqlStatement - * @return hashmap of name/value pairs - * @throws PipelineException - */ - public HashMap getValuesFromSql(String sqlStatement) - throws PipelineException { - Connection conn = null; - Statement stmt = null; - ResultSet rs = null; - HashMap values = new HashMap(); - - try { - conn = getConnection(); - stmt = conn.createStatement(); - LogService.getInstance().logDebug("Executing statement: " + sqlStatement); - rs = stmt.executeQuery(sqlStatement); - - //Assume that statement returned only one record with one column - //Others will be ignored - if (rs.next()) { - ResultSetMetaData metaData = rs.getMetaData(); - - for (int i = 1, count = metaData.getColumnCount(); i <= count; i++) { - String name = metaData.getColumnLabel(i); - Object value = rs.getObject(i); - values.put(name, value); - } - } - } catch (ResourceException e) { - throw new PipelineException(I18n.get("sql.103"), e); - } catch (SQLException e) { - throw new PipelineException(I18n.get("sql.104", sqlStatement), e); - } finally { - try { - if (rs != null) { - rs.close(); - } - } catch (Exception ignoreThis) { - } - - try { - if (stmt != null) { - stmt.close(); - } - } catch (Exception ignoreThis) { - } - - try { - if (conn != null) { - resource.checkIn(conn); - } - } catch (Exception ignoreThis) { - } - } - - return values; } } --- 364,367 ---- Index: SqlWriterPipelineStage.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/pipeline/stage/SqlWriterPipelineStage.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SqlWriterPipelineStage.java 8 Jun 2003 18:23:47 -0000 1.12 --- SqlWriterPipelineStage.java 27 Jun 2003 02:05:59 -0000 1.13 *************** *** 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.sql.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.sql.pipeline.stage; *************** *** 35,41 **** --- 79,87 ---- import java.io.BufferedReader; import java.io.StringReader; + import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; + import java.util.ArrayList; import java.util.Collection; *************** *** 43,75 **** /** - * @author bruce - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ - /** * Pipeline stage for executing sql statements * ! * @author Dejan Krsmanovic <a href="mailto:dej...@ya...">dej...@ya...</a> * @version 1.0 */ ! public class SqlWriterPipelineStage ! extends PipelineStage { ! /** ! * Constants ! */ ! public final static String RESOURCE_NAME = "resourceName"; ! public final static String USE_BATCH = "useBatch"; ! public final static String BATCH_SIZE = "batchSize"; ! public final static String SQL = "sql"; //This is used for specifying message that should be retuned. It should be //placed inside comments ! public final static String MESSAGE_TAG = "messageTag"; ! public final static String FAIL_ON_FIRST = "failOnFirst"; private IResource resource = null; private boolean batchSupported = false; private int batchSize = 20; - private String messageTag = "message:"; /** --- 89,112 ---- /** * Pipeline stage for executing sql statements * ! * @author Dejan Krsmanovic * @version 1.0 */ ! public class SqlWriterPipelineStage extends PipelineStage { ! /** Constants */ ! public static final String RESOURCE_NAME = "resourceName"; ! public static final String USE_BATCH = "useBatch"; ! public static final String BATCH_SIZE = "batchSize"; ! public static final String SQL = "sql"; //This is used for specifying message that should be retuned. It should be //placed inside comments ! public static final String MESSAGE_TAG = "messageTag"; ! public static final String FAIL_ON_FIRST = "failOnFirst"; private IResource resource = null; + private String messageTag = "message:"; private boolean batchSupported = false; private int batchSize = 20; /** *************** *** 78,119 **** public SqlWriterPipelineStage() { super(new com.babeldoc.core.pipeline.PipelineStageInfo() { ! public String getName() { ! return "SqlWriter"; } ! public String getDescription() { ! return I18n.get("sql.190"); } ! public Collection getTypeSpecificOptions() { ! ArrayList options = new ArrayList(); ! options.add(new ConfigOption ! (RESOURCE_NAME, ! IConfigOptionType.STRING, ! null, true, I18n.get("sql.101"))); ! options.add(new ConfigOption ! (USE_BATCH, ! IConfigOptionType.BOOLEAN, ! "false", false, I18n.get("sql.191"))); ! options.add(new ConfigOption ! (BATCH_SIZE, ! IConfigOptionType.INTEGER, ! "20", false, I18n.get("sql.192"))); ! options.add(new ConfigOption ! (SQL, ! IConfigOptionType.STRING, ! null, true, I18n.get("sql.193"))); ! options.add(new ConfigOption ! (FAIL_ON_FIRST, ! IConfigOptionType.BOOLEAN, ! "false", false, I18n.get("sql.194"))); ! options.add(new ConfigOption ! (MESSAGE_TAG, ! IConfigOptionType.STRING, ! null, true, I18n.get("sql.195"))); ! return options; } ! }); } --- 115,188 ---- public SqlWriterPipelineStage() { super(new com.babeldoc.core.pipeline.PipelineStageInfo() { ! public String getName() { ! return "SqlWriter"; ! } ! ! public String getDescription() { ! return I18n.get("sql.190"); ! } ! ! public Collection getTypeSpecificOptions() { ! ArrayList options = new ArrayList(); ! ! options.add(new ConfigOption(RESOURCE_NAME, IConfigOptionType.STRING, ! null, true, I18n.get("sql.101"))); ! options.add(new ConfigOption(USE_BATCH, IConfigOptionType.BOOLEAN, ! "false", false, I18n.get("sql.191"))); ! options.add(new ConfigOption(BATCH_SIZE, IConfigOptionType.INTEGER, ! "20", false, I18n.get("sql.192"))); ! options.add(new ConfigOption(SQL, IConfigOptionType.STRING, null, ! true, I18n.get("sql.193"))); ! options.add(new ConfigOption(FAIL_ON_FIRST, ! IConfigOptionType.BOOLEAN, "false", false, I18n.get("sql.194"))); ! options.add(new ConfigOption(MESSAGE_TAG, IConfigOptionType.STRING, ! null, true, I18n.get("sql.195"))); ! ! return options; ! } ! }); ! } ! ! /** ! * Process the pipeline document ! * ! * @return ! * ! * @throws PipelineException ! */ ! public PipelineStageResult[] process() throws PipelineException { ! try { ! batchSupported = "true".equalsIgnoreCase(getOptions(USE_BATCH)); ! ! if (this.hasOption(MESSAGE_TAG)) { ! messageTag = getOptions(MESSAGE_TAG); } ! String batchSizeOpt = getOptions(BATCH_SIZE); ! boolean failOnFirst = "true".equalsIgnoreCase(getOptions(FAIL_ON_FIRST)); ! ! if ((batchSizeOpt != null) && !batchSizeOpt.equals("")) { ! try { ! batchSize = Integer.parseInt(batchSizeOpt); ! } catch (NumberFormatException nfe) { ! } } ! if (!hasOption(RESOURCE_NAME)) { ! throw new PipelineException(I18n.get("sql.201")); ! } ! String sqlScript = this.getOptions(SQL); ! ! if ((sqlScript == null) || sqlScript.equals("")) { ! throw new PipelineException(I18n.get("sql.200")); } ! ! executeSqlScript(sqlScript, failOnFirst); ! ! return super.processHelper(); ! } catch (Exception e) { ! throw new PipelineException(I18n.get("sql.104"), e); ! } } *************** *** 122,125 **** --- 191,195 ---- * * @return a new database connection + * * @throws ResourceException */ *************** *** 127,133 **** if (resource == null) { resource = ResourceFactory.getResource(getOptions(RESOURCE_NAME)); ! if (resource == null) ! { ! throw new ResourceException(I18n.get("sql.103")); } } --- 197,203 ---- if (resource == null) { resource = ResourceFactory.getResource(getOptions(RESOURCE_NAME)); ! ! if (resource == null) { ! throw new ResourceException(I18n.get("sql.103")); } } *************** *** 138,141 **** --- 208,219 ---- /** * Execute the sql script + * + * @param sqlScript DOCUMENT ME! + * @param failOnFirst DOCUMENT ME! + * + * @return DOCUMENT ME! + * + * @throws Exception DOCUMENT ME! + * @throws PipelineException DOCUMENT ME! */ private boolean executeSqlScript(String sqlScript, boolean failOnFirst) *************** *** 157,161 **** String currentComment = ""; - //String command = br.readLine(); int currentBatchSize = 0; --- 235,238 ---- *************** *** 167,175 **** String command = br.readLine(); LogService.getInstance().logDebug("Current line= " + command); if (command == null) { ! if (batchSupported && currentBatchSize > 0) { stmt.executeBatch(); LogService.getInstance().logDebug("Executed " + currentBatchSize + ! " statements in batch"); } --- 244,253 ---- String command = br.readLine(); LogService.getInstance().logDebug("Current line= " + command); + if (command == null) { ! if (batchSupported && (currentBatchSize > 0)) { stmt.executeBatch(); LogService.getInstance().logDebug("Executed " + currentBatchSize + ! " statements in batch"); } *************** *** 188,192 **** //Only single line comments are supported if ((command.startsWith("--") || command.startsWith("/*")) && ! (command.length() > 2)) { currentComment = command.substring(2); --- 266,270 ---- //Only single line comments are supported if ((command.startsWith("--") || command.startsWith("/*")) && ! (command.length() > 2)) { currentComment = command.substring(2); *************** *** 195,201 **** currentComment.length() - 3); } //this is not executable statement. Get next one! continue; - } --- 273,279 ---- currentComment.length() - 3); } + //this is not executable statement. Get next one! continue; } *************** *** 207,211 **** stmt.addBatch(command); LogService.getInstance().logDebug("Command " + command + ! " added to batch list"); currentBatchSize++; --- 285,289 ---- stmt.addBatch(command); LogService.getInstance().logDebug("Command " + command + ! " added to batch list"); currentBatchSize++; *************** *** 213,221 **** stmt.executeBatch(); LogService.getInstance().logDebug("Executed " + ! currentBatchSize + " statements in batch"); } } else { LogService.getInstance().logDebug("Executing statement: " + ! command); stmt.execute(command); } --- 291,299 ---- stmt.executeBatch(); LogService.getInstance().logDebug("Executed " + ! currentBatchSize + " statements in batch"); } } else { LogService.getInstance().logDebug("Executing statement: " + ! command); stmt.execute(command); } *************** *** 223,231 **** commandCount = 0; } - } catch (SQLException ex) { //if current comment starts with message tag then it should be displayed //instead of actual error message String currentMessage; if (currentComment.startsWith(messageTag)) { //remove message tag --- 301,309 ---- commandCount = 0; } } catch (SQLException ex) { //if current comment starts with message tag then it should be displayed //instead of actual error message String currentMessage; + if (currentComment.startsWith(messageTag)) { //remove message tag *************** *** 234,242 **** --- 312,323 ---- currentMessage = ex.getMessage(); } + LogService.getInstance().logWarn(I18n.get("sql.196", currentMessage)); + if (failOnFirst) { //if fail on first command then immediately rollback and throw //exception. Otherwise, execute all script and then rollback conn.rollback(); + // getLog().debug("Rollback!"); throw new PipelineException(currentMessage); *************** *** 254,257 **** --- 335,339 ---- } else { conn.rollback(); + // getLog().debug("rollback... throwing exception"); throw new PipelineException(errorMessage); *************** *** 274,314 **** } catch (Exception ex) { } - } - } - - /** - * Process the pipeline document - * - * @return - * @throws PipelineException - */ - public PipelineStageResult[] process() throws PipelineException { - try { - batchSupported = "true".equalsIgnoreCase(getOptions(USE_BATCH)); - if (this.hasOption(MESSAGE_TAG)) { - messageTag = getOptions(MESSAGE_TAG); - } - String batchSizeOpt = getOptions(BATCH_SIZE); - boolean failOnFirst = "true".equalsIgnoreCase(getOptions(FAIL_ON_FIRST)); - - if ((batchSizeOpt != null) && !batchSizeOpt.equals("")) { - try { - batchSize = Integer.parseInt(batchSizeOpt); - } catch (NumberFormatException nfe) { - } - } - if (! hasOption(RESOURCE_NAME)) - { - throw new PipelineException(I18n.get("sql.201")); - } - String sqlScript = this.getOptions(SQL); - if (sqlScript == null || sqlScript.equals("")) { - throw new PipelineException(I18n.get("sql.200")); - } - executeSqlScript(sqlScript, failOnFirst); - - return super.processHelper(); - } catch (Exception e) { - throw new PipelineException(I18n.get("sql.104"), e); } } --- 356,359 ---- |
|
From: <tr...@us...> - 2003-06-27 02:06:02
|
Update of /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/config In directory sc8-pr-cvs1:/tmp/cvs-serv31771/src/com/babeldoc/sql/config Modified Files: SqlConfig.java SqlConfigService.java SqlConfigurationLoader.java Log Message: Reformatted and updated license header Index: SqlConfig.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/config/SqlConfig.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SqlConfig.java 3 Jun 2003 22:35:26 -0000 1.5 --- SqlConfig.java 27 Jun 2003 02:05:58 -0000 1.6 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/21 17:01:20 $ * * ! * 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.sql.config; --- 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.sql.config; *************** *** 28,49 **** import java.util.Set; /** ! * <strong>SqlConfig</strong> ! * <p>another simple implementation of a IConfig interface. This stuff should really go ! * in to a more suitable superclass</p> * * @author Bmcdonald * @version 1.0 */ ! public class SqlConfig ! extends com.babeldoc.core.Named ! implements IConfig { /** instance: the data */ private Map data; - /** instance: the parent service */ - SqlConfigService service; - /** The dirty flag - how tell if this data has changed. */ private boolean dirty = false; --- 72,94 ---- import java.util.Set; + /** ! * <strong>SqlConfig</strong> ! * ! * <p> ! * another simple implementation of a IConfig interface. This stuff should ! * really go in to a more suitable superclass ! * </p> * * @author Bmcdonald * @version 1.0 */ ! public class SqlConfig extends com.babeldoc.core.Named implements IConfig { ! /** instance: the parent service */ ! SqlConfigService service; /** instance: the data */ private Map data; /** The dirty flag - how tell if this data has changed. */ private boolean dirty = false; *************** *** 53,56 **** --- 98,102 ---- * * @param name configuration object name + * @param service DOCUMENT ME! */ SqlConfig(String name, SqlConfigService service) { *************** *** 61,85 **** /** ! * Get the string configuration setting for the name * ! * @param name the configuration option key ! * @return the value of the configuration option */ ! public String getString(String name) { ! return (String) data.get(name); } /** ! * Get an enumeration of all the configurations. * ! * @return */ ! public Set keys() { ! return data.keySet(); } /** * does this configuration object have this key? * @param name * @return true if key found, else false. */ --- 107,147 ---- /** ! * Get the state of the dirty flag. * ! * @return */ ! public boolean isDirty() { ! return dirty; } /** ! * Set the configuration option. This may not be implemented in all ! * interfaces. It is intended for more sophistacated implementations. * ! * @param name the key of the option ! * @param value of the option */ ! public void setString(String name, String value) { ! service.setString(this.getName(), name, value); ! data.put(name, value); ! setDirty(true); ! } ! ! /** ! * Get the string configuration setting for the name ! * ! * @param name the configuration option key ! * ! * @return the value of the configuration option ! */ ! public String getString(String name) { ! return (String) data.get(name); } /** * does this configuration object have this key? + * * @param name + * * @return true if key found, else false. */ *************** *** 89,102 **** /** ! * Set the configuration option. This may not be implemented in ! * all interfaces. It is intended for more sophistacated implementations. * ! * @param name the key of the option ! * @param value of the option */ ! public void setString(String name, String value) { ! service.setString(this.getName(), name, value); ! data.put(name, value); ! setDirty(true); } --- 151,160 ---- /** ! * Get an enumeration of all the configurations. * ! * @return */ ! public Set keys() { ! return data.keySet(); } *************** *** 108,119 **** void setDirty(boolean dirty) { this.dirty = dirty; - } - - /** - * Get the state of the dirty flag. - * @return - */ - public boolean isDirty() { - return dirty; } } --- 166,169 ---- Index: SqlConfigService.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/config/SqlConfigService.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SqlConfigService.java 3 Jun 2003 22:35:27 -0000 1.5 --- SqlConfigService.java 27 Jun 2003 02:05:58 -0000 1.6 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/21 17:01:20 $ * * ! * 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.sql.config; --- 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.sql.config; *************** *** 27,70 **** import java.sql.*; import java.util.Locale; /** * A sql configuration service ! * ! * <p>The implementation of the configuration service is intended for high-volume, enterprise ! * installations. This implementation allows for dynamic configurations and also for configuration ! * writing, something not allowed in the "Light" version.</p> * * @author Bmcdonald * @version 1.0 */ ! public class SqlConfigService ! implements IConfigService { ! /** constant: the name of the database */ ! public final static String DB_NAME = "dbName"; /** constant: the password to use */ ! public final static String DB_PASSWORD = "dbPassword"; /** constant: the url to use to resolved the database */ ! public final static String DB_URL = "dbUrl"; ! /** constant: the name of database driver class-name */ ! public final static String DB_DRIVER = "dbDriver"; ! /** constant: the select query to get the configuration data */ public static final String CONFIG_SELECT = "SELECT cfg_name, cfg_value FROM config WHERE cfg_name LIKE "; /** constant: delete the key */ public static final String CONFIG_DELETE = "delete from config WHERE cfg_name = ?"; /** constant: insert the key */ public static final String CONFIG_INSERT = "INSERT INTO config ( cfg_name , cfg_value ) values ( ? , ? )"; // Instance variable settings. String dbName; String dbPasswd; - String dbDriver; String dbUrl; /** ! * Construct a sql connection. This will extract the properties from the system ! * properties and will initialize the instance variables representing the database ! * information. This method will attempt to load the driver class. */ public SqlConfigService() { --- 71,124 ---- import java.sql.*; + import java.util.Locale; + /** * A sql configuration service ! * ! * <p> ! * The implementation of the configuration service is intended for high-volume, ! * enterprise installations. This implementation allows for dynamic ! * configurations and also for configuration writing, something not allowed in ! * the "Light" version. ! * </p> * * @author Bmcdonald * @version 1.0 */ ! public class SqlConfigService implements IConfigService { /** constant: the name of the database */ ! public static final String DB_NAME = "dbName"; ! /** constant: the password to use */ ! public static final String DB_PASSWORD = "dbPassword"; ! /** constant: the url to use to resolved the database */ ! public static final String DB_URL = "dbUrl"; ! ! /** constant: the name of database driver class-name */ ! public static final String DB_DRIVER = "dbDriver"; ! ! /** constant: the select query to get the configuration data */ public static final String CONFIG_SELECT = "SELECT cfg_name, cfg_value FROM config WHERE cfg_name LIKE "; + /** constant: delete the key */ public static final String CONFIG_DELETE = "delete from config WHERE cfg_name = ?"; + /** constant: insert the key */ public static final String CONFIG_INSERT = "INSERT INTO config ( cfg_name , cfg_value ) values ( ? , ? )"; + String dbDriver; // Instance variable settings. String dbName; String dbPasswd; String dbUrl; /** ! * Construct a sql connection. This will extract the properties from the ! * system properties and will initialize the instance variables representing ! * the database information. This method will attempt to load the driver ! * class. */ public SqlConfigService() { *************** *** 74,78 **** dbUrl = System.getProperty(DB_URL); ! if (dbName != null && dbPasswd != null && dbDriver != null && dbUrl != null) { try { Class.forName(dbDriver).newInstance(); --- 128,133 ---- dbUrl = System.getProperty(DB_URL); ! if ((dbName != null) && (dbPasswd != null) && (dbDriver != null) && ! (dbUrl != null)) { try { Class.forName(dbDriver).newInstance(); *************** *** 84,92 **** /** ! * get a config bundle for the name and given locale. This extracts the country and ! * language strings from the locale object and calls the getConfig method * * @param name configuration object name * @param locale locale to use * @return the configuration object */ --- 139,149 ---- /** ! * get a config bundle for the name and given locale. This extracts the ! * country and language strings from the locale object and calls the ! * getConfig method * * @param name configuration object name * @param locale locale to use + * * @return the configuration object */ *************** *** 96,103 **** if (country != null) { ! name += "." + country; } if (language != null) { ! name += "." + language; } --- 153,161 ---- if (country != null) { ! name += ("." + country); } + if (language != null) { ! name += ("." + language); } *************** *** 106,114 **** /** ! * get a config bundle for the name and default locale. This is were the the database is ! * actually opened and data is selected. ! * <strong>TODO: Use a connection pool</strong> * * @param name configurationobject name * @return configuration object */ --- 164,173 ---- /** ! * get a config bundle for the name and default locale. This is were the the ! * database is actually opened and data is selected. <strong>TODO: Use a ! * connection pool</strong> * * @param name configurationobject name + * * @return configuration object */ *************** *** 123,126 **** --- 182,186 ---- stmt = con.createStatement(); results = stmt.executeQuery(CONFIG_SELECT + "'" + name + "%'"); + int nameLen = name.length() + 1; *************** *** 139,154 **** --- 199,220 ---- } catch (Exception x) { } + ; + try { stmt.close(); } catch (Exception x) { } + ; + try { con.close(); } catch (Exception x) { } + ; } + return config; } *************** *** 158,161 **** --- 224,228 ---- * * @param name + * * @return */ *************** *** 164,171 **** --- 231,246 ---- } + //this should be implemented... + public boolean saveConfig(String name, IConfig config) { + System.out.println("Not supported yet"); + + return false; + } + /** * package privacy - set the configuration value * * @param name the key of the option + * @param key DOCUMENT ME! * @param value of the option */ *************** *** 178,182 **** // Build the string name/key - remember names + keys get // stored in the same table. ! name += "." + key; try { --- 253,257 ---- // Build the string name/key - remember names + keys get // stored in the same table. ! name += ("." + key); try { *************** *** 199,208 **** --- 274,287 ---- } catch (Exception x) { } + ; + try { pstmt1.close(); } catch (Exception x) { } + ; + try { if (pstmt2 != null) { *************** *** 211,228 **** } catch (Exception x) { } ; try { con.close(); } catch (Exception x) { } ; } - } - - - //this should be implemented... - public boolean saveConfig(String name, IConfig config) { - System.out.println("Not supported yet"); - return false; } } --- 290,303 ---- } catch (Exception x) { } + ; + try { con.close(); } catch (Exception x) { } + ; } } } Index: SqlConfigurationLoader.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/config/SqlConfigurationLoader.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SqlConfigurationLoader.java 22 May 2003 03:20:32 -0000 1.6 --- SqlConfigurationLoader.java 27 Jun 2003 02:05:58 -0000 1.7 *************** *** 1,26 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/21 17:01:20 $ * * ! * 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.sql.config; import com.babeldoc.core.I18n; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.OptionBuilder; --- 1,72 ---- ! /* ==================================================================== ! * 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.sql.config; import com.babeldoc.core.I18n; + import com.babeldoc.core.BabeldocCommand; + import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.OptionBuilder; *************** *** 30,40 **** import java.io.FileInputStream; import java.io.IOException; import java.util.Enumeration; import java.util.Properties; /** ! * <strong>SqlConfigurationLoader</strong> ! * <p>Provides a way to import all the configuration data from the configuration properties ! * files into the sql configuration tables</p> * * @author Bmcdonald --- 76,91 ---- import java.io.FileInputStream; import java.io.IOException; + import java.util.Enumeration; import java.util.Properties; + /** ! * <strong>SqlConfigurationLoader</strong> ! * ! * <p> ! * Provides a way to import all the configuration data from the configuration ! * properties files into the sql configuration tables ! * </p> * * @author Bmcdonald *************** *** 42,48 **** */ public class SqlConfigurationLoader ! extends com.babeldoc.core.BabeldocCommand { /** instance: the directory to scan from */ private File directory; /** instance: the configuration service to use to set the values */ private SqlConfigService sqlConfigService; --- 93,100 ---- */ public class SqlConfigurationLoader ! extends BabeldocCommand { /** instance: the directory to scan from */ private File directory; + /** instance: the configuration service to use to set the values */ private SqlConfigService sqlConfigService; *************** *** 58,71 **** /** - * 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().withDescription(com.babeldoc.core.I18n.get("sql.002")).withLongOpt("directory").hasArg().create('d')); - } - - /** * Handle the command line from main * --- 110,113 ---- *************** *** 76,79 **** --- 118,122 ---- String dir = commandLine.getOptionValue('d'); directory = new File(dir); + if (directory.isDirectory()) { this.sqlConfigService = new SqlConfigService(); *************** *** 88,91 **** --- 131,155 ---- /** + * Main routine + * + * @param args + */ + public static void main(String[] args) { + new SqlConfigurationLoader(args); + } + + /** + * 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() + .withDescription(com.babeldoc.core.I18n.get( + "sql.002")).withLongOpt("directory").hasArg().create('d')); + } + + /** * recursive descend into the directory with property files * *************** *** 95,98 **** --- 159,163 ---- if (file.isDirectory()) { File[] files = file.listFiles(); + for (int i = 0; i < files.length; ++i) { process(files[i]); *************** *** 101,111 **** if (file.getAbsolutePath().endsWith(".properties")) { Properties props = new Properties(); try { props.load(new FileInputStream(file)); String dir = directory.getAbsolutePath(); String fname = file.getAbsolutePath(); ! String basename = fname.substring(dir.length() + 1).replace(File.separatorChar, '/'); ! basename = basename.substring(0, basename.length() - ".properties".length()); Enumeration e = props.keys(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); --- 166,182 ---- if (file.getAbsolutePath().endsWith(".properties")) { Properties props = new Properties(); + try { props.load(new FileInputStream(file)); + String dir = directory.getAbsolutePath(); String fname = file.getAbsolutePath(); ! String basename = fname.substring(dir.length() + 1).replace(File.separatorChar, ! '/'); ! basename = basename.substring(0, ! basename.length() - ".properties".length()); ! Enumeration e = props.keys(); + while (e.hasMoreElements()) { String key = (String) e.nextElement(); *************** *** 114,129 **** } } catch (IOException e) { ! com.babeldoc.core.LogService.getInstance().logError(com.babeldoc.core.I18n.get("002001") + file.toString(), e); } } } - } - - /** - * Main routine - * @param args - */ - public static void main(String[] args) { - new SqlConfigurationLoader(args); } } --- 185,193 ---- } } catch (IOException e) { ! com.babeldoc.core.LogService.getInstance().logError(com.babeldoc.core.I18n.get( ! "002001") + file.toString(), e); } } } } } |
|
From: <tr...@us...> - 2003-06-27 02:06:02
|
Update of /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/module In directory sc8-pr-cvs1:/tmp/cvs-serv31771/src/com/babeldoc/sql/module Modified Files: SqlModule.java Log Message: Reformatted and updated license header Index: SqlModule.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/module/SqlModule.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SqlModule.java 22 May 2003 03:20:32 -0000 1.2 --- SqlModule.java 27 Jun 2003 02:05:59 -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.sql.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.sql.module; *************** *** 24,27 **** --- 68,72 ---- import com.babeldoc.core.VariableProcessor; import com.babeldoc.core.module.BabeldocModule; + import com.babeldoc.sql.util.VelocitySqlContext; *************** *** 33,44 **** * This is the sql module - please look around but dont touch. * ! * @author bmcdonald * @version 1.0 */ ! public class SqlModule ! extends BabeldocModule { ! public final static String MODULE = "sql"; /** --- 78,98 ---- * This is the sql module - please look around but dont touch. * ! * @author bmcdonald * @version 1.0 */ + public class SqlModule extends BabeldocModule { + public static final String MODULE = "sql"; ! /** ! * sql module only depends on core ! * ! * @return ! */ ! public Set getDependsOn() { ! Set set = new HashSet(); ! set.add("core"); ! return set; ! } /** *************** *** 56,69 **** public void initialize() { VariableProcessor.addToContext(MODULE, new VelocitySqlContext()); - } - /** - * sql module only depends on core - * - * @return - */ - public Set getDependsOn() { - Set set = new HashSet(); - set.add("core"); - return set; } } --- 110,113 ---- |
|
From: <tr...@us...> - 2003-06-27 02:06:02
|
Update of /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/util In directory sc8-pr-cvs1:/tmp/cvs-serv31771/src/com/babeldoc/sql/util Modified Files: SqlQueryManager.java TableKeyHelper.java VelocitySqlContext.java Log Message: Reformatted and updated license header Index: SqlQueryManager.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/util/SqlQueryManager.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SqlQueryManager.java 22 May 2003 03:20:32 -0000 1.5 --- SqlQueryManager.java 27 Jun 2003 02:05:59 -0000 1.6 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/21 17:01:20 $ * * ! * 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.sql.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.sql.util; *************** *** 30,46 **** import java.sql.SQLException; /** ! * Description: Provides a very simple interface to the conifguration ! * manager stuff for get sql query strings. This is a useful abstraction ! * so that the queries can get changes on the fly, etc. * * @author bmcdonald * @version 1.0 */ - public class SqlQueryManager { ! /** ! * Configuration constants ! */ public static String CONFIG_FILENAME = "sql/query"; public static String SCANNER_THREADS = "scannerThreads"; --- 74,88 ---- import java.sql.SQLException; + /** ! * Description: Provides a very simple interface to the conifguration manager ! * stuff for get sql query strings. This is a useful abstraction so that the ! * queries can get changes on the fly, etc. * * @author bmcdonald * @version 1.0 */ public class SqlQueryManager { ! /** Configuration constants */ public static String CONFIG_FILENAME = "sql/query"; public static String SCANNER_THREADS = "scannerThreads"; *************** *** 50,54 **** * * @param queryName the name of query ! * @param queryName actual query */ public static String getSqlQuery(String queryName) { --- 92,97 ---- * * @param queryName the name of query ! * ! * @return DOCUMENT ME! */ public static String getSqlQuery(String queryName) { *************** *** 57,68 **** /** * Get the prepared statement * * @param queryName the name of the query * @return prepared statement */ ! public static PreparedStatement prepareStatement(Connection connection, String queryName) ! throws com.babeldoc.core.GeneralException, SQLException { String query = getSqlQuery(queryName); if (query == null) { throw new GeneralException(I18n.get("sql.301", queryName)); --- 100,127 ---- /** + * Main - for testing + * + * @param args + */ + public static void main(String[] args) { + SqlQueryManager sqlQueryManager1 = new SqlQueryManager(); + } + + /** * Get the prepared statement * + * @param connection DOCUMENT ME! * @param queryName the name of the query + * * @return prepared statement + * + * @throws com.babeldoc.core.GeneralException DOCUMENT ME! + * @throws SQLException DOCUMENT ME! + * @throws GeneralException DOCUMENT ME! */ ! public static PreparedStatement prepareStatement(Connection connection, ! String queryName) throws com.babeldoc.core.GeneralException, SQLException { String query = getSqlQuery(queryName); + if (query == null) { throw new GeneralException(I18n.get("sql.301", queryName)); *************** *** 70,81 **** return connection.prepareStatement(query); } - } - - /** - * Main - for testing - * @param args - */ - public static void main(String[] args) { - SqlQueryManager sqlQueryManager1 = new SqlQueryManager(); } } --- 129,132 ---- Index: TableKeyHelper.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/util/TableKeyHelper.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TableKeyHelper.java 22 May 2003 03:20:32 -0000 1.4 --- TableKeyHelper.java 27 Jun 2003 02:05:59 -0000 1.5 *************** *** 1,24 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/21 17:01:20 $ * * ! * 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.sql.util; --- 1,67 ---- ! /* ==================================================================== ! * The Apache Software License, Version 1.1 * + * Copyright (c) 2000 The Apache Software Foundation. All rights + * reserved. * ! * Redistribution and use in source and binary forms, with or without ! * modification, are permitted provided that the following conditions ! * are met: * ! * 1. Redistributions of source code must retain the above copyright ! * notice, this list of conditions and the following disclaimer. * ! * 2. Redistributions in binary form must reproduce the above copyright ! * notice, this list of conditions and the following disclaimer in ! * the documentation and/or other materials provided with the ! * distribution. ! * ! * 3. The end-user documentation included with the redistribution, ! * if any, must include the following acknowledgment: ! * "This product includes software developed by the ! * Apache Software Foundation (http://www.apache.org/)." ! * Alternately, this acknowledgment may appear in the software itself, ! * if and wherever such third-party acknowledgments normally appear. ! * ! * 4. The names "Apache" and "Apache Software Foundation" must ! * not be used to endorse or promote products derived from this ! * software without prior written permission. For written ! * permission, please contact ap...@ap.... ! * ! * 5. Products derived from this software may not be called "Apache", ! * nor may "Apache" appear in their name, without prior written ! * permission of the Apache Software Foundation. ! * ! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ! * SUCH DAMAGE. ! * ==================================================================== ! * ! * This software consists of voluntary contributions made by many ! * individuals on behalf of the Apache Software Foundation. For more ! * information on the Apache Software Foundation, please see ! * <http://www.apache.org/>. ! * ! * Portions of this software are based upon public domain software ! * originally written at the National Center for Supercomputing Applications, ! * University of Illinois, Urbana-Champaign. ! * ==================================================================== ! * ! * Babeldoc: The Universal Document Processor ! * ! * $Header$ ! * $DateTime$ ! * $Author$ * */ package com.babeldoc.sql.util; *************** *** 30,37 **** import java.sql.ResultSet; /** ! * Simple class to create new ids using a db table to keep ! * track of the max id for that table. Useful to get unique keys ! * in a db independent way. * * @author Bmcdonald --- 73,80 ---- import java.sql.ResultSet; + /** ! * Simple class to create new ids using a db table to keep track of the max id ! * for that table. Useful to get unique keys in a db independent way. * * @author Bmcdonald *************** *** 39,46 **** */ public class TableKeyHelper { ! ! /** ! * Configuration constants ! */ public static String TABLE_KEY_GET = "tableKeyGet"; public static String TABLE_KEY_UPDATE = "tableKeyUpdate"; --- 82,86 ---- */ public class TableKeyHelper { ! /** Configuration constants */ public static String TABLE_KEY_GET = "tableKeyGet"; public static String TABLE_KEY_UPDATE = "tableKeyUpdate"; *************** *** 55,63 **** /** * Return the new available key for the table. * @param con * @param tableName * @return */ ! public synchronized static Long getNextId(Connection con, String tableName) { //LogService.getLogger().logDebug("[TableKeyHelper.getNextId] Called"); PreparedStatement pstmt = null; --- 95,105 ---- /** * Return the new available key for the table. + * * @param con * @param tableName + * * @return */ ! public static synchronized Long getNextId(Connection con, String tableName) { //LogService.getLogger().logDebug("[TableKeyHelper.getNextId] Called"); PreparedStatement pstmt = null; *************** *** 67,70 **** --- 109,113 ---- String keyUpdate = SqlQueryManager.getSqlQuery(TABLE_KEY_UPDATE); String keyCreate = SqlQueryManager.getSqlQuery(TABLE_KEY_CREATE); + try { //LogService.getLogger().logDebug("[TableKeyHelper.getNextId] Getting next id"); *************** *** 73,78 **** --- 116,123 ---- //LogService.getLogger().logDebug("[TableKeyHelper.getNextId] keyQuery = "+keyQuery); pstmt.setString(1, tableName); + //LogService.getLogger().logDebug("[TableKeyHelper.getNextId] after set"); result = pstmt.executeQuery(); + if (result.next()) { //LogService.getLogger().logDebug("[TableKeyHelper.getNextId] Updating existing row"); *************** *** 82,85 **** --- 127,131 ---- pstmt2.setString(2, tableName); pstmt2.executeUpdate(); + return new Long(seqValue); } else { *************** *** 88,91 **** --- 134,138 ---- pstmt2.setString(1, tableName); pstmt2.executeUpdate(); + return new Long(0); } *************** *** 94,104 **** } finally { try { ! if (result != null) result.close(); ! if (pstmt != null) pstmt.close(); ! if (pstmt2 != null) pstmt2.close(); } catch (Exception e) { LogService.getInstance().logError(I18n.get("sql.403"), e); } } return new Long(-1); } --- 141,160 ---- } finally { try { ! if (result != null) { ! result.close(); ! } ! ! if (pstmt != null) { ! pstmt.close(); ! } ! ! if (pstmt2 != null) { ! pstmt2.close(); ! } } catch (Exception e) { LogService.getInstance().logError(I18n.get("sql.403"), e); } } + return new Long(-1); } Index: VelocitySqlContext.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/util/VelocitySqlContext.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** VelocitySqlContext.java 22 May 2003 03:20:32 -0000 1.3 --- VelocitySqlContext.java 27 Jun 2003 02:05:59 -0000 1.4 *************** *** 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.sql.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.sql.util; *************** *** 29,42 **** import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; /** ! * Velocity context object to be added the variable processor to do all kinds of nifty ! * sql tricks. This will allow velocity scripts to do all these nice tricks too. * * @author bmcdonald * @version 1.0 */ - public class VelocitySqlContext { /** --- 73,88 ---- import java.sql.ResultSet; import java.sql.Statement; + import java.util.ArrayList; + /** ! * Velocity context object to be added the variable processor to do all kinds ! * of nifty sql tricks. This will allow velocity scripts to do all these nice ! * tricks too. * * @author bmcdonald * @version 1.0 */ public class VelocitySqlContext { /** *************** *** 45,54 **** --- 91,104 ---- * @param resourceName the name of the resource * @param table the sql table name to get the next id for + * + * @return DOCUMENT ME! */ public String getNextTableId(String resourceName, String table) { IResource resource = ResourceFactory.getResource(resourceName); Connection connection = null; + try { connection = (Connection) resource.checkOut(); + return TableKeyHelper.getNextId(connection, table).toString(); } catch (Exception e) { *************** *** 60,87 **** } } return null; } /** ! * Execute sql update * ! * @param resourceName the name of the resource ! * @param sql the sql statement to execute */ ! public void executeSqlUpdate(String resourceName, String sql) { IResource resource = ResourceFactory.getResource(resourceName); Connection connection = null; Statement stmt = null; try { connection = (Connection) resource.checkOut(); stmt = connection.createStatement(); ! stmt.executeUpdate(sql); } catch (Exception e) { LogService.getInstance().logError(e); } finally { try { stmt.close(); } catch (Exception e) { } try { resource.checkIn(connection); --- 110,160 ---- } } + return null; } /** ! * Execute a sql select. * ! * @param resourceName resource name ! * @param sql the statement to execute ! * ! * @return arraylist of arraylists */ ! public ArrayList executeSqlSelect(String resourceName, String sql) { ! ArrayList rows = new ArrayList(); IResource resource = ResourceFactory.getResource(resourceName); Connection connection = null; Statement stmt = null; + ResultSet rs = null; + try { connection = (Connection) resource.checkOut(); stmt = connection.createStatement(); ! rs = stmt.executeQuery(sql); ! ! while (rs.next()) { ! int numColumns = rs.getMetaData().getColumnCount(); ! ArrayList colums = new ArrayList(numColumns); ! ! for (int i = 0; i < numColumns; ++i) { ! colums.add(rs.getString(i + 1)); ! } ! ! rows.add(colums); ! } } catch (Exception e) { LogService.getInstance().logError(e); } finally { try { + rs.close(); + } catch (Exception e) { + } + + try { stmt.close(); } catch (Exception e) { } + try { resource.checkIn(connection); *************** *** 89,131 **** } } } /** ! * Execute a sql select. * ! * @param resourceName resource name ! * @param sql the statement to execute ! * @return arraylist of arraylists */ ! public ArrayList executeSqlSelect(String resourceName, String sql) { ! ArrayList rows = new ArrayList(); IResource resource = ResourceFactory.getResource(resourceName); Connection connection = null; Statement stmt = null; ! ResultSet rs = null; try { connection = (Connection) resource.checkOut(); stmt = connection.createStatement(); ! rs = stmt.executeQuery(sql); ! ! while (rs.next()) { ! int numColumns = rs.getMetaData().getColumnCount(); ! ArrayList colums = new ArrayList(numColumns); ! for (int i = 0; i < numColumns; ++i) { ! colums.add(rs.getString(i + 1)); ! } ! rows.add(colums); ! } } catch (Exception e) { LogService.getInstance().logError(e); } finally { try { - rs.close(); - } catch (Exception e) { - } - try { stmt.close(); } catch (Exception e) { } try { resource.checkIn(connection); --- 162,192 ---- } } + + return rows; } /** ! * Execute sql update * ! * @param resourceName the name of the resource ! * @param sql the sql statement to execute */ ! public void executeSqlUpdate(String resourceName, String sql) { IResource resource = ResourceFactory.getResource(resourceName); Connection connection = null; Statement stmt = null; ! try { connection = (Connection) resource.checkOut(); stmt = connection.createStatement(); ! stmt.executeUpdate(sql); } catch (Exception e) { LogService.getInstance().logError(e); } finally { try { stmt.close(); } catch (Exception e) { } + try { resource.checkIn(connection); *************** *** 133,137 **** } } - return rows; } ! } \ No newline at end of file --- 194,197 ---- } } } ! } |
|
From: <tr...@us...> - 2003-06-27 02:06:02
|
Update of /cvsroot/babeldoc/babeldoc/modules/sql
In directory sc8-pr-cvs1:/tmp/cvs-serv31771
Modified Files:
build.xml
Log Message:
Reformatted and updated license header
Index: build.xml
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/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:21 -0000 1.7
--- build.xml 27 Jun 2003 02:05:58 -0000 1.8
***************
*** 80,94 ****
<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" />
--- 80,90 ----
<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 02:06:01
|
Update of /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/journal
In directory sc8-pr-cvs1:/tmp/cvs-serv31771/src/com/babeldoc/sql/journal
Modified Files:
GenericSqlJournal.java MySqlJournal.java OracleJournal.java
Log Message:
Reformatted and updated license header
Index: GenericSqlJournal.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/journal/GenericSqlJournal.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** GenericSqlJournal.java 29 May 2003 00:17:22 -0000 1.6
--- GenericSqlJournal.java 27 Jun 2003 02:05:58 -0000 1.7
***************
*** 1,22 ****
! /*
! * $Header$
! * $DateTime: 2002/07/21 17:01:20 $
*
*
! * 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
[...1409 lines suppressed...]
! }
! pstmt.setString(3, key);
! pstmt.setString(4, value);
! pstmt.executeUpdate();
}
} catch (Exception e) {
! LogService.getInstance().logError(e);
! throw new SQLException(e.toString());
} finally {
try {
if (pstmt != null) {
pstmt.close();
}
! } catch (Exception e) {
! LogService.getInstance().logError(I18n.get("sql.403"), e);
}
}
}
}
Index: MySqlJournal.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/journal/MySqlJournal.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** MySqlJournal.java 29 May 2003 00:17:23 -0000 1.5
--- MySqlJournal.java 27 Jun 2003 02:05:58 -0000 1.6
***************
*** 1,22 ****
! /*
! * $Header$
! * $DateTime: 2002/07/23 23:18:23 $
*
*
! * 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.sql.journal;
--- 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.sql.journal;
***************
*** 24,32 ****
--- 68,79 ----
import com.babeldoc.core.I18n;
import com.babeldoc.core.LogService;
+ import com.babeldoc.core.pipeline.PipelineDocument;
import com.babeldoc.core.journal.query.JournalQuery;
+
import com.babeldoc.sql.util.SqlQueryManager;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
+
import java.sql.Connection;
import java.sql.PreparedStatement;
***************
*** 36,43 ****
/**
! * The MySqlJournal provides an implementation of the journal for MySQL databases.
! * Most of the implementation is in the GenericSqlJournal. I suspect that other
! * than the screwy oracle implementation lots of databases can use this implemenation
! * since it seems to follow the standards (!) for writing binary objects to databases.
*
* @author bmcdonald
--- 83,91 ----
/**
! * The MySqlJournal provides an implementation of the journal for MySQL
! * databases. Most of the implementation is in the GenericSqlJournal. I
! * suspect that other than the screwy oracle implementation lots of databases
! * can use this implemenation since it seems to follow the standards (!) for
! * writing binary objects to databases.
*
* @author bmcdonald
***************
*** 45,59 ****
*/
public class MySqlJournal extends GenericSqlJournal {
! public final static String DELTA_MAKEROW = "journalAddBlankDataRow-mysql";
/**
* writeDelta - Write a document to the rdbms.
* @param con the connection
* @param id the log id
* @param step the log step
*/
protected void writeDelta(Connection con, long id, long step,
! com.babeldoc.core.pipeline.PipelineDocument doc) throws SQLException {
!
String insertStmt = SqlQueryManager.getSqlQuery(DELTA_MAKEROW);
PreparedStatement pstmt = null;
--- 93,143 ----
*/
public class MySqlJournal extends GenericSqlJournal {
! public static final String DELTA_MAKEROW = "journalAddBlankDataRow-mysql";
!
! /**
! * getTicketsProcessQueryString concoct the query string from the bits and
! * pieces. Calls back to the getTicketsProcess...
! *
! * @param jQuery
! *
! * @return
! */
! protected StringBuffer getTicketsProcessQueryString(JournalQuery jQuery) {
! boolean whereAdded;
!
! StringBuffer query = new StringBuffer(SqlQueryManager.getSqlQuery(
! LOG_QUERY_TICKETS));
!
! whereAdded = getTicketsProcessDates(jQuery.getStartDate(),
! jQuery.getEndDate(), query);
! whereAdded = getTicketsProcessJournalOperations(whereAdded, query,
! jQuery.getJournalOperations());
! getTicketsProcessQueryOptions(jQuery.getQueryOptions(), query);
!
! // Limit stuff
! if (jQuery.getStartIndex() > 0) {
! query.append(" limit " + jQuery.getStartIndex() + ", " +
! jQuery.getNumResults());
!
! // HACK ALERT - need to do this to stop the parent skipping
! // on the result set.
! jQuery.setStartIndex(0);
! }
!
! return query;
! }
/**
* writeDelta - Write a document to the rdbms.
+ *
* @param con the connection
* @param id the log id
* @param step the log step
+ * @param doc DOCUMENT ME!
+ *
+ * @throws SQLException DOCUMENT ME!
*/
protected void writeDelta(Connection con, long id, long step,
! PipelineDocument doc) throws SQLException {
String insertStmt = SqlQueryManager.getSqlQuery(DELTA_MAKEROW);
PreparedStatement pstmt = null;
***************
*** 98,133 ****
}
}
- }
-
- /**
- * getTicketsProcessQueryString concoct the query string from the bits and
- * pieces. Calls back to the getTicketsProcess...
- *
- * @param jQuery
- * @return
- */
- protected StringBuffer getTicketsProcessQueryString(JournalQuery jQuery) {
- boolean whereAdded;
-
- StringBuffer query = new StringBuffer(SqlQueryManager.getSqlQuery(
- LOG_QUERY_TICKETS));
-
- whereAdded = getTicketsProcessDates(jQuery.getStartDate(),
- jQuery.getEndDate(), query);
- whereAdded = getTicketsProcessJournalOperations(whereAdded, query,
- jQuery.getJournalOperations());
- getTicketsProcessQueryOptions(jQuery.getQueryOptions(), query);
-
- // Limit stuff
- if (jQuery.getStartIndex() > 0) {
- query.append(" limit " + jQuery.getStartIndex() + ", " +
- jQuery.getNumResults());
-
- // HACK ALERT - need to do this to stop the parent skipping
- // on the result set.
- jQuery.setStartIndex(0);
- }
-
- return query;
}
}
--- 182,185 ----
Index: OracleJournal.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/journal/OracleJournal.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** OracleJournal.java 22 May 2003 03:20:32 -0000 1.4
--- OracleJournal.java 27 Jun 2003 02:05:58 -0000 1.5
***************
*** 1,58 ****
! /*
! * $Header$
! * $DateTime: 2002/07/07 18:09:19 $
*
*
! * 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.sql.journal;
import com.babeldoc.core.LogService;
import com.babeldoc.sql.util.SqlQueryManager;
import oracle.sql.BLOB;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.sql.*;
/**
! * <p>Title: OracleJournal</p>
! * <p>Description: Provides oracle specific code for writing blobs down
! * to the rdbms. It would have been nice if it was available from the jdbc sdk
! * but alas, it is not.</p>
*
* @author bmcdonald
* @version 1.0
*/
! public class OracleJournal extends GenericSqlJournal {
! public final static String DELTA_MAKEROW = "journalAddBlankDataRow-oracle";
! public final static String SELECT_BLOB = "journalSelectBlobForUpdate-oracle";
/**
* writeDelta - this method involves lots of db specific trickery (in this
* case ORACLE).
* @param con the connection
* @param id the log id
* @param step the log step
* @param doc the object to write out
*/
! protected void writeDelta(Connection con, long id, long step, com.babeldoc.core.pipeline.PipelineDocument doc)
! throws SQLException {
!
LogService.getInstance().logDebug("[Oracle.writeDelta] called");
String insertStmt = SqlQueryManager.getSqlQuery(DELTA_MAKEROW);
String selectBlobStmt = SqlQueryManager.getSqlQuery(SELECT_BLOB);
--- 1,116 ----
! /* ====================================================================
! * 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.sql.journal;
import com.babeldoc.core.LogService;
+ import com.babeldoc.core.pipeline.PipelineDocument;
+
import com.babeldoc.sql.util.SqlQueryManager;
+
import oracle.sql.BLOB;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
+
import java.sql.*;
+
/**
! * <p>
! * Title: OracleJournal
! * </p>
! *
! * <p>
! * Description: Provides oracle specific code for writing blobs down to the
! * rdbms. It would have been nice if it was available from the jdbc sdk but
! * alas, it is not.
! * </p>
*
* @author bmcdonald
* @version 1.0
*/
! public class OracleJournal
! extends GenericSqlJournal {
! public static final String DELTA_MAKEROW = "journalAddBlankDataRow-oracle";
! public static final String SELECT_BLOB = "journalSelectBlobForUpdate-oracle";
/**
* writeDelta - this method involves lots of db specific trickery (in this
* case ORACLE).
+ *
* @param con the connection
* @param id the log id
* @param step the log step
* @param doc the object to write out
+ *
+ * @throws SQLException DOCUMENT ME!
*/
! protected void writeDelta(Connection con, long id, long step,
! PipelineDocument doc) throws SQLException {
LogService.getInstance().logDebug("[Oracle.writeDelta] called");
+
String insertStmt = SqlQueryManager.getSqlQuery(DELTA_MAKEROW);
String selectBlobStmt = SqlQueryManager.getSqlQuery(SELECT_BLOB);
***************
*** 60,63 ****
--- 118,122 ----
ResultSet rset = null;
OutputStream ostream = null;
+
try {
LogService.getInstance().logDebug("[Oracle.writeDelta] Creating journal row");
***************
*** 76,86 ****
--- 135,148 ----
//getLog().debug("Getting blob");
rset.next();
+
Blob blob = rset.getBlob(1);
//getLog().debug("Streaming out blob");
ostream = ((BLOB) blob).getBinaryOutputStream();
+
ObjectOutputStream oostream = new ObjectOutputStream(ostream);
oostream.writeObject(doc);
writeExtraData(con, id, step, doc);
+
//must be closed before commit
oostream.close();
***************
*** 88,101 ****
LogService.getInstance().logDebug("Commited");
-
} catch (Exception e) {
! com.babeldoc.core.LogService.getInstance().logError("Error updating document", e);
con.rollback();
throw new SQLException(e.toString());
} finally {
try {
! if (pstmt != null) pstmt.close();
! if (rset != null) rset.close();
! if (ostream != null) ostream.close();
} catch (Exception e) {
com.babeldoc.core.LogService.getInstance().logError("Closing objects", e);
--- 150,171 ----
LogService.getInstance().logDebug("Commited");
} catch (Exception e) {
! com.babeldoc.core.LogService.getInstance().logError("Error updating document",
! e);
con.rollback();
throw new SQLException(e.toString());
} finally {
try {
! if (pstmt != null) {
! pstmt.close();
! }
!
! if (rset != null) {
! rset.close();
! }
!
! if (ostream != null) {
! ostream.close();
! }
} catch (Exception e) {
com.babeldoc.core.LogService.getInstance().logError("Closing objects", e);
|
|
From: <tr...@us...> - 2003-06-27 01:56:32
|
Update of /cvsroot/babeldoc/babeldoc/modules/crypto/src/com/babeldoc/crypto/module In directory sc8-pr-cvs1:/tmp/cvs-serv30137/src/com/babeldoc/crypto/module Modified Files: CryptoModule.java Log Message: reformatted and changed header Index: CryptoModule.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/crypto/src/com/babeldoc/crypto/module/CryptoModule.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CryptoModule.java 22 May 2003 03:20:29 -0000 1.2 --- CryptoModule.java 27 Jun 2003 01:50: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.crypto.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.crypto.module; *************** *** 31,61 **** * This is the crypto module - please look around but dont touch. * ! * @author bmcdonald * @version 1.0 */ ! ! public class CryptoModule ! extends BabeldocModule { ! ! public final static String MODULE = "crypto"; /** ! * The Name of the module is MODULE - 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; } } --- 75,103 ---- * This is the crypto module - please look around but dont touch. * ! * @author bmcdonald * @version 1.0 */ ! public class CryptoModule extends BabeldocModule { ! public static final String MODULE = "crypto"; /** ! * 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 MODULE - and dont you forget it! * * @return */ ! public String getName() { ! return MODULE; } } |
|
From: <tr...@us...> - 2003-06-27 01:56:32
|
Update of /cvsroot/babeldoc/babeldoc/modules/crypto
In directory sc8-pr-cvs1:/tmp/cvs-serv30137
Modified Files:
build.xml
Log Message:
reformatted and changed header
Index: build.xml
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/crypto/build.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** build.xml 11 Jun 2003 11:03:20 -0000 1.6
--- build.xml 27 Jun 2003 01:50:07 -0000 1.7
***************
*** 77,96 ****
<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" />
</fileset>
</jalopy>
! -->
! </target>
</project>
--- 77,91 ----
<target name="format">
<!--
<jalopy fileformat="${jalopy.fileformat}"
convention="${jalopy.convention}"
history="${jalopy.history}"
loglevel="${jalopy.loglevel}"
! threads="${jalopy.threads}">
<fileset dir="./src">
<include name="**/*.java" />
</fileset>
</jalopy>
! </target>
! -->
</project>
|