Classloading – Visibility of Resources
Table of contents |
With the introduction of “Isolated mode”, modules can be developed in two different modes (“isolated” and “legacy”), whereby both modes can also be used in one module (“mixed mode”).
The module developer continues to be responsible for deciding what visibility certain resources have within the module or on the server. Resources used within a module can be visible server-wide or locally within a module. Mixed modules are also possible.
Possible combinations within a component or a module:
- Resource is available server-wide and is isolated
- Resource is available locally within a module and is isolated
- Resource is available server-wide and is not isolated (legacy mode)
- Resource is available locally within a module and is not isolated (legacy mode)
Classes and other resources are defined in the module and in the components in <resource> entries (see Optionale Einträge (→Manual for Module Developers)). These refer to a jar file or a directory. To use these entries in Classloader, they are unpacked by FirstSpirit (module installation, server start-up) and put in a temporary directory.
Global Resources (scope="server")
Global resources are also available to other modules on the server. However, all classes are in a namespace and each class can therefore only exist once. It is for this reason that different versions of a class cannot be used.
Resources Locally Within a Module (scope="module")
Resources locally within a module are only available within the module. Each module sees “its” local resources and all global resources (e.g., libraries of other modules). Different versions of the same class can therefore exist in different modules without affecting each other (depending on the area of validity).
The following applies: Classes from globally defined jars cannot use classes from jars defined locally within a module. However, the reverse is possible.
Isolated Resources (mode="isolated")
Only interfaces of FirstSpirit API (“Runtime API”, see figure), resources locally within a module (implementation classes and libraries of the module) and globally available resources of other modules can be used as resources for module development.
Implementation classes and libraries within FirstSpirit are no longer seen by Classloader and can no longer be used.
Non-Isolated Resources (mode="legacy")
Interfaces of FirstSpirit API (“Runtime API”, see figure), resources locally within a module (implementation classes and libraries of the module) and globally available resources of other modules can be used as resources for module development.
Implementation classes and libraries within FirstSpirit are also available via Classloader (current standard behavior).