On Wed, Aug 5, 2009 at 17:47, Vincent Massol<[email protected]> wrote: > Hi, > > This is following the proposal done here some time ago: > http://markmail.org/message/nnybto3mluvp2rov > > Since we now have a generic Script notion we need to revisit it in > that light. Also we really need to implement it now since more and > more components are put in the velocity context (office importer, > syntax factory, etc) and we need to bring some order. > > Here's a new generic proposal: > > Short term > ======== > > * The variable "services" is bound in the script context. For ex in > Velocity: $services > * The Services object (ScriptServiceManager) has a ScriptService > get(String serviceName) method which returns the service > * We use the namespace: services.<module name>.<method>. Each module > provides only one service entry point. > * ScriptService interface (empty interface) represents a service to > be bound in the context > * ScriptServiceManager.get() looks for all components of role > ScriptService and returns the component matching the the name as the > component hint. > > Ex: > > @Component("mymodule") > public class MyModuleScriptService implements ScriptService, > MyModuleBusinessInterface > { > public void myMethod() {} > } > > In script: > > {{velocity}} > $services.mymodule.myMethod > {{/velocity}}
+1 > > Medium term > ========== > > * We handle @authorization(Authorization.PROGRAMMING) annotations to > check for access rights. To do this in ScriptServiceManager.get() we > use a Dynamic Proxy to implement MyModuleBusinessInterface (we > probably need a ScriptService.getInterface() method to make it > unambiguous). The Dynamic Proxy checks the annotation before proxying > to the real object. +1 > > WDYT? > > Thanks > -Vincent > > PS: This is to answer Sergiu's question about where is > getAvailableParserSyntaxes() from my other mail... ;) Answer: It would > be in RenderingScriptService. > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > -- Thomas Mortagne _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

