public class ProxyTrustExporter extends Object implements Exporter
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.ProxyTrustILFactory
Constructor and Description |
---|
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).
|
public ProxyTrustExporter(Exporter mainExporter, Exporter bootExporter)
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.mainExporter
- the main exporter, for the main remote objectbootExporter
- the bootstrap exporter, for the bootstrap remote
objectNullPointerException
- if any argument is null
public ProxyTrustExporter(Exporter mainExporter, Exporter bootExporter, ClassLoader loader)
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.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, or
null
NullPointerException
- if either exporter argument is
null
public Remote export(Remote impl) throws ExportException
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.export
in interface Exporter
impl
- a remote object to exportExportException
- 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
exporterIllegalArgumentException
- 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")
permissionpublic boolean unexport(boolean force)
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.unexport
in interface Exporter
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 progresstrue
if the remote object is unexported when
this method returns and false
otherwiseIllegalStateException
- if the unexport of either remote object
throws IllegalStateException