Powered by SmartDoc

RCDL

The Relaxer Component Definition Language (RCDL) is a component definition langugage.

The namespace of RCDL is "http://www.relaxer.org/xmlns/relaxer/cdl".

Elements of RCDL
element function
component RCDL top element
interface RIDL top element
invariant invariant constraint on a component instance

component

The component element is a top-level element of RCDL.

This element has the following attributes:

The name attribute specifies a component name. The namespace attribute specifies a namespace of the component. The name and the namespace are required attributes.

The component element has the following child elements:

There are two ways you can use the interface element in the RCDL.

One way is as an external reference to an interface, and another way is a concrete definition for an interface.

The specification element defines a specification of the component. The component element can have zero or one specification element.

The extension element defines extension points of the component. The component element can have zero or one extension element.

The realization element defines a realization of the component. The component element can have zero or one realization element.

Example

List 19.2.1.1.1[grammarComponent.rcdl] is a sample RIDL definition and List 19.2.1.1.2[grammarComponent.rng] is a sample RELAX NG schema used in the RIDL definition.

grammarComponent.rcdl
<component xmlns="http://www.relaxer.org/xmlns/cdl"
           namespace="http://example.com/account"
           name="accountManager">
  <interface namespace="http://example.com/account" name="accountManager">
<grammar namespace="http://example.com/account" \
    location="grammarComponent.rng"/>
    <operation name="findAccount">
      <in name="accountNo" type="token"/>
      <out label="account"/>
    </operation>
  </interface>
</component>
grammarComponent.rng
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <ref name="account"/>
  </start>
  <define name="account">
    <element name="account">
      <attribute name="accountNo">
        <data type="token"/>
      </attribute>
      <element name="balance">
        <data type="int"/>
      </element>
      <element name="owner">
        <data type="token"/>
      </element>
      <ref name="address"/>
      <zeroOrMore>
        <ref name="phone"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="address">
    <element name="address">
      <attribute name="zip">
        <data type="token"/>
      </attribute>
      <text/>
    </element>
  </define>
  <define name="phone">
    <element name="phone">
      <attribute name="area">
        <data type="token"/>
      </attribute>
      <data type="token"/>
    </element>
  </define>
</grammar>

interface (reference)

One type of the interface element is a reference to the interface. The interface element has the following attributes:

The location attribute specifies a reference to an interface. The location are a required attribure.

The java.type attribute specifies a Java class name. The java.type are an optional attribure.

Example

List 19.2.2.1.1[grammarInterfaceRef.rcdl] is a sample RCDL definition, List 19.2.2.1.2[grammarInterfaceRef.ridl] is a sample RIDL definition to be used in the sample RCDL definition, and List 19.2.2.1.3[grammarInterfaceRef.rng] is a sample RELAX NG schema to be used in the sample RIDL definition.

grammarInterfaceRef.rcdl
<component xmlns="http://www.relaxer.org/xmlns/cdl"
           namespace="http://example.com/account"
           name="accountManager">
  <interface href="grammarInterfaceRef.ridl"/>
</component>
grammarInterfaceRef.ridl
<interface xmlns="http://www.relaxer.org/xmlns/cdl"
           namespace="http://example.com/account" name="accountManager">
  <grammar namespace="http://example.com/account"
           location="grammarInterfaceRef.rng"/>
  <operation name="findAccount">
    <in name="accountNo" type="token"/>
    <out label="account"/>
  </operation>
</interface>
grammarInterfaceRef.rng
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <ref name="account"/>
  </start>
  <define name="account">
    <element name="account">
      <attribute name="accountNo">
        <data type="token"/>
      </attribute>
      <element name="balance">
        <data type="int"/>
      </element>
      <element name="owner">
        <data type="token"/>
      </element>
      <ref name="address"/>
      <zeroOrMore>
        <ref name="phone"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="address">
    <element name="address">
      <attribute name="zip">
        <data type="token"/>
      </attribute>
      <text/>
    </element>
  </define>
  <define name="phone">
    <element name="phone">
      <attribute name="area">
        <data type="token"/>
      </attribute>
      <data type="token"/>
    </element>
  </define>
</grammar>

interface (define)

Another type of interface element is a definition itself. This interface element has the following attributes:

The name attribute specifies an interface name. This attribute is required.

The namespace attribute specifies a namespace name. This attribute is optional.

The java.type attribute specifies a Java class name. This is also optional.

The interface has child elements as follows:

The grammar element defines a document type used in the interface. An interface element can have any number of grammar children.

The attribute element defines an attribute that RIDL supports. The interface element can have any number of attribute children.

The operation element defines an operation that RIDL supports. The interface element can have any number of operation children.

The specification element defines a specification of the component. The interface element can have zero or one specification element.

Example

List 19.2.3.1.1[grammarInterfaceDef.rcdl] is a sample RCDL definition and List 19.2.3.1.2[grammarInterfaceDef.rng] is a sample RELAX NG schema that may be used in the sample RCDL definition.

grammarInterfaceDef.rcdl
<component xmlns="http://www.relaxer.org/xmlns/cdl"
           namespace="http://example.com/account"
           name="accountManager">
  <interface namespace="http://example.com/account" name="accountManager">
    <grammar namespace="http://example.com/account"
             location="grammarInterfaceDef.rng"/>
    <operation name="findAccount">
      <in name="accountNo" type="token"/>
      <out label="account"/>
    </operation>
  </interface>
</component>
grammarInterfaceDef.rng
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <ref name="account"/>
  </start>
  <define name="account">
    <element name="account">
      <attribute name="accountNo">
        <data type="token"/>
      </attribute>
      <element name="balance">
        <data type="int"/>
      </element>
      <element name="owner">
        <data type="token"/>
      </element>
      <ref name="address"/>
      <zeroOrMore>
        <ref name="phone"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="address">
    <element name="address">
      <attribute name="zip">
        <data type="token"/>
      </attribute>
      <text/>
    </element>
  </define>
  <define name="phone">
    <element name="phone">
      <attribute name="area">
        <data type="token"/>
      </attribute>
      <data type="token"/>
    </element>
  </define>
</grammar>