GigaSpaces XAP 10.0.1 API

net.jini.security.proxytrust
Class ProxyTrustExporter

java.lang.Object
  extended by net.jini.security.proxytrust.ProxyTrustExporter
All Implemented Interfaces:
Exporter

public class ProxyTrustExporter
extends Object
implements Exporter

Contains the information necessary to export a remote object that has a proxy that will not directly be considered trusted by clients, such that the proxy can be trusted by clients using ProxyTrustVerifier. The remote object to be exported (called the main remote object) must be an instance of ServerProxyTrust. In addition to exporting the main remote object, this exporter also exports a second remote object (called the bootstrap remote object, which is created internally by this exporter) that implements the ProxyTrust interface by delegating the getProxyVerifier method to the corresponding getProxyVerifier method of the main remote object. (see also net.jini.jeri.ProxyTrustILFactory)

Since:
2.0
Author:
Sun Microsystems, Inc.

Constructor Summary
ProxyTrustExporter(Exporter mainExporter, Exporter bootExporter)
          Creates an instance with the specified main exporter (which will be used to export the main remote object) and the specified bootstrap exporter (which will be used to export the bootstrap remote object).
ProxyTrustExporter(Exporter mainExporter, Exporter bootExporter, ClassLoader loader)
          Creates an instance with the specified main exporter (which will be used to export the main remote object), the specified bootstrap exporter (which will be used to export the bootstrap remote object), and the specified class loader (in which the generated dynamic proxy class will be defined).
 
Method Summary
 Remote export(Remote impl)
          Exports the specified main remote object and returns a dynamic proxy for the object.
 boolean unexport(boolean force)
          Unexports the remote objects that were previously exported via this exporter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyTrustExporter

public ProxyTrustExporter(Exporter mainExporter,
                          Exporter bootExporter)
Creates an instance with the specified main exporter (which will be used to export the main remote object) and the specified bootstrap exporter (which will be used to export the bootstrap remote object). The main exporter must produce a proxy (called the main proxy) that is an instance of both RemoteMethodControl and TrustEquivalence, and if the main proxy's class is not public, the direct superinterfaces of that class and all of its superclasses must be public. The bootstrap exporter, when used to export a remote object that is an instance of ProxyTrust, must produce a proxy (called the bootstrap proxy) that is an instance of ProxyTrust, RemoteMethodControl, and TrustEquivalence, and should satisfy the bootstrap proxy requirements of ProxyTrustVerifier. The dynamic proxy class generated at export will be defined by the same class loader as the main proxy's class.

Parameters:
mainExporter - the main exporter, for the main remote object
bootExporter - the bootstrap exporter, for the bootstrap remote object
Throws:
NullPointerException - if any argument is null

ProxyTrustExporter

public ProxyTrustExporter(Exporter mainExporter,
                          Exporter bootExporter,
                          ClassLoader loader)
Creates an instance with the specified main exporter (which will be used to export the main remote object), the specified bootstrap exporter (which will be used to export the bootstrap remote object), and the specified class loader (in which the generated dynamic proxy class will be defined). The main exporter must produce a proxy (called the main proxy) that is an instance of both RemoteMethodControl and TrustEquivalence, and if the main proxy's class is not public, the direct superinterfaces of that class and all of its superclasses must be public. The bootstrap exporter, when used to export a remote object that is an instance of ProxyTrust, must produce a proxy (called the bootstrap proxy) that is an instance of ProxyTrust, RemoteMethodControl, and TrustEquivalence, and should satisfy the bootstrap proxy requirements of ProxyTrustVerifier. If the specified class loader is null, the dynamic proxy class generated at export will be defined by the same class loader as the main proxy's class.

Parameters:
mainExporter - the main exporter, for the main remote object
bootExporter - the bootstrap exporter, for the bootstrap remote object
loader - the class loader to define the proxy class in, or null
Throws:
NullPointerException - if either exporter argument is null
Method Detail

export

public Remote export(Remote impl)
              throws ExportException
Exports the specified main remote object and returns a dynamic proxy for the object. The main remote object must be an instance of ServerProxyTrust. The main remote object is exported using the main exporter (specified at the construction of this exporter), returning a proxy called the main proxy. The main proxy must be an instance of both RemoteMethodControl and TrustEquivalence, and if the main proxy's class is not public, the direct superinterfaces of that class and all of its superclasses must be public. A bootstrap remote object that is an instance of ProxyTrust is created and exported using the bootstrap exporter (also specified at the construction of this exporter), returning a proxy called the bootstrap proxy. The bootstrap proxy must be an instance of ProxyTrust, RemoteMethodControl, and TrustEquivalence. The bootstrap remote object will remain reachable as long as the main remote object is reachable and the unexport method of this exporter has not returned true. A Proxy class is generated that implements the direct superinterfaces of the main proxy's class and all of its superclasses, in the following order: the direct superinterfaces of a class immediately follow the direct superinterfaces of its direct superclass; the direct superinterfaces of a class are in declaration order (the order in which they are declared in the class's implements clause); and if an interface appears more than once, only the first instance is retained. If a non-null class loader was specified at the construction of this exporter, the generated class is defined by that class loader, otherwise it is defined by the class loader of the main proxy's class. The dynamic proxy returned by this method is an instance of that generated class, containing a ProxyTrustInvocationHandler instance created with the main proxy and the bootstrap proxy.

Specified by:
export in interface Exporter
Parameters:
impl - a remote object to export
Returns:
a proxy for the remote object
Throws:
ExportException - if the export of either remote object throws ExportException, or if the export the bootstrap remote object throws IllegalArgumentException, or if the main proxy is not an instance of both RemoteMethodControl and TrustEquivalence, or if the main proxy's class is not public and it or a superclass has a non-public direct superinterface, or if the bootstrap proxy is not an instance of ProxyTrust, RemoteMethodControl, and TrustEquivalence, or if any of the superinterfaces of the main proxy's class are not visible through the class loader specified at the construction of this exporter
IllegalArgumentException - if the specified remote object is not an instance of ServerProxyTrust, or if the export of the main remote object throws IllegalArgumentException
IllegalStateException - if the export of either remote object throws IllegalStateException
SecurityException - if a non-null class loader was not specified at the construction of this exporter and the calling context does not have RuntimePermission("getClassLoader") permission

unexport

public boolean unexport(boolean force)
Unexports the remote objects that were previously exported via this exporter. The unexport method of the main exporter is called with the specified argument and if that returns true, the unexport method of the bootstrap exporter is called with true. The result of the main unexport call is returned by this method. Any exception thrown by either unexport call is rethrown by this method.

Specified by:
unexport in interface Exporter
Parameters:
force - if true, the remote object will be unexported even if there are remote calls pending or in progress; if false, the remote object may only be unexported if there are no known remote calls pending or in progress
Returns:
true if the remote object is unexported when this method returns and false otherwise
Throws:
IllegalStateException - if the unexport of either remote object throws IllegalStateException

GigaSpaces XAP 10.0.1 API

Copyright © GigaSpaces.