oracle.jsp.jwcache
Class ExpirationPolicy

java.lang.Object
  |
  +--oracle.jsp.jwcache.ExpirationPolicy

public class ExpirationPolicy
extends java.lang.Object
implements java.io.Serializable

ExpirationPolicy represents the expiration and storage information used in storing cache data in cache repository.

See Also:
Serialized Form

Field Summary
protected  CachePolicy cachePolicyObj
          CachePolicy (protected) object handle that this expiration policy is a part of.
static int TYPE_DAILY
          integer constant for expiration type: daily - daily expiration at a fixed time
static int TYPE_MONTHLY
          integer constant for expiration type: monthly - monthly expiration at a fixed time at a fixed day
static java.lang.String[] TYPE_STRS
          expiration type keyword strings: TTL, daily, weekly, monthly
static int TYPE_TTL
          integer constant for expiration type: TTL - Time To Live
static int TYPE_WEEKLY
          integer constant for expiration type: weekly - weekly expiration at a fixed time at a fixed day
static int WEEKLY_FRIDAY
          integer constant for weekly expiration on Friday
static int WEEKLY_MONDAY
          integer constant for weekly expiration on Monday
static int WEEKLY_SATURDAY
          integer constant for weekly expiration on Saturday
static java.lang.String[] WEEKLY_STRS
          weekly expiration type keyword strings: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
static int WEEKLY_SUNDAY
          integer constant for weekly expiration on Sunday
static int WEEKLY_THURSDAY
          integer constant for weekly expiration on Thursday
static int WEEKLY_TUESDAY
          integer constant for weekly expiration on Tuesday
static int WEEKLY_WEDNESDAY
          integer constant for weekly expiration on Wednesday
 
Constructor Summary
ExpirationPolicy()
          Constructor for default expiration policy
ExpirationPolicy(ExpirationPolicy expPolicy)
          Copy constructor for expiration policy
ExpirationPolicy(int type, long ttl, long timeInaDay, int dayInaWeek, int dayInaMonth, boolean writeThrough)
          Full constructor for expiration policy
 
Method Summary
 int getDayInaMonth()
          to get the day of a month when the monthly expiration happens (in integer)
 int getDayInaWeek()
          to get the day of a week when the weekly expiration happens (in integer)
 long getExpirationTime(long cur)
          to calculate the expiration time based on the expiration policy and given current time
 long getTimeInaDay()
          get the time in a day (in seconds, in long) when the expiration happens (if the type is daily, weekly or monthly)
 long getTTL()
          get the TTL (time-to-live) value (in long)
 int getType()
          get the type of the expiration (in integer)
 boolean getWriteThrough()
          to get the flag of the persistence write through flag
 void setDayInaMonth(int dayInaMonth)
          to set the day of a month when the monthly expiration happens (in integer)
 void setDayInaWeek(int dayInaWeek)
          to set the day of a week when the weekly expiration happens (in integer)
 void setDayInaWeek(java.lang.String s)
          to set the day of a week when the weekly expiration happens (in String)
 void setTimeInaDay(long timeInaDay)
          set the time in a day (in seconds, in long) when the expiration happens (if the type is daily, weekly or monthly)
 void setTimeInaDay(java.lang.String s)
          set the time in a day (in String, in "00:00:00" format) when the expiration happens (if the type is daily, weekly or monthly)
 void setTTL(long ttl)
          set the TTL (time-to-live) value (in long)
 void setType(int type)
          set the type of the expiration (in integer)
 void setType(java.lang.String s)
          set the type of the expiration (in String)
 void setWriteThrough(boolean writeThrough)
          to set the flag of the persistence write through flag
 void setWriteThrough(java.lang.String v)
          to set the flag of the persistence write through flag (by String)
 java.lang.String toString()
          to get the XML-based description string of the expiration policy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cachePolicyObj

protected CachePolicy cachePolicyObj
CachePolicy (protected) object handle that this expiration policy is a part of.


TYPE_TTL

public static final int TYPE_TTL
integer constant for expiration type: TTL - Time To Live

TYPE_DAILY

public static final int TYPE_DAILY
integer constant for expiration type: daily - daily expiration at a fixed time

TYPE_WEEKLY

public static final int TYPE_WEEKLY
integer constant for expiration type: weekly - weekly expiration at a fixed time at a fixed day

TYPE_MONTHLY

public static final int TYPE_MONTHLY
integer constant for expiration type: monthly - monthly expiration at a fixed time at a fixed day

TYPE_STRS

public static final java.lang.String[] TYPE_STRS
expiration type keyword strings: TTL, daily, weekly, monthly

WEEKLY_SUNDAY

public static final int WEEKLY_SUNDAY
integer constant for weekly expiration on Sunday

WEEKLY_MONDAY

public static final int WEEKLY_MONDAY
integer constant for weekly expiration on Monday

WEEKLY_TUESDAY

public static final int WEEKLY_TUESDAY
integer constant for weekly expiration on Tuesday

WEEKLY_WEDNESDAY

