Hint

From APIDesign

(Difference between revisions)
Jump to: navigation, search

JaroslavTulach (Talk | contribs)
(New page: Hint in a modular system allows expressing, default, preferred and actual solution to particular configuration problem. A module system like Jigsaw may use hints to elimina...)
Next diff →

Current revision

Hint in a modular system allows expressing, default, preferred and actual solution to particular configuration problem. A module system like Jigsaw may use hints to eliminate the NP-Complete nature of its JigsawServices.

Levels of Configuration

The general principle should be: the one that knows more should make the decision:

  1. a JAXP API knows it needs an implementation of its API and it knows that Xerces module provides one that is good enough. This is an example of Convention over Configuration - unless somebody overrides my default, use Xerces.
  2. the application vendor (providing the application module) knows all the modules in its application and all the services and can decide certain services should have different default (this is what Maven tries to do with its shortest path dependency). Also when compiling the whole application, it should be easy to decide whether different services are compatible with the rest of modules or not as one knows the transitive closure of the whole application.
  3. a deployer should have the option to override the application defaults without coding in Java of course one needs to install com.myapp.xsltproc module into the appropriate Jigsaw library as well as org.apache.crimson module, so the resolver can enable both.

The 3rd level could be achieved from a command line or by using configuration file of yet undefined format:

$ java \
  -module com.myapp.xsltproc \
  -service javax.xml.parser.DocumentBuilderFactory \
  -default org.apache.crimson.CrimsonBuilderFactory
Personal tools
buy