From: paspes <pa...@us...> - 2007-11-19 12:11:23
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/config In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25066/modules/core/src/com/babeldoc/core/config Modified Files: DefaultConfig.java ConfigChangeNotifier.java Log Message: Bug resolution: [1119364 ] AsyncronusFeeder and error handlers Index: DefaultConfig.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/config/DefaultConfig.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DefaultConfig.java 30 Jul 2004 01:32:59 -0000 1.3 --- DefaultConfig.java 19 Nov 2007 12:10:12 -0000 1.4 *************** *** 68,72 **** import com.babeldoc.core.Named; ! import java.util.HashMap; import java.util.Map; import java.util.Set; --- 68,72 ---- import com.babeldoc.core.Named; ! import java.util.Hashtable; import java.util.Map; import java.util.Set; *************** *** 101,105 **** super(name); this.service = service; ! data = new HashMap(); } --- 101,105 ---- super(name); this.service = service; ! data = new Hashtable(); } *************** *** 114,118 **** super(name); this.service = service; ! this.data = new HashMap(properties); } --- 114,118 ---- super(name); this.service = service; ! this.data = new Hashtable(properties); } Index: ConfigChangeNotifier.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/config/ConfigChangeNotifier.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ConfigChangeNotifier.java 30 Jul 2004 01:32:59 -0000 1.3 --- ConfigChangeNotifier.java 19 Nov 2007 12:10:23 -0000 1.4 *************** *** 1 **** ! /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. * ==================================================================== * * Babeldoc: The Universal Document Processor * * $Header$ * $DateTime$ * $Author$ * */ package com.babeldoc.core.config; import java.util.Map; import java.util.HashMap; import java.util.Iterator; /** * An implementation for the IConfigChangeNotifier. * * @author Bmcdonald * @version 1.3 */ public class ConfigChangeNotifier { Map listeners = new HashMap(); /** * Add a configuration change listener. This configuration change listener is * always fired when a configuration changes - it responds to changes in any * configuration. * * @param listener listener to add */ public void addConfigChangeListener(IConfigChangeListener listener) { listeners.put(listener, new String[]{ }); } /** * Add a configuration change listener to this object and a configuration * that this listener is interested in. * * @param listener the listener to recieve notifications * @param config the configuration of interest */ public void addConfigChangeListener(IConfigChangeListener listener, String config) { listeners.put(listener, new String[]{config}); } /** * Add a configuration change listener to this object and a configuration * that this listener is interested in. * * @param listener the listener to recieve notifications * @param configs the configurations of interest */ public void addConfigChangeListener(IConfigChangeListener listener, String[] configs) { listeners.put(listener, configs); } /** * remove the listener from the list of configuration change listeners. * * @param listener the listener to remove */ public void removeConfigChangeListener(IConfigChangeListener listener) { listeners.remove(listener); } /** * Fire event to all the configurations that are interested in this event. * * @param config configuration name */ public void configChanged(String config) { for (Iterator keys = listeners.keySet().iterator(); keys.hasNext();) { IConfigChangeListener listener = (IConfigChangeListener) keys.next(); String[] configs = (String[]) listeners.get(listener); // If the config is null or the list of interested configs for this // listener is null, then fire the change if (config == null || configs == null || configs.length == 0) { listener.configChanged(new ConfigChangeEvent(config)); } else { // Otherwise try and find the changed configuration in the // list of configs that this listener is interested in. for (int i = 0; i < configs.length; ++i) { if (config.equals(configs[i])) { listener.configChanged(new ConfigChangeEvent(config)); } } } } } } \ No newline at end of file --- 1 ---- ! /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. * ==================================================================== * * Babeldoc: The Universal Document Processor * * $Header$ * $DateTime$ * $Author$ * */ package com.babeldoc.core.config; import java.util.Map; import java.util.Hashtable; import java.util.Iterator; /** * An implementation for the IConfigChangeNotifier. * * @author Bmcdonald * @version 1.3 */ public class ConfigChangeNotifier { Map listeners = new Hashtable(); /** * Add a configuration change listener. This configuration change listener is * always fired when a configuration changes - it responds to changes in any * configuration. * * @param listener listener to add */ public void addConfigChangeListener(IConfigChangeListener listener) { listeners.put(listener, new String[]{ }); } /** * Add a configuration change listener to this object and a configuration * that this listener is interested in. * * @param listener the listener to recieve notifications * @param config the configuration of interest */ public void addConfigChangeListener(IConfigChangeListener listener, String config) { listeners.put(listener, new String[]{config}); } /** * Add a configuration change listener to this object and a configuration * that this listener is interested in. * * @param listener the listener to recieve notifications * @param configs the configurations of interest */ public void addConfigChangeListener(IConfigChangeListener listener, String[] configs) { listeners.put(listener, configs); } /** * remove the listener from the list of configuration change listeners. * * @param listener the listener to remove */ public void removeConfigChangeListener(IConfigChangeListener listener) { listeners.remove(listener); } /** * Fire event to all the configurations that are interested in this event. * * @param config configuration name */ public void configChanged(String config) { for (Iterator keys = listeners.keySet().iterator(); keys.hasNext();) { IConfigChangeListener listener = (IConfigChangeListener) keys.next(); String[] configs = (String[]) listeners.get(listener); // If the config is null or the list of interested configs for this // listener is null, then fire the change if (config == null || configs == null || configs.length == 0) { listener.configChanged(new ConfigChangeEvent(config)); } else { // Otherwise try and find the changed configuration in the // list of configs that this listener is interested in. for (int i = 0; i < configs.length; ++i) { if (config.equals(configs[i])) { listener.configChanged(new ConfigChangeEvent(config)); } } } } } } \ No newline at end of file |