public static final int WEEKLY_WEDNESDAY
integer constant for weekly expiration on Wednesday

WEEKLY_THURSDAY

public static final int WEEKLY_THURSDAY
integer constant for weekly expiration on Thursday

WEEKLY_FRIDAY

public static final int WEEKLY_FRIDAY
integer constant for weekly expiration on Friday

WEEKLY_SATURDAY

public static final int WEEKLY_SATURDAY
integer constant for weekly expiration on Saturday

WEEKLY_STRS

public static final java.lang.String[] WEEKLY_STRS
weekly expiration type keyword strings: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
Constructor Detail

ExpirationPolicy

public ExpirationPolicy()
Constructor for default expiration policy

TYPE is TTL; time to live is 300 seconds; expiration time in a day is 300 seconds from mid-nite (ignored because of TTL type); weekly expiration day is Wednesday (ignored); monthly expiration day is 10 (ignored); persistence write-through option is true / on.


ExpirationPolicy

public ExpirationPolicy(ExpirationPolicy expPolicy)
Copy constructor for expiration policy


ExpirationPolicy

public ExpirationPolicy(int type,
                        long ttl,
                        long timeInaDay,
                        int dayInaWeek,
                        int dayInaMonth,
                        boolean writeThrough)
Full constructor for expiration policy

Parameters:
type - expiration policy type
ttl - TTL / time-to-live (in seconds)
timeInaDay - the time when the daily / weekly / monthly expiration happens the time is measured in seconds elapsed from mid-nite
dayInaWeek - the day when the weekly expiration happens
dayInaMonth - the day when the monthly expiration happens
writeThrough - the boolean flag that specifies whether persistent write through is on.
Method Detail

getType

public int getType()
get the type of the expiration (in integer)
Returns:
the type of the expiration (in integer)

setType

public void setType(int type)
set the type of the expiration (in integer)
Parameters:
type - the type of the expiration (in integer)

setType

public void setType(java.lang.String s)
set the type of the expiration (in String)
Parameters:
s - the type of the expiration (in String)

getTTL

public long getTTL()
get the TTL (time-to-live) value (in long)
Returns:
the TTL (time-to-live) value (in long)

setTTL

public void setTTL(long ttl)
set the TTL (time-to-live) value (in long)
Parameters:
ttl - the TTL (time-to-live) value (in long)

getTimeInaDay

public long getTimeInaDay()
get the time in a day (in seconds, in long) when the expiration happens (if the type is daily, weekly or monthly)
Returns:
the time in a day (in seconds, in long) when the expiration happens

setTimeInaDay

public void setTimeInaDay(long timeInaDay)
set the time in a day (in seconds, in long) when the expiration happens (if the type is daily, weekly or monthly)
Parameters:
timeInaDay - the time in a day (in seconds, in long) when the expiration happens

setTimeInaDay

public void setTimeInaDay(java.lang.String s)
                   throws java.text.ParseException
set the time in a day (in String, in "00:00:00" format) when the expiration happens (if the type is daily, weekly or monthly)
Parameters:
s - the time in a day (in String, in "00:00:00" format) when the expiration happens

toString

public java.lang.String toString()
to get the XML-based description string of the expiration policy
Overrides:
toString in class java.lang.Object
Returns:
the XML-based description string of the expiration policy

getDayInaWeek

public int getDayInaWeek()
to get the day of a week when the weekly expiration happens (in integer)
Returns:
the day of a week when the weekly expiration happens (in integer)

setDayInaWeek

public void setDayInaWeek(int dayInaWeek)
to set the day of a week when the weekly expiration happens (in integer)
Parameters:
dayInaWeek - the day of a week when the weekly expiration happens (in integer)

setDayInaWeek

public void setDayInaWeek(java.lang.String s)
to set the day of a week when the weekly expiration happens (in String)
Parameters:
s - the day of a week when the weekly expiration happens (in String)

getDayInaMonth

public int getDayInaMonth()
to get the day of a month when the monthly expiration happens (in integer)
Returns:
the day of a month when the monthly expiration happens (in integer)

setDayInaMonth

public void setDayInaMonth(int dayInaMonth)
to set the day of a month when the monthly expiration happens (in integer)
Parameters:
dayInaMonth - the day of a month when the monthly expiration happens (in integer)

getWriteThrough

public boolean getWriteThrough()
to get the flag of the persistence write through flag
Returns:
get the flag of the persistence write through flag

setWriteThrough

public void setWriteThrough(boolean writeThrough)
to set the flag of the persistence write through flag
Parameters:
writeThrough - set the flag of the persistence write through flag

setWriteThrough

public void setWriteThrough(java.lang.String v)
to set the flag of the persistence write through flag (by String)
Parameters:
v - set the flag of the persistence write through flag (by String)

getExpirationTime

public long getExpirationTime(long cur)
to calculate the expiration time based on the expiration policy and given current time

Both expiration time and given current time are the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.

Parameters:
cur - the given current time (in long)
Returns:
the expiration time (in long)