Last modified 16 years ago
Last modified on 03/18/09 16:56:08
Analysis
Overview
The goal of this task is to solve the shared resources issue and to describe(and may be refactor) the way we get the class module instances.
Task requirements
- Create document(or write in the design section) how we set, get and use the instances of the module classes([module_name]Module).
- See which resources have to be shared and separate them in new src/main/resources/distrib folders.
- Think out a way to share the module resources and get them without problems. It must work with the fake and true launchers of the sophie2 platform.
- Create API in core.modularity which provides functionality for dealing with the resources.
- See if there are any static paths while getting the resources and change them with the newly created functions.
Task result
- classes in core.modularity
- information about the static instances
- new storage for the resources
Implementation idea
- When you write new module you must create static get() method which returns the instance of the class.
- Use ClassLoaders and streams while working with resources.
Related
PLUGIN_SUPPORT_LIB_BASE_R0
PLATFORM_DEPLOYMENT_BUILD_MAVEN_R1
How to demo
- Show the new classes and describe their functionality. Run tests if you manage to think out how to test the new API.
- Show the information about the instances.
- Show where the resources are stored.
Design
- When you create new Sophie module, first of all you should create instance of the module and get() method for getting it. The template is here:
trunk/sophie2-platform/dev-tools/eclipse_templates/module_templates/module_instance.xml. It is stored in PLATFORM_DEPLOYMENT_BUILD_ECLIPSE for now.
- Create distrib folders in src/main/resource folders where the modules should provide shared resources(these are the application resources as icons and book_templates and will be called file entries not to be messed with other sophie resources).
- For the resource API
- Create class in core.modularity which will represent the resource API.
- It has to:
- give resource for reading
- give resource for modifying
- list now available resources
- The main implementation can be separated in two parts. The differences between them are:
- Starting Sophie 2 through Eclipse
- The file entry manager looks for the wanted entries for reading in
- module_name/src/main/resources
- module_name/target/classes
- module_name/module_name-2.0-SNAPSHOT.jar
- The file entry manager creates temp directory(can be in sophie-platform/target/tmp-distrib) in which it writes the file entries, if they are wanted for modifying.
- The file entry manager looks for the wanted entries for reading in
- Starting Sophie 2 from the distribution
- The file entry manager reads the resources from the module jar files.
- The file entry manager writes the resources in sophie-edition/ folder(for example sophie2-author/).
- Starting Sophie 2 through Eclipse
- Note: To know weather the project is started under Eclipse or under distribution check if the current dir contains .jar file.
- More specific things for the implementation:
- Create method which returns list of all read-only roots(all of the places to be searched, described in 1.)
- Create method which returns path to the writable root which is temp-distirb or current distributed edition folder.
- Create method which searches recursively for the /modules folder from which you should search the file entries.
- TODO: add test revisions.
Implementation
1877 - FileEntryManager.java is the implementation.
Testing
Comments
(Write comments for this or later revisions here.)