Type: New Feature
Affects Version/s: None
Fix Version/s: future
Number of attachments :
Assembly of an application can be simplified by allowing the user to only specify the minimum amount of information required to assemble a component. Currently Loom requires all components to explicitly declare all the other components that they depend upon.
However in many cases it is possible to automatically deduce the dependencys for a component. Each component is described by a BlockInfo object. The BlockInfo object defines a set of services it depends upon.
So for each service the following process could be followed;
- If user specifies it in assembly.xml then use that
- If user leaves it unsepcified, search all the Blocks in an application and find out which of those blocks implement service.
- If no blocks implement service then generate an error
- If one block implements service then use that
- If multiple blocks implement service then Select one based on heuristics
The way to implement this is as follows;
1. Define a set of classes similar to those in metadata package. With the exception that they are read-write and capable of being changed at runtime. You will end up with BlockCandidate, DependencyCandidate, etc
2. Extend the assembly.xml file format to take a version attribute at top of file (ie <assembly version="1.1">)
3. Read assembly.xml into Candidate objects.
4. Create a pluggable interface via which selection of service can be done (when multiple blocks implement required service). Something like
float rateService( ComponentCandidate consumer,
ServiceDescriptor service )
5. Scan through blocks to find the candidate services, rank them using the selector and choose the hihest ranked service.
6. When all dependencies are resolved turn the candidate objects into MetaData objects and procede with application startup