First attempt to generate LB.wsdl from LB's internal .T structure definitions
authorAleš Křenek <ljocha@ics.muni.cz>
Thu, 17 Feb 2005 15:40:48 +0000 (15:40 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Thu, 17 Feb 2005 15:40:48 +0000 (15:40 +0000)
- only JobStatus operation implemented so far
- passes through wsdl2h
- untested otherwise
- breaks LB server compilation (obviously)
- install & stage still uses hand-written LB.wsdl

org.glite.lb.ws-interface/Makefile
org.glite.lb.ws-interface/build.xml
org.glite.lb.ws-interface/project/version.properties
org.glite.lb.ws-interface/src/LB.xml.T [new file with mode: 0644]
org.glite.lb.ws-interface/src/puke-wsdl.xsl [new file with mode: 0644]

index 051fdeb..aacc67c 100644 (file)
@@ -12,7 +12,12 @@ PREFIX=/opt/glite
 
 -include Makefile.inc
 
-VPATH=${top_srcdir}/interface
+SUFFIXES = .T
+
+VPATH=${top_srcdir}/src
+AT3=perl -I${top_srcdir}/project ${top_srcdir}/project/at3
+XSLTPROC=xsltproc
+
 STAGETO=interface
 
 WSDL=LB.wsdl
@@ -43,7 +48,16 @@ install:
        -mkdir -p ${PREFIX}/share/doc/${package}-${version}
        install -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version}
        cd ${top_srcdir}/interface && install -m 644 ${WSDL} ${PREFIX}/${STAGETO}
+#      install -m 644 ${WSDL} ${PREFIX}/${STAGETO}
 
 clean:
        rm -f *.h
        
+
+%.xml: %.xml.T
+       rm -f $@
+       ${AT3} $< >$@ || rm -f $@
+       chmod -w $@ >/dev/null
+
+${WSDL}: LB.xml
+       ${XSLTPROC} ../src/puke-wsdl.xsl LB.xml >$@
index b412fb1..9480f9f 100644 (file)
@@ -20,6 +20,9 @@
 
        Revision history:
        $Log$
+       Revision 1.1.1.1  2004/11/25 15:20:10  akrenek
+       initial import
+       
        Revision 1.5  2004/07/20 16:08:30  flammer
        Changed incorrect my_... instead of .._template entries for subsystem and component.
        
        
        <target name="localinit"
                description="Module specific initialization tasks">
+               <copy toDir="${module.project.dir}">
+                       <fileset dir="${subsystem.project.dir}">
+                               <include name="at3" />
+                               <include name="*.T" />
+                               <include name="*.pm" />
+                       </fileset>
+               </copy>
                <antcall target="lbmakefiles" />
        </target>
        
index c3b130e..b98db4e 100755 (executable)
@@ -1,4 +1,4 @@
 #Wed Jan 12 04:07:54 CET 2005
-module.version=1.1.0
+module.version=1.2.0
 module.build=46
 module.age=1
