KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > classloading > spi > DomainClassLoader


1 /*
2  * JBoss, Home of Professional Open Source
3  * Copyright 2005, JBoss Inc., and individual contributors as indicated
4  * by the @authors tag. See the copyright.txt in the distribution for a
5  * full listing of individual contributors.
6  *
7  * This is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this software; if not, write to the Free
19  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21  */

22 package org.jboss.classloading.spi;
23
24 import java.io.IOException JavaDoc;
25 import java.net.URL JavaDoc;
26 import java.util.Enumeration JavaDoc;
27
28 /**
29  * A classloader that can be put in a domain
30  *
31  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
32  * @version $Revision: 57133 $
33  */

34 public interface DomainClassLoader
35 {
36    /**
37     * The domain of the classloader
38     *
39     * @return the domain
40     */

41    ClassLoadingDomain getDomain();
42
43    /**
44     * Set the domain of the classloader
45     *
46     * @param domain the domain
47     */

48    void setDomain(ClassLoadingDomain domain);
49
50    /**
51     * Get the classpath
52     *
53     * @return the classpath
54     */

55    public URL JavaDoc[] getClasspath();
56
57    /**
58     * Load a class
59     *
60     * @param name the name
61     * @return the class
62     * @throws ClassNotFoundException
63     */

64    Class JavaDoc loadClass(String JavaDoc name) throws ClassNotFoundException JavaDoc;
65
66    /**
67     * Load a class
68     *
69     * @param name the class name
70     * @param resolve whether to resolve the class
71     * @return the class
72     * @throws ClassNotFoundException when there is not class
73     */

74    Class JavaDoc loadClassLocally(String JavaDoc name, boolean resolve) throws ClassNotFoundException JavaDoc;
75    
76    /**
77     * Get a resource
78     *
79     * @param name the resource name
80     * @return the resource or null if not found
81     */

82    URL JavaDoc loadResourceLocally(String JavaDoc name);
83    
84    /**
85     * Find resources locally
86     *
87     * @param name the name of the resource
88     * @return the resources
89     * @throws IOException for any error
90     */

91    Enumeration JavaDoc<URL JavaDoc> findResourcesLocally(String JavaDoc name) throws IOException JavaDoc;
92
93    /**
94     * Get the possible package names associated with the class loader. This
95     * may be a superset of the currently defined Packages.
96     *
97     * @return unique package names of classes available to the class loader.
98     */

99    public String JavaDoc[] getPackageNames();
100    /**
101     * Get the packages defined by the classloader
102     *
103     * @return the packages
104     */

105    Package JavaDoc[] getPackages();
106
107    /**
108     * Get a package defined by the classloader
109     *
110     * @param name the name of the package
111     * @return the package
112     */

113    Package JavaDoc getPackage(String JavaDoc name);
114 }
115
Popular Tags