Cernunnos Manual


<spring-beans>

Description:

Creates a spring context from the XML bean definition file specified by LOCATION, registers all the beans contained therein as request attributes, then invokes SUBTASKS.

Reagents:

Name XPath Description Reagent Type Expected Type Required
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 @location 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
CACHE @cache If true (the default), this task will retain and reuse an existing ApplicationContext unless/until either: (1) a different XML file is specified; or (2) this reagent becomes false. PHRASE java.lang.Boolean No
SUBTASKS * The set of tasks that are children of this task. NODE_LIST java.util.List No

Examples:

Loads a Spring bean container defined in 'datasourceContext.xml' which contains a DataSource, then begins a transaction, then queries that DataSource for the 'user_id' associated with the 'admin' account, then performs an 'upsert' operation on the 'up_user_profile' table:

 
       
        <spring-beans location="datasourceContext.xml"> 
          <with-attribute key="SqlAttributes.DATA_SOURCE" value="${PortalDb}"> 
            <sql-transaction> 
              <sql-upsert> 
                <update-statement>UPDATE up_user_profile SET profile_name = 'HTML browser profile' WHERE user_id = ?</update-statement>  
                <insert-statement>INSERT INTO up_user_profile(user_id, profile_id, profile_name, description, layout_id, structure_ss_id, theme_ss_id) VALUES(?, 1, 'HTML browser profile', 'A sample profile for common web browsers', 1, 1 1)</insert-statement>  
                <parameter value="${sql(SELECT user_id FROM up_user WHERE user_name = 'admin')}"/> 
              </sql-upsert> 
            </sql-transaction> 
          </with-attribute> 
        </spring-beans>