/*
 * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//chain/src/java/org/apache/commons/chain/impl/CatalogBase.java,v 1.4 2003/09/29 15:44:40 husted Exp $
 * $Revision: 1.4 $
 * $Date: 2003/09/29 15:44:40 $
 *
 * ====================================================================
 *
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 1999-2003 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 acknowlegement:
 *       "This product includes software developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    Alternately, this acknowlegement may appear in the software itself,
 *    if and wherever such third-party acknowlegements normally appear.
 *
 * 4. The names "The Jakarta Project", "Commons", 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 apache@apache.org.
 *
 * 5. Products derived from this software may not be called "Apache"
 *    nor may "Apache" appear in their names without prior written
 *    permission of the Apache Group.
 *
 * 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/>.
 *
 */

package org.apache.commons.chain.impl;


import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.commons.chain.Catalog;
import org.apache.commons.chain.Chain;
import org.apache.commons.chain.Command;


/**
 * <p>Simple in-memory implementation of {@link Catalog}.  This class can
 * also be used as the basis for more advanced implementations.</p>
 *
 * @author Craig R. McClanahan
 * @author Matthew J. Sgarlata
 * @version $Revision: 1.4 $ $Date: 2003/09/29 15:44:40 $
 */

public class CatalogBase implements Catalog {


    // ----------------------------------------------------- Instance Variables


    /**
     * <p>The map of named {@link Command}s, keyed by name.
     */
    protected Map commands = new HashMap();


    // --------------------------------------------------------- Public Methods


    /**
     * Adds a Command to this Catalog.
     * @param name the name by which the Command can be identified
     * @param command the Command to add to this Catalog
     */
    public void addCommand(String name, Command command) {

        commands.put(name, command);

    }

 	/**
     * Retrieves the Command identified by the given name from this Catalog.
 	 * @return the Command identified by the given name from this Catalog
 	 */
    public Command getCommand(String name) {

        return ((Command) commands.get(name));

    }


 	/**
 	 * Returns an Iterator which can be used to iterate through all the Commands
 	 * in the Catalog.
 	 * @return an Iterator which can be used to iterate through all the Commands
 	 * in the Catalog
 	 */
    public Iterator getNames() {

        return (commands.keySet().iterator());

    }

 	/**
 	 * Converts this Catalog to a String.  Useful for debugging purposes.
 	 * @return a representation of this catalog as a String
 	 */
 	public String toString() {

 		Iterator names = getNames();
 		StringBuffer str =
 			new StringBuffer("[" + this.getClass().getName() + ": ");

 		while (names.hasNext()) {
 			str.append(names.next());
 			if (names.hasNext()) {
  			str.append(", ");
 			}
 		}
 		str.append("]");

 		return str.toString();

 	}
}

@@ -150,17 +150,17 @@
 ava,v 1.
-4
+5
  2003/09
@@ -164,23 +164,23 @@
 /09/29 1
-5:44:40
+7:45:29
  husted 
@@ -201,17 +201,17 @@
 sion: 1.
-4
+5
  $%0A * $D
@@ -223,31 +223,31 @@
 2003/09/29 1
-5:44:40
+7:45:29
  $%0A *%0A * ===
@@ -3370,17 +3370,17 @@
 sion: 1.
-4
+5
  $ $Date
@@ -3397,15 +3397,15 @@
 29 1
-5:44:40
+7:45:29
  $%0A 
@@ -3751,760 +3751,326 @@
    /
-**%0A     * Adds a Command to this Catalog.%0A     * @param name the name by which the Command can be identified%0A     * @param command the Command to add to this Catalog%0A     */%0A    public void addCommand(String name, Command command) %7B%0A%0A        commands.put(name, command);%0A%0A    %7D%0A%0A %09/**%0A     * Retrieves the Command identified by the given name from this Catalog.%0A %09 * @return the Command identified by the given name from this Catalog%0A %09 */%0A    public Command getCommand(String name) %7B%0A%0A        return ((Command) commands.get(name));%0A%0A    %7D%0A%0A%0A %09/**%0A %09 * Returns an Iterator which can be used to iterate through all the Commands%0A %09 * in the Catalog.%0A %09 * @return an Iterator which can be used to iterate through all the Commands%0A %09 * in the Catalog%0A %09 */
+/ Documented in Catalog interface%0A    public void addCommand(String name, Command command) %7B%0A%0A        commands.put(name, command);%0A%0A    %7D%0A%0A    // Documented in Catalog interface%0A    public Command getCommand(String name) %7B%0A%0A        return ((Command) commands.get(name));%0A%0A    %7D%0A%0A%0A    // Documented in Catalog interface
 %0A   

Replace rendundant Javadoc with reference to Interface.