java.rmi.constraint
Class DelegationRelativeTime

java.lang.Object
  |
  +--java.rmi.constraint.DelegationRelativeTime
All Implemented Interfaces:
RelativeTimeConstraint, SecurityConstraint, java.io.Serializable

public final class DelegationRelativeTime
extends java.lang.Object
implements RelativeTimeConstraint, java.io.Serializable

Represents a constraint on delegation, such that if delegation is permitted, it be permitted for a range of time measured relative to the start of the remote call. 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:

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, negative values are permitted (and may be desirable) for the minimum and maximum start durations.

The use of an instance of this constraint 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.

Since:
1.4
See Also:
Serialized Form

Constructor Summary
DelegationRelativeTime(long minStart, long maxStart, long minStop, long maxStop)
          Creates a constraint with the specified durations.
 
Method Summary
 boolean equals(java.lang.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.
 long getMaxStart()
          Returns the maximum start duration in milliseconds.
 long getMaxStop()
          Returns the maximum stop duration in milliseconds.
 long getMinStart()
          Returns the minimum start duration in milliseconds.
 long getMinStop()
          Returns the minimum stop duration in milliseconds.
 int hashCode()
          Returns a hash code value for this object.
 SecurityConstraint makeAbsolute(long baseTime)
          Returns a DelegationAbsoluteTime instance with times obtained by adding the specified base time parameter to the duration values from this instance.
 SecurityConstraint reduceBy(SecurityConstraint c)
          Returns the smallest representable subset of this constraint that contains the intersection of this constraint with the specified constraint, or null if there is no intersection.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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:
java.lang.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 Detail

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

reduceBy

public SecurityConstraint reduceBy(SecurityConstraint c)
Returns the smallest representable subset of this constraint that contains the intersection of this constraint with the specified constraint, or null if there is no intersection.

For any instances c1 and c2 of this class, c1.reduceBy(c2) returns a DelegationRelativeTime instance with a minimum start duration of

Math.max(c1.getMinStart(), c2.getMinStart())
a maximum start duration of
Math.min(c1.getMaxStart(), c2.getMaxStart())
a minimum stop duration of
Math.max(c1.getMinStop(), c2.getMinStop())
and a maximum stop duration of
Math.min(c1.getMaxStop(), c2.getMaxStop())
unless the computed minimum start is greater than the computed maximum start, or the computed maximum start is greater than the computed minimum stop, or the computed minimum stop is greater than the computed maximum stop, in which cases the result is null.

For any instance c of this class, c.reduceBy(Delegation.NO) returns Delegation.NO and c.reduceBy(ClientAuthentication.NO) returns ClientAuthentication.NO.

For any instance c1 of this class and any ConstraintAlternatives instance c2 containing DelegationRelativeTime instances, c1.reduceBy(c2) returns the result of calling ConstraintAlternatives.create with all of the non-null values returned by c1.reduceBy(c) for each element c of c2, or null if there are no non-null values.

For any instance c1 of this class and any other constraint instance c2 not previously mentioned, c1.reduceBy(c2) returns c1.

Specified by:
reduceBy in interface SecurityConstraint
Following copied from interface: java.rmi.constraint.SecurityConstraint
Parameters:
c - a constraint
Returns:
the smallest representable subset of this constraint that intersects with the specified constraint, or null if there is no intersection

makeAbsolute

public SecurityConstraint makeAbsolute(long baseTime)
Returns a DelegationAbsoluteTime instance with times obtained by adding the specified base time parameter 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
Following copied from interface: java.rmi.constraint.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 java.lang.Object

equals

public boolean equals(java.lang.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 java.lang.Object

toString

public java.lang.String toString()
Returns a string representation of this object.
Overrides:
toString in class java.lang.Object


Copyright © 2000 Sun Microsystems, Inc. All rights reserved