44 | | * FileEntryManager.getRoRoots() currently searches for a "modules" dir from the current working directory to the root of the filesystem tree which is not cool because with JWS no such directory exists and the initial current working directory can be unpredictable. FileEntryManager needs this dir to find all .jars which correspond to Sophie modules and be able to look up inside them for resources, such as icons etc. |
45 | | In order to fix it, FileEntryManager will access the new ListProp<ModuleInfo>startedModules() of the running ModuleRegistry. |
46 | | * Both FakeModuleRegistry and TrueModuleRegistry will need to implement ListProp<ModuleInfo>startedModules(): |
47 | | * TrueModuleRegistry will implement it by getting a BundleContext and use it to get all the started Bundles and their URLs (in the case that a given URL is a local file path, it will be converted to absolute file path). Then it will create respective ModuleInfos and fill startedModules() with them. |
48 | | * FakeModuleRegistry will implement it by parsing the System.getProperty("java.class.path"), filter out "org.sophie2.<module-name>/target/*" entries and constructing URLs to the jars inside these locations, then respectively construct ModuleInfos and fill startedModules() with them. |
49 | | * The above mentioned BundleContext will be gotten from a newly created CoreModularityModule. As specified by the docs, a created BundleContext is passed to the start() and stop() methods of a Bundle, so that's where well save this BundleContext and expose it for public usage. This is ugly and according to the docs, a BundleContext instance is responsible only for the Bundle it's associated with, though we can access all started Bundles through any given BundleContext produced by the same Felix instance, so we'll exploit this "feature" and siut it for our needs (: |
| 44 | * '''FileEntryManager.getRoRoots()''' currently searches for a "modules" dir from the current working directory to the root of the filesystem tree which is not cool because with JWS no such directory exists and the initial current working directory can be unpredictable. '''FileEntryManager''' needs this dir to find all .jars which correspond to Sophie modules and be able to look up inside them for resources, such as icons etc. |
| 45 | In order to fix it, '''FileEntryManager''' will access the new '''ListProp<ModuleInfo>startedModules()''' of the running '''ModuleRegistry'''. |
| 46 | * Both '''FakeModuleRegistry''' and '''TrueModuleRegistry''' will need to implement '''ListProp<ModuleInfo>startedModules()''': |
| 47 | * '''TrueModuleRegistry''' will implement it by getting a '''BundleContext''' and use it to get all the started '''Bundle'''s and their URLs (in the case that a given URL is a local file path, it will be converted to absolute file path). Then it will create respective '''ModuleInfo'''s and fill '''startedModules()''' with them. |
| 48 | * '''FakeModuleRegistry''' will implement it by parsing the ''System.getProperty("java.class.path")'', filter out "org.sophie2.<module-name>/target/*" entries and constructing URLs to the jars inside these locations, then respectively construct '''ModuleInfo'''s and fill '''startedModules()''' with them. |
| 49 | * The above mentioned '''BundleContext''' will be gotten from a newly created '''CoreModularityModule'''. As specified by the docs, a created '''BundleContext''' is passed to the '''start()''' and '''stop()''' methods of a '''Bundle''', so that's where well save this '''BundleContext''' and expose it for public usage. This is ugly and according to the docs, a '''BundleContext''' instance is responsible only for the '''Bundle''' it's associated with, though we can access all started '''Bundle'''s through any given '''BundleContext''' produced by the same '''Felix''' instance, so we'll exploit this "feature" and suit it for our needs (: |