issrg.pba.rbac
Class Clock

java.lang.Object
  extended by issrg.pba.rbac.Time
      extended by issrg.pba.rbac.Clock
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
ConstantClock, EnvironmentClock, GetAttributesTest, PermisRBACDISTest, PermisRBACTest, PTBClock, SystemClock

public abstract class Clock
extends Time

This is the abstract class that provides the RelativeValidityPeriod and decision with current time. The simplest implementation just gets the system time. You may wish to provide a secure clock, obtaining the time from a time-stamping authority.

The latch method is used to get current time that will be used in subsequent calls to getTime method. This use ensures that the time will remain the same during long calculations. This is needed when making decisions to ensure that "current time" is the same during the whole process.

Author:
A.Otenko

Field Summary
 
Fields inherited from class issrg.pba.rbac.Time
log, s_defaultTimeZone, TIME_TYPE
 
Constructor Summary
Clock()
           
 
Method Summary
 java.util.Date getEvaluationTime()
          Returns the date that the evaluation takes place at.
abstract  java.util.Date getTime()
          This method returns the time returned by the last call to latch, so all calculations will be consistent.
abstract  java.util.Date latch()
          This method gets the actual time and keeps it for later reference.
 
Methods inherited from class issrg.pba.rbac.Time
calendarToTime, calendarToTime, compareTo, equals, getDefaultTimeZone, parse, register, setDefaultTimeZone, setDefaultTimeZone, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Clock

public Clock()
Method Detail

latch

public abstract java.util.Date latch()
This method gets the actual time and keeps it for later reference. Subsequent calls to getTime will return the same value (needed in operations extended in time).

Returns:
the current time

getTime

public abstract java.util.Date getTime()
This method returns the time returned by the last call to latch, so all calculations will be consistent.

Returns:
the time returned by the last call to latch

getEvaluationTime

public java.util.Date getEvaluationTime()
Description copied from class: Time
Returns the date that the evaluation takes place at. If the Time is a pattern, the returned Date will be null, as the evaluation time cannot be represented as a single Date.

Overrides:
getEvaluationTime in class Time
Returns:
Date of evaluation