Difference between revisions of "Placeholders"

From GreenVulcano Wiki
Jump to: navigation, search
Line 40: Line 40:
 
| [[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 [[JDBCConnectionBuilder|GVAdapter.xml JDBCConnectionBuilder]] 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 64: Line 64:
 
| [[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''
 
|}
 
|}

Revision as of 11:00, 20 February 2012

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.

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}} Use this if you want a property previously defined by System.
propname represents the System property name
sp{{propname}} Use this if you want a property previously defined by System.
propname represents the System property name
@{{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
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 JDBCConnectionBuilder 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 JDBCConnectionBuilder 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 JDBCConnectionBuilder or the JNDI name of a DataSource

ognl{{script}} Evaluates a OGNL script. The GVBuffer is added to the context as object (and is also the 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