001: /*
002: * Copyright (c) 2001 by Matt Welsh and The Regents of the University of
003: * California. All rights reserved.
004: *
005: * Permission to use, copy, modify, and distribute this software and its
006: * documentation for any purpose, without fee, and without written agreement is
007: * hereby granted, provided that the above copyright notice and the following
008: * two paragraphs appear in all copies of this software.
009: *
010: * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
011: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
012: * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
013: * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
014: *
015: * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
016: * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
017: * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
018: * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
019: * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
020: *
021: * Author: Matt Welsh <mdw@cs.berkeley.edu>
022: *
023: */
024:
025: package seda.sandStorm.api;
026:
027: /**
028: * ConfigDataIF is used to pass configuration arguments to stages.
029: * When a stage is initialized, a ConfigDataIF is passed to its
030: * 'init()' method.
031: *
032: * @author Matt Welsh
033: */
034: public interface ConfigDataIF {
035:
036: /**
037: * The default value for a string key with no other specified value.
038: */
039: public static final String SET = "set";
040:
041: /**
042: * Returns true if the given key is set in the configuration.
043: */
044: public boolean contains(String key);
045:
046: /**
047: * Get the string value corresponding to the given configuration key.
048: * This is the basic way for a stage to retrieve its initialization
049: * arguments. Returns null if not set.
050: */
051: public String getString(String key);
052:
053: /**
054: * Get the integer value corresponding to the given configuration key.
055: * This is the basic way for a stage to retrieve its initialization
056: * arguments. Returns -1 if not set or if the value is not an integer.
057: */
058: public int getInt(String key);
059:
060: /**
061: * Get the double value corresponding to the given configuration key.
062: * This is the basic way for a stage to retrieve its initialization
063: * arguments. Returns -1.0 if not set or if the value is not a double.
064: */
065: public double getDouble(String key);
066:
067: /**
068: * Get the boolean value corresponding to the given configuration key.
069: * This is the basic way for a stage to retrieve its initialization
070: * arguments. Returns false if not set.
071: */
072: public boolean getBoolean(String key);
073:
074: /**
075: * Get the value corresponding to the given configuration key as a
076: * list of Strings. Returns null if not set.
077: */
078: public String[] getStringList(String key);
079:
080: /**
081: * Set the given configuration key to the given string value.
082: */
083: public void setString(String key, String val);
084:
085: /**
086: * Set the given configuration key to the given integer value.
087: */
088: public void setInt(String key, int val);
089:
090: /**
091: * Set the given configuration key to the given double value.
092: */
093: public void setDouble(String key, double val);
094:
095: /**
096: * Set the given configuration key to the given boolean value.
097: */
098: public void setBoolean(String key, boolean val);
099:
100: /**
101: * Set the value corresponding to the given configuration key as a
102: * list of Strings.
103: */
104: public void setStringList(String key, String values[]);
105:
106: /**
107: * Return a handle to the system manager.
108: * The system manager can (among other things) be used to access
109: * other stages in the system.
110: *
111: * @see ManagerIF
112: */
113: public ManagerIF getManager();
114:
115: /**
116: * Return the StageIF for this stage.
117: * The StageIF can be used (among other things) to access the
118: * event queues for this stage.
119: *
120: * @see StageIF
121: */
122: public StageIF getStage();
123:
124: /**
125: * Used to set the StageIF when initializing a ConfigDataIF.
126: * This is an internal interface and not for use by applications.
127: */
128: public void setStage(StageIF stage);
129:
130: }
|