GigaSpaces XAP 9.0 API

net.jini.core.constraint
Class ClientMaxPrincipalType

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

public final class ClientMaxPrincipalType
extends Object
implements InvocationConstraint, Serializable

Represents a constraint on the client, such that if the client authenticates itself, then it may only authenticate itself as principals that are instances of one or more of the specified classes. The mechanisms and credentials used to authenticate the client as those principals are not specified by this constraint. A client can use this constraint to limit how much of its identity is exposed in remote calls. For example, if the client's subject contains sufficient information to authenticate as two distinct principals of different types, the client might wish to limit authentication to just one of the two types, if the client believes the other is unnecessary for authorization at the server and wants to avoid revealing that part of its identity to the server.

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

Since:
2.0
Author:
Sun Microsystems, Inc.
See Also:
ClientAuthentication, ClientMaxPrincipal, ClientMinPrincipal, ClientMinPrincipalType, AuthenticationPermission, Serialized Form

Constructor Summary
ClientMaxPrincipalType(Class clazz)
          Creates a constraint containing the specified class.
ClientMaxPrincipalType(Class[] classes)
          Creates a constraint containing the specified classes, with redundant classes removed.
ClientMaxPrincipalType(Collection c)
          Creates a constraint containing the specified classes, with redundant classes removed.
 
Method Summary
 Set elements()
          Returns an immutable set of all of the classes.
 boolean equals(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.
 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

ClientMaxPrincipalType

public ClientMaxPrincipalType(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:
NullPointerException - if the argument is null
IllegalArgumentException - if the argument is a primitive type, an array type, or a final class that does not have Principal as a superinterface

ClientMaxPrincipalType

public ClientMaxPrincipalType(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 c2 is removed. That is, duplicates and subtypes are removed. The argument passed to the constructor is neither modified nor retained; subsequent changes to that argument have no effect on the instance created.

Parameters:
classes - the classes
Throws:
IllegalArgumentException - if the argument is empty, or if any element is a primitive type, an array type, or a final class that does not have Principal as a superinterface
NullPointerException - if the argument is null or any element is null

ClientMaxPrincipalType

public ClientMaxPrincipalType(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 c2 is removed. That is, duplicates and subtypes are removed. The argument passed to the constructor is neither modified nor retained; subsequent changes to that argument have no effect on the instance created.

Parameters:
c - the classes
Throws:
IllegalArgumentException - if the argument is empty, or if any element is not a Class, or is a primitive type, an array type, or a final class that does not have Principal as a superinterface
NullPointerException - if the argument is null or any element is null
Method Detail

elements

public 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

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

Overrides:
equals in class Object

toString

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

Overrides:
toString in class Object

GigaSpaces XAP 9.0 API

Copyright © GigaSpaces.