Difference between revisions of "Placeholders"

From GreenVulcano Wiki
Jump to: navigation, search
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{GVESB}} provides some placeholders and metadata. Their numerous applications range from the property definitions and attribute settings to more concrete applications as the evaluations of JavaScript scripts and database queries.
+
{{GVESB}} provides some placeholders and metadata. Their numerous applications range from the property definitions and attribute settings to more concrete applications as the evaluations of JavaScript scripts and database queries. Placeholders can be nested.
  
 
Next comes a table with all the metadata used by {{GVESB}} and their description. It is also available for each item a link for deepening into, with concrete examples.
 
Next comes a table with all the metadata used by {{GVESB}} and their description. It is also available for each item a link for deepening into, with concrete examples.
Line 16: Line 16:
 
| [[Placeholders Example|<nowiki>%{{package}}</nowiki>]] || Represents the object package name
 
| [[Placeholders Example|<nowiki>%{{package}}</nowiki>]] || Represents the object package name
 
|-
 
|-
| [[Placeholders Example|<nowiki>${{propname}} </nowiki>]] || Use this if you want a property previously defined by System. <br/> ''propname'' represents the System property name
+
| [[Placeholders Example|<nowiki>${{propname}} </nowiki>]] || Returns the value of the ''propname'' system property
 
|-
 
|-
| [[Placeholders Example|<nowiki>sp{{propname}} </nowiki>]] || Use this if you want a property previously defined by System. <br/> ''propname'' represents the System property name
+
| [[Placeholders Example|<nowiki>sp{{propname}} </nowiki>]] || Returns the value of the ''propname'' system property
 
|-
 
|-
 
| [[Placeholders Example|<nowiki>@{{propname}} </nowiki>]] || Use this if you want a property passed as input. <br/> ''propname'' represents the inProperties property name
 
| [[Placeholders Example|<nowiki>@{{propname}} </nowiki>]] || Use this if you want a property passed as input. <br/> ''propname'' represents the inProperties property name
Line 34: Line 34:
 
