|
From: <tr...@us...> - 2003-08-08 23:43:15
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/processor In directory sc8-pr-cvs1:/tmp/cvs-serv27392/modules/core/src/com/babeldoc/core/pipeline/processor Modified Files: AsyncPipelineStageProcessor.java IPipelineStageProcessor.java SyncPipelineStageProcessor.java ThreadPooledPipelineStageProcessor.java Added Files: ProcessorConfigInfo.java Log Message: Lots of updates to the documentation. The processor documentation is now generated directly from the source code. --- NEW FILE: ProcessorConfigInfo.java --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. * ==================================================================== * * Babeldoc: The Universal Document Processor * * $Header: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/processor/ProcessorConfigInfo.java,v 1.1 2003/08/08 23:43:11 triphop Exp $ * $DateTime$ * $Author: triphop $ * */ package com.babeldoc.core.pipeline.processor; import com.babeldoc.core.option.ConfigInfo; import com.babeldoc.core.option.ConfigOption; import java.util.Collection; import java.util.ArrayList; import java.util.Iterator; import java.io.StringWriter; import java.io.IOException; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.dom4j.io.OutputFormat; import org.dom4j.io.XMLWriter; /** * Configuration information class for processors. This allows for the * The customization of how pipeline stage documents are handled in a pipeline * * @author bmcdonald * @version 1.1 */ public abstract class ProcessorConfigInfo extends ConfigInfo{ /** * This method returns options that are general to all components * * @return comments */ public Collection getGeneralOptions() { return new ArrayList(); } /** * Return an xmlized version of the of the config info * * @return DOCUMENT ME! */ public String toXml() { Document document = DocumentHelper.createDocument(); // Using dom4j - create the tree Element root = document.addElement("processor-defn"); root.addElement("processor-name").setText(this.getName()); root.addElement("processor-desc").setText(this.getDescription()); // Now do the options for (Iterator iopt = this.getOptions().iterator(); iopt.hasNext();) { ConfigOption option = (ConfigOption) iopt.next(); Element optionElement = root.addElement("processor-option"); optionElement.addElement("option-name").setText(option.getName()); optionElement.addElement("option-desc").setText(option.getDescription()); optionElement.addElement("option-type").setText(option.getType().getName()); Element optionNumber = optionElement.addElement("option-number"); if (option.isComplex()) { if (option.isMandatory()) { optionNumber.setText("1..n"); } else { optionNumber.setText("0..n"); } } else { if (option.isMandatory()) { optionNumber.setText("1..1"); } else { optionNumber.setText("0..1"); } } } OutputFormat outformat = OutputFormat.createPrettyPrint(); outformat.setSuppressDeclaration(true); outformat.setOmitEncoding(true); StringWriter strWriter = new StringWriter(); XMLWriter writer = new XMLWriter(strWriter, outformat); try { writer.write(document); writer.flush(); } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use Options | File Templates. } return strWriter.toString(); } } Index: AsyncPipelineStageProcessor.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/processor/AsyncPipelineStageProcessor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AsyncPipelineStageProcessor.java 16 Jul 2003 22:45:28 -0000 1.1 --- AsyncPipelineStageProcessor.java 8 Aug 2003 23:43:11 -0000 1.2 *************** *** 67,70 **** --- 67,74 ---- import com.babeldoc.core.pipeline.*; + import com.babeldoc.core.option.IConfigInfo; + import com.babeldoc.core.option.ConfigOption; + import com.babeldoc.core.option.IConfigOptionType; + import com.babeldoc.core.I18n; import java.util.*; *************** *** 191,194 **** --- 195,240 ---- public int getGlobalMaxThreads() { return globalMaxThreads; + } + + + /** + * Get the configuration information for this processor + * + * @return IConfigInfo object + */ + public IConfigInfo getInfo() { + return new ProcessorConfigInfo() { + /** + * This method returns type specific options + * + * @return comments + */ + public Collection getTypeSpecificOptions() { + Collection options = new ArrayList(); + + options.add(new ConfigOption(MAX_THREADS, IConfigOptionType.INTEGER, + null, false, I18n.get("core.pipeline.processor.async.option.maxThreads"))); + + return options; + } + + /** + * Return description of this worker + * + * @return description + */ + public String getDescription() { + return I18n.get("core.pipeline.processor.async.desc"); + } + + /** + * return the name + * + * @return + */ + public String getName() { + return "async"; + } + }; } } Index: IPipelineStageProcessor.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/processor/IPipelineStageProcessor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IPipelineStageProcessor.java 16 Jul 2003 22:45:28 -0000 1.1 --- IPipelineStageProcessor.java 8 Aug 2003 23:43:11 -0000 1.2 *************** *** 71,74 **** --- 71,75 ---- import com.babeldoc.core.pipeline.IPipelineStageFactory; import com.babeldoc.core.journal.IJournalTicket; + import com.babeldoc.core.option.IConfigurable; import java.util.Collection; *************** *** 81,85 **** * */ ! public interface IPipelineStageProcessor { public static final String PROCESSOR = "processor"; --- 82,87 ---- * */ ! public interface IPipelineStageProcessor ! extends IConfigurable { public static final String PROCESSOR = "processor"; *************** *** 91,95 **** * @return a reference to the pipeline stage * ! * @throws PipelineException DOCUMENT ME! */ public IPipelineStage getPipelineStage(String stageName) --- 93,97 ---- * @return a reference to the pipeline stage * ! * @throws PipelineException */ public IPipelineStage getPipelineStage(String stageName) Index: SyncPipelineStageProcessor.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/processor/SyncPipelineStageProcessor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SyncPipelineStageProcessor.java 16 Jul 2003 22:45:28 -0000 1.1 --- SyncPipelineStageProcessor.java 8 Aug 2003 23:43:11 -0000 1.2 *************** *** 72,75 **** --- 72,76 ---- import com.babeldoc.core.I18n; import com.babeldoc.core.LogService; + import com.babeldoc.core.option.IConfigInfo; import java.util.*; *************** *** 280,283 **** --- 281,320 ---- } } + } + + /** + * Get the configuration information for this processor + * + * @return IConfigInfo object + */ + public IConfigInfo getInfo() { + return new ProcessorConfigInfo() { + /** + * This method returns type specific options + * + * @return comments + */ + public Collection getTypeSpecificOptions() { + return new ArrayList(); + } + + /** + * Return description of this worker + * + * @return description + */ + public String getDescription() { + return I18n.get("core.pipeline.processor.sync.desc"); + } + + /** + * return the name + * + * @return + */ + public String getName() { + return "sync"; + } + }; } } Index: ThreadPooledPipelineStageProcessor.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/processor/ThreadPooledPipelineStageProcessor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ThreadPooledPipelineStageProcessor.java 4 Aug 2003 23:46:38 -0000 1.2 --- ThreadPooledPipelineStageProcessor.java 8 Aug 2003 23:43:11 -0000 1.3 *************** *** 68,71 **** --- 68,75 ---- import com.babeldoc.core.pipeline.*; import com.babeldoc.core.LogService; + import com.babeldoc.core.I18n; + import com.babeldoc.core.option.IConfigInfo; + import com.babeldoc.core.option.ConfigOption; + import com.babeldoc.core.option.IConfigOptionType; import java.util.*; *************** *** 134,137 **** --- 138,182 ---- } } + } + + /** + * Get the configuration information for this processor + * + * @return IConfigInfo object + */ + public IConfigInfo getInfo() { + return new ProcessorConfigInfo() { + /** + * This method returns type specific options + * + * @return comments + */ + public Collection getTypeSpecificOptions() { + Collection options = new ArrayList(); + + options.add(new ConfigOption(POOL_SIZE, IConfigOptionType.INTEGER, + null, false, I18n.get("core.pipeline.processor.threadpool.desc"))); + + return options; + } + + /** + * Return description of this worker + * + * @return description + */ + public String getDescription() { + return I18n.get("core.pipeline.processor.threadpool.desc"); + } + + /** + * return the name + * + * @return + */ + public String getName() { + return "threadpool"; + } + }; } } |