01: package org.csvbeans.context;
02:
03: public interface ContextManager {
04:
05: public static final String SESSION_CONTEXT = "session";
06:
07: public static final String RECORD_CONTEXT = "record";
08:
09: /**
10: * Store a record attribute.
11: *
12: * @param name the name of the attribute
13: * @param value its value
14: */
15: void setRecordAttribute(String name, Object value);
16:
17: /**
18: * Empty the record context.
19: */
20: void clearRecordContext();
21:
22: /**
23: * Empty the session context.
24: */
25: void clearSessionContext();
26:
27: /**
28: * Store a session attribute.
29: *
30: * @param name the name of the attribute
31: * @param value its value
32: */
33: void setSessionAttribute(String name, Object value);
34:
35: /**
36: * Return the object associated with the specified attribute in
37: * the record context. <code>null</code> returned if not found.
38: *
39: * @param name the attribute to retrieve
40: * @return the associated value or <code>null</code> if not found.
41: */
42: Object getRecordAttribute(String name);
43:
44: /**
45: * Return the object associated with the specified attribute in
46: * the session context. <code>null</code> returned if not found.
47: *
48: * @param name the attribute to retrieve
49: * @return the associated value or <code>null</code> if not found.
50: */
51: Object getSessionAttribute(String name);
52:
53: /**
54: * Return the object associated with the specified attribute.
55: * It will try to retrieve the object from the record context
56: * first. If not found, it will then try to retrieve it from
57: * the session context.
58: *
59: * @param name the attribute to retrieve
60: * @return the associated value or <code>null</code> if not found.
61: */
62: Object getAttribute(String name);
63:
64: /**
65: * Retrieve an attribute from the specified scope.
66: * The scope must be REQUEST_CONTEXT or SESSION_CONTEXT,
67: * otherwise a <code>null</code> object will be returned.
68: *
69: * @param name the attribute to retrieve
70: * @param scope the context where to retrieve the attribute
71: * @return the associated object
72: */
73: Object getAttribute(String name, String scope);
74:
75: /**
76: * Store an attribute in the specified scope.
77: * The scope must be REQUEST_CONTEXT or SESSION_CONTEXT,
78: * otherwise a <code>null</code> object will be returned.
79: *
80: * @param name the attribute to define
81: * @param value the attribute value
82: * @param scope the context where to store the attribute
83: */
84: void setAttribute(String name, Object value, String scope);
85:
86: }
|