Feature
 Completed
  • Closed XWIKI-5195 Allow implementing any component from the wiki, using objects

Description

Goal

Be able to implements any component in a wiki page like we implement wiki macro in a wiki page.

Prototype in contrib's sandbox : http://svn.xwiki.org/svnroot/xwiki/contrib/sandbox/xwiki-wiki-components/

Descriptor

ComponentClass (1 object)

Indicate the page is a component.

  • implemented role
  • role hint

ComponentRequirementClass (several objects)

Indicate which components the page require

  • role
  • role hint
  • binding name
  • type (single, list, map)

ComponentMethod (several objects)

Describe one method of the component, that's the tricky part. This object contains the actual implementation of the method (like wiki macro object contains the implementation of Macro#execute component method).

  • method name
  • method implementation

A method is not more than input and output so the idea is to have something like:

{{velocity}}
#set($param1 = $xcontext.method.input.1)
$xcontext.method.output.returnValue("return first param ${param} as string")
{{/velocity}}

If $xcontext.method.output.returnValue() as not been called rendering the resulting XDOM with plain/1.0 renderer and return it if the return type is a string.

Access to an equivalent of this is made available through the binding xcontext.method.component.

Implementation

Use a proxy to implement the component role and execute proper wiki content for each method.


 


Tags:
Created by Ecaterina Moraru (Valica) on 2013/11/06 14:13
    

Get Connected