issrg.pba.rbac
Class AdjustedValidityPeriod

java.lang.Object
  extended by issrg.pba.rbac.SubsetCredentials
      extended by issrg.pba.rbac.DefaultValidityPeriodBehaviour
          extended by issrg.pba.rbac.RelativeValidityPeriod
              extended by issrg.pba.rbac.AdjustedValidityPeriod
All Implemented Interfaces:
Credentials, ValidityPeriod, java.lang.Cloneable
Direct Known Subclasses:
AdjustedPeriodCollection

public class AdjustedValidityPeriod
extends RelativeValidityPeriod

This class represents a validity period with run-time rules. It builds the margins updated according to the rules and the given ValidityPeriod.

If the given validity period has NotAfter time between MinSpan and MaxSpan, and NotBefore time later than Age, then the unchanged validity period is returned. Otherwise an Invalid Period is returned (null length).

If no validity period is provided, it returns "now" for both notBefore and notAfter times.

Author:
A.Otenko

Field Summary
protected  RelativeDate age
           
protected  RelativeDate maxSpan
           
protected  RelativeDate minSpan
           
 
Fields inherited from class issrg.pba.rbac.RelativeValidityPeriod
na, nb, notAfter, theClock, unlimited
 
Constructor Summary
protected AdjustedValidityPeriod()
           
  AdjustedValidityPeriod(RelativeDate age, RelativeDate minSpan, RelativeDate maxSpan)
          This constructor builds a AdjustedValidityPeriod given the Age, Min life span, and Max life span.
 
Method Summary
 ValidityPeriod adjust(ValidityPeriod vp)
          This method returns the given ValidityPeriod adjusted according to the constraints provided at construction time.
 Credentials intersection(Credentials c)
          This method redefines how intersection rule works.
 java.lang.String toString()
           
 
Methods inherited from class issrg.pba.rbac.RelativeValidityPeriod
clone, getNotAfter, getNotBefore
 
Methods inherited from class issrg.pba.rbac.DefaultValidityPeriodBehaviour
contains
 
Methods inherited from class issrg.pba.rbac.SubsetCredentials
equals, union
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface issrg.pba.Credentials
union
 

Field Detail

maxSpan

protected RelativeDate maxSpan

minSpan

protected RelativeDate minSpan

age

protected RelativeDate age
Constructor Detail

AdjustedValidityPeriod

protected AdjustedValidityPeriod()

AdjustedValidityPeriod

public AdjustedValidityPeriod(RelativeDate age,
                              RelativeDate minSpan,
                              RelativeDate maxSpan)
This constructor builds a AdjustedValidityPeriod given the Age, Min life span, and Max life span. Note that if Min life span is longer than Max life span, any ValidityPeriod will be invalid. Any or all of these parameters can be null, meaning that the ValidityPeriods will not be constrained in that respect.

Parameters:
age - - the maximum age of the ValidityPeriod; a RelativeDate showing the earliest point in the past when the ValidityPeriod can start; if it starts earlier, it is fully invalid
minSpan - - the minimum life span required of the ValidityPeriod; a RelativeDate showing the earliest point in the future when the ValidityPeriod can end; if it ends earlier, it is fully invalid
maxSpan - - the maximum life span required of the ValidityPeriod; a RelativeDate showing the latest point in the future when the ValidityPeriod can end; if it ends later, it is fully invalid
Method Detail

adjust

public ValidityPeriod adjust(ValidityPeriod vp)
This method returns the given ValidityPeriod adjusted according to the constraints provided at construction time. See description of the logic of the constraints in the constructor.

Parameters:
vp - - the ValidityPeriod to be constrained

intersection

public Credentials intersection(Credentials c)
This method redefines how intersection rule works. Effectively, it applies the adjust method to compute intersections, if the given Credentials is a ValidityPeriod.

Specified by:
intersection in interface Credentials
Overrides:
intersection in class DefaultValidityPeriodBehaviour
Parameters:
c - - a Credentials to intersect with; makes sense only if it is a ValidityPeriod, but supports intersections with other Credentials
Returns:
the ValidityPeriod that is the intersection of this and the given ValidityPeriod

toString

public java.lang.String toString()
Overrides:
toString in class RelativeValidityPeriod