java.rmi.constraint
Class ClientMinPrincipalType

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

public final class ClientMinPrincipalType
extends java.lang.Object
implements SecurityConstraint, java.io.Serializable

Represents a constraint on the client, such that if the client authenticates itself, then it must authenticate itself such that, for each specified class, at least one authenticated principal is an instance of that class.

The use of an instance of this constraint does not directly imply a ClientAuthentication.YES constraint; that must be specified separately to ensure that the client actually authenticates itself.

Since:
1.4
See Also:
AuthenticationPermission, Serialized Form

Constructor Summary
ClientMinPrincipalType(java.lang.Class clazz)
          Creates a constraint containing the specified class.
ClientMinPrincipalType(java.lang.Class[] classes)
          Creates a constraint containing the specified classes, with redundant classes removed.
ClientMinPrincipalType(java.util.Collection c)
          Creates a constraint containing the specified classes, with redundant classes removed.
 
Method Summary
 java.util.Set elements()
          Returns an immutable set of all of the classes.
 boolean equals(java.lang.Object obj)
          Two instances of this class are equal if they have the same classes (ignoring order).
 int hashCode()
          Returns a hash code value for this object.
 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

ClientMinPrincipalType

public ClientMinPrincipalType(java.lang.Class clazz)
Creates a constraint containing the specified class. This constructor is equivalent to calling a constructor with a single-element array containing the specified class.
Parameters:
clazz - the class
Throws:
java.lang.IllegalArgumentException - if the parameter is not a trusted principal class or a supertype, or the parameter is a degenerate class (java.security.Principal, Object or java.io.Serializable)
NullPointerException - if the parameter is null

ClientMinPrincipalType

public ClientMinPrincipalType(java.lang.Class[] classes)
Creates a constraint containing the specified classes, with redundant classes removed. Redundant classes are removed as follows: for any two specified classes c1 and c2, if c1.isAssignableFrom(c2) is true, then c1 is removed. That is, duplicates and supertypes are removed. The parameter passed to the constructor is neither modified nor retained; subsequent changes to that parameter have no effect on the instance created.
Parameters:
classes - the classes
Throws:
java.lang.IllegalArgumentException - if the parameter is empty, or the elements are not all trusted principal classes or supertypes, or any element is a degenerate class (java.security.Principal, Object or java.io.Serializable)
NullPointerException - if the parameter is null or any element is null

ClientMinPrincipalType

public ClientMinPrincipalType(java.util.Collection c)
Creates a constraint containing the specified classes, with redundant classes removed. Redundant classes are removed as follows: for any two specified classes c1 and c2, if c1.isAssignableFrom(c2) is true, then c1 is removed. That is, duplicates and supertypes are removed. The parameter passed to the constructor is neither modified nor retained; subsequent changes to that parameter have no effect on the instance created.
Parameters:
classes - the classes
Throws:
java.lang.IllegalArgumentException - if the parameter is empty, or the elements are not all trusted principal classes or supertypes, or any element is a degenerate class (java.security.Principal, Object or java.io.Serializable)
NullPointerException - if the parameter is null or any element is null
Method Detail

elements

public java.util.Set elements()
Returns an immutable set of all of the classes. Any attempt to modify the set results in an UnsupportedOperationException being thrown.
Returns:
an immutable set of all of the classes

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 ClientMinPrincipalType constructed from the combined classes of both c1 and c2, with redundant classes removed as specified for the constructors of this class.

For any instance c1 of this class and any ClientMinPrincipal instance c2, c1.reduceBy(c2) returns c2 if for every class t in c1 there exists a principal in c2 that is an instance of t. Otherwise, the result is a ClientMinPrincipalType instance constructed from the collection containing every class in c1 and the concrete class of each principal in c2.

For any instance c1 of this class and any ClientMaxPrincipal instance c2, c1.reduceBy(c2) returns null if there exists a class t in c1 such that no principal in c2 is an instance of t. Otherwise, the result is a ClientMinPrincipal instance containing each principal in c2 that is an instance of at least one class in c1.

For any instance c1 of this class and any ClientMaxPrincipalType instance c2, c1.reduceBy(c2) returns null if there exists a class t1 in c1 such that for every class t2 in c2, both t1.isAssignableFrom(t2) and t2.isAssignableFrom(t1) are false. Otherwise, the result is a ClientMinPrincipalType instance constructed from the following collection. For each class t1 in c1, if there is a class t2 in c2 such that t2.isAssignableFrom(t1) is true, then t1 is added to the collection, otherwise a set is formed of all classes t2 in c2 that are subtypes of t1 and the trusted least common ancestors of that set are added to the collection. A class c is a trusted common ancestor of a set of classes if c is a trusted principal class (or a supertype) and for each class t in the set, c.isAssignableFrom(t) is true. A class c is a trusted least common ancestor of a set of classes if c is a trusted common ancestor of the set and no subclass of c is a trusted common ancestor of the set.

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

For any instance c1 of this class and any ConstraintAlternatives instance c2 containing instances of this class, c1.reduceBy(c2) returns the result of calling ConstraintAlternatives.create with all of the values returned by c1.reduceBy(c) for each element c of c2.

For any instance c1 of this class and any ConstraintAlternatives instance c2 containing ClientMinPrincipal instances, c1.reduceBy(c2) returns the result of calling ConstraintAlternatives.create with a collection formed as follows. The collection initially contains the values returned by c1.reduceBy(c) for each element c of c2. If the collection contains both ClientMinPrincipal and ClientMinPrincipalType instances, then each ClientMinPrincipal instance m in the collection is replaced with a ClientMinPrincipalType instance constructed from the collection containing the concrete class of each principal in m.

For any instance c1 of this class and any ConstraintAlternatives instance c2 containing ClientMaxPrincipal or ClientMaxPrincipalType instances, c1.reduceBy(c2) returns the result of calling ConstraintAlternatives.create with a collection containing 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

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 they have the same classes (ignoring order).
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