JBoss Community Archive (Read Only)

WildFly 8

Create the schema

First, let us define the schema for our subsystem. Rename src/main/resources/schema/mysubsystem.xsd to src/main/resources/schema/acme.xsd. Then open acme.xsd and modify it to the following

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"

   <!-- The subsystem root element -->
   <xs:element name="subsystem" type="subsystemType"/>
   <xs:complexType name="subsystemType">
         <xs:element name="deployment-types" type="deployment-typesType"/>
   <xs:complexType name="deployment-typesType">
      <xs:choice minOccurs="0" maxOccurs="unbounded">
         <xs:element name="deployment-type" type="deployment-typeType"/>
   <xs:complexType name="deployment-typeType">
      <xs:attribute name="suffix" use="required"/>
      <xs:attribute name="tick" type="xs:long" use="optional" default="10000"/>
Note that we modified the xmlns and targetNamespace values to urn.com.acme.corp.tracker:1.0. Our new subsystem element has a child called deployment-types, which in turn can have zero or more children called deployment-type. Each deployment-type has a required suffix attribute, and a tick attribute which defaults to true.

Now modify the com.acme.corp.tracker.extension.SubsystemExtension class to contain the new namespace.

public class SubsystemExtension implements Extension {

    /** The name space used for the {@code substystem} element */
    public static final String NAMESPACE = "urn:com.acme.corp.tracker:1.0";
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 13:50:36 UTC, last content change 2012-05-29 15:04:51 UTC.