net.jini.core.constraint
Class DelegationAbsoluteTime

java.lang.Object
  extended by net.jini.core.constraint.DelegationAbsoluteTime
All Implemented Interfaces:
Serializable, InvocationConstraint

public final class DelegationAbsoluteTime
extends Object
implements InvocationConstraint, Serializable

Represents a constraint on delegation, such that if delegation is permitted, it be permitted only for a range of absolute times. The mechanisms and credentials used to support this are not specified by this constraint. Each end of the range is itself specified as a range, yielding four absolute times, all specified in milliseconds from midnight, January 1, 1970 UTC. The four times have the following semantics:

To accommodate clock skew between systems, it may be desirable to specify start times that are earlier than the current time.

The use of an instance of this class does not directly imply a ClientAuthentication.YES constraint or a Delegation.YES constraint; those must be specified separately to ensure that the client actually authenticates itself and that delegation is actually used. Because this constraint is conditional on delegation, it does not conflict with ClientAuthentication.NO or Delegation.NO.

Since:
2.0
Author:
Sun Microsystems, Inc.
See Also:
ClientAuthentication, Delegation, DelegationRelativeTime, Serialized Form

Field Summary
private static SoftReference formatterRef
          SoftReference containing a SimpleDateFormat instance, or null.
private  long maxStart
          The maximum start time in milliseconds from midnight, January 1, 1970 UTC.
private  long maxStop
          The maximum stop time in milliseconds from midnight, January 1, 1970 UTC.
private  long minStart
          The minimum start time in milliseconds from midnight, January 1, 1970 UTC.
private  long minStop
          The minimum stop time in milliseconds from midnight, January 1, 1970 UTC.
private static long serialVersionUID
           
 
Constructor Summary
DelegationAbsoluteTime(Date minStart, Date maxStart, Date minStop, Date maxStop)
          Creates a constraint with the specified dates.
DelegationAbsoluteTime(long minStart, long maxStart, long minStop, long maxStop)
          Creates a constraint with the specified absolute times.
 
Method Summary
 boolean equals(Object obj)
          Two instances of this class are equal if both have the same minimum start, the same maximum start, the same minimum stop, and the same maximum stop.
private static void format(long min, long max, SimpleDateFormat formatter, StringBuffer buf, FieldPosition pos)
          Format a min,max time pair.
private static SimpleDateFormat getFormatter()
          Returns a formatter for "yyyy.MM.dd HH:mm:ss.SSSS zzz".
 long getMaxStart()
          Returns the maximum start time in milliseconds from midnight, January 1, 1970 UTC.
 long getMaxStop()
          Returns the maximum stop time in milliseconds from midnight, January 1, 1970 UTC.
 long getMinStart()
          Returns the minimum start time in milliseconds from midnight, January 1, 1970 UTC.
 long getMinStop()
          Returns the minimum stop time in milliseconds from midnight, January 1, 1970 UTC.
 int hashCode()
          Returns a hash code value for this object.
private  void readObject(ObjectInputStream s)
          Verifies that minStart is less than or equal to maxStart, maxStart is less than or equal to minStop, and minStop is less than or equal to maxStop.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

minStart

private final long minStart
The minimum start time in milliseconds from midnight, January 1, 1970 UTC.


maxStart

private final long maxStart
The maximum start time in milliseconds from midnight, January 1, 1970 UTC.


minStop

private final long minStop
The minimum stop time in milliseconds from midnight, January 1, 1970 UTC.


maxStop

private final long maxStop
The maximum stop time in milliseconds from midnight, January 1, 1970 UTC.


formatterRef

private static SoftReference formatterRef
SoftReference containing a SimpleDateFormat instance, or null.

Constructor Detail

DelegationAbsoluteTime

public DelegationAbsoluteTime(long minStart,
                              long maxStart,
                              long minStop,
                              long maxStop)
Creates a constraint with the specified absolute times.

Parameters:
minStart - the minimum start time in milliseconds from midnight, January 1, 1970 UTC
maxStart - the maximum start time in milliseconds from midnight, January 1, 1970 UTC
minStop - the minimum stop time in milliseconds from midnight, January 1, 1970 UTC
maxStop - the maximum stop time in milliseconds from midnight, January 1, 1970 UTC
Throws:
IllegalArgumentException - if minStart is greater than maxStart, or maxStart is greater than minStop, or minStop is greater than maxStop

DelegationAbsoluteTime

public DelegationAbsoluteTime(Date minStart,
                              Date maxStart,
                              Date minStop,
                              Date maxStop)
Creates a constraint with the specified dates. The arguments passed to the constructor are neither modified nor retained; subsequent changes to those arguments have no effect on the instance created.

Parameters:
minStart - the minimum start date
maxStart - the maximum start date
minStop - the minimum stop date
maxStop - the maximum stop date
Throws:
NullPointerException - if any argument is null
IllegalArgumentException - if minStart is later than maxStart, or maxStart is later than minStop, or minStop is later than maxStop
Method Detail

getMinStart

public long getMinStart()
Returns the minimum start time in milliseconds from midnight, January 1, 1970 UTC.

Returns:
the minimum start time in milliseconds from midnight, January 1, 1970 UTC

getMaxStart

public long getMaxStart()
Returns the maximum start time in milliseconds from midnight, January 1, 1970 UTC.

Returns:
the maximum start time in milliseconds from midnight, January 1, 1970 UTC

getMinStop

public long getMinStop()
Returns the minimum stop time in milliseconds from midnight, January 1, 1970 UTC.

Returns:
the minimum stop time in milliseconds from midnight, January 1, 1970 UTC

getMaxStop

public long getMaxStop()
Returns the maximum stop time in milliseconds from midnight, January 1, 1970 UTC.

Returns:
the maximum stop time in milliseconds from midnight, January 1, 1970 UTC

hashCode

public int hashCode()
Returns a hash code value for this object.

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Two instances of this class are equal if both have the same minimum start, the same maximum start, the same minimum stop, and the same maximum stop.

Overrides:
equals in class Object

toString

public String toString()
Returns a string representation of this object.

Overrides:
toString in class Object

format

private static void format(long min,
                           long max,
                           SimpleDateFormat formatter,
                           StringBuffer buf,
                           FieldPosition pos)
Format a min,max time pair.


getFormatter

private static SimpleDateFormat getFormatter()
Returns a formatter for "yyyy.MM.dd HH:mm:ss.SSSS zzz".


readObject

private void readObject(ObjectInputStream s)
                 throws IOException,
                        ClassNotFoundException
Verifies that minStart is less than or equal to maxStart, maxStart is less than or equal to minStop, and minStop is less than or equal to maxStop.

Throws:
InvalidObjectException - if minStart is greater than maxStart, or maxStart is greater than minStop, or minStop is greater than maxStop
IOException
ClassNotFoundException


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.