Engine Demonstration #3

[ engine demonstrations | engine overview | imnmotion.com | Stephen W. Cote ]

Engine Demonstration #3 exemplifies an engine implementation that leverages the TaskService to load an application level configuration file and an engine configuration file. The files required for this demonstration are as follows:

The purpose of this demonstration is to import arbitrary XHTML into the engine using a custom engine configuration element. In Demonstration #2, the engine loads the engine configuration engine_config.xml through a task list, and the engine content is static XHTML within the specified page configuration, demonstration_2. In this demonstration, the page configuration is modified to use the engine configuration syntax to define a custom element that will synchronously import XHTML into the engine, where the path to the XHTML is dynamically set when the engine is started. For that reason, the engine configuration shouldn't be applied until the dynamic value is set.

The XML-based engine configuration syntax is handled as follows:

The object-definition syntax is self-referential in regards to the XML document and matching element. The object request aliases (ORA) are used to access these references. This approach provides developers with declarative access into the engine API at runtime.

Alternately, instead of using a dynamic path, a src attribute could be set on the import-xml element, and the first parameter in the object_definition, which is ora:data_source for this demonstration, could be changed to ora:src_attr. Any ORA parameter ending in _attr is discovered, making the src attribute arbitrary.

If you see the text Engine Loaded in the following block, then the demonstration succeeded. If the engine is not started text does not vanish, you may be using an unsupported browser or there may be a bug in the software.

engine is not started

The Engine for Web Applications should start almost immediately. If this message does not disappear, there may be a bug with the software, a connectivity problem to the server, or you may be using an unsupported browser.

Engine Configuration XML

<?xml version="1.0" encoding="iso-8859-1" ?>
<engine-configurations>

   <page-configuration id = "demonstration_3">
      <h2>Start External Data</h2>

      <import-xml id = "import_1_xml" />

      <h2>Stop External Data</h2>      
   </page-configuration>

   <object-definitions>
      <!-- abstract definition for the imported data -->
      <definition id = "import-data">
         <implementation abstract = "1" />
      </definition>

      <!-- definition to import data -->
      <definition id="import-xml">
         <implementation context-switch = "1" context-path = "/import-data">
            <package pid="org.cote.js.xml" />
            <constructor name="getXml">
               <param value="ora:data_source" />
               <param value="ora:integer_0" />
               <param value="ora:integer_0" />
               <param value="ora:id_attr" />
               <param value="ora:integer_1" />
            </constructor>
         </implementation>
      </definition>

   </object-definitions>

</engine-configurations>

Message Output

The following output is from the subscription to the send messages publication.