Java Doc for ModuleManager.java in  » IDE-Netbeans » library » org » netbeans » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » library » org.netbeans 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.netbeans.ModuleManager

ModuleManager
final public class ModuleManager (Code)
Manages a collection of modules. Must use ModuleManager.mutex to access its important methods.
author:
   Jesse Glick


Field Summary
static  booleanPRINT_TOPOLOGICAL_EXCEPTION_STACK_TRACES
    
final public static  StringPROP_CLASS_LOADER
    
final public static  StringPROP_ENABLED_MODULES
    
final public static  StringPROP_MODULES
    

Constructor Summary
public  ModuleManager(ModuleInstaller installer, Events ev)
     Create a manager, initially with no managed modules.

Method Summary
final public  voidaddPropertyChangeListener(PropertyChangeListener l)
     Add a change listener. Only the declared properties will be fired, and they are not guaranteed to be fired synchronously with the change (currently they are not in fact, for safety).
 voidassertWritable()
     Assert that the current thread state permits writing.
public  Modulecreate(File jar, Object history, boolean reloadable, boolean autoload)
    
public  Modulecreate(File jar, Object history, boolean reloadable, boolean autoload, boolean eager)
     Create a module from a JAR and add it to the managed set. Will initially be disabled, unless it is eager and can be enabled immediately. May throw an IOException if the JAR file cannot be opened for some reason, or is malformed. If there is already a module of the same name managed, throws a duplicate exception.