| [[Placeholders Example|<nowiki>xpath{{field://name::path}}</nowiki>]] || If ''field'' begin with ''file://'' the following string must be a name of a file in the classpath on which apply the xpath. Then is read by XMLConfig class
 
| [[Placeholders Example|<nowiki>xpath{{field://name::path}}</nowiki>]] || If ''field'' begin with ''file://'' the following string must be a name of a file in the classpath on which apply the xpath. Then is read by XMLConfig class
 
|-
 
|-
| [[Placeholders Example|<nowiki>js{{scope::script}}</nowiki>]] || Evaluates a JavaScript script, using the scope ''scope''. The [[GVBuffer]] is added to the scope as ''object''
+
| [[Placeholders Example|<nowiki>js{{scope::script}}</nowiki>]] || Evaluates a JavaScript script, using the scope ''scope''. The [[GVBuffer]] is added to the scope as ''object'' variable
 
|-
 
|-
| [[Placeholders Example|<nowiki>sql{{[conn::]statement}}</nowiki>]] || Executes a select sql statement and returns the value of the first field of the first selected record.<br/> The ''conn'' parameter is the name of a connection defined in [[JDBCConnectionBuilder|GVAdapter.xml JDBCConnectionBuilder]] or the JNDI name of a DataSource
+
| [[Placeholders Example|<nowiki>sql{{[conn::]statement}}</nowiki>]] || Executes a select sql statement and returns the value of the first field of the first selected record.<br/> The ''conn'' parameter is the name of a connection defined in GVAdapter.xml/[[GVJDBCConnectionBuilder]]] or the JNDI name of a DataSource
 
|-
 
|-
| [[Placeholders Example|<nowiki>sqllist{{[conn::[::sep]]statement}}</nowiki>]] || Executes a select sql statement and returns the value of the first field of all selected records as  as a 'sep' (default to comma) separated list. <br/> The ''conn'' parameter is the name of a connection defined in [[JDBCConnectionBuilder|GVAdapter.xml JDBCConnectionBuilder]] or the JNDI name of a DataSource
+
| [[Placeholders Example|<nowiki>sqllist{{[conn::[::sep]]statement}}</nowiki>]] || Executes a select sql statement and returns the value of the first field of all selected records as  as a 'sep' (default to comma) separated list. <br/> The ''conn'' parameter is the name of a connection defined in GVAdapter.xml/[[GVJDBCConnectionBuilder]] or the JNDI name of a DataSource
 
|-
 
|-
| [[Placeholders Example|<nowiki>sqltable{{conn::statement}}</nowiki>]] || Executes a select sql statement and returns all values of returned cursor as a XML. <br/> For instance, if the cursor has 3 values, the returned XML will have following fields:
+
| [[Placeholders Example|<nowiki>sqltable{{conn::statement}}</nowiki>]] || Executes a select sql statement and returns all values of returned cursor as a XML. <br/> For instance, if the cursor has 3 fields, the returned XML will have following fields:
 
<syntaxhighlight lang="XML">
 
<syntaxhighlight lang="XML">
 
<RowSet>
 
<RowSet>
Line 58: Line 58:
 
</RowSet>
 
</RowSet>
 
</syntaxhighlight>
 
</syntaxhighlight>
The ''conn'' parameter is the name of a connection defined in [[JDBCConnectionBuilder|GVAdapter.xml JDBCConnectionBuilder]] or the JNDI name of a DataSource
+
The ''conn'' parameter is the name of a connection defined in GVAdapter.xml/[[GVJDBCConnectionBuilder]] or the JNDI name of a DataSource
 
|-
 
|-
| [[Placeholders Example|<nowiki>ognl{{script}}</nowiki>]] || Evaluates a OGNL script. The [[GVBuffer]] is added to the context as ''object'' (and is also the object on which executes the script)
+
| [[Placeholders Example|<nowiki>ognl{{script}}</nowiki>]] || Evaluates a OGNL script. The [[GVBuffer]] is added to the context as ''<nowiki>#object</nowiki>'' variable (and is also the context object on which executes the script)
 
|-
 
|-
 
| [[Placeholders Example|<nowiki>escJS{{string}}</nowiki>]] || escapes invalid JavaScript characters from 'string' (ex. ' -> \')
 
| [[Placeholders Example|<nowiki>escJS{{string}}</nowiki>]] || escapes invalid JavaScript characters from 'string' (ex. ' -> \')
 
|-
 
|-
| [[Placeholders Example|<nowiki>escSQL{{string}}</nowiki>]] || escapes invalid SQL characters from 'string' (ex. ' -> '')
+
| [[Placeholders Example|<nowiki>escSQL{{string}}</nowiki>]] || escapes invalid SQL characters from 'string' (ex. ' -> <nowiki>''</nowiki>)
 
|-
 
|-
| [[Placeholders Example|<nowiki>escXML{{string}}</nowiki>]] || escapes invalid XML characters from 'string' (ex. ' -> &apos;)
+
| [[Placeholders Example|<nowiki>escXML{{string}}</nowiki>]] || escapes invalid XML characters from 'string' (ex. ' -> <nowiki>&apos;</nowiki>)
 
|-
 
|-
 
| [[Placeholders Example|<nowiki>replace{{string::search::subst}}</nowiki>]] || replaces in ''string'' all occurrences of ''search'' with ''replace''
 
| [[Placeholders Example|<nowiki>replace{{string::search::subst}}</nowiki>]] || replaces in ''string'' all occurrences of ''search'' with ''replace''
 
|}
 
|}
 +
 +
 +
<div class="version_ge3.3.2">
 +
{|class="gvtable"
 +
! Placeholders / Metadata !! Brief description
 +
|-
 +
| [[Placeholders Example|<nowiki>env{{propname}} </nowiki>]] || Returns the value of the ''propname'' environment variable
 +
|}
 +
</div>
 +
 +
<div class="version_ge3.3.3">
 +
{|class="gvtable"
 +
! Placeholders / Metadata !! Brief description
 +
|-
 +
| [[Placeholders Example|<nowiki>urlEnc{{string}} </nowiki>]] || URL encode invalid characters from 'string'
 +
|-
 +
| [[Placeholders Example|<nowiki>urlDec{{string}} </nowiki>]] || decode URL encoded characters from 'string'
 +
|}
 +
</div>

Latest revision as of 14:37, 31 October 2013

GreenVulcano® ESB provides some placeholders and metadata. Their numerous applications range from the property definitions and attribute settings to more concrete applications as the evaluations of JavaScript scripts and database queries. Placeholders can be nested.

Next comes a table with all the metadata used by GreenVulcano® ESB and their description. It is also available for each item a link for deepening into, with concrete examples.

Placeholders / Metadata Brief description
xmlp{{propname}} Used by XML configuration reading framework. Replaces in file filename.xml the occurrences of xmlp{{prop}} with the prop value defined in the filename.properties file, before parsing the XML document.
fixed You can use a text string
%{{class}} Represents the object class name
%{{fqclass}} Represents the object fully qualified class name
%{{package}} Represents the object package name
${{propname}} Returns the value of the propname system property
sp{{propname}} Returns the value of the propname system property
@{{propname}} Use this if you want a property passed as input.
propname represents the inProperties property name
timestamp{{pattern}} Returns the current timestamp formatted as pattern. The pattern syntax is like the SimpleDateFormat class
dateformat{{date::source-pattern::dest-pattern}} Use this if you want to change the date format from source-pattern to dest-pattern. the pattern syntax is like the SimpleDateFormat class
decode{{field[::cond1::val1][::cond2::val2][cond...n::val...n]::default}} Works as the if-then-else construct: if field is equal to cond1, return the value of val1, ...; if field is equal to condn, return the value of valn; otherwise default
decodeL{{sep::field[::cond1::val1][::cond2::val2][cond...n::val...n]::default}} It is equivalent to decode, with the difference that condX can be a list of values separated by sep
xpath{{field::path}} Parses the inProperties field value (must contain a XML string), then applies the xpath and returns the found value
xpath{{field://name::path}} If field begin with file:// the following string must be a name of a file in the classpath on which apply the xpath. Then is read by XMLConfig class
js{{scope::script}} Evaluates a JavaScript script, using the scope scope. The GVBuffer is added to the scope as object variable
sql{{[conn::]statement}} Executes a select sql statement and returns the value of the first field of the first selected record.
The conn parameter is the name of a connection defined in GVAdapter.xml/GVJDBCConnectionBuilder] or the JNDI name of a DataSource
sqllist{{[conn::[::sep]]statement}} Executes a select sql statement and returns the value of the first field of all selected records as as a 'sep' (default to comma) separated list.
The conn parameter is the name of a connection defined in GVAdapter.xml/GVJDBCConnectionBuilder or the JNDI name of a DataSource
sqltable{{conn::statement}} Executes a select sql statement and returns all values of returned cursor as a XML.
For instance, if the cursor has 3 fields, the returned XML will have following fields:
<RowSet>
   <data>
      <row>
         <col>value1</col>
         <col>value2</col>
         <col>value3</col>
      </row>
      ...
      <row>
         <col>valuex</col>
         <col>valuey</col>
         <col>valuez</col>
      </row>
   </data>
</RowSet>

The conn parameter is the name of a connection defined in GVAdapter.xml/GVJDBCConnectionBuilder or the JNDI name of a DataSource

ognl{{script}} Evaluates a OGNL script. The GVBuffer is added to the context as #object variable (and is also the context object on which executes the script)
escJS{{string}} escapes invalid JavaScript characters from 'string' (ex. ' -> \')
escSQL{{string}} escapes invalid SQL characters from 'string' (ex. ' -> '')
escXML{{string}} escapes invalid XML characters from 'string' (ex. ' -> ')
replace{{string::search::subst}} replaces in string all occurrences of search with replace


Placeholders / Metadata Brief description
env{{propname}} Returns the value of the propname environment variable
Placeholders / Metadata Brief description
urlEnc{{string}} URL encode invalid characters from 'string'
urlDec{{string}} decode URL encoded characters from 'string'