Project

General

Profile

Feature #5096

Updated by Reynaud Sylvain over 10 years ago

+Refactoring steps+: 
 1) replace @path-template with list of <argument> 

  * support <argument> for path() only. 
  * develop XSL to translate @path-template to <argument> (for lavoisier-update-config.sh). 

 2) replace XPath functions path() and request(). 


 +Replace @path-template with list of <argument>+: 
 * @name="string" 
 * @pattern="regexp | .*" 
 * @path-format=" | VALUE | name/value" 
 * @eval => the default value (_+example+: property('def')_). 
 * text() => the default value (_+NOTE+: not allowed if preceding-sibling::argument[text()='']_). 

 +Example+: 
 <pre><code class="xml"> 
 <view><!-- /vo/{vo=dteam}/{site=CC-IN2P3} --> 
     <argument name="vo" path-format="name/value">dteam</argument> 
     <argument name="site">CC-IN2P3</argument> 
 </view> 
 </code></pre> 

 +Replace XPath functions with+: 
 * STRING *variables* instead of path('k'). 
 * STRING path() and request() with no argument. args() and post()+: 
 * NODESET arguments() with path(    ) (_+NOTE+: 'key' no argument. more supported here_). 
 * NODE post() with no argument instead of request('k'). arguments( [<key>] ) => XML or [string] (_+NOTE+: 'path' is a reserved keyword for 'key'_). 
 * NODE current() as post(    ) => XML (_+NOTE+: a synonym of post() may be removed because it conflicts with for function current() in eval() ??? current()_). 

 +Modify XPath functions view() and view_request()+: 
 * NODE view(STRING, [<entry> NODESET]) instead of view(STRING, [STRING]). view( <view>, [<entries>] ) => XML. 
 * NODE view_post(STRING, NODE, [<entry> NODESET]) instead of view_request(STRING, NODE, [STRING]). 
 * OBJECT eval(STRING, [NODESET]) instead of eval(STRING, [BOOLEAN]). 
 * NODESET users(['IP | DN | LOGIN']). view_post( <view>, <post>, [<entries>] ) => XML. 

 +Function arguments() is a NODESET of <e:entry> documents, <e:entries> XML document, which contains *ALL* of the following following+: 
 * default values described in this *order*+: list of <argument> 
 * key/values extracted from query fields path 
 * key/values extracted from path query fields 
 * key/values extracted from posted HTML form 
 * default values described in list of <argument> 

 +Function post() is any XML document, which contains *ONLY ONE* of the following+: 
 * posted HTML form 
 * posted XML data 
 * XML data sent by view (_+NOTE+: using function view_post()_) 
 * NULL 

 +Example+: revert priority order or arguments +Examples+: 
 <pre><code class="xml"> 
 <view name="v1" xmlns:str="http://exslt.org/strings"> 
     <argument name="a">666</argument> 
     <argument name="b" eval="6 * 111"/> 
     <argument name="c"/> 
     <argument name="d"/> 
     <argument name="e"/> 
     <connector type="XMLConnector"> 
         <parameter name="content" eval="view('v2', 
   eval('entry(@name, text() | eval(@eval))', view('config')/*/lav:view[@name='v1']/lav:argument[text()!='' or @eval]) 
 | post()/*/* 
 | eval('entry(@name, str:split(path(),&quot;/&quot;)[position(current())])', 
                                              view('config')/*/lav:view[@name='v1']/lav:argument[not(@path-format='')]) 
 | arguments())"/> 
     </connector> 
 </view> 
 <view name="v2"> 
     <argument name="a"/><argument name="b"/><argument name="c"/><argument name="d"/><argument name="e"/> 
     <connector type="StringConnector"> 
         <parameter name="content" eval="concat($a,'/',$b,'/',$c,'/',$d,'/',$e)"/> 
     </connector> 
 </view> 
 </code></pre> 
 If URL is... 
 <pre> 
 POST http://localhost:8080/lavoisier/v1/path/path/path/path?a=query&b=query&c=query&d=query&e=query view('view1') 
 a=post view('view1', arguments()) 
 b=post view('view1', entries(entry('newK',arguments('oldK')))) 
 c=post view_post('view1', post(), arguments()) 
 </pre> 
 Then result is... 
 <pre>666/666/post/path/query

Back