01: /* Copyright 2001 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal;
07:
08: /**
09: * A general channel cache key class. The class includes the key iteslf, as well as key properties.
10: * @author Peter Kharchenko {@link <a href="mailto:pkharchenko@interactivebusiness.com">pkharchenko@interactivebusiness.com</a>}
11: * @version $Revision: 36690 $
12: */
13: public class ChannelCacheKey {
14: /**
15: * Specifies that the cache is specific to the instance of the channel that generated it.
16: * This is the default scope. This scope should be used if the screen rendering at the
17: * current state involves any user-specific information.
18: */
19: public static final int INSTANCE_KEY_SCOPE = 0;
20: /**
21: * Specifies that the cache is accessable by all instances of that channel class.
22: * In construction a session-wide key, make sure to include static data information in there.
23: */
24: public static final int SYSTEM_KEY_SCOPE = 1;
25:
26: String key; // the actual key
27: int keyScope; // scope in which the cache to be used
28: Object keyValidity; // validity object
29:
30: public ChannelCacheKey() {
31: key = null;
32: keyValidity = null;
33: keyScope = INSTANCE_KEY_SCOPE;
34: }
35:
36: public void setKey(String key) {
37: this .key = key;
38: }
39:
40: /**
41: * Returns a key uniqly describing the channel state.
42: */
43: public String getKey() {
44: return key;
45: }
46:
47: public void setKeyScope(int scope) {
48: this .keyScope = scope;
49: }
50:
51: /**
52: * Returns a specification of the scope in which the cache to be used.
53: * Possible values are : INSTANCE_KEY_SCOPE and SYSTEM_KEY_SCOPE.
54: */
55: public int getKeyScope() {
56: return keyScope;
57: }
58:
59: public void setKeyValidity(Object validity) {
60: this .keyValidity = validity;
61: }
62:
63: /**
64: * Returns an object that can be used by the channel to verify cache validity.
65: * In general, cache validators allow to strengthen the key, by allowing for non-exact
66: * checks. A good example is a cache validity condition involving expiration time-stamp.
67: */
68: public Object getKeyValidity() {
69: return keyValidity;
70: }
71: }
|