Cernunnos Manual


${crn()}

Description:

Returns the product of evaluating the Cernunnos script specified by LOCATION; use the <return> task to set the return value within the specified script.

Reagents:

Name XPath Description Reagent Type Expected Type Required
CACHE @cache A shared Map to cache items in. The default is the value of the 'Attributes.CACHE' request attribute. PHRASE java.util.Map No
CACHE_MODEL @cache-model Specify either NONE, ONE, or ALL. PHRASE java.lang.String No
CONTEXT @context Optional context from which missing elements of the LOCATION will be inferred if it is relative. The default is the value of the 'Attributes.ORIGIN' request attribute. PHRASE java.lang.String No
LOCATION descendant-or-self::text() Optional location of a resource; if omitted, the value of the 'Attributes.LOCATION' request attribute will be used. LOCATION may be a filesystem path or a URL, and may be absolute or relative; if a relative value is provided, it will be resolved based on the value of CONTEXT. PHRASE java.lang.String No
TASK @task Cernunnos Task to invoke. Specify either LOCATION or TASK, but not both. PHRASE org.danann.cernunnos.Task No

Examples:

Invokes 'is-admin.crn' to deturmine if the user is an administrator, then either (1) deletes the file(s) specified on the command prompt or (2) gives the user appropriate feedback:

 
       
        <choose> 
          <when test="${crn(is-admin.crn)}"> 
            <argument-iterator> 
              <delete-file file="${Attributes.STRING}"/> 
            </argument-iterator> 
          </when>  
          <otherwise> 
            <echo-ln>You are not authorized to perform the specified action.</echo-ln> 
          </otherwise> 
        </choose>