On Oct 31, 2008, at 11:18 AM, Jerome Velociter wrote:
Dear devs,
Regarding XWIKI-2784 (Create a {{map}} macro for XWiki Syntax 2.0),
I'd
like to discuss the way I should go to have several implementations
available for the same macro.
The idea is for one to be able to chose a map provider (google, MS
live,
yahoo, etc.). From a syntax point of view, there are 2 possibilities :
1. Using a parameter : {{map service="google" .../}}
2. Using aliases for the macro {{livemap .../}}
(and 3. supporting both)
I'd go for 2 with common implementation. Something like:
AbstractMapMacro and then GoogleMapMacro, LiveMapMacro, YahooMapMacro,
etc.
Thanks
-Vincent
For 2. we could implement one macro per supported service, all of them
using the same parameters bean. There might be some redundant code
though, that would need to be extracted in a common class (for example
the code to generate the proper JS call according to the parameters,
as
I plan to have a common JS interface for all services, and load the
proper one according to the service requested).
For 1. (or for 3.) I guess it would mean a unique macro class entry
point. Then a possibility I discussed with Thomas could be to have a
component interface for generating blocks for a map (MapProvider, or
something like this), and one implementation of that component per
service. The macro would then lookup for the proper implementation
according to the alias used or the parameters used.
WDYT ? Do I miss something there ?
Jerome.