KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > osgi > baseadaptor > hooks > ClassLoadingStatsHook


1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.osgi.baseadaptor.hooks;
13
14 import java.net.URL JavaDoc;
15 import org.eclipse.osgi.baseadaptor.HookRegistry;
16 import org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry;
17 import org.eclipse.osgi.baseadaptor.loader.ClasspathEntry;
18 import org.eclipse.osgi.baseadaptor.loader.ClasspathManager;
19
20 /**
21  * A ClassLoadingStatsHook hooks into the <code>ClasspathManager</code> class. This class allows
22  * a hook to record statistics about classloading.
23  * @see ClasspathManager
24  * @see HookRegistry#getClassLoadingStatsHooks()
25  * @see HookRegistry#addClassLoadingStatsHook(ClassLoadingStatsHook)
26  * @since 3.2
27  */

28 public interface ClassLoadingStatsHook {
29     /**
30      * Gets called by a classpath manager during {@link ClasspathManager#findLocalClass(String)} before
31      * searching the local classloader for a class. A classpath manager will call this method for
32      * each configured class loading stat hook.
33      * @param name the name of the requested class
34      * @param manager the classpath manager used to find and load the requested class
35      * @throws ClassNotFoundException to prevent the requested class from loading
36      */

37     void preFindLocalClass(String JavaDoc name, ClasspathManager manager) throws ClassNotFoundException JavaDoc;
38
39     /**
40      * Gets called by a classpath manager during {@link ClasspathManager#findLocalClass(String)} after
41      * searching the local classloader for a class. A classpath manager will call this method for
42      * each configured class loading stat hook.
43      * @param name the name of the requested class
44      * @param clazz the loaded class or null if not found
45      * @param manager the classpath manager used to find and load the requested class
46      */

47     void postFindLocalClass(String JavaDoc name, Class JavaDoc clazz, ClasspathManager manager) throws ClassNotFoundException JavaDoc;
48
49     /**
50      * Gets called by a classpath manager during {@link ClasspathManager#findLocalResource(String)} before
51      * searching the local classloader for a resource. A classpath manager will call this method for
52      * each configured class loading stat hook.
53      * @param name the name of the requested resource
54      * @param manager the classpath manager used to find the requested resource
55      */

56     void preFindLocalResource(String JavaDoc name, ClasspathManager manager);
57
58     /**
59      * Gets called by a classpath manager during {@link ClasspathManager#findLocalResource(String)} after
60      * searching the local classloader for a resource. A classpath manager will call this method for
61      * each configured class loading stat hook.
62      * @param name the name of the requested resource
63      * @param resource the URL to the requested resource or null if not found
64      * @param manager the classpath manager used to find the requested resource
65      */

66     void postFindLocalResource(String JavaDoc name, URL JavaDoc resource, ClasspathManager manager);
67
68     /**
69      * Gets called by a classpath manager after a successfully defining a class. This method allows
70      * a class loading stat hook to record data about a class definition.
71      * @param name the name of the class that got defined
72      * @param clazz the class object that got defined
73      * @param classbytes the class bytes used to define the class
74      * @param classpathEntry the ClasspathEntry where the class bytes got read from
75      * @param entry the BundleEntyr source of the class bytes
76      * @param manager the classpath manager used to define the class
77      */

78     void recordClassDefine(String JavaDoc name, Class JavaDoc clazz, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager);
79
80 }
81
Popular Tags