Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: c10632a3e407ebf19d44e16c52f43407568e90ac (plain) (blame)
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
/*******************************************************************************
 * Copyright (c) 2005, 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.osgi.baseadaptor.loader;

import java.net.URL;
import java.security.ProtectionDomain;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile;
import org.eclipse.osgi.framework.adaptor.BundleClassLoader;

/**
 * The actual class loader object used to define classes for a classpath manager.
 * This interface provides public versions of a few methods on class loader.
 * @see ClasspathManager
 * @since 3.2
 */
public interface BaseClassLoader extends BundleClassLoader {
	/**
	 * Returns the domain for the host bundle of this class loader
	 * @return the domain for the host bundle of this class loader
	 */
	ProtectionDomain getDomain();

	/**
	 * Creates a classpath entry with the given bundle file and domain
	 * @param bundlefile the source bundle file for a classpath entry
	 * @param cpDomain the source domain for a classpath entry
	 * @return a classpath entry with the given bundle file and domain
	 */
	ClasspathEntry createClassPathEntry(BundleFile bundlefile, ProtectionDomain cpDomain);

	/**
	 * Defines a Class.
	 * @param name the name of the class to define
	 * @param classbytes the bytes of the class to define
	 * @param classpathEntry the classpath entry used to load the class bytes
	 * @param entry the bundle entry used to load the class bytes
	 * @return a defined Class
	 */
	Class defineClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry);

	/**
	 * A public version of the ClassLoader.findLoadedClass(java.lang.String) method.
	 * @param classname the class name to find.
	 * @return a loaded class
	 */
	Class publicFindLoaded(String classname);

	/**
	 * A public version of the ClassLoader#getPackage(java.lang.String) method.
	 * @param pkgname the package name to get.
	 * @return the package or null if it does not exist
	 */
	Object publicGetPackage(String pkgname);

	/**
	 * A public version of the ClassLoader#definePackage(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.net.URL) method.
	 * @return a defined Package
	 */
	Object publicDefinePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase);

	/**
	 * Returns the ClasspathManager for this BaseClassLoader
	 * @return the ClasspathManager
	 */
	ClasspathManager getClasspathManager();
}

Back to the top