KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > eviction > ExpirationConfiguration


1 package org.jboss.cache.eviction;
2
3 import org.jboss.cache.config.Dynamic;
4
5 /**
6  * Configuration for indicating the Node key for setting a specific eviction time.
7  */

8 public class ExpirationConfiguration extends EvictionPolicyConfigBase
9 {
10
11    private static final long serialVersionUID = 47338798734219507L;
12
13    /**
14     * Default key name for indicating expiration time.
15     */

16    public static final String JavaDoc EXPIRATION_KEY = "expiration";
17
18    /**
19     * Node key name used to indicate the expiration of a node.
20     */

21    @Dynamic
22    private String JavaDoc expirationKeyName = EXPIRATION_KEY;
23    
24    @Dynamic
25    private boolean warnNoExpirationKey = true;
26
27    @Dynamic
28    private int timeToLiveSeconds = 0;
29
30    public ExpirationConfiguration()
31    {
32       setEvictionPolicyClassName();
33    }
34
35    @Override JavaDoc
36    protected void setEvictionPolicyClassName()
37    {
38       setEvictionPolicyClass(ExpirationPolicy.class.getName());
39    }
40
41    /**
42     * Returns the expirationKeyName.
43     * This key should point to a java.lang.Long value in the Node data.
44     */

45    public String JavaDoc getExpirationKeyName()
46    {
47       return expirationKeyName;
48    }
49
50    /**
51     * Sets the expirationKeyName.
52     */

53    public void setExpirationKeyName(String JavaDoc expirationKeyName)
54    {
55       this.expirationKeyName = expirationKeyName;
56    }
57
58    /**
59     * Returns true if the algorithm should warn if a expiration key is missing for a node.
60     */

61    public boolean getWarnNoExpirationKey()
62    {
63       return warnNoExpirationKey;
64    }
65
66    /**
67     * Sets if the algorithm should warn if a expiration key is missing for a node.
68     */

69    public void setWarnNoExpirationKey(boolean warnNoExpirationKey)
70    {
71       this.warnNoExpirationKey = warnNoExpirationKey;
72    }
73
74    public int getTimeToLiveSeconds()
75    {
76       return timeToLiveSeconds;
77    }
78
79    public void setTimeToLiveSeconds(int timeToLiveSeconds)
80    {
81       this.timeToLiveSeconds = timeToLiveSeconds;
82    }
83
84 }
85
Popular Tags