Service Locator

aka protocols...

A 'protocol' is just simple, short, abstract string reference that refer to a real (but not known in details) provider/service -something that could provide any kind of responses or actions - placed in particular namespace (i.e. deep.protocols).

You use it to hide/abstract reals providers/services from your code.

For convenience, simplicity, and json compliance, 'protocol' itself is placed, inline, in front of ressources (string) path (or parameters or wathever) follwed by '::'.

Examples :

  • "json::/my/json/path.json"
  • "dom.htmlOf::#myDomID"
  • "dq::./*?something"

deepjs will retrieve those providers/services when needed, and acts therefore as an "abstract service locator".

It allow you to have fully "environnement dependent" providers/services, and so allow you to go much further than with simple, classical Service Locator Pattern. Firstly, by managing OCManager and secondly by playing with deep.context for you.

You'll place there your Restful services, your ressources providers (Json, html,...) or more subtil and helpful providers that you'll learn to use and create.