KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > chain > Catalog


1 /*
2  * Copyright 2003-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.chain;
17
18
19 import java.util.Iterator JavaDoc;
20
21
22 /**
23  * <p>A {@link Catalog} is a collection of named {@link Command}s (or
24  * {@link Chain}s) that can be used retrieve the set of commands that
25  * should be performed based on a symbolic identifier. Use of catalogs
26  * is optional, but convenient when there are multiple possible chains
27  * that can be selected and executed based on environmental conditions.</p>
28  *
29  * @author Craig R. McClanahan
30  * @version $Revision: 1.7 $ $Date: 2004/11/30 05:52:22 $
31  */

32
33 public interface Catalog {
34
35
36     /**
37      * <p>A default context attribute for storing a default {@link Catalog},
38      * provided as a convenience only.</p>
39      */

40     String JavaDoc CATALOG_KEY = "org.apache.commons.chain.CATALOG";
41
42
43     /**
44      * <p>Add a new name and associated {@link Command} or {@link Chain}
45      * to the set of named commands known to this {@link Catalog},
46      * replacing any previous command for that name.
47      *
48      * @param name Name of the new command
49      * @param command {@link Command} or {@link Chain} to be returned
50      * for later lookups on this name
51      */

52     void addCommand(String JavaDoc name, Command command);
53
54
55     /**
56      * <p>Return the {@link Command} or {@link Chain} associated with the
57      * specified name, if any; otherwise, return <code>null</code>.</p>
58      *
59      * @param name Name for which a {@link Command} or {@link Chain}
60      * should be retrieved
61      */

62     Command getCommand(String JavaDoc name);
63
64
65
66     /**
67      * <p>Return an <code>Iterator</code> over the set of named commands
68      * known to this {@link Catalog}. If there are no known commands,
69      * an empty Iterator is returned.</p>
70      */

71     Iterator JavaDoc getNames();
72
73
74 }
75
76
Popular Tags