diff --git a/org.glite.lb.ws-interface/src/LB.xml.T b/org.glite.lb.ws-interface/src/LB.xml.T
new file mode 100644 (file)
index 0000000..a96551b
--- /dev/null
@@ -0,0 +1,127 @@
+<?xml version="1.0"?>
+
+@@@LANG: wsdl
+<!--
+@@@AUTO
+-->
+
+<service name="LoggingAndBookkeeping"
+       ns="http://glite.org/wsdl/services/lb"
+       prefix="lb">
+
+       Keeping track of state of grid jobs.
+
+       <types ns="http://glite.org/wsdl/types/lb" prefix="lbt">
+               <flags name="jobFlags">
+                       Flags determining which fields of job status should be retrieved.
+                       Can be combined arbitrarily.
+                       <val name="CLASSADS">Include also long job descriptions (JDL).</val>
+                       <val name="CHILDREN">Return list of subjobs of a DAG.</val>
+                       <val name="CHILDSTAT">Return state of the subjobs, i.e. apply other flags recursively </val>
+               </flags>
+
+               <enum name="statName">
+@@@{
+       for my $stat ($status->getTypesOrdered) {
+               my $u = uc $stat;
+               my $c = getTypeComment $status $stat;
+               gen qq{
+!                      <val name="$u">$c</val>
+};
+       }
+@@@}
+               </enum>
+
+@@@{
+       for my $n ($status->getAllFieldsOrdered) {
+               my $f = selectField $status $n;
+               if ($f->{codes}) {
+                       my $n = getName $f;
+                       $n = $1.ucfirst $2 while $n =~ /([[:alpha:]]*)_([[:alpha:]]*)/;
+                               gen qq{
+!              <enum name="$n">
+};
+                               for (@{$f->{codes}}) {
+                                       my $uc = uc $_->{name};
+                                       gen qq{
+!                      <val name="$uc">$_->{comment}</val>
+};
+                               }
+                               gen qq{
+!              </enum>
+};
+               }
+       }
+@@@}
+
+<!-- FIXME: list which are arrays in fact are not portable and 
+       will not work most likely in this way -->
+
+               <struct name="jobStatus">
+                       Status of a job, possibly including subjobs.
+                       <elem name="state" type="statName">Status name.</elem>
+@@@{
+       for my $n (getAllFieldsOrdered $status) {
+               selectField $status $n;
+               my $f = getField $status;
+               my $name = getName $f;
+               $name = $1.ucfirst $2 while $name =~ /([[:alpha:]]*)_([[:alpha:]]*)/;
+               my $type = $f->{type};
+               my $list = 'no';
+
+               if ($main::baseTypes{$type}) {
+                       $type = eval $main::types{wsdl}->{$main::baseTypes{$type}};
+                       $list = 'yes'
+               }
+               elsif ($f->{codes}) {
+                       $type = $name;
+               }
+               else {
+                       $type = getType $f;
+               }
+
+               my $comment = getComment $f;
+# XXX: currently nothing is "optional" as we don't know from status.T 
+               gen qq{
+!                      <elem name="$name" type="$type" list="$list" optional="no">$comment</elem>
+};
+       }
+@@@}
+               </struct>
+
+               <struct name="tagValue">
+                       <elem name="tag" type="xsd:string"/>
+                       <elem name="value" type="xsd:string" optional="yes"/>
+               </struct>
+
+               <struct name="timeval">
+                       <elem name="tvSec" type="xsd:long"/>
+                       <elem name="tvUsec" type="xsd:long"/>
+               </struct>
+
+
+               <struct name="genericFault" fault="yes">
+                       Generic SOAP fault, used to deliver any LB errors.
+                       <elem name="source" type="xsd:string">Source component (module) of the error.</elem>
+                       <elem name="code" type="xsd:int">Numeric error code.</elem>
+                       <elem name="text" type="xsd:string">Error text corresponding to the code.</elem>
+                       <elem name="description" type="xsd:string" optional="yes">Additional description of the error (e.g. filename)</elem>
+                       <elem name="reason" type="genericFault" optional="yes">Reason of the error, coming from lower levels.</elem>
+               </struct>
+
+               <simple name="string"/>
+               <simple name="int"/>
+
+       </types>
+
+
+
+       <op name="JobStatus">
+               Query state of a single job.
+               <input name="jobid" type="string"> Id of the queried job. </input>
+               <input name="flags" type="jobFlags"> Which data fields to retrieve. </input>
+               <output name="stat" type="jobStatus"> Current state of the job. </output>
+               <fault name="genericFault" type="genericFault"> Any error. </fault>
+       </op>
+
+</service>
diff --git a/org.glite.lb.ws-interface/src/puke-wsdl.xsl b/org.glite.lb.ws-interface/src/puke-wsdl.xsl
new file mode 100644 (file)
index 0000000..9342e89
--- /dev/null
@@ -0,0 +1,167 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0"
+       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+
+       xmlns:lb="http://glite.org/wsdl/services/lb"
+       xmlns:lbt="http://glite.org/wsdl/types/lb">
+
+<xsl:output indent="yes"/>
+
+<xsl:template match="/service">
+       <definitions
+               xmlns="http://schemas.xmlsoap.org/wsdl/"
+               name="{@name}"
+               targetNamespace="{@ns}">
+       <documentation> <xsl:value-of select="text()"/> </documentation>
+               <types>
+                       <xsl:apply-templates select="types"/>
+               </types>
+
+               <xsl:apply-templates select="op" mode="message"/>
+
+               <xsl:apply-templates select="types/struct[@fault='yes']" mode="message"/>
+
+               <portType name="{@name}PortType">
+                       <xsl:apply-templates select="op" mode="port-type"/>
+               </portType>
+
+               <binding name="{@name}" type="{@prefix}:{@name}PortType">
+                       <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+                       <xsl:apply-templates select="op" mode="binding"/>
+               </binding>
+
+               <service name="{@name}">
+                       <documentation><xsl:value-of select="text()"/></documentation>
+                       <port name="{@name}" binding="{@prefix}:{@name}">
+                               <soap:address location="http://test.glite.org/{@prefix}:8080"/>
+                       </port>
+
+               </service>
+
+       </definitions>
+</xsl:template>
+
+<xsl:template match="types">
+       <schema targetNamespace="{@ns}"
+               xmlns="http://www.w3.org/2001/XMLSchema"
+               elementFormDefault="unqualified"
+               attributeFormDefault="unqualified">
+
+               <xsl:apply-templates/>
+       </schema>
+</xsl:template>
+
+<xsl:template match="simple">
+       <xsd:element name="{@name}" type="xsd:{@name}"/>
+</xsl:template>
+
+<xsl:template match="enum">
+       <xsd:simpleType name="{@name}">
+               <xsd:restriction base="xsd:string">
+                       <xsl:for-each select="val"><xsd:enumeration value="{@name}"/></xsl:for-each>
+               </xsd:restriction>
+       </xsd:simpleType>
+       <xsd:element name="{@name}" type="{/service/types/@prefix}:{@name}"/>
+</xsl:template>
+
+<xsl:template match="flags">
+       <xsd:simpleType name="{@name}Value">
+               <xsd:restriction base="xsd:string">
+                       <xsl:for-each select="val"><xsd:enumeration value="{@name}"/></xsl:for-each>
+               </xsd:restriction>
+       </xsd:simpleType>
+       <xsd:complexType name="{@name}">
+               <xsd:sequence>
+                       <xsd:element name="flag" type="{/service/types/@prefix}:{@name}Value" minOccurs="0" maxOccurs="unbounded"/>
+               </xsd:sequence>
+       </xsd:complexType>
+       <xsd:element name="{@name}" type="{/service/types/@prefix}:{@name}"/>
+</xsl:template>
+
+<xsl:template match="struct">
+       <xsd:complexType name="{@name}">
+               <xsd:sequence>
+                       <xsl:for-each select="elem">
+                               <xsl:variable name="type">
+                                       <xsl:choose>
+                                               <xsl:when test="contains(@type,':')">
+                                                       <xsl:value-of select="@type"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:value-of select="/service/types/@prefix"/>:<xsl:value-of select="@type"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:variable>
+                               <xsl:variable name="min">
+                                       <xsl:choose>
+                                               <xsl:when test="@optional='yes'">0</xsl:when>
+                                               <xsl:otherwise>1</xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:variable>
+                               <xsl:variable name="max">
+                                       <xsl:choose>
+                                               <xsl:when test="@list='yes'">unbounded</xsl:when>
+                                               <xsl:otherwise>1</xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:variable>
+                               <xsd:element name="{@name}" type="{$type}" minOccurs="{$min}" maxOccurs="{$max}"/>
+                       </xsl:for-each>
+               </xsd:sequence>
+       </xsd:complexType>
+       <xsd:element name="{@name}" type="{/service/types/@prefix}:{@name}"/>
+</xsl:template>
+
+<xsl:template match="op" mode="message">
+       <wsdl:message name="{@name}Request">
+               <xsl:for-each select="input">
+                       <wsdl:part name="{@name}" element="{/service/types/@prefix}:{@type}">
+                               <wsdl:documentation><xsl:value-of select="text()"/></wsdl:documentation>
+                       </wsdl:part>
+               </xsl:for-each>
+       </wsdl:message>
+       <wsdl:message name="{@name}Response">
+               <xsl:for-each select="output">
+                       <wsdl:part name="{@name}" element="{/service/types/@prefix}:{@type}">
+                               <wsdl:documentation><xsl:value-of select="text()"/></wsdl:documentation>
+                       </wsdl:part>
+               </xsl:for-each>
+       </wsdl:message>
+</xsl:template>
+
+<xsl:template match="struct[@fault='yes']" mode="message">
+       <wsdl:message name="{@name}">
+               <wsdl:part name="{@name}" element="{/service/types/@prefix}:{@name}">
+                       <wsdl:documentation><xsl:value-of select="text()"/></wsdl:documentation>
+               </wsdl:part>
+       </wsdl:message>
+</xsl:template>
+
+<xsl:template match="op" mode="port-type">
+       <wsdl:operation name="{@name}">
+               <wsdl:documentation><xsl:value-of select="text()"/></wsdl:documentation>
+               <wsdl:input name="i" message="{/service/@prefix}:{@name}Request"/>
+               <wsdl:output name="o" message="{/service/@prefix}:{@name}Response"/>
+               <wsdl:fault name="f" message="{/service/@prefix}:{fault/@name}"/>
+       </wsdl:operation>
+</xsl:template>
+
+<xsl:template match="op" mode="binding">
+       <wsdl:operation name="{@name}">
+               <soap:operation style="rpc"/>
+               <wsdl:input name="i">
+                       <soap:body use="literal" namespace="{/service/@ns}"/>
+               </wsdl:input>
+               <wsdl:output name="o">
+                       <soap:body use="literal" namespace="{/service/@ns}"/>
+               </wsdl:output>
+               <wsdl:fault name="f">
+                       <soap:fault use="literal"/>
+               </wsdl:fault>
+       </wsdl:operation>
+</xsl:template>
+
+</xsl:stylesheet>