urf.xsd from http://schemas.ogf.org/urf/2003/09/url

TODO: Clarify OGF license with ASF legal
diff --git a/NOTICE b/NOTICE
index 77b7b4a..5a8ba6e 100644
--- a/NOTICE
+++ b/NOTICE
@@ -9,6 +9,35 @@
 These have been licensed to the Apache Software Foundation under a software grant.
 
 ---------------------------------------------------------
+taverna-server-usagerecord/src/main/xsd
+
+      Usage Record Working Group XML Schema definition (GFD.98)
+
+      Copyright (C) Open Grid Forum (2006-2007). All Rights Reserved.
+
+      This document and translations of it may be copied and furnished to
+      others, and derivative works that comment on or otherwise explain it or
+      assist in its implementation may be prepared, copied, published and
+      distributed, in whole or in part, without restriction of any kind,
+      provided that the above copyright notice and this paragraph are included
+      on all such copies and derivative works. However, this document itself
+      may not be modified in any way, such as by removing the copyright notice
+      or references to the OGF or other organizations, except as needed for
+      the purpose of developing Grid Recommendations in which case the
+      procedures for copyrights defined in the OGF Document process must be
+      followed, or as required to translate it into languages other than
+      English.
+
+      The limited permissions granted above are perpetual and will not be
+      revoked by the OGF or its successors or assignees.
+
+      This document and the information contained herein is provided on an "As
+      Is" basis and the OGF disclaims all warranties, express or implied,
+      including but not limited to any warranty that the use of the
+      information herein will not infringe any rights or any implied
+      warranties of merchantability or fitness for a particular purpose.
+---------------------------------------------------------
+
 
 TODO: Copyright from *.xsd
 TODO: GPL/CDDL ./taverna-server-webapp/src/misc/xsd/persistence_1_0.xsd
