<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
 * Copyright 1999-2006 University of Chicago
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy
 * of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
 -->
<xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.globus.org/2007/08/workspace/types"
    xmlns="http://www.globus.org/2007/08/workspace/types"
    xmlns:tns="http://www.globus.org/2007/08/workspace/types"
    xmlns:vwmeta="http://www.globus.org/2007/08/workspace/metadata"
    xmlns:neg="http://www.globus.org/2007/08/workspace/negotiable"
    xmlns:log="http://www.globus.org/2007/08/workspace/metadata/logistics"
    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
    xmlns:wsbf="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.xsd"
    attributeFormDefault="qualified"
    elementFormDefault="qualified">

    <xs:import namespace="http://schemas.xmlsoap.org/ws/2004/03/addressing"
               schemaLocation="../ws/addressing/WS-Addressing.xsd" />

    <xs:import namespace="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.xsd"
               schemaLocation="../wsrf/faults/WS-BaseFaults.xsd" />

    <xs:import namespace="http://www.globus.org/2007/08/workspace/metadata"
               schemaLocation="./metadata/vw.xsd" />

    <xs:import namespace="http://www.globus.org/2007/08/workspace/negotiable"
               schemaLocation="./negotiable.xsd" />

    <xs:import
        namespace="http://www.globus.org/2007/08/workspace/metadata/logistics"
        schemaLocation="./metadata/vw-logistics.xsd" />

    <!--==================================================-->
    <!--              input/output types                  -->
    <!--==================================================-->

    <xs:complexType name="voidType" />

    <xs:simpleType name="shutdownEnumeration">
        <xs:restriction base="xs:string">
            <xs:enumeration value="Normal" />
            <xs:enumeration value="Pause" />
            <xs:enumeration value="Serialize" />
            <xs:enumeration value="Reboot" />
            <xs:enumeration value="Trash" />
            <xs:enumeration value="ReadyForTransport" />
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="WorkspaceCreateRequest_Type">
        <xs:sequence>

            <xs:element name="metadata"
                        type="vwmeta:VirtualWorkspace_Type" />

            <xs:element name="resourceRequest"
                        type="neg:WorkspaceDeployment_Type" />

            <xs:element name="optionalParameters"
                        type="tns:optionalParameters_Type"
                        minOccurs="0" />

        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="WorkspaceCreateResponse_Type">
        <xs:sequence>

            <xs:element name="GroupEPR"
                        type="wsa:EndpointReferenceType"
                        nillable="true" />

            <xs:element name="WorkspaceReference"
                        type="tns:WorkspaceReference_Type"
                        maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="WorkspaceReference_Type">
        <xs:sequence>
            <xs:element ref="wsa:EndpointReference" />

            <xs:element name="ActualInstantiationTime"
                        type="xs:dateTime"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>The actual time workspace started or
                        will start.  If missing, it means the workspace is
                        scheduled as best-effort.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>

            <xs:element name="Duration"
                        type="xs:duration">
                <xs:annotation>
                    <xs:documentation>The workspace running time
                    </xs:documentation>
                </xs:annotation>
            </xs:element>

            <xs:element name="ActualTerminationTime"
                        type="xs:dateTime"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>The resource termination time.  If
                        missing, the workspace is scheduled as best-effort and
                        WSRF resource termination time is currently infinite. 
                    </xs:documentation>
                </xs:annotation>
          </xs:element>
        </xs:sequence>
    </xs:complexType>

    <xs:element name="OptionalParameters"
                type="tns:optionalParameters_Type" />

    <xs:complexType name="optionalParameters_Type">
        <xs:sequence>
            <xs:element name="stageIn"
                        type="tns:transferRequest_Type"
                        minOccurs="0" />
            <xs:element name="stageOut"
                        type="tns:transferRequest_Type"
                        minOccurs="0" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="transferRequest_Type">
        <xs:sequence>
            <xs:element name="serviceEndpoint"
                        type="xs:anyURI"
                        minOccurs="0" />
            <xs:element name="sourceURL"
                        type="xs:anyURI" />
            <xs:element name="destURL"
                        type="xs:anyURI" />
            <xs:element name="stagingCredential"
                        type="wsa:EndpointReferenceType"
                        minOccurs="0" />
            <xs:element name="transferCredential"
                        type="wsa:EndpointReferenceType"
                        minOccurs="0" />
            <xs:element name="checksum"
                        type="xs:string"
                        minOccurs="0" />
            <xs:element name="checksumtype"
                        type="xs:string"
                        minOccurs="0" />
        </xs:sequence>
    </xs:complexType>

    <!--==================================================-->
    <!--              resource properties                 -->
    <!--==================================================-->

    <!-- Note these are not ALL the RPs, just the ones without
         GEDs in other files -->

    <xs:element name="DefaultRunningTime"
                type="xs:duration" />
    
    <xs:element name="MaximumRunningTime"
                type="xs:duration" />

    <xs:element name="Associations">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="association"
                            type="xs:string"
                            maxOccurs="unbounded" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <!--==================================================-->
    <!--                 fault types                      -->
    <!--==================================================-->

    <xs:element name="WorkspaceFault">
        <xs:complexType>
            <xs:complexContent>
                <xs:extension base="wsbf:BaseFaultType" />
            </xs:complexContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="WorkspaceCreationFault">
        <xs:complexType>
            <xs:complexContent>
                <xs:extension base="wsbf:BaseFaultType" />
            </xs:complexContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="WorkspaceMetadataFault">
        <xs:complexType>
            <xs:complexContent>
                <xs:extension base="wsbf:BaseFaultType" />
            </xs:complexContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="WorkspaceResourceRequestDeniedFault">
        <xs:complexType>
            <xs:complexContent>
                <xs:extension base="wsbf:BaseFaultType" />
            </xs:complexContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="WorkspaceStagingRequestDeniedFault">
        <xs:complexType>
            <xs:complexContent>
                <xs:extension base="wsbf:BaseFaultType" />
            </xs:complexContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="OperationDisabledFault">
        <xs:complexType>
            <xs:complexContent>
                <xs:extension base="wsbf:BaseFaultType" />
            </xs:complexContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="WorkspaceShutdownFault">
        <xs:complexType>
            <xs:complexContent>
                <xs:extension base="wsbf:BaseFaultType" />
            </xs:complexContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="WorkspaceStartFault">
        <xs:complexType>
            <xs:complexContent>
                <xs:extension base="wsbf:BaseFaultType" />
            </xs:complexContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="WorkspaceSchedulingFault">
        <xs:complexType>
            <xs:complexContent>
                <xs:extension base="wsbf:BaseFaultType" />
            </xs:complexContent>
        </xs:complexType>
    </xs:element>

</xs:schema>
