01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.cocoon.components.modules.input;
19:
20: import org.apache.avalon.framework.component.Component;
21: import org.apache.avalon.framework.configuration.Configuration;
22: import org.apache.avalon.framework.configuration.ConfigurationException;
23:
24: import java.util.Iterator;
25: import java.util.Map;
26:
27: /**
28: * InputModule specifies an interface for components that provide
29: * access to individual attributes e.g. request parameters, request
30: * attributes, session attributes &c.
31: *
32: * @author <a href="mailto:haul@apache.org">Christian Haul</a>
33: * @version $Id: InputModule.java 433543 2006-08-22 06:22:54Z crossley $
34: */
35: public interface InputModule extends Component {
36:
37: String ROLE = InputModule.class.getName();
38:
39: /**
40: * Standard access to an attribute's value. If more than one value
41: * exists, the first is returned. If the value does not exist,
42: * null is returned. To get all values, use
43: * {@link #getAttributeValues(String, Configuration, Map)} or
44: * {@link #getAttributeNames(Configuration, Map)} and
45: * {@link #getAttribute(String, Configuration, Map)} to get them one by one.
46: * @param name a String that specifies what the caller thinks
47: * would identify an attribute. This is mainly a fallback if no
48: * modeConf is present.
49: * @param modeConf column's mode configuration from resource
50: * description. This argument is optional.
51: * @param objectModel
52: */
53: Object getAttribute(String name, Configuration modeConf,
54: Map objectModel) throws ConfigurationException;
55:
56: /**
57: * Returns an Iterator of String objects containing the names
58: * of the attributes available. If no attributes are available,
59: * the method returns an empty Iterator.
60: * @param modeConf column's mode configuration from resource
61: * description. This argument is optional.
62: * @param objectModel
63: */
64: Iterator getAttributeNames(Configuration modeConf, Map objectModel)
65: throws ConfigurationException;
66:
67: /**
68: * Returns an array of String objects containing all of the values
69: * the given attribute has, or null if the attribute does not
70: * exist. As an alternative,
71: * {@link #getAttributeNames(Configuration, Map)} together with
72: * {@link #getAttribute(String, Configuration, Map)} can be used to get the
73: * values one by one.
74: * @param name a String that specifies what the caller thinks
75: * would identify an attributes. This is mainly a fallback
76: * if no modeConf is present.
77: * @param modeConf column's mode configuration from resource
78: * description. This argument is optional.
79: * @param objectModel
80: */
81: Object[] getAttributeValues(String name, Configuration modeConf,
82: Map objectModel) throws ConfigurationException;
83:
84: }
|