01: /**
02: * Copyright 2006 Webmedia Group Ltd.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: **/package org.araneaframework;
16:
17: import java.io.Serializable;
18: import org.araneaframework.core.NoSuchEnvironmentEntryException;
19:
20: /**
21: * A special data structure providing encapsulation of data needed by different components.
22: * Every Aranea component has an environment. The environment can be inhereted from the parent
23: * or be standalone. No component knows from which component the Environment comes from.
24: * <br><br>
25: * Component does know about the hooks in the environment. As different contexts are added to
26: * the environment the component in need of them is reponsible of checking them and acting upon
27: * them.
28: *
29: * @author "Toomas Römer" <toomas@webmedia.ee>
30: * @author Jevgeni Kabanov (ekabanov <i>at</i> araneaframework <i>dot</i> org)
31: */
32: public interface Environment extends Serializable {
33:
34: /**
35: * The key that can be used to retrieve Environment (as an example a request scope attribute).
36: *
37: * @since 1.1
38: */
39: public static final String ENVIRONMENT_KEY = "org.araneaframework.Environment";
40:
41: /**
42: * Returns the entry with the specified key from this Environment.
43: * Returns null if the entry is not present in the environment.
44: */
45: public Object getEntry(Object key);
46:
47: /**
48: * Does the same as {@link #getEntry(Object)}, but throws a {@link NoSuchEnvironmentEntryException} if
49: * entry cannot be found.
50: *
51: * @throws NoSuchEnvironmentEntryException If environment entry could not be found.
52: */
53: public Object requireEntry(Object key)
54: throws NoSuchEnvironmentEntryException;
55: }
|