public  ModulecreateFixed(Manifest mani, Object history, ClassLoader loader)
     Create a fixed module (e.g.
public  ModulecreateFixed(Manifest mani, Object history, ClassLoader loader, boolean autoload, boolean eager)
     Create a fixed module (e.g.
public  voiddelete(Module m)
     Remove a module from the managed set.
final public  voiddisable(Module m)
     Disable a single module.
public  voiddisable(Set<Module> modules)
     Disable a set of modules together.
final public  voidenable(Module m)
     Enable a single module.
public  voidenable(Set<Module> modules)
     Enable a set of modules together. Must have satisfied their dependencies (possibly with one another). Must not contain autoload nor eager modules. Might contain fixed modules (they can only be installed once of course). It is permissible to pass in modules which in fact at runtime cannot satisfy their package dependencies, or which ModuleInstaller.prepare rejects on the basis of missing contents.
final  voidfireModulesCreatedDeleted(Set created, Set deleted)
    
final  voidfirePropertyChange(String prop, Object old, Object nue)
    
final  voidfireReloadable(Module m)
     For access from Module.
final public  Moduleget(String codeNameBase)
     Convenience method to find a module by name.
public  ClassLoadergetClassLoader()
     Get a classloader capable of loading from any of the enabled modules or their declared extensions.
final public  Set<Module>getEnabledModules()
     Get a set of modules managed which are currently enabled.
final public  EventsgetEvents()
     Access for ManifestSection.
public  Set<Module>getModuleInterdependencies(Module m, boolean reverse, boolean transitive)
     Get a set of modules depended upon or depending on this module.
public  LookupgetModuleLookup()
     Retrieve set of modules in Lookup form. The core top manager should install this into the set of available lookups.
public  Set<Module>getModules()
     Get a set of Module s being managed.
 ManifestloadManifest(File jar)
    
 Set<Union2<Dependency, InvalidException>>missingDependencies(Module probed)
    
final public  Mutexmutex()
     Get a locking mutex for this module installer. All calls other than adding or removing property change listeners, or getting the module lookup, called on this class must be done within the scope of this mutex (with read or write access as appropriate).
final public  Mutex.PrivilegedmutexPrivileged()
     Classes in this package can, if careful, use the privileged form.
 voidreadOnly(boolean ro)
     Sets the r/o flag.
public  voidrefineClassLoader(Module m, List parents)
     Used by Module to communicate with the ModuleInstaller re.
 voidrefineDependencies(Module m, Set<Dependency> dependencies)
     Used by Module to communicate with the ModuleInstaller re.
 String[]refineProvides(Module m)
    
public  voidreleaseModuleManifests()
     Release storage for all module manifests.
public  voidreload(Module m)
     Reload a module.
final public  voidremovePropertyChangeListener(PropertyChangeListener l)
     Remove a change listener.
public  booleanshouldDelegateResource(Module m, Module parent, String pkg)
     Use by OneModuleClassLoader to communicate with the ModuleInstaller re.
public  booleanshutDown()
     Try to shut down the system.
public  booleanshutDown(Runnable midHook)
     Try to shut down the system.
public  List<Module>simulateDisable(Set<Module> modules)
     Simulate what would happen if a set of modules were to be disabled.
public  List<Module>simulateEnable(Set<Module> modules)
     Simulate what would happen if a set of modules were to be enabled.

Field Detail
PRINT_TOPOLOGICAL_EXCEPTION_STACK_TRACES
static boolean PRINT_TOPOLOGICAL_EXCEPTION_STACK_TRACES(Code)



PROP_CLASS_LOADER
final public static String PROP_CLASS_LOADER(Code)



PROP_ENABLED_MODULES
final public static String PROP_ENABLED_MODULES(Code)



PROP_MODULES
final public static String PROP_MODULES(Code)




Constructor Detail
ModuleManager
public ModuleManager(ModuleInstaller installer, Events ev)(Code)
Create a manager, initially with no managed modules. The handler for installing modules is given. Also the sink for event messages must be given.




Method Detail
addPropertyChangeListener
final public void addPropertyChangeListener(PropertyChangeListener l)(Code)
Add a change listener. Only the declared properties will be fired, and they are not guaranteed to be fired synchronously with the change (currently they are not in fact, for safety). The change events are not guaranteed to provide an old and new value, so you will need to use the proper getter methods. When the changes are fired, you are inside the mutex with read access.



assertWritable
void assertWritable() throws IllegalThreadStateException(Code)
Assert that the current thread state permits writing. Currently does not check that there is a write mutex! (Pending #13352.) But does check that I am not firing changes.
throws:
  IllegalThreadStateException - if currently firing changes



create
public Module create(File jar, Object history, boolean reloadable, boolean autoload) throws IOException, DuplicateException(Code)

See Also:   ModuleManager.create(File,Object,boolean,boolean,boolean)



create
public Module create(File jar, Object history, boolean reloadable, boolean autoload, boolean eager) throws IOException, DuplicateException(Code)
Create a module from a JAR and add it to the managed set. Will initially be disabled, unless it is eager and can be enabled immediately. May throw an IOException if the JAR file cannot be opened for some reason, or is malformed. If there is already a module of the same name managed, throws a duplicate exception. In this case you may wish to delete the original and try again. You must give it some history object which can be used to provide context for where the module came from and whether it has been here before. You cannot request that a module be both autoload and eager.



createFixed
public Module createFixed(Manifest mani, Object history, ClassLoader loader) throws InvalidException, DuplicateException(Code)
Create a fixed module (e.g. from classpath). Will initially be disabled.



createFixed
public Module createFixed(Manifest mani, Object history, ClassLoader loader, boolean autoload, boolean eager) throws InvalidException, DuplicateException(Code)
Create a fixed module (e.g. from classpath) with optional autoload and eager flags. Will initially be disabled.
since:
   2.7



delete
public void delete(Module m) throws IllegalArgumentException(Code)
Remove a module from the managed set. Must be disabled first. Must not be a "fixed" module.



disable
final public void disable(Module m) throws IllegalArgumentException(Code)
Disable a single module. Must not be required by any enabled modules. Must not be an autoload module, when supported.



disable
public void disable(Set<Module> modules) throws IllegalArgumentException(Code)
Disable a set of modules together. Must not be required by any enabled modules (except one another). Must not contain autoload nor eager modules. Must not contain fixed modules.



enable
final public void enable(Module m) throws IllegalArgumentException, InvalidException(Code)
Enable a single module. Must have satisfied its dependencies. Must not be an autoload module, when supported.



enable
public void enable(Set<Module> modules) throws IllegalArgumentException, InvalidException(Code)
Enable a set of modules together. Must have satisfied their dependencies (possibly with one another). Must not contain autoload nor eager modules. Might contain fixed modules (they can only be installed once of course). It is permissible to pass in modules which in fact at runtime cannot satisfy their package dependencies, or which ModuleInstaller.prepare rejects on the basis of missing contents. In such a case InvalidException will be thrown and nothing will be installed. The InvalidException in such a case should contain a reference to the offending module.



fireModulesCreatedDeleted
final void fireModulesCreatedDeleted(Set created, Set deleted)(Code)



firePropertyChange
final void firePropertyChange(String prop, Object old, Object nue)(Code)



fireReloadable
final void fireReloadable(Module m)(Code)
For access from Module.



get
final public Module get(String codeNameBase)(Code)
Convenience method to find a module by name. Returns null if there is no such managed module.



getClassLoader
public ClassLoader getClassLoader()(Code)
Get a classloader capable of loading from any of the enabled modules or their declared extensions. Should be used as the result of TopManager.systemClassLoader. Thread-safe.
See Also:   ModuleManager.PROP_CLASS_LOADER



getEnabledModules
final public Set<Module> getEnabledModules()(Code)
Get a set of modules managed which are currently enabled. Convenience method only.
See Also:   ModuleManager.PROP_ENABLED_MODULES



getEvents
final public Events getEvents()(Code)
Access for ManifestSection.
since:
   JST-PENDING needed by ManifestSection



getModuleInterdependencies
public Set<Module> getModuleInterdependencies(Module m, boolean reverse, boolean transitive)(Code)
Get a set of modules depended upon or depending on this module.

Note that provide-require/need dependencies are listed alongside direct dependencies; a module with a required token is considered to depend on all modules providing that token (though in fact only one is needed to enable it).

Illegal cyclic dependencies are omitted.
Parameters:
  m - a module to start from; may be enabled or not, but must be owned by this manager
Parameters:
  reverse - if true, find modules depending on this module; if false, findmodules this module depends upon
Parameters:
  transitive - if true, these dependencies are considered transitively as well a set (possibly empty) of modules managed by this manager, never including m
since:
   org.netbeans.core/1 > 1.17




getModuleLookup
public Lookup getModuleLookup()(Code)
Retrieve set of modules in Lookup form. The core top manager should install this into the set of available lookups. Will fire lookup events when the set of modules changes (not for enabling/disabling/etc.). No other subsystem should make any attempt to provide an instance of ModuleInfo via lookup, so an optimization could be to jump straight to this lookup when ModuleInfo/Module is requested.



getModules
public Set<Module> getModules()(Code)
Get a set of Module s being managed. No two contained modules may at any time share the same code name base.
See Also:   ModuleManager.PROP_MODULES



loadManifest
Manifest loadManifest(File jar) throws IOException(Code)



missingDependencies
Set<Union2<Dependency, InvalidException>> missingDependencies(Module probed)(Code)



mutex
final public Mutex mutex()(Code)
Get a locking mutex for this module installer. All calls other than adding or removing property change listeners, or getting the module lookup, called on this class must be done within the scope of this mutex (with read or write access as appropriate). Methods on ModuleInfo need not be called within it; methods specifically on Module do need to be called within it (read access is sufficient). Note that property changes are fired with read access already held for convenience. Please avoid entering the mutex from "sensitive" threads such as the event thread, the folder recognizer/lookup thread, etc., or with other locks held (such as the Children mutex), especially when entering the mutex as a writer: actions such as enabling modules in particular can call arbitrary foreign module code which may do a number of strange things (including consuming a significant amount of time and waiting for other tasks such as lookup or data object recognition). Use the request processor or the IDE's main startup thread or the execution engine to be safe.



mutexPrivileged
final public Mutex.Privileged mutexPrivileged()(Code)
Classes in this package can, if careful, use the privileged form.
since:
   JST-PENDING this had to be made public as the package is now split in two



readOnly
void readOnly(boolean ro)(Code)
Sets the r/o flag. Access from ChangeFirer.
Parameters:
  ro - if true, cannot make any changes until set to false again



refineClassLoader
public void refineClassLoader(Module m, List parents)(Code)
Used by Module to communicate with the ModuleInstaller re. classloader.



refineDependencies
void refineDependencies(Module m, Set<Dependency> dependencies)(Code)
Used by Module to communicate with the ModuleInstaller re. dependencies.



refineProvides
String[] refineProvides(Module m)(Code)
Allows the installer to add provides (used to provide name of platform we run on)



releaseModuleManifests
public void releaseModuleManifests()(Code)
Release storage for all module manifests.
See Also:   Module.releaseManifest



reload
public void reload(Module m) throws IllegalArgumentException, IOException(Code)
Reload a module. This could make a fresh copy of its JAR file preparing to enable it with different contents; at least it will rescan the manifest. It must currently be disabled and not "fixed", and it will stay disabled after this call; to actually reinstall it requires a separate call. It may or may not actually be marked "reloadable", but for greatest reliability it should be. Besides actually reloading the contents, any cached information about failed dependencies or runtime problems with the module is cleared so it may be tried again.



removePropertyChangeListener
final public void removePropertyChangeListener(PropertyChangeListener l)(Code)
Remove a change listener.



shouldDelegateResource
public boolean shouldDelegateResource(Module m, Module parent, String pkg)(Code)
Use by OneModuleClassLoader to communicate with the ModuleInstaller re. masking.



shutDown
public boolean shutDown()(Code)
Try to shut down the system. First all modules are asked if they wish to close, in the proper order. Assuming they say yes, then they are informed of the close. Returns true if they all said yes.



shutDown
public boolean shutDown(Runnable midHook)(Code)
Try to shut down the system. First all modules are asked if they wish to close, in the proper order. Assuming they say yes, a hook is run, then they are informed of the close. If they did not agree to close, the hook is not run.
Parameters:
  midHook - a hook to run before closing modules if they agree to close true if they all said yes and the module system is now shut down
since:
   org.netbeans.core/1 1.11



simulateDisable
public List<Module> simulateDisable(Set<Module> modules) throws IllegalArgumentException(Code)
Simulate what would happen if a set of modules were to be disabled. None of the listed modules may be autoload modules, nor eager, nor currently disabled, nor fixed. The returned set will list all modules that would actually be disabled, meaning the listed modules, plus any currently enabled but unlisted modules (including autoloads) that require some listed modules, plus any autoloads which would no longer be needed as they were only required by modules otherwise disabled. Provide-require pairs count for purposes of disablement: if the set of requested modules includes all remaining enabled providers of some token, and modules requiring that token will need to be disabled as well. Modules are returned in an order in which they could be disabled (where dependent modules are always disabled before base modules).



simulateEnable
public List<Module> simulateEnable(Set<Module> modules) throws IllegalArgumentException(Code)
Simulate what would happen if a set of modules were to be enabled. None of the listed modules may be autoload modules, nor eager, nor currently enabled, though they may be fixed (if they have not yet been enabled). It may happen that some of them do not satisfy their dependencies. It may also happen that some of them require other, currently disabled, modules to be enabled in order for them to be enabled. It may further happen that some currently disabled eager modules could be enabled as a result of these modules being enabled. The returned set is the set of all modules that actually could be enabled. It will include the requested modules, minus any that cannot satisfy their dependencies (even on each other), plus any managed but currently disabled modules that would need to be enabled (including autoload modules required by some listed module but not by any currently enabled module), plus any eager modules which can be enabled with the other enablements (and possibly any autoloads needed by those eager modules). Where a requested module requires some token, either it will not be included in the result (in case the dependency cannot be satisfied), or it will, and all modules providing that token which can be included will be included, even if it would suffice to choose only one - unless a module providing that token is already enabled or in the requested list, in which case just the requested module will be listed. Modules are returned in an order in which they could be enabled (where base modules are always enabled before dependent modules). Note that the returned list might include modules which in fact cannot be enabled either because some package dependencies (which are checked only on a live classloader) cannot be met; or ModuleInstaller.prepare indicates that the modules are not in a valid format to install; or creating the module classloader fails unexpectedly.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.