net.jini.security
Class Security.Context

java.lang.Object
  extended by net.jini.security.Security.Context
All Implemented Interfaces:
TrustVerifier.Context
Enclosing class:
Security

private static class Security.Context
extends Object
implements TrustVerifier.Context

TrustVerifier.Context implementation.


Field Summary
private  ClassLoader cl
          The class loader.
private  Collection context
          Caller context.
private static WeakIdentityMap map
          Weak map from ClassLoader to SoftReference(TrustVerifier[]).
private  TrustVerifier[] verifiers
          Trust verifiers.
 
Constructor Summary
Security.Context(ClassLoader cl, Collection context)
          Creates an instance containing the trust verifiers found from the specified class loader, using the verifier cache and updating the cache as necessary.
 
Method Summary
 Collection getCallerContext()
          Returns a collection of context objects for use by trust verifiers.
 ClassLoader getClassLoader()
          Returns the class loader that can be used as a basis for trust verification.
 boolean isTrustedObject(Object obj)
          Returns true if the specified object is trusted to correctly implement its contract; returns false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

verifiers

private final TrustVerifier[] verifiers
Trust verifiers.


cl

private final ClassLoader cl
The class loader.


context

private final Collection context
Caller context.


map

private static final WeakIdentityMap map
Weak map from ClassLoader to SoftReference(TrustVerifier[]).

Constructor Detail

Security.Context

Security.Context(ClassLoader cl,
                 Collection context)
Creates an instance containing the trust verifiers found from the specified class loader, using the verifier cache and updating the cache as necessary.

Method Detail

isTrustedObject

public boolean isTrustedObject(Object obj)
                        throws RemoteException
Description copied from interface: TrustVerifier.Context
Returns true if the specified object is trusted to correctly implement its contract; returns false otherwise.

If the specified object is null, this method returns true. Otherwise, the isTrustedObject method of each verifier contained in this context is called (in order) with the specified object and this context. If any verifier call returns true, the object is trusted and this method returns true. If all of the verifier calls return false, this method returns false. If one or more verifier calls throw a RemoteException or SecurityException, the last such exception is thrown to the caller (unless some verifier call returns true).

Specified by:
isTrustedObject in interface TrustVerifier.Context
Parameters:
obj - the object in which to verify trust
Returns:
true if the specified object is trusted to correctly implements its contract; false otherwise
Throws:
RemoteException - if a communication-related exception occurs

getClassLoader

public ClassLoader getClassLoader()
Description copied from interface: TrustVerifier.Context
Returns the class loader that can be used as a basis for trust verification. In particular, classes and resources reachable from this class loader can be assumed to be trustworthy. A null value is interpreted to mean the current context class loader.

Specified by:
getClassLoader in interface TrustVerifier.Context
Returns:
the class loader that can be used as a basis for trust verification

getCallerContext

public Collection getCallerContext()
Description copied from interface: TrustVerifier.Context
Returns a collection of context objects for use by trust verifiers. The meaning of an element in this collection is determined by its type. As a specific example, a MethodConstraints instance could be used to specify client constraints for any remote calls that trust verifiers might need to perform.

Specified by:
getCallerContext in interface TrustVerifier.Context
Returns:
a collection of context objects for use by trust verifiers


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.