net.jini.activation
Class ActivationExporter

java.lang.Object
  extended by net.jini.activation.ActivationExporter
All Implemented Interfaces:
Exporter

public final class ActivationExporter
extends Object
implements Exporter

An Exporter implementation for exporting an activatable remote object using its underlying exporter. The proxy returned by the export method activates the remote object on demand. Each instance of ActivationExporter can export only a single remote object.

Since:
2.0
Author:
Sun Microsystems, Inc.

Field Summary
private static Permission getClassLoaderPermission
          Cached getClassLoader permission
private  ActivationID id
          the activation identifier
private  ClassLoader loader
          The class loader to define the proxy class in
private  Exporter underlyingExporter
          the underlying exporter
private  boolean used
          If true, this exporter has already been used to export an object
 
Constructor Summary
ActivationExporter(ActivationID id, Exporter underlyingExporter)
          Creates an exporter for an activatable remote object with the specified activation identifier, underlying exporter, and a null class loader.
ActivationExporter(ActivationID id, Exporter underlyingExporter, ClassLoader loader)
          Creates an exporter for an activatable remote object with the specified activation identifier, underlying exporter, and class loader.
 
Method Summary
 Remote export(Remote impl)
          Exports an activatable remote object.
private static void getSuperinterfaces(Set list, Class cl, boolean isConstrainable, boolean checkPublic)
          Fills the given array list with the superinterfaces implemented by the given class eliminating duplicates.
 boolean unexport(boolean force)
          Unexports the activatable remote object that was previously exported via the export method of the underlying exporter supplied during construction of this exporter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

private final ActivationID id
the activation identifier


underlyingExporter

private final Exporter underlyingExporter
the underlying exporter


loader

private final ClassLoader loader
The class loader to define the proxy class in


used

private boolean used
If true, this exporter has already been used to export an object


getClassLoaderPermission

private static final Permission getClassLoaderPermission
Cached getClassLoader permission

Constructor Detail

ActivationExporter

public ActivationExporter(ActivationID id,
                          Exporter underlyingExporter)
Creates an exporter for an activatable remote object with the specified activation identifier, underlying exporter, and a null class loader.

Parameters:
id - an activation identifier
underlyingExporter - an exporter
Throws:
NullPointerException - if id or underlyingExporter is null

ActivationExporter

public ActivationExporter(ActivationID id,
                          Exporter underlyingExporter,
                          ClassLoader loader)
Creates an exporter for an activatable remote object with the specified activation identifier, underlying exporter, and class loader.

Parameters:
id - an activation identifier
underlyingExporter - an exporter
loader - the class loader to define the proxy class in, or null
Throws:
NullPointerException - if id or underlyingExporter is null
Method Detail

export

public Remote export(Remote impl)
              throws ExportException
Exports an activatable remote object. This exporter exports impl by calling the export method on the underlying exporter (supplied during construction of this exporter) to obtain an underlying proxy. It then constructs and returns a Proxy instance where:

Specified by:
export in interface Exporter
Parameters:
impl - a remote object to export
Returns:
a proxy for the remote object
Throws:
NullPointerException - if impl is null
IllegalStateException - if an object has already been exported with this Exporter instance
ExportException - if a problem occurs exporting impl or if the underlying proxy's class is non-public and implements non-public interfaces

unexport

public boolean unexport(boolean force)
Unexports the activatable remote object that was previously exported via the export method of the underlying exporter supplied during construction of this exporter. Returns the result of unexporting the remote object by calling the unexport method on the underlying exporter passing force as the argument.

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 an object has not been exported with this Exporter instance

getSuperinterfaces

private static void getSuperinterfaces(Set list,
                                       Class cl,
                                       boolean isConstrainable,
                                       boolean checkPublic)
                                throws ExportException
Fills the given array list with the superinterfaces implemented by the given class eliminating duplicates. If isConstrainable is true, then the ProxyTrust interface won't be added to the list.

Parameters:
list - the list to fill with interfaces
cl - the class to get the superinterfaces of
isConstrainable - true if proxy class implements RemoteMethodControl
checkPublic - true if proxy has a non-public class
Throws:
IllegalArgumentException - if the specified class implements any illegal remote interfaces
NullPointerException - if the specified class or list is null
ExportException - if proxy has a non-public class and implements a non-public interface


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