KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > ModuleFactory


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Nokia. Portions Copyright 2005 Nokia. All Rights Reserved.
17  */

18 package org.netbeans;
19
20 import java.io.File JavaDoc;
21 import java.io.IOException JavaDoc;
22 import java.util.jar.Manifest JavaDoc;
23
24 /**
25  * Allows creation of custom modules. The factories are searched in
26  * the default lookup (org.openide.util.Lookup.getDefault()). If there is one
27  * it is used - if there are more of them arbitrary one is used (so please make
28  * sure that there is only one present in the installation). If there is none
29  * in the default lookup the system will use an instance of this class.
30  *
31  * @author David Strupl
32  */

33 public class ModuleFactory {
34
35     /**
36      * This method creates a "standard" module. Standard modules can be
37      * disabled, reloaded, autoloaded (loaded only when needed).
38      * @see StandardModule
39      */

40     public Module create(File JavaDoc jar, Object JavaDoc history, boolean reloadable,
41             boolean autoload, boolean eager, ModuleManager mgr, Events ev)
42             throws IOException JavaDoc {
43         return new StandardModule(mgr, ev, jar, history, reloadable, autoload, eager);
44     }
45     /**
46      * This method creates a "fixed" module. Fixed modules cannot be
47      * realoaded, are always enabled and are typically present on the
48      * classpath.
49      * @see FixedModule
50      */

51     public Module createFixed(Manifest JavaDoc mani, Object JavaDoc history,
52             ClassLoader JavaDoc loader, ModuleManager mgr, Events ev)
53             throws InvalidException {
54         return new FixedModule(mgr, ev, mani, history, loader);
55     }
56     /**
57      * Allows specifying different parent classloader of all modules classloaders.
58      */

59     public ClassLoader JavaDoc getClasspathDelegateClassLoader(ModuleManager mgr, ClassLoader JavaDoc del) {
60         return del;
61     }
62     
63     /**
64      * If this method returns true the parent the original classpath
65      * classloader will be removed from the parent classloaders of a module classloader.
66      */

67     public boolean removeBaseClassLoader() {
68         return false;
69     }
70     
71 }
72
Popular Tags