Placeholders

From GreenVulcano Wiki
Revision as of 14:37, 31 October 2013 by G.dimaio (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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'