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
|
Update of /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder In directory sc8-pr-cvs1:/tmp/cvs-serv19450/com/babeldoc/gui/pipeline/builder Modified Files: AddPipelineAction.java AddPipelineStageAction.java AddPipelineStageConfigAction.java PipelineBuilderController.java PipelineBuilderModel.java PipelineBuilderPanel.java PipelineTree.java PipelineTreeCellRenderer.java RemovePipelineAction.java RemovePipelineStageAction.java Added Files: EditPipelineStageConfigAction.java Log Message: Lots of GUI loving! Been working on the pipeline builder tool and getting into some shape. Now the pipeline stage configuration editing is looking a whole lot better. --- NEW FILE: EditPipelineStageConfigAction.java --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. * ==================================================================== * * Babeldoc: The Universal Document Processor * * $Header: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/EditPipelineStageConfigAction.java,v 1.1 2003/09/13 15:33:11 triphop Exp $ * $DateTime$ * $Author: triphop $ * */ package com.babeldoc.gui.pipeline.builder; import com.babeldoc.gui.config.ConfigOptionPanel; import com.babeldoc.core.pipeline.PipelineException; import com.babeldoc.core.option.IConfigInfo; import com.babeldoc.core.LogService; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.*; import javax.swing.*; /** * Handle an Add Pipeline action event. */ public class EditPipelineStageConfigAction extends BuilderAction { public static final String ACTION_ADD_CONFIG = "Edit configuration"; private String pipeline; private String stage; /** * Creates a new EditPipelineStageConfigAction object. * * @param model DOCUMENT ME! * @param frame DOCUMENT ME! * @param pipeline DOCUMENT ME! * @param stage DOCUMENT ME! */ public EditPipelineStageConfigAction(PipelineBuilderModel model, PipelineBuilderPanel frame, PipelineTreeNode pipeline, PipelineTreeNode stage) { super(ACTION_ADD_CONFIG, null, model, frame); this.pipeline = pipeline.toString(); this.stage = stage.toString(); } /** * TODO: DOCUMENT ME! * * @param e DOCUMENT ME! */ public void actionPerformed(ActionEvent e) { final IConfigInfo info; try { info = PipelineBuilderModel.getPipelineStageConfigInfo(pipeline, stage); final JDialog dialog = new JDialog(); final ConfigOptionPanel panel = new ConfigOptionPanel(info); JPanel contents = new JPanel(); contents.setLayout(new BorderLayout()); contents.add(panel); JButton button = new JButton("close"); button.addActionListener(new ActionListener() { /** * Invoked when an action occurs. */ public void actionPerformed(ActionEvent e) { dialog.dispose(); try { PipelineBuilderModel.updatePipelineStageConfig(pipeline, stage, info); } catch (PipelineException pe) { LogService.getInstance().logError(pe); } } }); JPanel buttons = new JPanel(); buttons.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); buttons.setLayout(new BoxLayout(buttons, BoxLayout.LINE_AXIS)); buttons.add(Box.createHorizontalGlue()); buttons.add(button); buttons.add(Box.createHorizontalGlue()); contents.add(buttons, BorderLayout.SOUTH); dialog.setContentPane(contents); dialog.pack(); dialog.show(); } catch (PipelineException pe) { LogService.getInstance().logError(pe); } } } Index: AddPipelineAction.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/AddPipelineAction.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 Index: AddPipelineStageAction.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/AddPipelineStageAction.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AddPipelineStageAction.java 9 Sep 2003 21:50:50 -0000 1.6 --- AddPipelineStageAction.java 13 Sep 2003 15:33:11 -0000 1.7 *************** *** 67,70 **** --- 67,74 ---- import com.babeldoc.gui.wizard.addstage.AddPipelineStageWizard; + import com.babeldoc.gui.wizard.addstage.AddPipelineStageModel; + import com.babeldoc.core.pipeline.PipelineException; + import com.babeldoc.core.LogService; + import com.babeldoc.core.option.IConfigInfo; import javax.swing.tree.TreeNode; *************** *** 101,107 **** */ public void actionPerformed(ActionEvent e) { ! String stage = AddPipelineStageWizard.run(treenode.toString()).getModel().getStage(); if(stage!=null) { TreeNode pipeNode = getFrame().getTree().getTreeNodeForPipeline(treenode.toString()); getFrame().getTree().addPipelineStage(pipeNode, stage); --- 105,118 ---- */ public void actionPerformed(ActionEvent e) { ! AddPipelineStageModel model = AddPipelineStageWizard.run(treenode.toString()).getModel(); ! String stage = model.getStage(); if(stage!=null) { + try { + IConfigInfo info = model.getPipelineStageConfigInfo(); + PipelineBuilderModel.updatePipelineStageConfig(treenode.toString(), stage, info); + } catch (PipelineException e1) { + LogService.getInstance().logError(e1); + } TreeNode pipeNode = getFrame().getTree().getTreeNodeForPipeline(treenode.toString()); getFrame().getTree().addPipelineStage(pipeNode, stage); Index: AddPipelineStageConfigAction.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/AddPipelineStageConfigAction.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 Index: PipelineBuilderController.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/PipelineBuilderController.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 Index: PipelineBuilderModel.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/PipelineBuilderModel.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PipelineBuilderModel.java 9 Sep 2003 21:50:50 -0000 1.9 --- PipelineBuilderModel.java 13 Sep 2003 15:33:11 -0000 1.10 *************** *** 68,71 **** --- 68,74 ---- import com.babeldoc.core.EnvironmentLoader; import com.babeldoc.core.option.IConfigData; + import com.babeldoc.core.option.IConfigInfo; + import com.babeldoc.core.option.ConfigData; + import com.babeldoc.core.option.ConfigInfo; import com.babeldoc.core.config.ConfigService; import com.babeldoc.core.config.IConfig; *************** *** 329,334 **** /** ! * Returns the configuration that defines this pipeline stage. It is to ! * create a pipeline stage from this information. * * @param pipeline --- 332,336 ---- /** ! * Returns the configuration data from this pipeline stage * * @param pipeline *************** *** 339,343 **** * @throws PipelineException */ ! public static IConfigData getPipelineStageConfig(String pipeline, String stage) throws PipelineException { IPipelineStageFactory pfactory = PipelineFactoryFactory.getPipelineStageFactory(pipeline); --- 341,345 ---- * @throws PipelineException */ ! public static IConfigData getPipelineStageConfigData(String pipeline, String stage) throws PipelineException { IPipelineStageFactory pfactory = PipelineFactoryFactory.getPipelineStageFactory(pipeline); *************** *** 347,350 **** --- 349,370 ---- /** + * Returns the configuration data from this pipeline stage + * + * @param pipeline + * @param stage + * + * @return + * + * @throws PipelineException + */ + public static IConfigInfo getPipelineStageConfigInfo(String pipeline, + String stage) throws PipelineException { + IPipelineStageFactory pfactory = PipelineFactoryFactory. + getPipelineStageFactory(pipeline); + return ((PipelineStageFactory)pfactory).getProcessor(). + getPipelineStage(stage).getInfo(); + } + + /** * This sets the properteis for the pipeline stage. * *************** *** 472,475 **** --- 492,508 ---- config.setString(pipeline + DOT_CONFIGFILE, configName); saveConfig(config); + } + + + public static void updatePipelineStageConfig(String pipeline, String stage, IConfigInfo info ) + throws PipelineException { + // Create the pipeline config and write it down + String configName = PIPELINE_SLASH + pipeline; + IConfig pipeconfig = ConfigService.getInstance().getConfig(configName); + System.out.println("Got config "+pipeconfig); + + IConfigData data = info.getConfigData(); + System.out.println("PIpelinestage data: "+data); + ConfigData.getConfigFromData(pipeconfig, data); } Index: PipelineBuilderPanel.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/PipelineBuilderPanel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PipelineBuilderPanel.java 9 Sep 2003 21:50:50 -0000 1.2 --- PipelineBuilderPanel.java 13 Sep 2003 15:33:11 -0000 1.3 *************** *** 214,225 **** popup.add(new RemovePipelineStageAction(getController().getModel(), this, parentNode, currentNode)); ! // popup.add(new AddPipelineStageConfigAction(getController().getModel(), ! // this, parentNode, currentNode)); menuItem = new JMenuItem(ACTION_SET_ENTRY_STAGE); popup.add(menuItem); - // } else if (currentNode.isConfig()) { - // menuItem = new JMenuItem(ACTION_REMOVE_CONFIG); - // menuItem.addActionListener(this); - // popup.add(menuItem); } } --- 214,221 ---- popup.add(new RemovePipelineStageAction(getController().getModel(), this, parentNode, currentNode)); ! popup.add(new EditPipelineStageConfigAction(getController().getModel(), ! this, parentNode, currentNode)); menuItem = new JMenuItem(ACTION_SET_ENTRY_STAGE); popup.add(menuItem); } } Index: PipelineTree.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/PipelineTree.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Index: PipelineTreeCellRenderer.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/PipelineTreeCellRenderer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Index: RemovePipelineAction.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/RemovePipelineAction.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 Index: RemovePipelineStageAction.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/RemovePipelineStageAction.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 |
|
From: <tr...@us...> - 2003-09-13 15:30:37
|
Update of /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/wizard/addconfig In directory sc8-pr-cvs1:/tmp/cvs-serv18990/addconfig Log Message: Directory /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/wizard/addconfig added to the repository |
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/option In directory sc8-pr-cvs1:/tmp/cvs-serv25799/src/com/babeldoc/core/option Modified Files: ConfigData.java ConfigInfo.java ConfigOption.java IConfigData.java IConfigInfo.java Added Files: IConfigDataContainer.java Log Message: Updates and rationalization for the gui --- NEW FILE: IConfigDataContainer.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/option/IConfigDataContainer.java,v 1.1 2003/09/13 03:33:43 triphop Exp $ * $DateTime$ * $Author: triphop $ * */ package com.babeldoc.core.option; /** * Interface to classes that manage configuration data objects * * @author bmcdonald * @version 1.1 */ public interface IConfigDataContainer { /** * @return get the configuration data */ public IConfigData getConfigData(); /** * Set the configuration data for this object * * @param configData the configuration data */ public void setConfigData(IConfigData configData); } Index: ConfigData.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/option/ConfigData.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ConfigData.java 15 Aug 2003 00:25:29 -0000 1.3 --- ConfigData.java 13 Sep 2003 03:33:42 -0000 1.4 *************** *** 232,240 **** children = new HashMap(); } ! this.children.put(configData.getName(), configData); } /** * Convert to a string * --- 232,252 ---- children = new HashMap(); } ! // System.out.println(this.getName()+" adding child: "+configData.getName()+" = "+configData.getValue()); this.children.put(configData.getName(), configData); } /** + * remove the named child from the list of children of this + * configuation data object + * + * @param configData child to remove + */ + public void removeChild(IConfigData configData) { + if(configData!=null) { + this.children.remove(configData.getName()); + } + } + + /** * Convert to a string * *************** *** 347,350 **** --- 359,414 ---- } return data; + } + + + /** + * Extract the configuration data from the data object and place in the config + * object ready to be persisted. + * + * @param config + * @param data + * @return filled config object + */ + public static IConfig getConfigFromData(IConfig config, IConfigData data) { + Stack names = new Stack(); + getConfigFromData(data.getName(), config, data, names); + + return config; + } + + /** + * Extract the configuration data from the data object and place in the config + * object ready to be persisted. + * + * @param stageName the name of the stage + * @param config the configuration data to fill + * @param data the configuration data object + */ + protected static void getConfigFromData(String stageName, IConfig config, IConfigData data, Stack names) { + if(data.getNumberChildren()>0) { + Set children = data.getChildrenNameSet(); + for (Iterator iterator = children.iterator(); iterator.hasNext();) { + String s = (String) iterator.next(); + IConfigData child = data.getChild(s); + names.add(child.getName()); + getConfigFromData(stageName, config, child, names); + } + } else { + System.out.println("Data: "+data); + StringBuffer sb = new StringBuffer(stageName+"."); + for (Iterator iterator = names.iterator(); iterator.hasNext();) { + String s = (String) iterator.next(); + sb.append(s); + if(iterator.hasNext()) { + sb.append("."); + } + } + String key = sb.toString(); + String value = (data.getValue()==null)?" ":data.getValue(); + + System.out.println("Key found: "+key+" = "+value); + config.setString(key, value); + names.clear(); + } } Index: ConfigInfo.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/option/ConfigInfo.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ConfigInfo.java 12 Sep 2003 00:54:04 -0000 1.12 --- ConfigInfo.java 13 Sep 2003 03:33:43 -0000 1.13 *************** *** 72,75 **** --- 72,77 ---- import org.apache.commons.lang.NumberUtils; + import org.apache.commons.lang.builder.ToStringBuilder; + import org.apache.commons.collections.SequencedHashMap; *************** *** 135,138 **** --- 137,141 ---- public ConfigOption getOption(String optionName) { if (options == null) { + // System.out.println("Making the options"); getOptions(); } *************** *** 237,252 **** */ public int getIntValue(String path) { ! return NumberUtils.stringToInt((String)getValue(path), 0); } /** ! * Get the option value in the path of options as a boolean true/false. The path is ! * specificed like a file path: /option/suboption/etc * ! * @param path ! * @return value */ public boolean getBooleanValue(String path) { ! return "true".equalsIgnoreCase(getStrValue(path)); } --- 240,255 ---- */ public int getIntValue(String path) { ! return NumberUtils.stringToInt(getStrValue(path), 0); } /** ! * Get the option value for the configuration data object poitned ! * as by the path * ! * @param path to the object of interest ! * @return */ public boolean getBooleanValue(String path) { ! return Boolean.valueOf(getStrValue(path)).booleanValue(); } *************** *** 284,288 **** if (options == null) { //put general component options ! options = new HashMap(); Collection generalOptions = getGeneralOptions(); --- 287,294 ---- if (options == null) { //put general component options ! // Please note that if a Sequenced hash map is not used, ! // then the gui utilites fail because they expect the ! // options sorted in the order they are added. ! options = new SequencedHashMap(); Collection generalOptions = getGeneralOptions(); *************** *** 319,328 **** /** ! * Add an option to the list options. * * @param option */ public void addOption(ConfigOption option) { options.put(option.getName(), option); } --- 325,340 ---- /** ! * Add an option to the list options. Also links the parent data container ! * up and down links. * * @param option */ public void addOption(ConfigOption option) { + // System.out.println("Adding option: "+option.getName()); options.put(option.getName(), option); + + // Now link up the configuration data + option.setParentDataContainer(this); // Do this first + getConfigData().addChild(option.getConfigData()); // This relies on parent having been set } *************** *** 337,349 **** /** ! * Return String representation of ConfigInfo object * ! * @return DOCUMENT ME! */ public String toString() { ! return "Description=" + this.getDescription() + "\nOptions:" + ! this.getOptions(); } /** * Initialize the options. --- 349,364 ---- /** ! * Convert to a string * ! * @return */ public String toString() { ! return new ToStringBuilder(this).append("name", getName()). ! append("description", getDescription()). ! append("options", getOptions()). ! append("data", getConfigData()).toString(); } + /** * Initialize the options. *************** *** 359,375 **** */ public void applyConfigData(IConfigData data) { this.setConfigData(data); for (Iterator iterator = data.getChildrenNameSet().iterator(); iterator.hasNext();) { String key = (String) iterator.next(); ! IConfigData option = data.getChild(key); ConfigOption configoption = this.getOption(key); // If the options are not found for this data, create an option. if (configoption == null) { ! configoption = createDynamicOption(option, key); this.addOption(configoption); } ! applyConfigValue(option, configoption); } } --- 374,395 ---- */ public void applyConfigData(IConfigData data) { + + // Get the options first this needs to be done right here + // because this DOES interfere with the data applications + this.getOptions(); + this.setConfigData(data); for (Iterator iterator = data.getChildrenNameSet().iterator(); iterator.hasNext();) { String key = (String) iterator.next(); ! IConfigData child = data.getChild(key); ConfigOption configoption = this.getOption(key); // If the options are not found for this data, create an option. if (configoption == null) { ! configoption = createDynamicOption(data, key); this.addOption(configoption); } ! applyConfigValue(child, configoption); } } *************** *** 433,441 **** /** ! * Get the configuration data that has been set on this object * * @return */ ! protected IConfigData getConfigData() { return configData; } --- 453,466 ---- /** ! * Get the configuration data that has been set on this object. If nothing set, ! * then a configuration data object is created. * * @return */ ! public IConfigData getConfigData() { ! if(configData==null) { ! // System.out.println("Creating new config data"); ! configData = new ConfigData(this.getName()); ! } return configData; } *************** *** 446,451 **** * @param configData */ ! protected void setConfigData(IConfigData configData) { this.configData = configData; } } --- 471,492 ---- * @param configData */ ! public void setConfigData(IConfigData configData) { this.configData = configData; + } + + /** + * Set the name (actually on the configuration data object) + * + * @param name + */ + public void setName(String name) { + this.getConfigData().setName(name); + } + + /** + * @return get the name from the configuration data object + */ + public String getName() { + return this.getConfigData().getName(); } } Index: ConfigOption.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/option/ConfigOption.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ConfigOption.java 29 Aug 2003 01:19:06 -0000 1.14 --- ConfigOption.java 13 Sep 2003 03:33:43 -0000 1.15 *************** *** 66,69 **** --- 66,71 ---- package com.babeldoc.core.option; + import com.babeldoc.core.Named; + import java.io.Serializable; *************** *** 73,94 **** /** * This class represents single config option. It is used thoughout babeldoc. A configuration ! * option is linked to a configuration data object. The option has a default value, a type, and a * number of other attributes. It also may contain a number of suboptions. * * @author bmcdonald * @version 1.0 */ ! public class ConfigOption implements Serializable { ! private ArrayList dependentOn; ! private ArrayList exclusiveTo; private IConfigOptionType type; private Map suboptions; ! private IConfigData data; private String defaultValue; private String description; ! private String name; private boolean mandatory; private boolean mutable; /** * Construct a config option object --- 75,122 ---- /** * This class represents single config option. It is used thoughout babeldoc. A configuration ! * option is linked to a configuration configData object. The option has a default value, a type, and a * number of other attributes. It also may contain a number of suboptions. * + * The underlying storage of the value of the configuration option is in + * the configuration data object. This object is stored analogously to the + * option as a tree of objects. + * * @author bmcdonald * @version 1.0 */ ! public class ConfigOption ! extends Named ! implements Serializable, IConfigDataContainer { ! ! /** Array of options that this option depends on */ ! private Collection dependentOn; ! ! /** Options that this option is exclusive to */ ! private Collection exclusiveTo; ! ! /** The type of this option */ private IConfigOptionType type; + + /** The suboptions of this option */ private Map suboptions; ! ! /** The configuration data */ ! private IConfigData configData; ! ! /** The default value */ private String defaultValue; + + /** The description of this option */ private String description; ! ! /** Is this a required options */ private boolean mandatory; + + /** Can this option be changed */ private boolean mutable; + /** The containing object - can be another option or a IConfigInfo */ + private IConfigDataContainer parentDataContainer; + /** * Construct a config option object *************** *** 102,106 **** public ConfigOption(String name, IConfigOptionType type, String defaultValue, boolean mandatory, String description) { ! this.name = name; this.type = type; this.defaultValue = defaultValue; --- 130,134 ---- public ConfigOption(String name, IConfigOptionType type, String defaultValue, boolean mandatory, String description) { ! super(name); this.type = type; this.defaultValue = defaultValue; *************** *** 122,126 **** */ public ConfigOption(String name, IConfigOptionType type, String description) { ! this.name = name; this.type = type; this.description = description; --- 150,154 ---- */ public ConfigOption(String name, IConfigOptionType type, String description) { ! super(name); this.type = type; this.description = description; *************** *** 135,141 **** /** ! * TODO: DOCUMENT ME! ! * ! * @return DOCUMENT ME! */ public boolean isComplex() { --- 163,167 ---- /** ! * @return Value of the complex flag */ public boolean isComplex() { *************** *** 186,190 **** * @return Options that this option must have */ ! public ArrayList getDependentOn() { return dependentOn; } --- 212,216 ---- * @return Options that this option must have */ ! public Collection getDependentOn() { return dependentOn; } *************** *** 222,226 **** * @return comments */ ! public ArrayList getExclusiveTo() { return exclusiveTo; } --- 248,252 ---- * @return comments */ ! public Collection getExclusiveTo() { return exclusiveTo; } *************** *** 263,284 **** /** - * Set the name - * - * @param newName - */ - public void setName(String newName) { - name = newName; - } - - /** - * Get the name - * - * @return - */ - public String getName() { - return name; - } - - /** * Get the number of suboptions in this config option * --- 289,292 ---- *************** *** 286,293 **** */ public int getNumberSuboptions() { ! if (suboptions == null) { return 0; } else { ! return suboptions.size(); } } --- 294,301 ---- */ public int getNumberSuboptions() { ! if (getSuboptions() == null) { return 0; } else { ! return getSuboptions().size(); } } *************** *** 301,308 **** */ public ConfigOption getSuboption(String name) { ! if (suboptions == null) { return null; } else { ! return (ConfigOption) suboptions.get(name); } } --- 309,316 ---- */ public ConfigOption getSuboption(String name) { ! if (getSuboptions() == null) { return null; } else { ! return (ConfigOption) getSuboptions().get(name); } } *************** *** 314,321 **** */ public Set getSuboptionNames() { ! if (suboptions == null) { return null; } else { ! return suboptions.keySet(); } } --- 322,329 ---- */ public Set getSuboptionNames() { ! if (getSuboptions() == null) { return null; } else { ! return getSuboptions().keySet(); } } *************** *** 340,344 **** /** ! * Apply the configuration data to this configuration information * object. This is package private - should only really be called * from the applyConfigData method. --- 348,352 ---- /** ! * Apply the configuration configData to this configuration information * object. This is package private - should only really be called * from the applyConfigData method. *************** *** 346,351 **** * @param data */ ! void setConfigData(IConfigData data) { ! this.data = data; } --- 354,360 ---- * @param data */ ! public void setConfigData(IConfigData data) { ! // System.out.println("Setting: "+getName()+" = "+data.getValue()); ! this.configData = data; } *************** *** 357,363 **** */ protected void protectedSetValue(Object value) { ! if(data!=null) { ! this.data.setValue(value.toString()); ! } } --- 366,370 ---- */ protected void protectedSetValue(Object value) { ! this.getConfigData().setValue(value.toString()); } *************** *** 373,376 **** --- 380,384 ---- throw new MutableConfigValueException("Cant change this value"); } else { + // System.out.println("Setting: "+getName()+" to value: "+value); protectedSetValue(value); } *************** *** 384,392 **** */ public Object getValue() { ! if (data != null) { ! return data.getValue(); ! } else { ! return getDefaultValue(); ! } } --- 392,396 ---- */ public Object getValue() { ! return getConfigData().getValue(); } *************** *** 398,403 **** */ public boolean isValid() { ! if(suboptions!=null) { ! for (Iterator iterator = suboptions.keySet().iterator(); iterator.hasNext();) { String name = (String) iterator.next(); ConfigOption subOption = getSuboption(name); --- 402,407 ---- */ public boolean isValid() { ! if(getSuboptions()!=null) { ! for (Iterator iterator = getSuboptions().keySet().iterator(); iterator.hasNext();) { String name = (String) iterator.next(); ConfigOption subOption = getSuboption(name); *************** *** 418,442 **** /** ! * Add a suboption to this option. * * @param suboption */ public void addSuboption(ConfigOption suboption) { ! if (suboptions == null) { suboptions = new HashMap(); } ! // System.out.println(getName()+" just had suboption added: "+suboption.getName()); ! suboptions.put(suboption.getName(), suboption); } /** ! * Remove the named option from the suboptions * * @param name */ public void removeSuboption(String name) { ! if (suboptions != null) { ! suboptions.remove(name); } } --- 422,454 ---- /** ! * Add a suboption to this option. This also connects the configuration data ! * objects together so that the parent child relationshipt is also maintained ! * in that structure. * * @param suboption */ public void addSuboption(ConfigOption suboption) { ! if (getSuboptions() == null) { suboptions = new HashMap(); } ! // Add to the collection ! getSuboptions().put(suboption.getName(), suboption); ! ! // Now connect the IConfigData objects together ! suboption.setParentDataContainer(this); // Do this first ! getConfigData().addChild(suboption.getConfigData()); // This relies on parent set } /** ! * Remove the named option from the suboptions and remove the configuration ! * data linkage too. * * @param name */ public void removeSuboption(String name) { ! if (getSuboptions() != null) { ! getConfigData().removeChild(getSuboption(name).getConfigData()); ! getSuboptions().remove(name); } } *************** *** 459,465 **** } ! return "Option='" + name + "' type='" + type + "' Description='" + description + "' Default value='" + defaultValue + "' Allowed Values=" + allowed+" value='"+getValue()+"'"; } } --- 471,521 ---- } ! return "Option='" + getName() + "' type='" + type + "' Description='" + description + "' Default value='" + defaultValue + "' Allowed Values=" + allowed+" value='"+getValue()+"'"; + } + + + /** + * Get the configuration data for this configuration option. if the + * configdata does not exists, create it and then set the value of the configuratio + * to the default. + * + * @return + */ + public IConfigData getConfigData() { + if(configData==null) { + // System.out.println("Config data is null, setting"); + configData = new ConfigData(this.getName()); + getParentDataContainer().getConfigData().addChild(configData); + configData.setValue(this.defaultValue); + } + + return configData; + } + + /** + * @return get the suboptions + */ + protected Map getSuboptions() { + return suboptions; + } + + /** + * Parent data container + * + * @return + */ + public IConfigDataContainer getParentDataContainer() { + return parentDataContainer; + } + + /** + * parent data container + * + * @param parentDataContainer + */ + public void setParentDataContainer(IConfigDataContainer parentDataContainer) { + this.parentDataContainer = parentDataContainer; } } Index: IConfigData.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/option/IConfigData.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IConfigData.java 12 Aug 2003 23:44:43 -0000 1.1 --- IConfigData.java 13 Sep 2003 03:33:43 -0000 1.2 *************** *** 127,130 **** --- 127,137 ---- /** + * remove the named child from the list of children of this + * configuation data object + * + * @param configData child to remove + */ + void removeChild(IConfigData configData); + /** * Get the value of the child object * Index: IConfigInfo.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/option/IConfigInfo.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** IConfigInfo.java 12 Sep 2003 00:59:15 -0000 1.8 --- IConfigInfo.java 13 Sep 2003 03:33:43 -0000 1.9 *************** *** 66,69 **** --- 66,71 ---- package com.babeldoc.core.option; + import com.babeldoc.core.INamed; + import java.io.Serializable; *************** *** 78,82 **** */ public interface IConfigInfo ! extends Serializable { /** * Return description of this worker --- 80,84 ---- */ public interface IConfigInfo ! extends Serializable, IConfigDataContainer, INamed { /** * Return description of this worker *************** *** 173,181 **** /** ! * Get the option value in the path of options as a boolean true/false. The path is ! * specificed like a file path: /option/suboption/etc * ! * @param path ! * @return value */ public boolean getBooleanValue(String path); --- 175,183 ---- /** ! * Get the option value for the configuration data object poitned ! * as by the path * ! * @param path to the object of interest ! * @return */ public boolean getBooleanValue(String path); |
Update of /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker
In directory sc8-pr-cvs1:/tmp/cvs-serv18862/scanner/src/com/babeldoc/scanner/worker
Modified Files:
DirectoryScanner.java FtpScanner.java NullScanner.java
SqlScanner.java
Log Message:
All scanner workers have a new general option: binary. This means that the document that they enqueue to the pipeline
could possibly be submitted as a binary file. Additionally I have changed the FtpScanner so that it sets the binary flag
for transfer depending on the state of this flag.
Index: DirectoryScanner.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker/DirectoryScanner.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** DirectoryScanner.java 5 Sep 2003 13:28:29 -0000 1.19
--- DirectoryScanner.java 12 Sep 2003 01:09:16 -0000 1.20
***************
*** 323,327 ****
/**
! * TODO: DOCUMENT ME!
*
* @author $author$
--- 323,327 ----
/**
! * The configuration information object for the directory scanner
*
* @author $author$
***************
*** 329,336 ****
*/
class DirectoryScannerInfo extends ScannerWorkerInfo {
/**
! * TODO: DOCUMENT ME!
! *
! * @return DOCUMENT ME!
*/
public String getDescription() {
--- 329,335 ----
*/
class DirectoryScannerInfo extends ScannerWorkerInfo {
+
/**
! * @return The description
*/
public String getDescription() {
***************
*** 339,345 ****
/**
! * TODO: DOCUMENT ME!
! *
! * @return DOCUMENT ME!
*/
public String getName() {
--- 338,342 ----
/**
! * @return The name
*/
public String getName() {
***************
*** 348,354 ****
/**
! * TODO: DOCUMENT ME!
! *
! * @return DOCUMENT ME!
*/
public Collection getTypeSpecificOptions() {
--- 345,349 ----
/**
! * @return The collection of type specific options
*/
public Collection getTypeSpecificOptions() {
Index: FtpScanner.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker/FtpScanner.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** FtpScanner.java 5 Sep 2003 13:28:29 -0000 1.20
--- FtpScanner.java 12 Sep 2003 01:09:17 -0000 1.21
***************
*** 87,90 ****
--- 87,91 ----
import com.babeldoc.core.option.ConfigOption;
import com.babeldoc.core.option.IConfigOptionType;
+ import com.babeldoc.core.option.ValueListConfigOptionType;
import com.babeldoc.core.pipeline.PipelineDocument;
import com.babeldoc.scanner.ScannerConfigurationException;
***************
*** 118,121 ****
--- 119,123 ----
private String ftpPassword = "";
private String ftpUsername = "";
+ private int ftpFileType = FTPClient.ASCII_FILE_TYPE;
private String localBackupFolder = "";
private boolean scanSubfolders = false;
***************
*** 177,181 ****
*/
public void initialize() throws ScannerConfigurationException {
-
ftpHost = this.getInfo().getStrValue(FTP_HOST);
ftpUsername = this.getInfo().getStrValue(FTP_USERNAME);
--- 179,182 ----
***************
*** 190,193 ****
--- 191,198 ----
}
+ if(isBinary()) {
+ ftpFileType = FTPClient.BINARY_FILE_TYPE;
+ }
+
//add filename filter
addFilter(FILTER_FILENAME);
***************
*** 229,235 ****
//check if connection was successfull
if (FTPReply.isPositiveCompletion(reply)) {
- //try to login
if (ftpClient.login(ftpUsername, ftpPassword)) {
! if (!ftpClient.changeWorkingDirectory(ftpFolder)) {
ftpClient.disconnect();
throw new ScannerException(
--- 234,247 ----
//check if connection was successfull
if (FTPReply.isPositiveCompletion(reply)) {
if (ftpClient.login(ftpUsername, ftpPassword)) {
! if (ftpClient.changeWorkingDirectory(ftpFolder)) {
! if(ftpClient.setFileType(ftpFileType)) {
! //
! } else {
! ftpClient.disconnect();
! throw new ScannerException(
! I18n.get("scanner.FtpScanner.error.filetype"));
! }
! } else {
ftpClient.disconnect();
throw new ScannerException(
***************
*** 511,515 ****
/**
! * TODO: DOCUMENT ME!
*
* @author $author$
--- 523,527 ----
/**
! * The information for the ftp scanner
*
* @author $author$
***************
*** 518,524 ****
class FtpScannerInfo extends ScannerWorkerInfo {
/**
! * TODO: DOCUMENT ME!
! *
! * @return DOCUMENT ME!
*/
public String getDescription() {
--- 530,534 ----
class FtpScannerInfo extends ScannerWorkerInfo {
/**
! * @return the description
*/
public String getDescription() {
***************
*** 527,533 ****
/**
! * TODO: DOCUMENT ME!
! *
! * @return DOCUMENT ME!
*/
public String getName() {
--- 537,541 ----
/**
! * @return the name
*/
public String getName() {
***************
*** 536,542 ****
/**
! * TODO: DOCUMENT ME!
! *
! * @return DOCUMENT ME!
*/
public Collection getTypeSpecificOptions() {
--- 544,548 ----
/**
! * @return the collection of type specific optins
*/
public Collection getTypeSpecificOptions() {
Index: NullScanner.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker/NullScanner.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** NullScanner.java 5 Sep 2003 13:28:29 -0000 1.2
--- NullScanner.java 12 Sep 2003 01:09:17 -0000 1.3
***************
*** 19,25 ****
public class NullScanner extends ScannerWorker {
/**
! * Get the information object
! *
! * @return information object
*/
public NullScanner() {
--- 19,23 ----
public class NullScanner extends ScannerWorker {
/**
! * Constructor
*/
public NullScanner() {
Index: SqlScanner.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker/SqlScanner.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** SqlScanner.java 5 Sep 2003 13:28:29 -0000 1.11
--- SqlScanner.java 12 Sep 2003 01:09:17 -0000 1.12
***************
*** 70,74 ****
import com.babeldoc.core.NameValuePair;
import com.babeldoc.core.option.ConfigOption;
- import com.babeldoc.core.option.IConfigInfo;
import com.babeldoc.core.option.IConfigOptionType;
import com.babeldoc.core.option.ValueListConfigOptionType;
--- 70,73 ----
***************
*** 154,160 ****
}
! this.enqueue(sb.toString().getBytes(), new NameValuePair[] {
! new NameValuePair(SCAN_MIMETYPE_KEY, "text/plain")
! });
}
}
--- 153,158 ----
}
! this.enqueue(sb.toString().getBytes(),
! new NameValuePair[] {new NameValuePair(SCAN_MIMETYPE_KEY, "text/plain")});
}
}
***************
*** 196,202 ****
// System.out.println(sb);
! enqueue(sb.toString().getBytes("UTF-8"), new NameValuePair[] {
! new NameValuePair(SCAN_MIMETYPE_KEY, "text/xml")
! });
}
}
--- 194,199 ----
// System.out.println(sb);
! enqueue(sb.toString().getBytes("UTF-8"),
! new NameValuePair[] {new NameValuePair(SCAN_MIMETYPE_KEY, "text/xml")});
}
}
|
|
From: <tr...@us...> - 2003-09-12 01:09:20
|
Update of /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner
In directory sc8-pr-cvs1:/tmp/cvs-serv18862/scanner/src/com/babeldoc/scanner
Modified Files:
ScannerWorker.java ScannerWorkerInfo.java
Log Message:
All scanner workers have a new general option: binary. This means that the document that they enqueue to the pipeline
could possibly be submitted as a binary file. Additionally I have changed the FtpScanner so that it sets the binary flag
for transfer depending on the state of this flag.
Index: ScannerWorker.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/ScannerWorker.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** ScannerWorker.java 5 Sep 2003 13:28:29 -0000 1.24
--- ScannerWorker.java 12 Sep 2003 01:09:16 -0000 1.25
***************
*** 112,115 ****
--- 112,118 ----
private ScannerSchedule cronSchedule = null;
+ /** must the documents be submitted as binaries */
+ private boolean binary;
+
public static final String SCANNER_KEY = "scanner";
public static final String SCAN_DATE_KEY = "scan_date";
***************
*** 246,249 ****
--- 249,253 ----
configData.getValue(ScannerWorkerInfo.SCANNER_TYPE) + ") configured...");
this.countdown = getInfo().getIntValue(ScannerWorkerInfo.COUNTDOWN);
+ this.binary = getInfo().getBooleanValue(ScannerWorkerInfo.BINARY);
}
***************
*** 367,373 ****
}
! FeedDocument feed = new FeedDocument(this.getPipelineName(), data, attr,
! !("false".equals(getInfo().getStrValue(ScannerWorkerInfo.JOURNAL))),
! false);
try {
--- 371,379 ----
}
! FeedDocument feed = new FeedDocument(this.getPipelineName(),
! data,
! attr,
! getInfo().getBooleanValue(ScannerWorkerInfo.JOURNAL),
! isBinary());
try {
***************
*** 518,521 ****
--- 524,535 ----
// return !(countdown == -1) || countdown-- == 0;
+ }
+
+ public int getCountdown() {
+ return countdown;
+ }
+
+ public boolean isBinary() {
+ return binary;
}
}
Index: ScannerWorkerInfo.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/ScannerWorkerInfo.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** ScannerWorkerInfo.java 17 Aug 2003 04:12:29 -0000 1.11
--- ScannerWorkerInfo.java 12 Sep 2003 01:09:16 -0000 1.12
***************
*** 110,113 ****
--- 110,116 ----
public static String COUNTDOWN = "countDown";
+ /** if the documents must be submitted as binary documents */
+ public static final String BINARY = "binary";
+
/**
* Return collection of options that are common to all scanners
***************
*** 150,153 ****
--- 153,160 ----
IConfigOptionType.INTEGER, "-1", false,
"The number of times this countdown must run."));
+
+ general.add(new ConfigOption(BINARY,
+ IConfigOptionType.BOOLEAN, "false", false,
+ "The documents from this stage must be submitted as binary pipeline documents"));
return general;
|
|
From: <tr...@us...> - 2003-09-12 01:09:19
|
Update of /cvsroot/babeldoc/babeldoc/modules/scanner/config/i18n
In directory sc8-pr-cvs1:/tmp/cvs-serv18862/scanner/config/i18n
Modified Files:
messages.properties
Log Message:
All scanner workers have a new general option: binary. This means that the document that they enqueue to the pipeline
could possibly be submitted as a binary file. Additionally I have changed the FtpScanner so that it sets the binary flag
for transfer depending on the state of this flag.
Index: messages.properties
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/config/i18n/messages.properties,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** messages.properties 15 Aug 2003 00:25:29 -0000 1.13
--- messages.properties 12 Sep 2003 01:09:16 -0000 1.14
***************
*** 58,61 ****
--- 58,62 ----
scanner.FtpScanner.error.general=Error connecting to ftp
scanner.FtpScanner.error.notAvaliable=Message not available
+ scanner.FtpScanner.error.filetype=Error changing to file type
scanner.FtpScannerInfo.description=Scans given folder on remote FTP server. This allows babeldoc to connect to remote FTP servers and then scan folders for documents to process.
scanner.FtpScannerInfo.option.ftpHost=Host name or address of the ftp server
***************
*** 63,69 ****
--- 64,73 ----
scanner.FtpScannerInfo.option.ftpPassword=Password that is used for connecting to host
scanner.FtpScannerInfo.option.ftpFolder=Folder name which is scanned
+ scanner.FtpScannerInfo.option.ftpFileType=The type of the file to transmit - this can be either ascii or binary which really determines how the end-of-line characters are handled.
scanner.FtpScannerInfo.option.includeSubfolders=Should subfolders be scanned too
scanner.FtpScannerInfo.option.ftpOutFolder=Folder on FTP server where scanned documents should be copied
scanner.FtpScannerInfo.option.localBackupFolder=Folder on local file system where scanned documents should be copied
+ scanner.FtpScannerInfo.option.ftpFileType=Folder on local file system where scanned documents should be copied
+
scanner.MailboxScanner.error.getFrom=Invalid value '{0}' for getFrom property! Only 'attachment' and 'body' values allowed!
|
|
From: <tr...@us...> - 2003-09-12 00:59:19
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/option
In directory sc8-pr-cvs1:/tmp/cvs-serv16922
Modified Files:
IConfigInfo.java
Log Message:
Missed the interface for the new method: getBooleanValue
Index: IConfigInfo.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/option/IConfigInfo.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** IConfigInfo.java 15 Aug 2003 00:25:29 -0000 1.7
--- IConfigInfo.java 12 Sep 2003 00:59:15 -0000 1.8
***************
*** 171,173 ****
--- 171,182 ----
*/
public int getIntValue(String path);
+
+ /**
+ * Get the option value in the path of options as a boolean true/false. The path is
+ * specificed like a file path: /option/suboption/etc
+ *
+ * @param path
+ * @return value
+ */
+ public boolean getBooleanValue(String path);
}
|
|
From: <tr...@us...> - 2003-09-12 00:54:07
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/option
In directory sc8-pr-cvs1:/tmp/cvs-serv16035
Modified Files:
ConfigInfo.java
Log Message:
Added another helper to the configinfo class
Index: ConfigInfo.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/option/ConfigInfo.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** ConfigInfo.java 29 Aug 2003 01:19:06 -0000 1.11
--- ConfigInfo.java 12 Sep 2003 00:54:04 -0000 1.12
***************
*** 241,244 ****
--- 241,255 ----
/**
+ * Get the option value in the path of options as a boolean true/false. The path is
+ * specificed like a file path: /option/suboption/etc
+ *
+ * @param path
+ * @return value
+ */
+ public boolean getBooleanValue(String path) {
+ return "true".equalsIgnoreCase(getStrValue(path));
+ }
+
+ /**
* Get the names and values of each of the child options of this configuration option
* pointed to be the path.
|
|
From: <tr...@us...> - 2003-09-12 00:44:15
|
Update of /cvsroot/babeldoc/babeldoc/modules/core
In directory sc8-pr-cvs1:/tmp/cvs-serv14277
Modified Files:
build.xml
Log Message:
removed all work on the binary directory from the build.xml - the binary files now come from the init "module"
Index: build.xml
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/build.xml,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** build.xml 27 Jun 2003 02:19:57 -0000 1.11
--- build.xml 12 Sep 2003 00:44:09 -0000 1.12
***************
*** 69,78 ****
<include name="examples/**"/>
<include name="lib/**"/>
- <include name="bin/**"/>
</fileset>
</copy>
-
- <!-- make all the files in the binary directory -->
- <chmod perm="+x" dir="${base_dir}/build/bin" includes="*"/>
</target>
--- 69,74 ----
|
|
From: Bruce M. <br...@mc...> - 2003-09-11 23:09:44
|
No real documentation - I would appreciate if you could add the necessary config options descriptions. On Wednesday 10 September 2003 06:37 pm, Bill Harrelson wrote: > Yep, it's there, silly me, I was looking in babeldoc-scanners.jar. > > Thanks, > > Bill > > (is there doc. for it, or do I need to download the source and read > that?) > > On 10 Sep 2003 at 14:06, McDonald, Bruce wrote: > > Its not in 1.1.9???? Check in the j2ee module. > > > > -----Original Message----- > > From: Bill Harrelson [mailto:Bil...@Ac...] > > Sent: Wednesday, September 10, 2003 11:38 AM > > To: Bab...@li... > > Subject: [Babeldoc-devel] JMS Scanner > > > > > > I think I remember that someone on the development list was > > writing a JMS scanner and JMS writer, and I'm about to need one. > > > > I've been playing around with 1.1.9, but I don't find it in there. > > Has it been checked in? Is it available? Do I need to write it? > > > > Thanks, > > > > Bill > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > Babeldoc-devel mailing list > > Bab...@li... > > https://lists.sourceforge.net/lists/listinfo/babeldoc-devel |
|
From: Dejan K. <dej...@ya...> - 2003-09-11 16:44:07
|
I think you should put setFileType line AFTER if
statement, that is:
if (ftpClient.login(ftpUsername, ftpPassword))
{
if
(!ftpClient.changeWorkingDirectory(ftpFolder)) {
ftpClient.disconnect();
throw new
ScannerException(I18n.get("scanner.FtpScanner.error.notReachable"));
}
} else {
ftpClient.disconnect();
throw new
ScannerException(I18n.get("scanner.FtpScanner.error.login"));
}
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
I am curently at home and have no Linux FTP servers
around to try this code. I will try it tomorrow, bu I
think it shouold work. Your code seems wrong to me
since you try to set file type in else statament,
which you can reach if you haven't logged in
correctly.
Anyway, this should be just workround, since we should
have this as configurable option. Could you put this
as a feature suggestion at Babeldoc SourceForge page.
I will try to implement it ASAP.
Dejan
P.S. Please use mailing list for this type of
questions since it could be useful for others too.
--- "Mthombeni, Godfrey" <GMt...@fn...> wrote:
> Hi guys,
>
> First of all Babeldoc Rocks.
>
> I have a question regarding the FTP scanner. I'm
> using the FTP scanner to
> scan a client's ftp server to retrieve pdf
> documents. The client's ftp
> server is running on a linux box and my application
> is running on a NT box.
> The problem is by the time the scanner sends the
> document to the pipeline
> the document is already corrupt and cannot be
> processed. If I manually
> connect to the FTP server and get the document I
> have to send a "binary"
> command befor retrieving it. What I need to know is
> how can I send a
> "binary" command and wher in the FTPScanner code can
> I do that. Below is the
> code I used to try to solve the problem but it
> didn't work.
>
> private void connectToHost() throws
> ScannerException {
> ..........
>
>
> if (ftpClient.login(ftpUsername, ftpPassword)) {
> if (!ftpClient.changeWorkingDirectory(ftpFolder))
> {
> ftpClient.disconnect();
> throw new ScannerException(
>
> I18n.get("scanner.FtpScanner.error.notReachable"));
> } else {
>
> ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
> }
>
>
> ........
> }
> your help will be highly appreciated.
>
> Regards
> Godfrey
>
>
>
___________________________________________________________________________________________________
>
>
> The views expressed in this email are, unless
> otherwise stated, those of the author and not those
> of the FirstRand Banking Group or its management.
> The information in this e-mail is confidential
> and is intended solely for the addressee. Access to
> this e-mail by anyone else is unauthorised.
> If you are not the intended recipient, any
> disclosure, copying, distribution or any action
> taken or
> omitted in reliance on this, is prohibited and may
> be unlawful.
> Whilst all reasonable steps are taken to ensure the
> accuracy and integrity of information and data
> transmitted electronically and to preserve the
> confidentiality thereof, no liability or
> responsibility whatsoever is accepted if information
> or data is, for whatever reason, corrupted
> or does not reach its intended destination.
>
>
> ________________________________
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
|
|
From: Bill H. <Bil...@Ac...> - 2003-09-10 22:40:44
|
Yep, it's there, silly me, I was looking in babeldoc-scanners.jar. Thanks, Bill (is there doc. for it, or do I need to download the source and read that?) On 10 Sep 2003 at 14:06, McDonald, Bruce wrote: > Its not in 1.1.9???? Check in the j2ee module. > > -----Original Message----- > From: Bill Harrelson [mailto:Bil...@Ac...] > Sent: Wednesday, September 10, 2003 11:38 AM > To: Bab...@li... > Subject: [Babeldoc-devel] JMS Scanner > > > I think I remember that someone on the development list was > writing a JMS scanner and JMS writer, and I'm about to need one. > > I've been playing around with 1.1.9, but I don't find it in there. > Has it been checked in? Is it available? Do I need to write it? > > Thanks, > > Bill > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Babeldoc-devel mailing list > Bab...@li... > https://lists.sourceforge.net/lists/listinfo/babeldoc-devel -- William B. Harrelson President Accordare 13A Medford Street, Arlington, MA 02474 t:781-646-2241 f:781-646-2242 Bil...@Ac... |
|
From: McDonald, B. <Bru...@ba...> - 2003-09-10 18:07:59
|
Its not in 1.1.9???? Check in the j2ee module. -----Original Message----- From: Bill Harrelson [mailto:Bil...@Ac...] Sent: Wednesday, September 10, 2003 11:38 AM To: Bab...@li... Subject: [Babeldoc-devel] JMS Scanner I think I remember that someone on the development list was writing a JMS scanner and JMS writer, and I'm about to need one. I've been playing around with 1.1.9, but I don't find it in there. Has it been checked in? Is it available? Do I need to write it? Thanks, Bill ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Babeldoc-devel mailing list Bab...@li... https://lists.sourceforge.net/lists/listinfo/babeldoc-devel |
|
From: Bill H. <Bil...@Ac...> - 2003-09-10 15:40:53
|
I think I remember that someone on the development list was writing a JMS scanner and JMS writer, and I'm about to need one. I've been playing around with 1.1.9, but I don't find it in there. Has it been checked in? Is it available? Do I need to write it? Thanks, Bill |
Update of /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder In directory sc8-pr-cvs1:/tmp/cvs-serv25543/src/com/babeldoc/gui/pipeline/builder Modified Files: AddPipelineAction.java AddPipelineStageAction.java AddPipelineStageConfigAction.java PipelineBuilderController.java PipelineBuilderModel.java PipelineBuilderPanel.java PipelineTree.java RemovePipelineAction.java RemovePipelineStageAction.java Added Files: PipelineTreeCellRenderer.java Log Message: Couple of fixes here. more sensible adding / removing from tree (doesnt repaint) and added different images for entry stages, etc. --- NEW FILE: PipelineTreeCellRenderer.java --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. * ==================================================================== * * Babeldoc: The Universal Document Processor * * $Header: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/PipelineTreeCellRenderer.java,v 1.1 2003/09/09 21:50:50 triphop Exp $ * $DateTime$ * $Author: triphop $ * */ package com.babeldoc.gui.pipeline.builder; import com.babeldoc.gui.pipeline.builder.PipelineTreeNode; import com.babeldoc.core.ResourceLoader; import com.babeldoc.core.LogService; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.*; import java.awt.*; import java.io.IOException; /** * Displays the * */ public class PipelineTreeCellRenderer extends DefaultTreeCellRenderer { private ImageIcon pipelineIcon; private ImageIcon stageIcon; private ImageIcon entryIcon; public static final String ORANGE_BALL = "images/orangeball.gif"; private static final String GREEN_BALL = "images/greenball.gif"; public PipelineTreeCellRenderer() { } public Component getTreeCellRendererComponent( JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { super.getTreeCellRendererComponent( tree, value, sel, expanded, leaf, row, hasFocus); PipelineTreeNode node = getPipelineTreeNode(value); if(node!=null) { if(node.isStage()&&node.isEntryStage()) { setIcon(getEntryIcon()); } else if(node.isStage()) { setIcon(getStageIcon()); } } return this; } protected PipelineTreeNode getPipelineTreeNode(Object value) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; if(node.getUserObject() instanceof PipelineTreeNode) { return (PipelineTreeNode) (node.getUserObject()); } return null; } public ImageIcon getPipelineIcon() { return pipelineIcon; } /** * Get non-entry stage icons * * @return */ public ImageIcon getStageIcon() { if(stageIcon==null) { byte [] bytes = null; try { bytes = ResourceLoader.getResourceBytes(ORANGE_BALL); } catch (IOException e) { LogService.getInstance().logError(e); } stageIcon = new ImageIcon(bytes); } return stageIcon; } /** * Get the entry stage icon * * @return */ public ImageIcon getEntryIcon() { if(entryIcon==null) { byte [] bytes = null; try { bytes = ResourceLoader.getResourceBytes(GREEN_BALL); } catch (IOException e) { LogService.getInstance().logError(e); } entryIcon = new ImageIcon(bytes); } return entryIcon; } } Index: AddPipelineAction.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/AddPipelineAction.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AddPipelineAction.java 26 Aug 2003 22:23:32 -0000 1.5 --- AddPipelineAction.java 9 Sep 2003 21:50:50 -0000 1.6 *************** *** 89,95 **** /** ! * TODO: DOCUMENT ME! * ! * @param e DOCUMENT ME! */ public void actionPerformed(ActionEvent e) { --- 89,95 ---- /** ! * Handle the add pipeline action * ! * @param e The action event */ public void actionPerformed(ActionEvent e) { *************** *** 104,108 **** try { PipelineBuilderModel.createNewPipeline(s, "simple"); ! getFrame().renderTree(); } catch (Exception x) { JOptionPane.showMessageDialog(getFrame(), x.toString(), "Exception", --- 104,109 ---- try { PipelineBuilderModel.createNewPipeline(s, "simple"); ! getFrame().getTree().addPipeline(s); ! // getFrame().renderTree(); } catch (Exception x) { JOptionPane.showMessageDialog(getFrame(), x.toString(), "Exception", Index: AddPipelineStageAction.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/AddPipelineStageAction.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AddPipelineStageAction.java 26 Aug 2003 22:23:32 -0000 1.5 --- AddPipelineStageAction.java 9 Sep 2003 21:50:50 -0000 1.6 *************** *** 68,71 **** --- 68,72 ---- import com.babeldoc.gui.wizard.addstage.AddPipelineStageWizard; + import javax.swing.tree.TreeNode; import java.awt.event.ActionEvent; *************** *** 76,80 **** public class AddPipelineStageAction extends BuilderAction { public static final String ACTION_ADD_STAGE = "Add pipeline stage..."; ! PipelineTreeNode treenode; /** --- 77,83 ---- public class AddPipelineStageAction extends BuilderAction { public static final String ACTION_ADD_STAGE = "Add pipeline stage..."; ! ! /** The tree node to operate on */ ! private PipelineTreeNode treenode; /** *************** *** 98,103 **** */ public void actionPerformed(ActionEvent e) { ! AddPipelineStageWizard.run(treenode.toString()); ! getFrame().renderTree(); } } --- 101,110 ---- */ public void actionPerformed(ActionEvent e) { ! String stage = AddPipelineStageWizard.run(treenode.toString()).getModel().getStage(); ! ! if(stage!=null) { ! TreeNode pipeNode = getFrame().getTree().getTreeNodeForPipeline(treenode.toString()); ! getFrame().getTree().addPipelineStage(pipeNode, stage); ! } } } Index: AddPipelineStageConfigAction.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/AddPipelineStageConfigAction.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AddPipelineStageConfigAction.java 26 Aug 2003 22:23:32 -0000 1.3 --- AddPipelineStageConfigAction.java 9 Sep 2003 21:50:50 -0000 1.4 *************** *** 116,121 **** String key = config.substring(0, index); String value = config.substring(index + 1); ! Properties props = PipelineBuilderModel.getPipelineStageProperties(pipeline, ! stage); props.setProperty(key, value); PipelineBuilderModel.setPipelineStageProperties(pipeline, stage, props); --- 116,120 ---- String key = config.substring(0, index); String value = config.substring(index + 1); ! Properties props = PipelineBuilderModel.getPipelineStageProperties(pipeline, stage); props.setProperty(key, value); PipelineBuilderModel.setPipelineStageProperties(pipeline, stage, props); Index: PipelineBuilderController.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/PipelineBuilderController.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PipelineBuilderController.java 26 Aug 2003 22:23:32 -0000 1.4 --- PipelineBuilderController.java 9 Sep 2003 21:50:50 -0000 1.5 *************** *** 66,74 **** package com.babeldoc.gui.pipeline.builder; - import com.babeldoc.core.pipeline.PipelineException; - import java.awt.event.ActionEvent; - import javax.swing.event.ListSelectionEvent; import javax.swing.event.TreeSelectionEvent; --- 66,71 ---- *************** *** 110,114 **** /** ! * TODO: DOCUMENT ME! * * @return DOCUMENT ME! --- 107,111 ---- /** ! * Get the model * * @return DOCUMENT ME! *************** *** 172,175 **** --- 169,173 ---- private String name; private int nodeType; + private boolean entryStage; /** *************** *** 251,254 **** --- 249,260 ---- public String toString() { return name; + } + + public boolean isEntryStage() { + return entryStage; + } + + public void setEntryStage(boolean entryStage) { + this.entryStage = entryStage; } } Index: PipelineBuilderModel.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/PipelineBuilderModel.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PipelineBuilderModel.java 26 Aug 2003 22:23:32 -0000 1.8 --- PipelineBuilderModel.java 9 Sep 2003 21:50:50 -0000 1.9 *************** *** 78,81 **** --- 78,86 ---- /** + * Pipeline builder model contains all the methods necessary to drive the pipeline builder + * applet. + * + * @author bmcdonald + * @version 1.1 */ public class PipelineBuilderModel { *************** *** 106,110 **** public static String[] getAllPipelineNames() { String configName = PIPELINE_CONFIG_NAME; ! ArrayList pipes = new ArrayList(); IConfig config = ConfigService.getInstance().getConfig(configName); --- 111,115 ---- public static String[] getAllPipelineNames() { String configName = PIPELINE_CONFIG_NAME; ! List pipes = new ArrayList(); IConfig config = ConfigService.getInstance().getConfig(configName); *************** *** 143,147 **** */ public static String[] getAllPipelineStages(String pipeline) { ! ArrayList stages = new ArrayList(); IConfig config = getPipelineConfiguration(pipeline); --- 148,152 ---- */ public static String[] getAllPipelineStages(String pipeline) { ! List stages = new ArrayList(); IConfig config = getPipelineConfiguration(pipeline); *************** *** 157,161 **** } ! return (String[]) stages.toArray((new String[stages.size()])); } else { return null; --- 162,167 ---- } ! return sortPipelineStageNames(pipeline, stages); ! //return (String[]) stages.toArray((new String[stages.size()])); } else { return null; *************** *** 164,167 **** --- 170,246 ---- /** + * Get a sorted list of pipeline stages. Here are the rules: + * 1. A stage which is the entry stage is always the first in the + * list. + * 2. A stage which is has as its nextStage another stage, that nextStage + * is considered greater than this stage. + * + * @param names + * @return + */ + public static String[] sortPipelineStageNames(final String pipeline, List names) { + // System.out.println("Sorting: "+pipeline+" which has: "+names.size()+" stages."); + + final String entryStage = PipelineBuilderModel.getPipelineEntryStage(pipeline); + // System.out.println("Entry stage: "+entryStage); + + // if(names==null||names.size()==0) { + // System.out.println("Doing comparison"); + + Comparator comp = new Comparator() { + public int compare(Object o1, Object o2) { + int comp = 0; + if(o1.equals(o2)) { + comp = 0; + } else { + String lhs = (String)o1; + String rhs = (String)o2; + + if(lhs.equals(entryStage)) { + comp = -1; + } else if(rhs.equals(entryStage)){ + comp = 1; + } else { + if(isStageDownStream(pipeline, lhs, rhs)) { + comp = -1; + } else if(isStageDownStream(pipeline, rhs, lhs)) { + comp = 1; + } + } + } + + // System.out.println("Comparing: "+o1+" and "+o2+" - result is: "+comp); + return comp; + } + }; + Collections.sort(names, comp); + // return names; + return (String[]) names.toArray((new String[names.size()])); + // } + // return null; + } + + /** + * This method answers the question if the rhs stage is downstream (ie in any + * of the nextStages (or their next stages) of the lhs stage + * + * @param lhs left hand stage + * @param rhs right hand stage + * @return true if rhs is downstream of lhs + */ + public static boolean isStageDownStream(String pipeline, String lhs, String rhs) { + if(lhs==null||lhs.equals("null")) { + return false; + } else if (lhs.equals(rhs)) { + return true; + } else { + Properties lhsProps = getPipelineStageProperties(pipeline, lhs); + String lhsNext = lhsProps.getProperty("nextStage"); + + return isStageDownStream(pipeline, lhsNext, rhs); + } + } + + /** * Get all the pipeline names in the system. This calls the factory methods * to get the data *************** *** 268,272 **** /** ! * DOCUMENT ME! * * @param pipeline --- 347,351 ---- /** ! * This sets the properteis for the pipeline stage. * * @param pipeline *************** *** 318,323 **** * @return */ ! public static Properties getPipelineStageProperties(String pipeline, ! String stage) { Properties properties = new Properties(); String stageDot = stage + DOT; --- 397,401 ---- * @return */ ! public static Properties getPipelineStageProperties(String pipeline, String stage) { Properties properties = new Properties(); String stageDot = stage + DOT; *************** *** 327,339 **** String key = (String) i.next(); - // System.out.print("lets look:"+key); if (key.startsWith(stageDot)) { String value = config.getString(key); key = key.substring(stageDot.length()); properties.put(key, value); - - // System.out.println(" - Found:"+key+"="+value); - } else { - // System.out.println(); } } --- 405,412 ---- *************** *** 459,463 **** /** ! * TODO: DOCUMENT ME! * * @param args DOCUMENT ME! --- 532,536 ---- /** ! * Just do some rundimentary testing. * * @param args DOCUMENT ME! Index: PipelineBuilderPanel.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/PipelineBuilderPanel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PipelineBuilderPanel.java 26 Aug 2003 22:23:32 -0000 1.1 --- PipelineBuilderPanel.java 9 Sep 2003 21:50:50 -0000 1.2 *************** *** 72,78 **** import java.awt.event.MouseEvent; - import java.util.Iterator; - import java.util.Properties; - import javax.swing.*; import javax.swing.event.TreeModelEvent; --- 72,75 ---- *************** *** 92,95 **** --- 89,94 ---- public static final String ACTION_REMOVE_CONFIG = "remove config"; public static final String ACTION_SET_ENTRY_STAGE = "set entry stage"; + + /** the controller */ private PipelineBuilderController controller = null; private PipelineTree tree; *************** *** 110,114 **** getTree().setPreferredSize(new Dimension(640, 480)); ! getTree().setEditable(true); getTree().getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); getTree().setShowsRootHandles(true); --- 109,113 ---- getTree().setPreferredSize(new Dimension(640, 480)); ! getTree().setEditable(false); getTree().getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); getTree().setShowsRootHandles(true); *************** *** 133,137 **** /** ! * TODO: DOCUMENT ME! * * @return DOCUMENT ME! --- 132,136 ---- /** ! * Get the controller * * @return DOCUMENT ME! *************** *** 142,146 **** /** ! * TODO: DOCUMENT ME! * * @return DOCUMENT ME! --- 141,145 ---- /** ! * Get the tree * * @return DOCUMENT ME! *************** *** 151,155 **** /** ! * TODO: DOCUMENT ME! * * @param e DOCUMENT ME! --- 150,154 ---- /** ! * Handle actions * * @param e DOCUMENT ME! *************** *** 159,163 **** /** ! * TODO: DOCUMENT ME! */ public void renderTree() { --- 158,163 ---- /** ! * Render the pipeline tree ! * */ public void renderTree() { *************** *** 167,190 **** for (int i = 0; i < pipes.length; ++i) { DefaultMutableTreeNode pipenode = getTree().addObject(null, ! PipelineTreeNode.pipelineNode(pipes[i])); String[] stages = new String[0]; ! stages = getController().getModel().getAllPipelineStages(pipes[i]); if(stages!=null) { for (int j = 0; j < stages.length; ++j) { ! DefaultMutableTreeNode stagenode = getTree().addObject(pipenode, ! PipelineTreeNode.stageNode(stages[j])); ! Properties properties = getController().getModel() ! .getPipelineStageProperties(pipes[i], ! stages[j]); ! ! for (Iterator k = properties.keySet().iterator(); k.hasNext();) { ! String config = (String) k.next(); ! String value = properties.getProperty(config); ! DefaultMutableTreeNode confignode = getTree().addObject(stagenode, ! PipelineTreeNode.configNode(config + "=" + value)); ! } } } --- 167,184 ---- for (int i = 0; i < pipes.length; ++i) { + String pipe = pipes[i]; DefaultMutableTreeNode pipenode = getTree().addObject(null, ! PipelineTreeNode.pipelineNode(pipe)); String[] stages = new String[0]; ! stages = getController().getModel().getAllPipelineStages(pipe); ! String entry = getController().getModel().getPipelineEntryStage(pipe); ! if(stages!=null) { for (int j = 0; j < stages.length; ++j) { ! PipelineTreeNode treeNode = PipelineTreeNode.stageNode(stages[j]); ! treeNode.setEntryStage(stages[j].equals(entry)); ! getTree().addObject(pipenode, treeNode); } } *************** *** 220,231 **** popup.add(new RemovePipelineStageAction(getController().getModel(), this, parentNode, currentNode)); ! popup.add(new AddPipelineStageConfigAction(getController().getModel(), ! this, parentNode, currentNode)); menuItem = new JMenuItem(ACTION_SET_ENTRY_STAGE); popup.add(menuItem); ! } else if (currentNode.isConfig()) { ! menuItem = new JMenuItem(ACTION_REMOVE_CONFIG); ! menuItem.addActionListener(this); ! popup.add(menuItem); } } --- 214,225 ---- popup.add(new RemovePipelineStageAction(getController().getModel(), this, parentNode, currentNode)); ! // popup.add(new AddPipelineStageConfigAction(getController().getModel(), ! // this, parentNode, currentNode)); menuItem = new JMenuItem(ACTION_SET_ENTRY_STAGE); popup.add(menuItem); ! // } else if (currentNode.isConfig()) { ! // menuItem = new JMenuItem(ACTION_REMOVE_CONFIG); ! // menuItem.addActionListener(this); ! // popup.add(menuItem); } } *************** *** 236,240 **** /** ! * TODO: DOCUMENT ME! * * @author $author$ --- 230,234 ---- /** ! * The tree model listener * * @author $author$ *************** *** 243,247 **** class MyTreeModelListener implements TreeModelListener { /** ! * TODO: DOCUMENT ME! * * @param e DOCUMENT ME! --- 237,241 ---- class MyTreeModelListener implements TreeModelListener { /** ! * Called when tree nodes have been changed * * @param e DOCUMENT ME! *************** *** 268,272 **** /** ! * TODO: DOCUMENT ME! * * @param e DOCUMENT ME! --- 262,266 ---- /** ! * When tree nodes have been inserted * * @param e DOCUMENT ME! *************** *** 276,280 **** /** ! * TODO: DOCUMENT ME! * * @param e DOCUMENT ME! --- 270,274 ---- /** ! * When tree nodes have been removed * * @param e DOCUMENT ME! *************** *** 284,288 **** /** ! * TODO: DOCUMENT ME! * * @param e DOCUMENT ME! --- 278,282 ---- /** ! * When the tree structure has been changed * * @param e DOCUMENT ME! Index: PipelineTree.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/PipelineTree.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PipelineTree.java 11 Jun 2003 23:35:38 -0000 1.2 --- PipelineTree.java 9 Sep 2003 21:50:50 -0000 1.3 *************** *** 66,83 **** package com.babeldoc.gui.pipeline.builder; import java.awt.*; import javax.swing.*; ! import javax.swing.tree.DefaultMutableTreeNode; ! import javax.swing.tree.DefaultTreeModel; ! import javax.swing.tree.MutableTreeNode; ! import javax.swing.tree.TreePath; /** ! * TODO: DOCUMENT ME! * ! * @author $author$ ! * @version $Revision$ */ public class PipelineTree extends JTree { --- 66,83 ---- package com.babeldoc.gui.pipeline.builder; + import com.babeldoc.gui.pipeline.builder.PipelineTreeNode; + import java.awt.*; import javax.swing.*; ! import javax.swing.tree.*; /** ! * The pipeline tree is the Swing component that displays ! * all the pipeline information in a tree gui component. * ! * @author bmcdonald ! * @version 1.1 */ public class PipelineTree extends JTree { *************** *** 92,95 **** --- 92,96 ---- setPipelineRootNode(new DefaultMutableTreeNode("Pipelines")); setPipelineTreeModel(new DefaultTreeModel(getPipelineRootNode())); + this.setCellRenderer(new PipelineTreeCellRenderer()); } *************** *** 113,117 **** /** ! * TODO: DOCUMENT ME! * * @param pipelineRootNode DOCUMENT ME! --- 114,118 ---- /** ! * Set the pipeline tree root node * * @param pipelineRootNode DOCUMENT ME! *************** *** 122,126 **** /** ! * TODO: DOCUMENT ME! * * @return DOCUMENT ME! --- 123,127 ---- /** ! * Get the pipeline tree root node * * @return DOCUMENT ME! *************** *** 131,135 **** /** ! * TODO: DOCUMENT ME! * * @param pipelineTreeModel DOCUMENT ME! --- 132,136 ---- /** ! * Set the pipeline tree model for this tree component * * @param pipelineTreeModel DOCUMENT ME! *************** *** 141,147 **** /** ! * TODO: DOCUMENT ME! * ! * @return DOCUMENT ME! */ public DefaultTreeModel getPipelineTreeModel() { --- 142,148 ---- /** ! * Get the pipeline tree model. * ! * @return the model */ public DefaultTreeModel getPipelineTreeModel() { *************** *** 150,153 **** --- 151,263 ---- /** + * Add a pipeline to the tree + * + * @param pipe + * @return + */ + public TreeNode addPipeline(String pipe) { + return addObject(null, PipelineTreeNode.pipelineNode(pipe)); + } + + /** + * Remove a pipeline from the tree of pipelines. Sorry about the + * code quality - searching for matching pipeline seems to be the only way to get + * to the correct node in the tree. + * + * I suggest that we move to a cache where we keep track of the + * @param pipe + * @return + */ + public TreeNode removePipeline(String pipe) { + TreeNode treeNode = getTreeNodeForPipeline(pipe); + if(treeNode!=null) { + getPipelineTreeModel().removeNodeFromParent((MutableTreeNode)treeNode); + } + return treeNode; + } + + /** + * Add a pipeline stage to a pipiline node + * + * @param pipeNode + * @param stage + * @return + */ + public TreeNode addPipelineStage(TreeNode pipeNode, String stage) { + if(pipeNode!=null) { + return addObject((DefaultMutableTreeNode)pipeNode, PipelineTreeNode.stageNode(stage)); + } + return null; + } + + /** + * Remove the pipeline stage node from the tree + * + * @param pipeNode + * @param stage + * @return + */ + public TreeNode removePipelineStage(TreeNode pipeNode, String stage) { + if(pipeNode!=null) { + TreeNode stageNode = getTreeNodeForPipelineStage(pipeNode, stage); + getPipelineTreeModel().removeNodeFromParent((MutableTreeNode)stageNode); + } + return null; + } + + /** + * Set this node to be the entry node or not depending on the state + * of the flag argument. + * + * @param stageNode + * @param flag + * @return + */ + public TreeNode setEntryStage(TreeNode stageNode, boolean flag) { + if(stageNode!=null) { + Object o = ((DefaultMutableTreeNode)stageNode).getUserObject(); + PipelineTreeNode node = (PipelineTreeNode)o; + node.setEntryStage(flag); + } + return stageNode; + } + + /** + * Get the tree node which corresponds to the pipeline name + * + * @param pipe pipeline name + * @return tree node + */ + public TreeNode getTreeNodeForPipeline(String pipe) { + DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode)getPipelineTreeModel().getRoot(); + for(int i = 0; i < rootNode.getChildCount(); ++i) { + TreeNode treeNode = rootNode.getChildAt(i); + if(pipe.equals(treeNode.toString())) { + return treeNode; + } + } + return null; + } + + /** + * Get the pipeline stage tree node node for the pipeline stage. + * + * @param pipeNode + * @param stage + * @return + */ + public TreeNode getTreeNodeForPipelineStage(TreeNode pipeNode, String stage) { + if(pipeNode!=null) { + for(int i = 0; i < pipeNode.getChildCount(); ++i) { + TreeNode treeNode = pipeNode.getChildAt(i); + if(stage.equals(treeNode.toString())) { + return treeNode; + } + } + } + return null; + } + + /** * Add child to the currently selected node. * *************** *** 156,160 **** * @return DOCUMENT ME! */ ! public DefaultMutableTreeNode addObject(Object child) { DefaultMutableTreeNode parentNode = getCurrentlySelectedNode(); --- 266,270 ---- * @return DOCUMENT ME! */ ! protected DefaultMutableTreeNode addObject(Object child) { DefaultMutableTreeNode parentNode = getCurrentlySelectedNode(); *************** *** 163,189 **** /** ! * TODO: DOCUMENT ME! * ! * @param parent DOCUMENT ME! ! * @param child DOCUMENT ME! * ! * @return DOCUMENT ME! */ ! public DefaultMutableTreeNode addObject(DefaultMutableTreeNode parent, ! Object child) { return addObject(parent, child, false); } /** ! * TODO: DOCUMENT ME! * ! * @param parent DOCUMENT ME! ! * @param child DOCUMENT ME! * @param shouldBeVisible DOCUMENT ME! * * @return DOCUMENT ME! */ ! public DefaultMutableTreeNode addObject(DefaultMutableTreeNode parent, ! Object child, boolean shouldBeVisible) { DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(child); --- 273,298 ---- /** ! * Add a node to the tree * ! * @param parent The tree object ! * @param child the parent object * ! * @return The tree node */ ! protected DefaultMutableTreeNode addObject(DefaultMutableTreeNode parent, Object child) { return addObject(parent, child, false); } /** ! * Add a node to the tree * ! * @param parent The parent object ! * @param child The child object (to add) * @param shouldBeVisible DOCUMENT ME! * * @return DOCUMENT ME! */ ! protected DefaultMutableTreeNode addObject(DefaultMutableTreeNode parent, ! Object child, boolean shouldBeVisible) { DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(child); Index: RemovePipelineAction.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/RemovePipelineAction.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RemovePipelineAction.java 26 Aug 2003 22:23:32 -0000 1.5 --- RemovePipelineAction.java 9 Sep 2003 21:50:50 -0000 1.6 *************** *** 81,87 **** * Creates a new RemovePipelineAction object. * ! * @param model DOCUMENT ME! ! * @param frame DOCUMENT ME! ! * @param treenode DOCUMENT ME! */ public RemovePipelineAction(PipelineBuilderModel model, --- 81,87 ---- * Creates a new RemovePipelineAction object. * ! * @param model ! * @param frame ! * @param treenode */ public RemovePipelineAction(PipelineBuilderModel model, *************** *** 92,98 **** /** ! * TODO: DOCUMENT ME! * ! * @param e DOCUMENT ME! */ public void actionPerformed(ActionEvent e) { --- 92,98 ---- /** ! * Remove the pipeline from the configurations * ! * @param e Action event */ public void actionPerformed(ActionEvent e) { *************** *** 104,108 **** try { PipelineBuilderModel.deletePipeline(treenode.toString()); ! getFrame().renderTree(); } catch (Exception x) { JOptionPane.showMessageDialog(getFrame(), x.toString(), "Exception", --- 104,108 ---- try { PipelineBuilderModel.deletePipeline(treenode.toString()); ! getFrame().getTree().removePipeline(treenode.toString()); } catch (Exception x) { JOptionPane.showMessageDialog(getFrame(), x.toString(), "Exception", Index: RemovePipelineStageAction.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/pipeline/builder/RemovePipelineStageAction.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RemovePipelineStageAction.java 26 Aug 2003 22:23:32 -0000 1.3 --- RemovePipelineStageAction.java 9 Sep 2003 21:50:50 -0000 1.4 *************** *** 69,72 **** --- 69,73 ---- import javax.swing.*; + import javax.swing.tree.TreeNode; *************** *** 109,113 **** try { PipelineBuilderModel.deletePipelineStage(pipeline, stage); ! getFrame().renderTree(); } catch (Exception x) { JOptionPane.showMessageDialog(getFrame(), x.toString(), "Exception", --- 110,115 ---- try { PipelineBuilderModel.deletePipelineStage(pipeline, stage); ! TreeNode pipeNode = getFrame().getTree().getTreeNodeForPipeline(pipeline); ! getFrame().getTree().removePipelineStage(pipeNode, stage); } catch (Exception x) { JOptionPane.showMessageDialog(getFrame(), x.toString(), "Exception", |
|
From: <tr...@us...> - 2003-09-09 21:50:53
|
Update of /cvsroot/babeldoc/babeldoc/modules/gui/config/images In directory sc8-pr-cvs1:/tmp/cvs-serv25543/config/images Added Files: greenball.gif orangeball.gif Log Message: Couple of fixes here. more sensible adding / removing from tree (doesnt repaint) and added different images for entry stages, etc. --- NEW FILE: greenball.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: orangeball.gif --- (This appears to be a binary file; contents omitted.) |
|
From: <tr...@us...> - 2003-09-09 21:48:18
|
Update of /cvsroot/babeldoc/babeldoc/modules/gui/config/images In directory sc8-pr-cvs1:/tmp/cvs-serv24667/images Log Message: Directory /cvsroot/babeldoc/babeldoc/modules/gui/config/images added to the repository |
|
From: <tr...@us...> - 2003-09-09 05:09:41
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal/dummy
In directory sc8-pr-cvs1:/tmp/cvs-serv32544
Modified Files:
DummyJournal.java
Log Message:
Fixed a few things from the dummy journal so that it does not crash babeldoc!
Index: DummyJournal.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal/dummy/DummyJournal.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DummyJournal.java 4 Sep 2003 00:25:39 -0000 1.1
--- DummyJournal.java 8 Sep 2003 22:49:29 -0000 1.2
***************
*** 97,101 ****
public PipelineDocument getDocumentAtTicketStep(IJournalTicket ticket,
int step) throws JournalException {
! return null;
}
--- 97,101 ----
public PipelineDocument getDocumentAtTicketStep(IJournalTicket ticket,
int step) throws JournalException {
! return new PipelineDocument(null);
}
***************
*** 108,112 ****
*/
public IJournalTicket getTicket(String identifier) throws JournalException {
! return null;
}
--- 108,112 ----
*/
public IJournalTicket getTicket(String identifier) throws JournalException {
! return new JournalTicket(0);
}
***************
*** 130,134 ****
*/
public IJournalTicket dummyTicket() throws JournalException {
! return null;
}
--- 130,134 ----
*/
public IJournalTicket dummyTicket() throws JournalException {
! return new JournalTicket(0);
}
***************
*** 142,146 ****
public IJournalTicket forkTicket(IJournalTicket parentTicket)
throws JournalException {
! return null;
}
--- 142,146 ----
public IJournalTicket forkTicket(IJournalTicket parentTicket)
throws JournalException {
! return new JournalTicket(0);
}
***************
*** 151,155 ****
*/
public IJournalTicket newTicket() throws JournalException {
! return null;
}
--- 151,155 ----
*/
public IJournalTicket newTicket() throws JournalException {
! return new JournalTicket(0);
}
|
|
From: <tr...@us...> - 2003-09-09 04:58:42
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/config/pipeline/documentation
In directory sc8-pr-cvs1:/tmp/cvs-serv8197/pipeline/documentation
Modified Files:
documentation.properties
Log Message:
Updated the documentation pipeline so that the common javascript is now in a library
Index: documentation.properties
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/config/pipeline/documentation/documentation.properties,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** documentation.properties 4 Sep 2003 03:16:53 -0000 1.5
--- documentation.properties 8 Sep 2003 23:43:27 -0000 1.6
***************
*** 66,93 ****
stagexml.stageType=Scripting
stagexml.language=javascript
! stagexml.script=\
! importClass(Packages.com.babeldoc.core.service.ServiceFactory);\
! importClass(Packages.com.babeldoc.core.pipeline.PipelineStageType);\
! importClass(Packages.java.lang.System);\
! var services = ServiceFactory.getAllServices("PipelineStage");\
! var keyset = services.keySet();\
! var keyiter = keyset.iterator();\
! var bufr = new java.lang.StringBuffer();\
! bufr.append("<stage-defns>\\n");\
! while(keyiter.hasNext()) {\
! var key = keyiter.next();\
! var objtype = PipelineStageType.getPipelineStageType(key);\
! if(objtype!=null) {\
! var obj = objtype.getTypeInstance();\
! var info = obj.getInfo();\
! if(info!=null) {\
! var xmlfrag = info.toXml();\
! bufr.append(xmlfrag);\
! }\
! }\
! }\
! bufr.append("</stage-defns>\\n");\
! document.setBytes(bufr.toString().getBytes());\
! document.setMimeType("text/xml");
stagexml.nextStage=stagexform
--- 66,72 ----
stagexml.stageType=Scripting
stagexml.language=javascript
! stagexml.scriptFile=core/scripts/servicexml.js
! stagexml.serviceType=PipelineStage
! stagexml.rootElement=stage-defns
stagexml.nextStage=stagexform
***************
*** 104,131 ****
scannerxml.stageType=Scripting
scannerxml.language=javascript
! scannerxml.script=\
! importClass(Packages.com.babeldoc.core.service.ServiceFactory);\
! importClass(Packages.com.babeldoc.scanner.ScannerWorkerType);\
! importClass(Packages.java.lang.System);\
! var services = ServiceFactory.getAllServices("ScannerWorker");\
! var keyset = services.keySet();\
! var keyiter = keyset.iterator();\
! var bufr = new java.lang.StringBuffer();\
! bufr.append("<scanner-defns>\\n");\
! while(keyiter.hasNext()) {\
! var key = keyiter.next();\
! var objtype = ScannerWorkerType.getScannerWorkerType(key);\
! if(objtype!=null) {\
! var obj = objtype.getTypeInstance();\
! var info = obj.getInfo();\
! if(info!=null) {\
! var xmlfrag = info.toXml();\
! bufr.append(xmlfrag);\
! }\
! }\
! }\
! bufr.append("</scanner-defns>\\n");\
! document.setBytes(bufr.toString().getBytes());\
! document.setMimeType("text/xml");
scannerxml.nextStage=scannertransform
--- 83,89 ----
scannerxml.stageType=Scripting
scannerxml.language=javascript
! scannerxml.scriptFile=core/scripts/servicexml.js
! scannerxml.serviceType=ScannerWorker
! scannerxml.rootElement=scanner-defns
scannerxml.nextStage=scannertransform
|
|
From: <tr...@us...> - 2003-09-09 04:58:32
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/config/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv8197/scripts
Added Files:
servicexml.js
Log Message:
Updated the documentation pipeline so that the common javascript is now in a library
--- NEW FILE: servicexml.js ---
/**
* For all the service types with the same prefix (ie. PipelineStage.), get the
* IConfigInfo object and then on each one, call the toXml method. Aggregate the
* all the xml files.
*
* Configuration files:
*
* 1. serviceType - the serviceType to scan for.
* 2. rootElement - the root element in the document
*
*/
importClass(Packages.com.babeldoc.core.service.ServiceFactory);
var serviceType = stage.getOptions("serviceType");
var rootElement = stage.getOptions("rootElement");
var services = ServiceFactory.getAllServices(serviceType);
var keyset = services.keySet();
var keyiter = keyset.iterator();
var bufr = new java.lang.StringBuffer();
bufr.append("<"+rootElement+">");
while(keyiter.hasNext()) {
var key = serviceType+"."+keyiter.next();
var obj = ServiceFactory.getService(key);
var info = obj.getInfo();
if(info!=null) {
var xmlfrag = info.toXml();
bufr.append(xmlfrag);
}
}
bufr.append("</"+rootElement+">");
document.setBytes(bufr.toString().getBytes());
document.setMimeType("text/xml");
|
|
From: <tr...@us...> - 2003-09-09 04:51:28
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/bin In directory sc8-pr-cvs1:/tmp/cvs-serv31590/bin Removed Files: babeldoc babeldoc.bat lcp.bat Log Message: removed unnecessary script files --- babeldoc DELETED --- --- babeldoc.bat DELETED --- --- lcp.bat DELETED --- |
|
From: <tr...@us...> - 2003-09-09 04:45:24
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline
In directory sc8-pr-cvs1:/tmp/cvs-serv32391
Modified Files:
PipelineDocument.java
Log Message:
Now correctly handle the toString method
Index: PipelineDocument.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/PipelineDocument.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** PipelineDocument.java 12 Aug 2003 23:44:44 -0000 1.15
--- PipelineDocument.java 8 Sep 2003 22:48:44 -0000 1.16
***************
*** 82,85 ****
--- 82,87 ----
import javax.activation.MimetypesFileTypeMap;
+ import org.apache.commons.lang.builder.ToStringBuilder;
+
/**
***************
*** 413,417 ****
*/
public String toString() {
! return new String(buffer);
}
--- 415,422 ----
*/
public String toString() {
! return new ToStringBuilder(this)
! .append("attributes", this.getAttributes())
! .append("buffer", buffer)
! .toString();
}
|
|
From: <tr...@us...> - 2003-09-09 03:41:33
|
Update of /cvsroot/babeldoc/babeldoc/modules/init/src/com/babeldoc/init In directory sc8-pr-cvs1:/tmp/cvs-serv31146/src/com/babeldoc/init Modified Files: Main.java Added Files: AdaptiveClassLoader.java Log Message: Lots of little changes here: 1. Loading classes from the classpath now works again 2. Added AdaptiveClassLoader - does all kind of useful things (reloading, etc, etc) but slower than old classloader so its optional 3. Small changes to the unix and dos scripts to invoke babeldoc --- NEW FILE: AdaptiveClassLoader.java --- package com.babeldoc.init; /* * This class slightly modified to allow optional resolving classes from this classloader * before system/ parent class loader. */ /* * Copyright (c) 1997-1999 The Java Apache Project. 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. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the Java Apache * Project for use in the Apache JServ servlet engine project * <http://java.apache.org/>." * * 4. The names "Apache JServ", "Apache JServ Servlet Engine" and * "Java Apache Project" must not be used to endorse or promote products * derived from this software without prior written permission. * * 5. Products derived from this software may not be called "Apache JServ" * nor may "Apache" nor "Apache JServ" appear in their names without * prior written permission of the Java Apache Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the Java Apache * Project for use in the Apache JServ servlet engine project * <http://java.apache.org/>." * * THIS SOFTWARE IS PROVIDED BY THE JAVA APACHE PROJECT "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 JAVA APACHE PROJECT 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 Java Apache Group. For more information * on the Java Apache Project and the Apache JServ Servlet Engine project, * please see <http://java.apache.org/>. */ import java.util.Hashtable; import java.util.Vector; import java.util.Enumeration; import java.io.*; import java.net.URL; import java.util.zip.ZipFile; import java.util.zip.ZipException; import java.util.zip.ZipEntry; /** * A class loader that loads classes from directories and/or zip-format * file such as JAR file. It tracks the modification time of the classes * it loads to permit reloading through re-instantiation. * <P> * When the classloader reports its creator that one of the classes it * has loaded has changed on disk, it should discard the classloader * and create a new instance using <CODE>reinstantiate</CODE>. * The classes are then reloaded into the new classloader as required. * * <P>The classloader can also load resources, which are a means * for packaging application data such as images within a jar file * or directory. * * <P>The classloader always first tries to load classes and resources * from the system, and uses it's own path if that fails. This is also * done if an empty repository is passed at construction. * * <P><B>How autoreload works:</B></P> * * <P>The Java VM considers two classes the same if they have the same * fully-qualified name <B>and</B> if they were loaded from the same * <CODE>ClassLoader</CODE>. * * <P>There is no way for a classloader to 'undefine' a class once it * has been loaded. However, the servlet engine can discard a * classloader and the classes it contains, causing the * * <P>The <CODE>JServServletManager</CODE> creates a new instance of * the classloader each time it detects that any of the loaded classes * have changed. * * <P>Before terminating, all servlets are destroyed. * * <P>According to the Java Language Specification (JLS), classes may * be garbage-collected when there are no longer any instances of that * class and the <CODE>java.lang.Class</CODE> object is finalizable. * It is intended that this be the case when a <CODE>JServClassLoader</CODE> * is discarded. * * <P>Many VM releases did not implement class garbage collection * properly. In such a VM, the memory usage will continue to grow if * autoreloading is enable. Running the VM with * <CODE>-verbosegc</CODE> (or the corresponding option for * non-Javasoft VMs) may give some debugging information. * * <P>It is important that the <CODE>destroy</CODE> method be * implemented properly, as servlets may be destroyed and * reinitialized several times in the life of a VM. * * @author Dawid Weiss (modifications) * @author Francis J. Lacoste * @author Martin Pool * @author Jim Heintz * @author <a href="mailto:st...@ap...">Stefano Mazzocchi</a> * @see java.lang.ClassLoader */ public class AdaptiveClassLoader extends ClassLoader { /** * Generation counter, incremented for each classloader as they are * created. */ static private int generationCounter = 0; /** * Generation number of the classloader, used to distinguish between * different instances. */ private int generation; /** * Cache of the loaded classes. This contains ClassCacheEntry keyed * by class names. */ private Hashtable cache; /** * Save our class loader for chaining, and speed purposes. */ private ClassLoader myParentClassLoader; /** * The classpath which this classloader searches for class definitions. * Each element of the vector should be either a directory, a .zip * file, or a .jar file. * <p> * It may be empty when only system classes are controlled. */ private Vector repository; /** * Order of class resolving - if true, parent class loader is checked after * this class loader attempted to load a class. */ private boolean parentClassLoaderLast; /** * Private class used to maintain information about the classes that * we loaded. */ private static class ClassCacheEntry { /** * The actual loaded class */ Class loadedClass; /** * The file from which this class was loaded; or null if * it was loaded from the system. */ File origin; /** * The time at which the class was loaded from the origin * file, in ms since the epoch. */ long lastModified; /** * Check whether this class was loaded from the system. */ public boolean isSystemClass() { return origin == null; } } //------------------------------------------------------- Constructors /** * Creates a new class loader that will load classes from specified * class repositories. * * @param classRepository An set of File classes indicating * directories and/or zip/jar files. It may be empty when * only system classes are loaded. * @param parentClassLoaderLast if set to true, classes are resolved using * this classloader before attempting the parent classloader. This * feature can be used for dynamic reloading of classes, however * it slows down performance and requires additional memory. * @throw java.lang.IllegalArgumentException if the objects contained * in the vector are not a file instance or the file is not * a valid directory or a zip/jar file. */ public AdaptiveClassLoader(Vector classRepository, boolean parentClassLoaderLast) throws IllegalArgumentException { this(classRepository, null, parentClassLoaderLast); } /** * Creates a new class loader that will load classes from specified * class repositories. * * @param classRepository An set of File classes indicating * directories and/or zip/jar files. It may be empty when * only system classes are loaded. * @param chainedClassLoader A class loader to attempt to load classes * as resources thru before falling back on the default system * loaders. * @param parentClassLoaderLast if set to true, classes are resolved using * this classloader before attempting the parent classloader. This * feature can be used for dynamic reloading of classes, however * it slows down performance and requires additional memory. * @throw java.lang.IllegalArgumentException if the objects contained * in the vector are not a file instance or the file is not * a valid directory or a zip/jar file. */ public AdaptiveClassLoader(Vector classRepository, ClassLoader chainedClassLoader, boolean parentClassLoaderLast) throws IllegalArgumentException { this.parentClassLoaderLast = parentClassLoaderLast; myParentClassLoader = chainedClassLoader; // Create the cache of loaded classes cache = new Hashtable(); // Verify that all the repository are valid. Enumeration e = classRepository.elements(); while (e.hasMoreElements()) { Object o = e.nextElement(); File file; // System.out.println("Found file: "+o.toString()); // Check to see if element is a File instance. try { file = (File) o; } catch (ClassCastException objectIsNotFile) { throw new IllegalArgumentException("Object " + o + "is not a valid \"File\" instance"); } // Check to see if we have proper access. if (!file.exists()) { throw new IllegalArgumentException("Repository " + file.getAbsolutePath() + " doesn't exist!"); } else if (!file.canRead()) { throw new IllegalArgumentException( "Do not have read access for file " + file.getAbsolutePath()); } // Check that it is a directory or zip/jar file if (!(file.isDirectory() || isZipOrJarArchive(file))) { throw new IllegalArgumentException( file.getAbsolutePath() + " is not a directory or zip/jar file" + " or if it's a zip/jar file then it is corrupted."); } } // Store the class repository for use this.repository = classRepository; // Increment and store generation counter this.generation = generationCounter++; } //------------------------------------------------------- Methods /** * Test if a file is a ZIP or JAR archive. * * @param file the file to be tested. * @return true if the file is a ZIP/JAR archive, false otherwise. */ private boolean isZipOrJarArchive(File file) { boolean isArchive = true; ZipFile zipFile = null; try { zipFile = new ZipFile(file); } catch (ZipException zipCurrupted) { isArchive = false; } catch (IOException anyIOError) { isArchive = false; } finally { if (zipFile != null) { try { zipFile.close(); } catch (IOException ignored) { } } } return isArchive; } /** * Check to see if a given class should be reloaded because of a * modification to the original class. * * @param classname The name of the class to check for modification. */ public synchronized boolean shouldReload(String classname) { ClassCacheEntry entry = (ClassCacheEntry) cache.get(classname); if (entry == null) { // class wasn't even loaded return false; } else if (entry.isSystemClass()) { // System classes cannot be reloaded return false; } else { boolean reload = (entry.origin.lastModified() != entry.lastModified); return reload; } } /** * Check whether the classloader should be reinstantiated. * <P> * The classloader must be replaced if there is any class whose * origin file has changed since it was last loaded. */ public synchronized boolean shouldReload() { // Check whether any class has changed Enumeration e = cache.elements(); while (e.hasMoreElements()) { ClassCacheEntry entry = (ClassCacheEntry) e.nextElement(); if (entry.isSystemClass()) continue; // XXX: Because we want the classloader to be an accurate // reflection of the contents of the repository, we also // reload if a class origin file is now missing. This // probably makes things a bit more fragile, but is OK in // a servlet development situation. <mb...@ph...> long msOrigin = entry.origin.lastModified(); if (msOrigin == 0) { // class no longer exists return true; } if (msOrigin != entry.lastModified) { // class is modified return true; } } // No changes, no need to reload return false; } /** * Re-instantiate this class loader. * <p> * This method creates a new instance * of the class loader that will load classes form the same path * as this one. */ public AdaptiveClassLoader reinstantiate() { return new AdaptiveClassLoader(repository, myParentClassLoader, parentClassLoaderLast); } //------------------------------------ Implementation of Classloader /* * XXX: The javadoc for java.lang.ClassLoader says that the * ClassLoader should cache classes so that it can handle repeated * requests for the same class. On the other hand, the JLS seems * to imply that each classloader is only asked to load each class * once. Is this a contradiction? * * Perhaps the second call only applies to classes which have been * garbage-collected? */ /** * Resolves the specified name to a Class. The method loadClass() * is called by the virtual machine. As an abstract method, * loadClass() must be defined in a subclass of ClassLoader. * * @param name the name of the desired Class. * @param resolve true if the Class needs to be resolved; * false if the virtual machine just wants to determine * whether the class exists or not * @return the resulting Class. * @exception ClassNotFoundException if the class loader cannot * find a the requested class. */ protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { // The class object that will be returned. Class c = null; // Use the cached value, if this class is already loaded into // this classloader. ClassCacheEntry entry = (ClassCacheEntry) cache.get(name); if (entry != null) { // Class found in our cache c = entry.loadedClass; if (resolve) resolveClass(c); return c; } if (!securityAllowsClass(name)) { return loadSystemClass(name, resolve); } if (parentClassLoaderLast == false) { // Attempt to load the class from the system try { c = loadSystemClass(name, resolve); if (c != null) { if (resolve) resolveClass(c); return c; } } catch (Exception e) { c = null; } } // Try to load it from each repository Enumeration repEnum = repository.elements(); // Cache entry. ClassCacheEntry classCache = new ClassCacheEntry(); while (repEnum.hasMoreElements()) { byte[] classData = null; File file = (File) repEnum.nextElement(); try { if (file.isDirectory()) { classData = loadClassFromDirectory(file, name, classCache); } else { classData = loadClassFromZipfile(file, name, classCache); } } catch (IOException ioe) { // Error while reading in data, consider it as not found classData = null; } if (classData != null) { // Define the class c = defineClass(name, classData, 0, classData.length); // Cache the result; classCache.loadedClass = c; // Origin is set by the specific loader classCache.lastModified = classCache.origin.lastModified(); cache.put(name, classCache); // Resolve it if necessary if (resolve) resolveClass(c); return c; } } if (parentClassLoaderLast == true) { // Attempt to load the class from the system try { c = loadSystemClass(name, resolve); if (c != null) { if (resolve) resolveClass(c); return c; } } catch (Exception e) { c = null; } } // If not found in any repository throw new ClassNotFoundException(name); } /** * Load a class using the system classloader. * * @exception ClassNotFoundException if the class loader cannot * find a the requested class. * @exception NoClassDefFoundError if the class loader cannot * find a definition for the class. */ protected Class loadSystemClass(String name, boolean resolve) throws NoClassDefFoundError, ClassNotFoundException { if (myParentClassLoader != null) return myParentClassLoader.loadClass(name); Class c = findSystemClass(name); // Throws if not found. // Add cache entry ClassCacheEntry cacheEntry = new ClassCacheEntry(); cacheEntry.origin = null; cacheEntry.loadedClass = c; cacheEntry.lastModified = Long.MAX_VALUE; cache.put(name, cacheEntry); if (resolve) resolveClass(c); return c; } /** * Checks whether a classloader is allowed to define a given class, * within the security manager restrictions. */ // XXX: Should we perhaps also not allow classes to be dynamically // loaded from org.apache.jserv.*? Would it introduce security // problems if people could override classes here? // <mb...@hu... 1998-07-29> private boolean securityAllowsClass(String className) { try { SecurityManager security = System.getSecurityManager(); if (security == null) { // if there's no security manager then all classes // are allowed to be loaded return true; } int lastDot = className.lastIndexOf('.'); // Check if we are allowed to load the class' package security.checkPackageDefinition((lastDot > -1) ? className.substring(0, lastDot) : ""); // Throws if not allowed return true; } catch (SecurityException e) { return false; } } /** * Tries to load the class from a directory. * * @param dir The directory that contains classes. * @param name The classname * @param cache The cache entry to set the file if successful. */ private byte[] loadClassFromDirectory(File dir, String name, ClassCacheEntry cache) throws IOException { // Translate class name to file name String classFileName = name.replace('.', File.separatorChar) + ".class"; // Check for garbage input at beginning of file name // i.e. ../ or similar if (!Character.isJavaIdentifierStart(classFileName.charAt(0))) { // Find real beginning of class name int start = 1; while (!Character.isJavaIdentifierStart( classFileName.charAt(start++))) ; classFileName = classFileName.substring(start); } File classFile = new File(dir, classFileName); if (classFile.exists()) { cache.origin = classFile; InputStream in = new FileInputStream(classFile); try { return loadBytesFromStream(in, (int) classFile.length()); } finally { in.close(); } } else { // Not found return null; } } /** * Tries to load the class from a zip file. * * @param file The zipfile that contains classes. * @param name The classname * @param cache The cache entry to set the file if successful. */ private byte[] loadClassFromZipfile(File file, String name, ClassCacheEntry cache) throws IOException { // Translate class name to file name String classFileName = name.replace('.', '/') + ".class"; ZipFile zipfile = new ZipFile(file); try { ZipEntry entry = zipfile.getEntry(classFileName); if (entry != null) { cache.origin = file; return loadBytesFromStream(zipfile.getInputStream(entry), (int) entry.getSize()); } else { // Not found return null; } } finally { zipfile.close(); } } /** * Loads all the bytes of an InputStream. */ private byte[] loadBytesFromStream(InputStream in, int length) throws IOException { byte[] buf = new byte[length]; int nRead, count = 0; while ((length > 0) && ((nRead = in.read(buf, count, length)) != -1)) { count += nRead; length -= nRead; } return buf; } /** * Get an InputStream on a given resource. Will return null if no * resource with this name is found. * <p> * The JServClassLoader translate the resource's name to a file * or a zip entry. It looks for the resource in all its repository * entry. * * @see java.lang.Class#getResourceAsStream(String) * @param name the name of the resource, to be used as is. * @return an InputStream on the resource, or null if not found. */ public InputStream getResourceAsStream(String name) { // Try to load it from the system class InputStream s = null; if (myParentClassLoader != null) { s = myParentClassLoader.getResourceAsStream(name); } if (s == null) { s = getSystemResourceAsStream(name); } if (s == null) { // Try to find it from every repository Enumeration repEnum = repository.elements(); while (repEnum.hasMoreElements()) { File file = (File) repEnum.nextElement(); if (file.isDirectory()) { s = loadResourceFromDirectory(file, name); } else if (name.endsWith(".initArgs")) { String parentFile = file.getParent(); if (parentFile != null) { File dir = new File(parentFile); s = loadResourceFromDirectory(dir, name); } } else { s = loadResourceFromZipfile(file, name); } if (s != null) { break; } } } return s; } /** * Loads resource from a directory. */ private InputStream loadResourceFromDirectory(File dir, String name) { // Name of resources are always separated by / String fileName = name.replace('/', File.separatorChar); File resFile = new File(dir, fileName); if (resFile.exists()) { try { return new FileInputStream(resFile); } catch (FileNotFoundException shouldnothappen) { return null; } } else { return null; } } /** * Loads resource from a zip file */ private InputStream loadResourceFromZipfile(File file, String name) { ZipFile zipfile = null; InputStream resourceStream = null; try { zipfile = new ZipFile(file); ZipEntry entry = zipfile.getEntry(name); if (entry != null) { long length = entry.getSize(); resourceStream = zipfile.getInputStream(entry); byte[] data = loadBytesFromStream(resourceStream, (int) length); return new ByteArrayInputStream(data); } else { return null; } } catch (IOException e) { return null; } finally { if (resourceStream != null) { try { resourceStream.close(); } catch (IOException ignored) { } } if (zipfile != null) { try { zipfile.close(); } catch (IOException ignored) { } } } } /** * Find a resource with a given name. The return is a URL to the * resource. Doing a getContent() on the URL may return an Image, * an AudioClip,or an InputStream. * <p> * This classloader looks for the resource only in the directory * repository for this resource. * * @param name the name of the resource, to be used as is. * @return an URL on the resource, or null if not found. */ public URL getResource(String name) { if (name == null) { return null; } // First ask the primordial class loader to fetch it from the classpath URL u = null; if (myParentClassLoader != null) { u = myParentClassLoader.getResource(name); } if (u == null) { u = getSystemResource(name); } if (u != null) { return u; } // We got here so we have to look for the resource in our list of repository elements Enumeration repEnum = repository.elements(); while (repEnum.hasMoreElements()) { File file = (File) repEnum.nextElement(); // Construct a file://-URL if the repository is a directory if (file.isDirectory()) { String fileName = name.replace('/', File.separatorChar); File resFile = new File(file, fileName); if (resFile.exists()) { // Build a file:// URL form the file name try { return new URL("file", null, resFile.getAbsolutePath()); } catch (java.net.MalformedURLException badurl) { badurl.printStackTrace(); return null; } } } else { // a jar:-URL *could* change even between minor releases, but // didn't between JVM's 1.1.6 and 1.3beta. Tested on JVM's from // IBM, Blackdown, Microsoft, Sun @ Windows and Sun @ Solaris try { ZipFile zf = new ZipFile(file.getAbsolutePath()); ZipEntry ze = zf.getEntry(name); if (ze != null) { try { return new URL("jar:file:" + file.getAbsolutePath() + "!/" + name); } catch (java.net.MalformedURLException badurl) { badurl.printStackTrace(); return null; } } } catch (IOException ioe) { ioe.printStackTrace(); return null; } } } // Not found return null; } /** * Find all the resources of this given name. * * @param name * @return * @throws IOException */ protected Enumeration findResources(String name) throws IOException { Vector resources = new Vector(); // First ask the primordial class loader to fetch it from the classpath Enumeration e = null; if (myParentClassLoader != null) { e = myParentClassLoader.getResources(name); } if (e == null) { e = getSystemResources(name); } if (e != null) { while (e.hasMoreElements()) { resources.add(e.nextElement()); } } // We got here so we have to look for the resource in our list of repository elements Enumeration repEnum = repository.elements(); while (repEnum.hasMoreElements()) { File file = (File) repEnum.nextElement(); // Construct a file://-URL if the repository is a directory if (file.isDirectory()) { String fileName = name.replace('/', File.separatorChar); File resFile = new File(file, fileName); if (resFile.exists()) { // Build a file:// URL form the file name try { resources.add(new URL("file", null, resFile.getAbsolutePath())); } catch (java.net.MalformedURLException badurl) { badurl.printStackTrace(); return null; } } } else { // a jar:-URL *could* change even between minor releases, but // didn't between JVM's 1.1.6 and 1.3beta. Tested on JVM's from // IBM, Blackdown, Microsoft, Sun @ Windows and Sun @ Solaris try { ZipFile zf = new ZipFile(file.getAbsolutePath()); ZipEntry ze = zf.getEntry(name); if (ze != null) { try { resources.add(new URL("jar:file:" + file.getAbsolutePath() + "!/" + name)); } catch (java.net.MalformedURLException badurl) { badurl.printStackTrace(); return null; } } } catch (IOException ioe) { ioe.printStackTrace(); return null; } } } return resources.elements(); } /** * Return the last modified time for a class in the * ClassCache. * * @throws ClassNotFoundException if class is not found */ public long lastModified(String name) throws ClassNotFoundException { ClassCacheEntry entry = (ClassCacheEntry) cache.get(name); if (entry == null) { throw new ClassNotFoundException("Could not find class: " + name); } else { return entry.lastModified; } } } Index: Main.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/init/src/com/babeldoc/init/Main.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Main.java 11 Jun 2003 23:34:56 -0000 1.4 --- Main.java 8 Sep 2003 22:40:59 -0000 1.5 *************** *** 71,77 **** import java.lang.reflect.Method; ! import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; --- 71,79 ---- import java.lang.reflect.Method; ! import java.util.Vector; ! import java.util.StringTokenizer; import java.net.URL; import java.net.URLClassLoader; + import java.net.MalformedURLException; *************** *** 83,91 **** // private static ClassLoader loader; public static final String BABELDOC_HOME = "babeldoc.home"; public static final String BABELDOC_SCANDIR = "babeldoc.scandir"; public static final String LIB = "lib"; public static final String DOT_JAR = ".jar"; public static final String DOT_ZIP = ".zip"; - public static final String BABELDOC_MAIN = "com.babeldoc.core.Main"; /** --- 85,98 ---- // private static ClassLoader loader; public static final String BABELDOC_HOME = "babeldoc.home"; + public static final String BABELDOC_CP = "babeldoc.cp"; public static final String BABELDOC_SCANDIR = "babeldoc.scandir"; + public static final String BABELDOC_MAIN = "com.babeldoc.core.Main"; + public static final String BABELDOC_CLASSLOADER = "babeldoc.classloader"; + + public static final String ADAPTIVE = "adaptive"; + public static final String LIB = "lib"; public static final String DOT_JAR = ".jar"; public static final String DOT_ZIP = ".zip"; /** *************** *** 101,105 **** if (fileHome.exists() && fileHome.isDirectory()) { ! runBabeldocMain(getLibraryUrls(home), args); return; --- 108,112 ---- if (fileHome.exists() && fileHome.isDirectory()) { ! runBabeldocMain(getLibraryFiles(home), args); return; *************** *** 117,121 **** * @return */ ! private static URL[] getLibraryUrls(String home) { File fileLib = new File(home, LIB); --- 124,128 ---- * @return */ ! private static File[] getLibraryFiles(String home) { File fileLib = new File(home, LIB); *************** *** 132,149 **** } }); - URL[] urls = new URL[libs.length]; - - for (int i = 0; i < libs.length; ++i) { - try { - urls[i] = libs[i].toURL(); - - // System.out.println(urls[i]); - } catch (MalformedURLException e) { - System.err.println("Can't load: " + libs[i]); - } - } - - return urls; } else { System.err.println("The directory: " + fileLib + --- 139,144 ---- } }); + return libs; } else { System.err.println("The directory: " + fileLib + *************** *** 158,168 **** * files to start babeldoc. * ! * @param urls * @param args */ ! private static void runBabeldocMain(URL[] urls, String[] args) { ! if (urls != null) { ! ClassLoader loader = new URLClassLoader(urls); ! Thread.currentThread().setContextClassLoader(loader); try { --- 153,162 ---- * files to start babeldoc. * ! * @param files * @param args */ ! private static void runBabeldocMain(File[] files, String[] args) { ! if (files != null) { ! ClassLoader loader = setupClassLoader(files); try { *************** *** 181,184 **** --- 175,179 ---- } catch (Exception e) { System.err.println(e); + e.printStackTrace(); } *************** *** 192,195 **** --- 187,270 ---- } } + } + + /** + * Setup the classloader. + * + * @param inFiles files discovered in the lib directory + * @return + */ + private static ClassLoader setupClassLoader(File[] inFiles) { + File [] files = incorporateClassPath(inFiles); + ClassLoader loader = null; + + if(ADAPTIVE.equals(System.getProperty(BABELDOC_CLASSLOADER))) { + Vector vec = new Vector(files.length); + for (int i = 0; i < files.length; i++) { + vec.add(files[i]); + } + loader = new AdaptiveClassLoader(vec, false); + } else { + URL [] urls = new URL[files.length]; + for (int i = 0; i < files.length; i++) { + try { + urls[i] = files[i].toURL(); + } catch (MalformedURLException e) { + System.out.println(e); + } + } + loader = new URLClassLoader(urls); + } + Thread.currentThread().setContextClassLoader(loader); + return loader; + } + + /** + * Load those classpath entries into the grand list of + * files to place in the classpath + * + * @param files + * @return + */ + private static File[] incorporateClassPath(File[] files) { + File [] cpFiles = getClasspathFiles(); + if(cpFiles!=null&&cpFiles.length>0) { + File [] newFiles = new File[cpFiles.length+files.length]; + int j = 0; + for (int i = 0; i < files.length; i++) { + newFiles[j++] = files[i]; + } + + for(int i = 0; i < cpFiles.length; i++) { + newFiles[j++] = cpFiles[i]; + } + files = newFiles; + } + return files; + } + + /** + * Get the files from the classpath - this is a hack to get around the + * hidden classpath issue when running -jar (which is how babeldoc runs) + * + * @return array of files representing the classpath + */ + private static File[] getClasspathFiles() { + String cp = System.getProperty(BABELDOC_CP); + File [] files = null; + if(cp!=null) { + StringTokenizer st = new StringTokenizer(cp, File.pathSeparator); + int num = st.countTokens(); + int i = 0; + files = new File[num]; + while(st.hasMoreTokens()) { + String token = st.nextToken(); + File file = new File(token); + if(file.exists()) { + files[i++] = file; + } + } + } + return files; } } |
|
From: <tr...@us...> - 2003-09-09 03:25:50
|
Update of /cvsroot/babeldoc/babeldoc/modules/init/bin
In directory sc8-pr-cvs1:/tmp/cvs-serv31146/bin
Modified Files:
babeldoc babeldoc.bat
Log Message:
Lots of little changes here:
1. Loading classes from the classpath now works again
2. Added AdaptiveClassLoader - does all kind of useful things (reloading, etc, etc) but slower than old classloader so its optional
3. Small changes to the unix and dos scripts to invoke babeldoc
Index: babeldoc
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/init/bin/babeldoc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** babeldoc 10 Jun 2003 23:17:52 -0000 1.1
--- babeldoc 8 Sep 2003 22:40:59 -0000 1.2
***************
*** 116,121 ****
fi
! BABELDOC_DEFNS="-Xbootclasspath/p:$BABELDOC_BOOTCP -Dbabeldoc.user=$BABELCONFIG_PATH"
! BABELDOC_MODULECACHE=$BABELDOC_HOME/modulecache.properties
if [ -n "$CYGHOME" ]; then
--- 116,120 ----
fi
! BABELDOC_DEFNS="-Xbootclasspath/p:$BABELDOC_BOOTCP -Dbabeldoc.user=$BABELCONFIG_PATH -Dbabeldoc.cp=${CLASSPATH}"
if [ -n "$CYGHOME" ]; then
Index: babeldoc.bat
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/init/bin/babeldoc.bat,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** babeldoc.bat 11 Jun 2003 14:29:23 -0000 1.2
--- babeldoc.bat 8 Sep 2003 22:40:59 -0000 1.3
***************
*** 99,104 ****
:runBabeldoc
! set BABELDOC_MODULECACHE=%BABELDOC_HOME%\modulecache.properties
! "%_JAVACMD%" %BABELDOC_DEFNS% -Dbabeldoc.user=%BABELDOC_CFGPATH% "-Dbabeldoc.home=%BABELDOC_HOME%" -jar %BABELDOC_HOME%\lib\babeldoc_init.jar %BABELDOC_ARGS% %BABELDOC_CMD_LINE_ARGS%
@echo off
--- 99,103 ----
:runBabeldoc
! "%_JAVACMD%" %BABELDOC_DEFNS% "-Dbabeldoc.user=%BABELDOC_CFGPATH%" "-Dbabeldoc.home=%BABELDOC_HOME%" "-Dbabeldoc.cp=%CLASSPATH%" -jar %BABELDOC_HOME%\lib\babeldoc_init.jar %BABELDOC_ARGS% %BABELDOC_CMD_LINE_ARGS%
@echo off
***************
*** 107,111 ****
:end
- set LOCALCLASSPATH=
set _JAVACMD=
set BABELDOC_CMD_LINE_ARGS=
--- 106,109 ----
|
|
From: <tr...@us...> - 2003-09-09 02:54:33
|
Update of /cvsroot/babeldoc/babeldoc/modules/j2ee/src/com/babeldoc/j2ee/scanner/worker
In directory sc8-pr-cvs1:/tmp/cvs-serv29023
Modified Files:
JmsScanner.java
Log Message:
JmsScanner now conforms to new method of setting IConfigInfo in the constructor.
Index: JmsScanner.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/j2ee/src/com/babeldoc/j2ee/scanner/worker/JmsScanner.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** JmsScanner.java 27 Aug 2003 03:15:31 -0000 1.1
--- JmsScanner.java 8 Sep 2003 22:28:06 -0000 1.2
***************
*** 67,71 ****
import com.babeldoc.core.LogService;
- import com.babeldoc.core.option.IConfigInfo;
import com.babeldoc.core.option.ConfigOption;
import com.babeldoc.core.option.IConfigOptionType;
--- 67,70 ----
***************
*** 91,103 ****
public final static String Q_NAME = "queueName";
! /** configuration information object */
! private IConfigInfo info;
- QueueConnection connection;
- Queue queue;
- QueueSession queueSession;
- Context context;
public static final int BYTE_BUFFER = 256;
/**
* Setup the options. Each of the options lives in the hashtable held
--- 90,123 ----
public final static String Q_NAME = "queueName";
! private QueueConnection connection;
! private Queue queue;
! private QueueSession queueSession;
! private Context context;
public static final int BYTE_BUFFER = 256;
+ public JmsScanner() {
+ super(new ScannerWorkerInfo() {
+ public String getDescription() {
+ return "JMS Scanner";
+ }
+
+ public String getName() {
+ return "JmsScanner";
+ }
+
+ public Collection getTypeSpecificOptions() {
+ ArrayList options = new ArrayList();
+
+ //add specific options
+ options.add(new ConfigOption(Q_FACTORY_NAME,
+ IConfigOptionType.STRING, null, true, "JMS Queue factory name"));
+ options.add(new ConfigOption(Q_NAME,
+ IConfigOptionType.STRING, null, true, "JMS Queue name"));
+
+ return options;
+ }
+ });
+ }
/**
* Setup the options. Each of the options lives in the hashtable held
***************
*** 143,181 ****
LogService.getInstance().logError("[relinquishResources]", e);
}
- }
-
- /**
- * Get the information object
- *
- * @return information object
- */
- public IConfigInfo getInfo() {
- if(info==null) {
- /**
- * informational class for the ExternalApplicationScanner.
- */
- info = new ScannerWorkerInfo() {
- public String getDescription() {
- return "JMS Scanner";
- }
-
- public String getName() {
- return "JmsScanner";
- }
-
- public Collection getTypeSpecificOptions() {
- ArrayList options = new ArrayList();
-
- //add specific options
- options.add(new ConfigOption(Q_FACTORY_NAME,
- IConfigOptionType.STRING, null, true, "JMS Queue factory name"));
- options.add(new ConfigOption(Q_NAME,
- IConfigOptionType.STRING, null, true, "JMS Queue name"));
-
- return options;
- }
- };
- }
- return info;
}
--- 163,166 ----
|