Class DelegationRelativeTime

java.lang.Object
net.jini.core.constraint.DelegationRelativeTime
All Implemented Interfaces:
Serializable, InvocationConstraint, RelativeTimeConstraint

public final class DelegationRelativeTime extends Object implements RelativeTimeConstraint, Serializable
Represents a constraint on delegation, such that if delegation is permitted, it be permitted only for a range of time measured relative to the start of the remote call. 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 durations, all specified in milliseconds. If t represents the current time at the start of a remote call, then the four durations have the following semantics:
  • minStart - delegation must not be permitted any earlier than time t + minStart
  • maxStart - delegation must be permitted from time t + maxStart onwards
  • minStop - delegation must be permitted up until at least time t + minStop
  • maxStop - delegation must not be permitted after time t + maxStop
The durations are translated into absolute end times at the point of a remote call by adding the caller's current time. To accommodate clock skew between systems, it is permitted (and may be desirable) to specify negative values for the minimum and maximum start durations, to include 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:
  • Constructor Summary

    Constructors
    Constructor
    Description
    DelegationRelativeTime(long minStart, long maxStart, long minStop, long maxStop)
    Creates a constraint with the specified durations.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    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.
    long
    Returns the maximum start duration in milliseconds.
    long
    Returns the maximum stop duration in milliseconds.
    long
    Returns the minimum start duration in milliseconds.
    long
    Returns the minimum stop duration in milliseconds.
    int
    Returns a hash code value for this object.
    makeAbsolute(long baseTime)
    Returns a DelegationAbsoluteTime instance with times obtained by adding the specified base time argument to the duration values from this instance.
    Returns a string representation of this object.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DelegationRelativeTime

      public DelegationRelativeTime(long minStart, long maxStart, long minStop, long maxStop)
      Creates a constraint with the specified durations.
      Parameters:
      minStart - the minimum start duration in milliseconds
      maxStart - the maximum start duration in milliseconds
      minStop - the minimum stop duration in milliseconds
      maxStop - the maximum stop duration in milliseconds
      Throws:
      IllegalArgumentException - if minStart is greater than maxStart, or maxStart is greater than minStop, or minStop is greater than maxStop, or minStop is less than zero
  • Method Details

    • getMinStart

      public long getMinStart()
      Returns the minimum start duration in milliseconds.
      Returns:
      the minimum start duration in milliseconds
    • getMaxStart

      public long getMaxStart()
      Returns the maximum start duration in milliseconds.
      Returns:
      the maximum start duration in milliseconds
    • getMinStop

      public long getMinStop()
      Returns the minimum stop duration in milliseconds.
      Returns:
      the minimum stop duration in milliseconds
    • getMaxStop

      public long getMaxStop()
      Returns the maximum stop duration in milliseconds.
      Returns:
      the maximum stop duration in milliseconds
    • makeAbsolute

      public InvocationConstraint makeAbsolute(long baseTime)
      Returns a DelegationAbsoluteTime instance with times obtained by adding the specified base time argument to the duration values from this instance. If an addition results in underflow or overflow, a time value of Long.MIN_VALUE or Long.MAX_VALUE is used, respectively.
      Specified by:
      makeAbsolute in interface RelativeTimeConstraint
      Parameters:
      baseTime - an absolute time, specified in milliseconds from midnight, January 1, 1970 UTC
      Returns:
      a constraint that has the relative times converted to absolute times by adding the specified absolute time to each relative time
    • 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