- java.lang.Object
-
- java.rmi.server.RMIClassLoaderSpi
-
public abstract class RMIClassLoaderSpi extends Object
RMIClassLoaderSpi
is the service provider interface forRMIClassLoader
. In particular, anRMIClassLoaderSpi
instance provides an implementation of the following static methods ofRMIClassLoader
:RMIClassLoader.loadClass(URL,String)
RMIClassLoader.loadClass(String,String)
RMIClassLoader.loadClass(String,String,ClassLoader)
RMIClassLoader.loadProxyClass(String,String[],ClassLoader)
RMIClassLoader.getClassLoader(String)
RMIClassLoader.getClassAnnotation(Class)
RMIClassLoader
for a description of how a provider instance is chosen.- Since:
- 1.4
- See Also:
RMIClassLoader
-
-
Constructor Summary
Constructors Constructor and Description RMIClassLoaderSpi()
-
Method Summary
Methods Modifier and Type Method and Description abstract String
getClassAnnotation(Class<?> cl)
Provides the implementation forRMIClassLoader.getClassAnnotation(Class)
.abstract ClassLoader
getClassLoader(String codebase)
Provides the implementation forRMIClassLoader.getClassLoader(String)
.abstract Class<?>
loadClass(String codebase, String name, ClassLoader defaultLoader)
Provides the implementation forRMIClassLoader.loadClass(URL,String)
,RMIClassLoader.loadClass(String,String)
, andRMIClassLoader.loadClass(String,String,ClassLoader)
.abstract Class<?>
loadProxyClass(String codebase, String[] interfaces, ClassLoader defaultLoader)
Provides the implementation forRMIClassLoader.loadProxyClass(String,String[],ClassLoader)
.
-
-
-
Method Detail
-
loadClass
public abstract Class<?> loadClass(String codebase, String name, ClassLoader defaultLoader) throws MalformedURLException, ClassNotFoundException
Provides the implementation forRMIClassLoader.loadClass(URL,String)
,RMIClassLoader.loadClass(String,String)
, andRMIClassLoader.loadClass(String,String,ClassLoader)
. Loads a class from a codebase URL path, optionally using the supplied loader. Typically, a provider implementation will attempt to resolve the named class using the givendefaultLoader
, if specified, before attempting to resolve the class from the codebase URL path.An implementation of this method must either return a class with the given name or throw an exception.
- Parameters:
codebase
- the list of URLs (separated by spaces) to load the class from, ornull
name
- the name of the class to loaddefaultLoader
- additional contextual class loader to use, ornull
- Returns:
- the
Class
object representing the loaded class - Throws:
MalformedURLException
- ifcodebase
is non-null
and contains an invalid URL, or ifcodebase
isnull
and a provider-specific URL used to load classes is invalidClassNotFoundException
- if a definition for the class could not be found at the specified location
-
loadProxyClass
public abstract Class<?> loadProxyClass(String codebase, String[] interfaces, ClassLoader defaultLoader) throws MalformedURLException, ClassNotFoundException
Provides the implementation forRMIClassLoader.loadProxyClass(String,String[],ClassLoader)
. Loads a dynamic proxy class (seeProxy
that implements a set of interfaces with the given names from a codebase URL path, optionally using the supplied loader.An implementation of this method must either return a proxy class that implements the named interfaces or throw an exception.
- Parameters:
codebase
- the list of URLs (space-separated) to load classes from, ornull
interfaces
- the names of the interfaces for the proxy class to implementdefaultLoader
- additional contextual class loader to use, ornull
- Returns:
- a dynamic proxy class that implements the named interfaces
- Throws:
MalformedURLException
- ifcodebase
is non-null
and contains an invalid URL, or ifcodebase
isnull
and a provider-specific URL used to load classes is invalidClassNotFoundException
- if a definition for one of the named interfaces could not be found at the specified location, or if creation of the dynamic proxy class failed (such as ifProxy.getProxyClass(ClassLoader,Class[])
would throw anIllegalArgumentException
for the given interface list)
-
getClassLoader
public abstract ClassLoader getClassLoader(String codebase) throws MalformedURLException
Provides the implementation forRMIClassLoader.getClassLoader(String)
. Returns a class loader that loads classes from the given codebase URL path.If there is a security manger, its
checkPermission
method will be invoked with aRuntimePermission("getClassLoader")
permission; this could result in aSecurityException
. The implementation of this method may also perform further security checks to verify that the calling context has permission to connect to all of the URLs in the codebase URL path.- Parameters:
codebase
- the list of URLs (space-separated) from which the returned class loader will load classes from, ornull
- Returns:
- a class loader that loads classes from the given codebase URL path
- Throws:
MalformedURLException
- ifcodebase
is non-null
and contains an invalid URL, or ifcodebase
isnull
and a provider-specific URL used to identify the class loader is invalidSecurityException
- if there is a security manager and the invocation of itscheckPermission
method fails, or if the caller does not have permission to connect to all of the URLs in the codebase URL path
-
getClassAnnotation
public abstract String getClassAnnotation(Class<?> cl)
Provides the implementation forRMIClassLoader.getClassAnnotation(Class)
. Returns the annotation string (representing a location for the class definition) that RMI will use to annotate the class descriptor when marshalling objects of the given class.- Parameters:
cl
- the class to obtain the annotation for- Returns:
- a string to be used to annotate the given class when
it gets marshalled, or
null
- Throws:
NullPointerException
- ifcl
isnull
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
19/12/2024 08:51:32 Cette version de la page est en cache (à la date du 19/12/2024 08:51:32) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 30/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-java/rmi/server/rmiclassloaderspi.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.