|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object issrg.pba.rbac.Time
public class Time
This is an extension for evaluating Time expressions in the XML Policy.
The Policy must contain Const values of type "Time". The values must conform to the following syntax: "ccyy-mm-ddThh:mm:ss timezone" (like in Validity elements in XML Policy). The timezone specification can be either of the form of GMT offset, with no leading space, or a timezone name, known to Java. Thus the time can be specified up to the seconds. The year should always have 4 digits. Other fields do not need to have 2 digits, if they represent numbers less than 10. "*" asterisc can be used as a wildcard to represent "any value" at that position. Trailing fields can be omitted and their values will be considered 0.
Examples:
<Constant Type="Time" Value="*-*-*T8:20" />
The example matches 08:20:00 in the morning any day
<Constant Type="Time" Value="*-*-*T8:20:*" />
The above matches any second after 08:20:00 and before 08:21:00 in the morning any day. This is different from the above example in that it matches ANY second, i.e. the whole minute up to 8:21, whilst the previous example specifies exact time of day (8:20:00).
<Constant Type="Time" Value="*-1-*T20" />
This example matches 8pm any day throughout January.
<Constant Type="Time" Value="*-1" />
This example matches midnight of every 1st of January.
The extension has been provided in PBA v1.1.
Field Summary | |
---|---|
protected static java.util.logging.Logger |
log
|
protected static java.util.TimeZone |
s_defaultTimeZone
|
static java.lang.String |
TIME_TYPE
|
Constructor Summary | |
---|---|
protected |
Time()
|
|
Time(java.lang.String timeString)
This constructor builds a Time object out of its string representation |
Method Summary | |
---|---|
protected static int[] |
calendarToTime(java.util.Calendar c)
This method does the same as calendarToTime( int[], Calendar ), only it allocates the array first, and returns it as the result. |
protected static void |
calendarToTime(int[] t,
java.util.Calendar c)
This routine takes the Calendar and extracts the date/time values in the Calendar's timezone into the array of integers. |
int |
compareTo(java.lang.Object t1)
Returns a negative, a positive integer or zero, if this Time is less than, more than, or equal to the given Time respectively. |
boolean |
equals(java.lang.Object o)
Returns true, if this Time is equal to the given Time. |
static java.util.TimeZone |
getDefaultTimeZone()
|
java.util.Date |
getEvaluationTime()
Returns the date that the evaluation takes place at. |
static int[] |
parse(java.lang.String timeString)
This method parses the String as the time of the form "yyyy-MM-ddThh:mm:ss", without the timezone, with every part of the string being optional, and allowing wildcard "*" values. |
static void |
register()
|
static void |
setDefaultTimeZone(java.lang.String tzID)
This method sets the default timezone to be used by Time, when parsing string without explicitly specified timezone. |
static void |
setDefaultTimeZone(java.util.TimeZone tz)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final java.util.logging.Logger log
public static final java.lang.String TIME_TYPE
protected static java.util.TimeZone s_defaultTimeZone
Constructor Detail |
---|
protected Time()
public Time(java.lang.String timeString) throws java.lang.IllegalArgumentException
timeString
- - the String in the format explained above.
java.lang.IllegalArgumentException
Method Detail |
---|
public static void register()
public static java.util.TimeZone getDefaultTimeZone()
public static void setDefaultTimeZone(java.lang.String tzID)
Calling this method affects only the newly created Time objects.
tzID
- the id of the TimeZone in a format compatible with
java.util.TimeZone requirementspublic static void setDefaultTimeZone(java.util.TimeZone tz)
public java.util.Date getEvaluationTime()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the Time to compare to
java.lang.ClassCastException
- - if o cannot be cast to Timepublic int compareTo(java.lang.Object t1)
compareTo
in interface java.lang.Comparable
time
- the Time to compare to
java.lang.ClassCastException
- - if t cannot be cast to Timepublic java.lang.String toString()
toString
in class java.lang.Object
protected static void calendarToTime(int[] t, java.util.Calendar c)
protected static int[] calendarToTime(java.util.Calendar c)
public static int[] parse(java.lang.String timeString)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |