Idoc URAs Advanced Guide
System Development Guides
Release Notes
License
Change History
NetKernel History
Acknowledgements

Idoc as an Accessor Guide

How to make an Idoc an Active Accessor

In the URA development guide we showed how to develop a custom Universal Resource Accesor and add it to the system. In this guide we show how to use an idoc as a URA.

A URA is simply an interface that returns a resource. It is therefore quite straightforward to take an Idoc and make it accessible as a URA. It can be very convenient to be able to use an idoc as a URA.

IdocAccessorAccessor

A special URA is provided org.ten60.netkernel.dpml.IdocAccessorAccessor which provides a wrapper which issues a DPML execution request. An Idoc can therefore be executed as though it is a standard accessor simply by mapping the URA reference to the IdocAccessorAccessor and providing the uri of the idoc to execute.

We can illustrate with the Schematron Accessor. validateSchematron is a URA provided for Schematron shema validation. It is actually implemented as an idoc that executes a series of XSLT's in order to perform the validation.

Here's the rewrite entry for the schematron Accessor - it maps the active:schematron... URI to the active:idoc... and sets the compound URI argument idocref to the schematron idoc. active:idoc is the URI to the IdocAccessorAccessor.

<rewrite>
  <rule>
    <match>^active:validateSchematron(.*)</match>
    <to>active:idoc$1+idocref@ffcpl:/org/ten60/netkernel/xml/accessor/schematronAccessor.idoc</to>
  </rule>
</rewrite>

The IdocAccessorAccessor passes all the arguments on the original request to the Idoc as URI arguments in a canonical parameter document. An Accessor idoc can therefore use arg:operand, arg:operator and arg:param to access the standard accessor arguments.

<idoc>
  <comment> (c) Copyright 2002,2003, 1060 Research Ltd This Software is licensed to You, the licensee, for use under the terms of the 1060 Public License v1.0. Please read and agree to the 1060 Public License v1.0 [www.1060research.com/license] before using or redistributing this software. In summary the 1060 Public license has the following conditions. A. You may use the Software free of charge provided you agree to the terms laid out in the 1060 Public License v1.0 B. You are only permitted to use the Software with components or applications that provide you with OSI Certified Open Source Code [www.opensource.org], or for which licensing has been approved by 1060 Research Limited. You may write your own software for execution by this Software provided any distribution of your software with this Software complies with terms set out in section 2 of the 1060 Public License v1.0 C. You may redistribute the Software provided you comply with the terms of the 1060 Public License v1.0 and that no warranty is implied or given. D. If you find you are unable to comply with this license you may seek to obtain an alternative license from 1060 Research Limited by contacting license@1060research.com or by visiting www.1060research.com NO WARRANTY: THIS SOFTWARE IS NOT COVERED BY ANY WARRANTY. SEE 1060 PUBLIC LICENSE V1.0 FOR DETAILS THIS COPYRIGHT NOTICE IS *NOT* THE 1060 PUBLIC LICENSE v1.0. PLEASE READ THE DISTRIBUTED 1060_Public_License.txt OR www.1060research.com/license File: $RCSfile: schematronAccessor.idoc,v $ Version: $Name: $ $Revision: 1.2 $ Last Modified: $Date: 2003/07/01 14:38:54 $ ******************************************* Schematron 1.5 Accessor ******************************************* Requires /xlib/schematron module. The Schematron Implementation: skeleton1-5.xsl, conformance1-5.xsl is copyright (C) 2000,2001 Rick Jelliffe and Academia Sinica Computing Center, Taiwan Licensed under Zlib/PNG license. ******************************************* </comment>
  <seq>
    <comment> ************** Build active validation transform from schema operand and conformance1-5 ************** </comment>
    <instr>
      <type>xslt</type>
      <operand>arg:operator</operand>
      <operator>schematron/conformance1-5.xsl</operator>
      <target>var:validator</target>
    </instr>
    <comment> ************** Validate operand against dynamically generated validator ************** </comment>
    <instr>
      <type>xslt</type>
      <operand>arg:operand</operand>
      <operator>var:validator</operator>
      <target>var:result</target>
    </instr>
    <comment> ************** Convert to Canonical Boolean ************** </comment>
    <instr>
      <type>xslt</type>
      <operand>var:result</operand>
      <operator>schematron/toBoolean.xsl</operator>
      <target>this:response</target>
    </instr>
    <instr>
      <type>cast</type>
      <operand>this:response</operand>
      <operator>
        <cast>
          <mimetype>text/xml</mimetype>
        </cast>
      </operator>
      <target>this:response</target>
    </instr>
  </seq>
</idoc>

1060® NetKernelTM Documentation
(C) 2003-2004 1060 Research Limited

Send Feedback

© 2003,2004, 1060® Research Limited
1060 registered trademark, NetKernel trademark of 1060 Research Limited