|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.jini.security.proxytrust.ProxyTrustInvocationHandler
public final class ProxyTrustInvocationHandler
Invocation handler for remote objects, supporting proxy trust verification
by clients using ProxyTrustVerifier
. This invocation handler
contains both an underlying main proxy and a bootstrap proxy; the main
proxy is not expected to be considered trusted directly by clients, but
the bootstrap proxy is. The main proxy must be an instance of both
RemoteMethodControl
and TrustEquivalence
, and the bootstrap
proxy must be an instance of ProxyTrust
,
RemoteMethodControl
, and TrustEquivalence
. This
invocation handler handles most method invocations by delegating to the
main proxy. The bootstrap proxy is produced by the iterator returned by
the getProxyTrustIterator
method, as
required by ProxyTrustVerifier
.
Constructor Summary | |
---|---|
ProxyTrustInvocationHandler(RemoteMethodControl main,
ProxyTrust boot)
Creates an instance with the specified main proxy and bootstrap proxy. |
Method Summary | |
---|---|
boolean |
checkTrustEquivalence(Object obj)
Returns true if the argument is an instance of this
class, and calling the checkTrustEquivalence method on
the main proxy of this invocation handler, passing the main proxy of
the argument, returns true , and calling the
checkTrustEquivalence method on the bootstrap proxy of
this invocation handler, passing the bootstrap proxy of the argument,
returns true , and returns false otherwise. |
static boolean |
equalInterfaces(Object obj1,
Object obj2)
Returns true if the interfaces implemented by obj1's class are the same (and in the same order) as obj2's class. |
boolean |
equals(Object obj)
Returns true if the argument is an instance of this
class with the same main proxy and the same bootstrap proxy, and
false otherwise. |
protected ProxyTrustIterator |
getProxyTrustIterator()
Returns an iterator that produces the bootstrap proxy as the only element of the iteration. |
int |
hashCode()
Returns a hash code value for this object. |
Object |
invoke(Object proxy,
Method method,
Object[] args)
Executes the specified method with the specified arguments on the specified proxy, and returns the return value, if any. |
static boolean |
sameProxyClass(Object proxy1,
Object proxy2)
Returns true if proxy2 is a generated Proxy (proxy1 is assumed to be one) and the classes of both proxies implement the same ordered list of interfaces, and returns false otherwise. |
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 |
---|
public ProxyTrustInvocationHandler(RemoteMethodControl main, ProxyTrust boot)
main
- the main proxyboot
- the bootstrap proxy
NullPointerException
- if any argument is null
IllegalArgumentException
- if the main proxy is not an instance
of TrustEquivalence
, or the bootstrap proxy is not an instance
of RemoteMethodControl
or TrustEquivalence
Method Detail |
---|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
If the specified method is Object.equals
, returns
true
if the argument (args[0]
) is an
instance of a dynamic proxy class (that is, a class generated by
Proxy
) that implements the same interfaces as the specified
proxy and this invocation handler is equal to the invocation handler
of that argument, and returns false
otherwise.
If the specified method is Object.toString
, returns
a string representation of the specified proxy object.
If the specified method is Object.hashCode
, returns
a hash code for the specified proxy object.
If the specified method is RemoteMethodControl.setConstraints
, returns a new proxy (an instance
of the same class as the specified proxy) containing an instance of
this class with a new main proxy and the same bootstrap proxy from
this handler. The new main proxy is obtained by delegating to the
existing main proxy of this handler (as described below). An exception
is thrown if the specified proxy is not an instance of a dynamic
proxy class containing this invocation handler.
If the specified method is
TrustEquivalence.checkTrustEquivalence
, returns true
if
the argument (args[0]
) is an instance of a dynamic proxy
class that implements the same interfaces as the specified proxy and
calling the checkTrustEquivalence
method
of this invocation handler with the invocation handler of that argument
returns true
, and returns false
otherwise.
For all other methods, returns the object obtained by delegating to the main proxy: the specified method is reflectively invoked on the main proxy with the specified arguments, unless the method's declaring class is not public but the main proxy is an instance of that declaring class and the main proxy's class is public, in which case the corresponding method of the main proxy's class is reflectively invoked instead.
The semantics of this method are unspecified if the arguments could not have been produced by an instance of some valid dynamic proxy class containing this invocation handler.
invoke
in interface InvocationHandler
proxy
- the proxy objectmethod
- the method being invokedargs
- the arguments to the specified method
null
if the method has void
return type
Throwable
- the exception thrown by executing the specified
method
IllegalArgumentException
- if the declaring class of the
specified method is not public and either the main proxy is not an
instance of that declaring class or the main proxy's class is not
publicpublic boolean checkTrustEquivalence(Object obj)
true
if the argument is an instance of this
class, and calling the checkTrustEquivalence
method on
the main proxy of this invocation handler, passing the main proxy of
the argument, returns true
, and calling the
checkTrustEquivalence
method on the bootstrap proxy of
this invocation handler, passing the bootstrap proxy of the argument,
returns true
, and returns false
otherwise.
checkTrustEquivalence
in interface TrustEquivalence
obj
- object to check that is not yet known to be trusted
true
if the specified object (that is not yet
known to be trusted) is equivalent in trust, content, and function to
this known trusted object, and returns false
otherwisepublic boolean equals(Object obj)
true
if the argument is an instance of this
class with the same main proxy and the same bootstrap proxy, and
false
otherwise.
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
protected ProxyTrustIterator getProxyTrustIterator()
public static boolean sameProxyClass(Object proxy1, Object proxy2)
public static boolean equalInterfaces(Object obj1, Object obj2)
|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |