Package net.jini.security.proxytrust
Class ProxyTrustExporter
java.lang.Object
net.jini.security.proxytrust.ProxyTrustExporter
- All Implemented Interfaces:
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.- Since:
- 2.0
- Author:
- Sun Microsystems, Inc.
-
Constructor Summary
ConstructorsConstructorDescriptionProxyTrustExporter(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
-
Constructor Details
-
ProxyTrustExporter
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 bothRemoteMethodControlandTrustEquivalence, and if the main proxy's class is notpublic, the direct superinterfaces of that class and all of its superclasses must bepublic. The bootstrap exporter, when used to export a remote object that is an instance ofProxyTrust, must produce a proxy (called the bootstrap proxy) that is an instance ofProxyTrust,RemoteMethodControl, andTrustEquivalence, and should satisfy the bootstrap proxy requirements ofProxyTrustVerifier. 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 objectbootExporter- the bootstrap exporter, for the bootstrap remote object- Throws:
NullPointerException- if any argument isnull
-
ProxyTrustExporter
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 bothRemoteMethodControlandTrustEquivalence, and if the main proxy's class is notpublic, the direct superinterfaces of that class and all of its superclasses must bepublic. The bootstrap exporter, when used to export a remote object that is an instance ofProxyTrust, must produce a proxy (called the bootstrap proxy) that is an instance ofProxyTrust,RemoteMethodControl, andTrustEquivalence, and should satisfy the bootstrap proxy requirements ofProxyTrustVerifier. If the specified class loader isnull, 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 objectbootExporter- the bootstrap exporter, for the bootstrap remote objectloader- the class loader to define the proxy class in, ornull- Throws:
NullPointerException- if either exporter argument isnull
-
-
Method Details
-
export
Exports the specified main remote object and returns a dynamic proxy for the object. The main remote object must be an instance ofServerProxyTrust. 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 bothRemoteMethodControlandTrustEquivalence, and if the main proxy's class is notpublic, the direct superinterfaces of that class and all of its superclasses must bepublic. A bootstrap remote object that is an instance ofProxyTrustis 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 ofProxyTrust,RemoteMethodControl, andTrustEquivalence. The bootstrap remote object will remain reachable as long as the main remote object is reachable and theunexportmethod of this exporter has not returnedtrue. AProxyclass 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'simplementsclause); and if an interface appears more than once, only the first instance is retained. If a non-nullclass 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 aProxyTrustInvocationHandlerinstance created with the main proxy and the bootstrap proxy.- Specified by:
exportin interfaceExporter- Parameters:
impl- a remote object to export- Returns:
- a proxy for the remote object
- Throws:
ExportException- if the export of either remote object throwsExportException, or if the export the bootstrap remote object throwsIllegalArgumentException, or if the main proxy is not an instance of bothRemoteMethodControlandTrustEquivalence, or if the main proxy's class is notpublicand it or a superclass has a non-publicdirect superinterface, or if the bootstrap proxy is not an instance ofProxyTrust,RemoteMethodControl, andTrustEquivalence, 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 exporterIllegalArgumentException- if the specified remote object is not an instance ofServerProxyTrust, or if the export of the main remote object throwsIllegalArgumentExceptionIllegalStateException- if the export of either remote object throwsIllegalStateExceptionSecurityException- if a non-nullclass loader was not specified at the construction of this exporter and the calling context does not haveRuntimePermission("getClassLoader")permission
-
unexport
public boolean unexport(boolean force) Unexports the remote objects that were previously exported via this exporter. Theunexportmethod of the main exporter is called with the specified argument and if that returnstrue, theunexportmethod of the bootstrap exporter is called withtrue. The result of the mainunexportcall is returned by this method. Any exception thrown by eitherunexportcall is rethrown by this method.- Specified by:
unexportin interfaceExporter- Parameters:
force- iftrue, the remote object will be unexported even if there are remote calls pending or in progress; iffalse, the remote object may only be unexported if there are no known remote calls pending or in progress- Returns:
trueif the remote object is unexported when this method returns andfalseotherwise- Throws:
IllegalStateException- if the unexport of either remote object throwsIllegalStateException
-