diff --git a/taverna-server-usagerecord/src/main/xsd/urf.xsd b/taverna-server-usagerecord/src/main/xsd/urf.xsd
new file mode 100644
index 0000000..2f3f2b5
--- /dev/null
+++ b/taverna-server-usagerecord/src/main/xsd/urf.xsd
@@ -0,0 +1,511 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified"
+        targetNamespace="http://schema.ogf.org/urf/2003/09/urf"
+        xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
+        xmlns:urf="http://schema.ogf.org/urf/2003/09/urf"
+        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <xsd:annotation>
+    <xsd:documentation xml:lang="en">
+      Usage Record Working Group XML Schema definition (GFD.98)
+
+      Copyright (C) Open Grid Forum (2006-2007). All Rights Reserved.
+
+      This document and translations of it may be copied and furnished to
+      others, and derivative works that comment on or otherwise explain it or
+      assist in its implementation may be prepared, copied, published and
+      distributed, in whole or in part, without restriction of any kind,
+      provided that the above copyright notice and this paragraph are included
+      on all such copies and derivative works. However, this document itself
+      may not be modified in any way, such as by removing the copyright notice
+      or references to the OGF or other organizations, except as needed for
+      the purpose of developing Grid Recommendations in which case the
+      procedures for copyrights defined in the OGF Document process must be
+      followed, or as required to translate it into languages other than
+      English.
+
+      The limited permissions granted above are perpetual and will not be
+      revoked by the OGF or its successors or assignees.
+
+      This document and the information contained herein is provided on an "As
+      Is" basis and the OGF disclaims all warranties, express or implied,
+      including but not limited to any warranty that the use of the
+      information herein will not infringe any rights or any implied
+      warranties of merchantability or fitness for a particular purpose.
+    </xsd:documentation>
+  </xsd:annotation>
+
+  <xsd:import namespace="http://www.w3.org/2000/09/xmldsig#"
+          schemaLocation="http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd" />
+
+  <xsd:complexType name="UsageRecordType">
+    <xsd:sequence>
+      <xsd:element maxOccurs="1" minOccurs="1" ref="urf:RecordIdentity" />
+      <xsd:element maxOccurs="1" minOccurs="0" ref="urf:JobIdentity" />
+      <xsd:element maxOccurs="unbounded" minOccurs="0"
+              ref="urf:UserIdentity" />
+      <xsd:element maxOccurs="1" minOccurs="0" ref="urf:JobName" />
+      <xsd:element maxOccurs="1" minOccurs="0" ref="urf:Charge" />
+      <xsd:element maxOccurs="1" minOccurs="1" ref="urf:Status" />
+      <xsd:choice maxOccurs="unbounded" minOccurs="0">
+        <xsd:annotation>
+          <xsd:documentation>
+            The elements grouped together in this choice may be represented
+            within a usage record multiple times. Each of these appearances
+            must be differentiated by the metric and/or type associated with
+            the element.
+          </xsd:documentation>
+        </xsd:annotation>
+        <xsd:element ref="urf:Disk" />
+        <xsd:element ref="urf:Memory" />
+        <xsd:element ref="urf:Swap" />
+        <xsd:element ref="urf:Network" />
+        <xsd:element ref="urf:TimeDuration" />
+        <xsd:element ref="urf:TimeInstant" />
+        <xsd:element ref="urf:ServiceLevel" />
+      </xsd:choice>
+      <xsd:choice maxOccurs="unbounded" minOccurs="0">
+        <xsd:element maxOccurs="1" minOccurs="0" ref="urf:WallDuration" />
+        <xsd:sequence maxOccurs="1" minOccurs="0">
+          <xsd:element maxOccurs="2" minOccurs="0" ref="urf:CpuDuration" />
+        </xsd:sequence>
+        <xsd:element maxOccurs="1" minOccurs="0" ref="urf:NodeCount" />
+        <xsd:element maxOccurs="1" minOccurs="0" ref="urf:Processors" />
+        <xsd:element maxOccurs="1" minOccurs="0" ref="urf:EndTime" />
+        <xsd:element maxOccurs="1" minOccurs="0" ref="urf:StartTime" />
+        <xsd:element maxOccurs="1" minOccurs="0" ref="urf:MachineName" />
+        <xsd:element maxOccurs="1" minOccurs="0" ref="urf:SubmitHost" />
+        <xsd:element maxOccurs="1" minOccurs="0" ref="urf:Queue" />
+        <xsd:sequence maxOccurs="1" minOccurs="0">
+          <xsd:element maxOccurs="unbounded" minOccurs="0"
+                  ref="urf:ProjectName" />
+        </xsd:sequence>
+        <xsd:sequence maxOccurs="1" minOccurs="0">
+          <xsd:element maxOccurs="unbounded" minOccurs="0" ref="urf:Host" />
+        </xsd:sequence>
+        <xsd:sequence maxOccurs="1" minOccurs="0">
+          <xsd:choice maxOccurs="unbounded" minOccurs="0">
+            <xsd:element ref="urf:PhaseResource" />
+            <xsd:element ref="urf:VolumeResource" />
+            <xsd:element ref="urf:Resource" />
+            <xsd:element ref="urf:ConsumableResource" />
+          </xsd:choice>
+        </xsd:sequence>
+      </xsd:choice>
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:element abstract="true" name="Usage" type="urf:UsageRecordType" />
+
+  <xsd:element name="UsageRecord" substitutionGroup="urf:Usage"
+          type="urf:UsageRecordType" />
+
+  <xsd:element name="JobUsageRecord" substitutionGroup="urf:Usage">
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="urf:UsageRecordType" />
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="UsageRecords">
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element maxOccurs="unbounded" minOccurs="0" ref="urf:Usage" />
+      </xsd:sequence>
+    </xsd:complexType>
+  </xsd:element>
+
+  <!--
+        Common properties that may be measured with several different metrics
+        within the same usage record
+  -->
+
+  <xsd:element name="Network">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:positiveInteger">
+          <xsd:attribute ref="urf:description" use="optional" />
+          <xsd:attributeGroup ref="urf:intervallicVolume" />
+          <xsd:attribute default="total" ref="urf:metric" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="Disk">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:positiveInteger">
+          <xsd:attribute ref="urf:description" use="optional" />
+          <xsd:attributeGroup ref="urf:intervallicVolume" />
+          <xsd:attribute default="total" ref="urf:metric" use="optional" />
+          <xsd:attribute ref="urf:type" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="Memory">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:positiveInteger">
+          <xsd:attribute ref="urf:description" use="optional" />
+          <xsd:attributeGroup ref="urf:intervallicVolume" />
+          <xsd:attribute default="total" ref="urf:metric" use="optional" />
+          <xsd:attribute ref="urf:type" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="Swap">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:positiveInteger">
+          <xsd:attribute ref="urf:description" use="optional" />
+          <xsd:attributeGroup ref="urf:intervallicVolume" />
+          <xsd:attribute default="total" ref="urf:metric" use="optional" />
+          <xsd:attribute ref="urf:type" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="NodeCount">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:positiveInteger">
+          <xsd:attribute ref="urf:description" use="optional" />
+          <xsd:attribute default="total" ref="urf:metric" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="Processors">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:positiveInteger">
+          <xsd:attribute ref="urf:description" use="optional" />
+          <xsd:attribute ref="urf:metric" use="optional" />
+          <xsd:attribute name="consumptionRate" type="xsd:float"
+                  use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="TimeDuration">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:duration">
+          <xsd:attribute ref="urf:type" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="TimeInstant">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:dateTime">
+          <xsd:attribute ref="urf:type" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="ServiceLevel">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:token">
+          <xsd:attribute ref="urf:type" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <!--
+        This element should appear at most twice within a usage record, with
+        differing values for usageType for each appearance
+  -->
+
+  <xsd:element name="CpuDuration">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:duration">
+          <xsd:attribute ref="urf:description" use="optional" />
+          <xsd:attribute name="usageType">
+            <xsd:simpleType>
+              <xsd:restriction base="xsd:token">
+                <xsd:enumeration value="user" />
+                <xsd:enumeration value="system" />
+              </xsd:restriction>
+            </xsd:simpleType>
+          </xsd:attribute>
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <!--
+        These common properties should appear at most once within a usage
+        record, rather that at most once per metric per usage record
+  -->
+
+  <xsd:element name="WallDuration">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:duration">
+          <xsd:attribute ref="urf:description" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="EndTime">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:dateTime">
+          <xsd:attribute ref="urf:description" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="StartTime">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:dateTime">
+          <xsd:attribute ref="urf:description" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="MachineName">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="urf:domainNameType">
+          <xsd:attribute ref="urf:description" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="SubmitHost">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="urf:domainNameType">
+          <xsd:attribute ref="urf:description" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="Host">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="urf:domainNameType">
+          <xsd:attribute ref="urf:description" use="optional" />
+          <xsd:attribute default="false" name="primary" type="xsd:boolean" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="Queue">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:string">
+          <xsd:attribute ref="urf:description" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="JobName">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:string">
+          <xsd:attribute ref="urf:description" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="ProjectName">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:string">
+          <xsd:attribute ref="urf:description" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="Status">
+    <xsd:annotation>
+      <xsd:documentation>
+        Minimum required set =
+        {Aborted, Completed, Failed, Held, Queued, Started, Suspended}
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:token">
+          <xsd:attribute ref="urf:description" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="Charge">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:float">
+          <xsd:attribute ref="urf:description" use="optional" />
+          <xsd:attribute ref="urf:unit" use="optional" />
+          <xsd:attribute name="formula" type="xsd:string" use="optional" />
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <!-- Identity elements -->
+
+  <xsd:element name="JobIdentity">
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element maxOccurs="1" minOccurs="0" name="GlobalJobId"
+                type="xsd:string" />
+        <xsd:element maxOccurs="1" minOccurs="0" name="LocalJobId"
+                type="xsd:string" />
+        <xsd:sequence>
+          <xsd:element maxOccurs="unbounded" minOccurs="0" name="ProcessId"
+                  type="xsd:string" />
+        </xsd:sequence>
+      </xsd:sequence>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="UserIdentity">
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element maxOccurs="1" minOccurs="0" name="LocalUserId"
+                type="xsd:string" />
+        <xsd:element maxOccurs="1" minOccurs="0" name="GlobalUserName"
+                type="xsd:string" />
+        <xsd:element maxOccurs="1" minOccurs="0" ref="ds:KeyInfo" />
+      </xsd:sequence>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="RecordIdentity">
+    <xsd:complexType>
+      <xsd:sequence maxOccurs="1" minOccurs="0">
+        <xsd:element ref="ds:KeyInfo" />
+      </xsd:sequence>
+      <xsd:attribute name="recordId" type="xsd:token" use="required" />
+      <xsd:attribute name="createTime" type="xsd:dateTime" use="optional" />
+    </xsd:complexType>
+  </xsd:element>
+
+  <!-- Extensibility Framework -->
+
+  <xsd:element name="Resource" type="urf:ResourceType" />
+
+  <xsd:element name="ConsumableResource" type="urf:ConsumableResourceType" />
+
+  <xsd:element name="PhaseResource">
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="urf:ConsumableResourceType">
+          <xsd:attribute ref="urf:phaseUnit" use="optional" />
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="VolumeResource">
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="urf:ConsumableResourceType">
+          <xsd:attribute ref="urf:storageUnit" use="optional" />
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <!-- Create a generic consumable resource. Carries the units attribute -->
+
+  <xsd:complexType name="ConsumableResourceType">
+    <xsd:simpleContent>
+      <xsd:extension base="xsd:float">
+        <xsd:attribute name="units" type="xsd:string" use="optional" />
+        <xsd:attribute ref="urf:description" use="optional" />
+      </xsd:extension>
+    </xsd:simpleContent>
+  </xsd:complexType>
+
+  <!-- Create a generic resource type -->
+
+  <xsd:complexType name="ResourceType">
+    <xsd:simpleContent>
+      <xsd:extension base="xsd:string">
+        <xsd:attribute ref="urf:description" use="optional" />
+      </xsd:extension>
+    </xsd:simpleContent>
+  </xsd:complexType>
+
+  <!-- Global Attribute Definitions -->
+
+  <xsd:attribute name="description" type="xsd:string" />
+
+  <!-- Units of measure attribute definitions -->
+
+  <xsd:attribute name="unit" type="xsd:token" />
+
+  <xsd:attribute name="storageUnit">
+    <xsd:simpleType>
+      <xsd:restriction base="xsd:token">
+        <xsd:enumeration value="b" />
+        <xsd:enumeration value="B" />
+        <xsd:enumeration value="KB" />
+        <xsd:enumeration value="MB" />
+        <xsd:enumeration value="GB" />
+        <xsd:enumeration value="PB" />
+        <xsd:enumeration value="EB" />
+        <xsd:enumeration value="Kb" />
+        <xsd:enumeration value="Mb" />
+        <xsd:enumeration value="Gb" />
+        <xsd:enumeration value="Pb" />
+        <xsd:enumeration value="Eb" />
+      </xsd:restriction>
+    </xsd:simpleType>
+  </xsd:attribute>
+
+  <xsd:attribute name="phaseUnit" type="xsd:duration" />
+
+  <xsd:attributeGroup name="intervallicVolume">
+    <xsd:attribute ref="urf:storageUnit" use="optional" />
+    <xsd:attribute ref="urf:phaseUnit" use="optional" />
+  </xsd:attributeGroup>
+
+  <!-- End units attributes -->
+
+  <xsd:attribute name="metric" type="xsd:token" />
+
+  <xsd:attribute name="type" type="xsd:token" />
+
+  <!-- Simple type definitions used to constrain values of attributes -->
+
+  <xsd:simpleType name="domainNameType">
+    <xsd:restriction base="xsd:string">
+      <xsd:pattern
+              value="([a-zA-Z0-9][a-zA-Z0-9'\-']*[a-zA-Z0-9]\.)*([a-zA-Z0-9][a-zA-Z0-9'\-']*[a-zA-Z0-9])?" />
+      <xsd:maxLength value="255" />
+    </xsd:restriction>
+  </xsd:simpleType>
+</xsd:schema>