API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.rmi.server. RMIClassLoaderSpi View Javadoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175

/*
 * @(#)RMIClassLoaderSpi.java	1.16 06/04/07
 *
 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

package java.rmi.server;

import java.net.MalformedURLException;
import java.net.URL;

/**
 * <code>RMIClassLoaderSpi</code> is the service provider interface for
 * <code>RMIClassLoader</code>.
 *
 * In particular, an <code>RMIClassLoaderSpi</code> instance provides an
 * implementation of the following static methods of
 * <code>RMIClassLoader</code>:
 *
 * <ul>
 *
 * <li>{@link RMIClassLoader#loadClass(URL,String)}
 * <li>{@link RMIClassLoader#loadClass(String,String)}
 * <li>{@link RMIClassLoader#loadClass(String,String,ClassLoader)}
 * <li>{@link RMIClassLoader#loadProxyClass(String,String[],ClassLoader)}
 * <li>{@link RMIClassLoader#getClassLoader(String)}
 * <li>{@link RMIClassLoader#getClassAnnotation(Class)}
 *
 * </ul>
 *
 * When one of those methods is invoked, its behavior is to delegate
 * to a corresponding method on an instance of this class.
 * The details of how each method delegates to the provider instance is
 * described in the documentation for each particular method.
 * See the documentation for {@link RMIClassLoader} for a description
 * of how a provider instance is chosen.
 *
 * @version	1.16, 06/04/07
 * @author	Peter Jones
 * @author	Laird Dornin
 * @see		RMIClassLoader
 * @since	1.4
 */
public abstract class RMIClassLoaderSpi {

    /**
     * Provides the implementation for
     * {@link RMIClassLoader#loadClass(URL,String)},
     * {@link RMIClassLoader#loadClass(String,String)}, and
     * {@link RMIClassLoader#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 given <code>defaultLoader</code>,
     * if specified, before attempting to resolve the class from the
     * codebase URL path.
     *
     * <p>An implementation of this method must either return a class
     * with the given name or throw an exception.
     *
     * @param	codebase the list of URLs (separated by spaces) to load
     * the class from, or <code>null</code>
     *
     * @param	name the name of the class to load
     *
     * @param	defaultLoader additional contextual class loader
     * to use, or <code>null</code>
     *
     * @return	the <code>Class</code> object representing the loaded class
     *
     * @throws	MalformedURLException if <code>codebase</code> is
     * non-<code>null</code> and contains an invalid URL, or
     * if <code>codebase</code> is <code>null</code> and a provider-specific
     * URL used to load classes is invalid
     *
     * @throws	ClassNotFoundException if a definition for the class
     * could not be found at the specified location
     */
    public abstract Class<?> loadClass(String codebase, String name,
				       ClassLoader defaultLoader)
	throws MalformedURLException, ClassNotFoundException;
    
    /**
     * Provides the implementation for
     * {@link RMIClassLoader#loadProxyClass(String,String[],ClassLoader)}.
     *
     * Loads a dynamic proxy class (see {@link java.lang.reflect.Proxy}
     * that implements a set of interfaces with the given names
     * from a codebase URL path, optionally using the supplied loader.
     * 
     * <p>An implementation of this method must either return a proxy
     * class that implements the named interfaces or throw an exception.
     *
     * @param	codebase the list of URLs (space-separated) to load
     * classes from, or <code>null</code>
     *
     * @param	interfaces the names of the interfaces for the proxy class
     * to implement
     *
     * @return	a dynamic proxy class that implements the named interfaces
     *
     * @param	defaultLoader additional contextual class loader
     * to use, or <code>null</code>
     *
     * @throws	MalformedURLException if <code>codebase</code> is
     * non-<code>null</code> and contains an invalid URL, or
     * if <code>codebase</code> is <code>null</code> and a provider-specific
     * URL used to load classes is invalid
     *
     * @throws	ClassNotFoundException 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 if
     * {@link java.lang.reflect.Proxy#getProxyClass(ClassLoader,Class[])}
     * would throw an <code>IllegalArgumentException</code> for the given
     * interface list)
     */
    public abstract Class<?> loadProxyClass(String codebase,
					    String[] interfaces,
					    ClassLoader defaultLoader)
	throws MalformedURLException, ClassNotFoundException;

    /**
     * Provides the implementation for
     * {@link RMIClassLoader#getClassLoader(String)}.
     *
     * Returns a class loader that loads classes from the given codebase
     * URL path.
     *
     * <p>If there is a security manger, its <code>checkPermission</code>
     * method will be invoked with a
     * <code>RuntimePermission("getClassLoader")</code> permission;
     * this could result in a <code>SecurityException</code>.
     * 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.
     *
     * @param	codebase the list of URLs (space-separated) from which
     * the returned class loader will load classes from, or <code>null</code>
     *
     * @return a class loader that loads classes from the given codebase URL
     * path
     *
     * @throws	MalformedURLException if <code>codebase</code> is
     * non-<code>null</code> and contains an invalid URL, or
     * if <code>codebase</code> is <code>null</code> and a provider-specific
     * URL used to identify the class loader is invalid
     *
     * @throws	SecurityException if there is a security manager and the
     * invocation of its <code>checkPermission</code> method fails, or
     * if the caller does not have permission to connect to all of the
     * URLs in the codebase URL path
     */
    public abstract ClassLoader getClassLoader(String codebase)
	throws MalformedURLException; // SecurityException

    /**
     * Provides the implementation for
     * {@link RMIClassLoader#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.
     *
     * @param	cl the class to obtain the annotation for
     *
     * @return	a string to be used to annotate the given class when
     * it gets marshalled, or <code>null</code>
     *
     * @throws	NullPointerException if <code>cl</code> is <code>null</code>
     */
    public abstract String getClassAnnotation(Class<?> cl);
}

Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar