| 
GigaSpaces XAP 9.1 API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.jini.security.BasicProxyPreparer
public class BasicProxyPreparer
A ProxyPreparer for verifying that proxies are trusted,
 granting them dynamic permissions, and setting their constraints, as well as
 for creating other proxy preparer subclasses that include those
 operations. 
Applications and configurations can use this class to create proxy preparers for several common cases. Some examples include creating proxy preparers that:
| Field Summary | |
|---|---|
protected  MethodConstraints | 
methodConstraints
Method constraints to use when verifying if proxies are trusted and for setting their constraints, if methodConstraintsSpecified is
 true. | 
protected  boolean | 
methodConstraintsSpecified
Whether to use methodConstraints when verifying if proxies are
 trusted and for setting their constraints. | 
protected  Permission[] | 
permissions
Permissions to grant to proxies, or an empty array if no permissions should be granted.  | 
protected  boolean | 
verify
Whether to verify if proxies are trusted.  | 
| Constructor Summary | |
|---|---|
BasicProxyPreparer()
Creates a proxy preparer that specifies not to verify proxies, grant them permissions, or set their constraints.  | 
|
BasicProxyPreparer(boolean verify,
                   MethodConstraints methodConstraints,
                   Permission[] permissions)
Creates a proxy preparer that specifies whether proxies should be verified, specifies permissions to grant them, and specifies what method constraints to use when verifying and setting constraints.  | 
|
BasicProxyPreparer(boolean verify,
                   Permission[] permissions)
Creates a proxy preparer that specifies whether proxies should be verified, using the constraints on the proxy by default, and specifies what permissions to grant to proxies.  | 
|
| Method Summary | |
|---|---|
 boolean | 
equals(Object object)
Returns true if the given object is an instance of the same
 class as this object, with the same value for verify, with
 method constraints that are equals or similarly not
 specified, and with permissions containing the same
 elements, independent of order. | 
protected  MethodConstraints | 
getMethodConstraints(Object proxy)
Returns the method constraints to use when verifying and setting constraints on the specified proxy.  | 
protected  Permission[] | 
getPermissions(Object proxy)
Returns the permissions to grant to proxies, or an empty array if no permissions should be granted.  | 
protected  void | 
grant(Object proxy)
Grants permissions to the proxy.  | 
 int | 
hashCode()
Returns a hash code value for this object.  | 
 Object | 
prepareProxy(Object proxy)
Performs operations on a proxy to prepare it for use, returning the prepared proxy, which may or may not be the argument itself.  | 
protected  Object | 
setConstraints(Object proxy)
Sets constraints on the proxy.  | 
 String | 
toString()
Returns a string representation of this object.  | 
protected  void | 
verify(Object proxy)
Verifies that the proxy is trusted.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
protected final boolean verify
protected final boolean methodConstraintsSpecified
methodConstraints when verifying if proxies are
 trusted and for setting their constraints.
protected final MethodConstraints methodConstraints
methodConstraintsSpecified is
 true. Set to null if
 methodConstraintsSpecified is false.
protected final Permission[] permissions
null.
| Constructor Detail | 
|---|
public BasicProxyPreparer()
public BasicProxyPreparer(boolean verify,
                          Permission[] permissions)
verify - whether to verify if proxies are trustedpermissions - permissions to grant, or null if no
              permissions should be granted
NullPointerException - if permissions is not
               null and any of its elements are null
public BasicProxyPreparer(boolean verify,
                          MethodConstraints methodConstraints,
                          Permission[] permissions)
verify - whether to verify if proxies are trustedmethodConstraints - method constraints to use when verifying 
              and setting constraintspermissions - permissions to grant, or null if no
              permissions should be granted
NullPointerException - if permissions is not
               null and any of its elements are null| Method Detail | 
|---|
protected MethodConstraints getMethodConstraints(Object proxy)
 The default implementation returns the value of methodConstraints if methodConstraintsSpecified is
 true, else returns the constraints on the specified proxy
 if it implements RemoteMethodControl, else returns
 null. 
Subclasses may wish to override this method, for example, to augment the existing constraints on the proxy rather than replacing them.
proxy - the proxy being prepared
protected Permission[] getPermissions(Object proxy)
null. 
 The default implementation returns the value of permissions. 
Subclasses may wish to override this method, for example, to grant permissions that depend on principal constraints found on the proxy.
proxy - the proxy being prepared
public Object prepareProxy(Object proxy)
                    throws RemoteException
 The default implementation provides the following behavior. If
 proxy is null, throws a NullPointerException. Otherwise, calls verify
 with proxy. If the verify call succeeds, calls
 grant with proxy. If the grant
 call succeeds, returns the result of calling setConstraints with proxy. 
 Subclasses may wish to override this method, for example, to perform
 additional operations, typically calling the default implementation via
 super.
prepareProxy in interface ProxyPreparerproxy - the proxy to prepare
NullPointerException - if proxy is null
RemoteException - if a communication-related exception occurs
SecurityException - if a security exception occursverify, 
grant, 
setConstraints
protected void verify(Object proxy)
               throws RemoteException
prepareProxy. 
 The default implementation provides the following behavior. If
 proxy is null, throws a NullPointerException. Otherwise, if verify is
 true, calls Security.verifyObjectTrust, with proxy, null
 for the class loader, and, for the context, a collection containing the
 result of calling getMethodConstraints
 with proxy, or an empty collection if the constraints are
 null. 
Subclasses may wish to override this method, for example, to specify a different class loader or context when verifying the proxy.
proxy - the proxy to verify
NullPointerException - if proxy is null
RemoteException - if a communication-related exception occurs
SecurityException - if verifying that the proxy is trusted failsprepareProxy, 
getMethodConstraints, 
Security.verifyObjectTrustprotected void grant(Object proxy)
prepareProxy unless verify
 throws an exception. 
 The default implementation provides the following behavior. If
 proxy is null, throws a NullPointerException. Otherwise, calls getPermissions with proxy to determine what permissions
 should be granted. If the permissions are not empty, calls Security.grant, with the proxy's
 class as the class argument and those permissions. If grant
 discovers that dynamic permission grants are not supported and throws a
 UnsupportedOperationException, catches that exception and throws
 a SecurityException. 
Subclasses may wish to override this method, for example, to alter the principals for which permission grants are made.
proxy - the proxy to grant permissions
SecurityException - if a security exception occurs
NullPointerException - if proxy is nullprepareProxy, 
getPermissions, 
Security.grantprotected Object setConstraints(Object proxy)
prepareProxy unless verify
 or grant throw an exception. 
 The default implementation provides the following behavior. If
 proxy is null, throws a NullPointerException. Otherwise, if methodConstraintsSpecified
 is false, returns the proxy, else if object does not
 implement RemoteMethodControl, throws a SecurityException, else returns the result of calling RemoteMethodControl.setConstraints
 on the proxy, using the value returned from calling getMethodConstraints with proxy. 
 Subclasses may wish to override this method, for example, to support
 verifying objects that do not implement RemoteMethodControl.
proxy - the proxy
NullPointerException - if proxy is null
SecurityException - if a security exception occursprepareProxy, 
getMethodConstraints, 
RemoteMethodControl.setConstraintspublic String toString()
toString in class Objectpublic boolean equals(Object object)
true if the given object is an instance of the same
 class as this object, with the same value for verify, with
 method constraints that are equals or similarly not
 specified, and with permissions containing the same
 elements, independent of order.
equals in class Objectpublic int hashCode()
hashCode in class Object
  | 
GigaSpaces XAP 9.1 API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||