Repository: incubator-taverna-common-activities Updated Branches: refs/heads/empty [created] 2e8f451ea
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/2e8f451e/taverna-wsdl-generic/src/test/resources/testwsdls/prodoric.wsdl ---------------------------------------------------------------------- diff --git a/taverna-wsdl-generic/src/test/resources/testwsdls/prodoric.wsdl b/taverna-wsdl-generic/src/test/resources/testwsdls/prodoric.wsdl deleted file mode 100644 index bd1ce36..0000000 --- a/taverna-wsdl-generic/src/test/resources/testwsdls/prodoric.wsdl +++ /dev/null @@ -1,360 +0,0 @@ -<?xml version ='1.0' encoding ='UTF-8' ?> -<definitions name='prodoric_ws' - targetNamespace='ws.prodoric' - xmlns:tns='ws.prodoric' - xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' - xmlns:xsd='http://www.w3.org/2001/XMLSchema' - xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' - xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' - xmlns='http://schemas.xmlsoap.org/wsdl/'> - -<wsdl:types> -<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:apachesoap="http://xml.apache.org/xml-soap" -xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" -targetNamespace="ws.prodoric"> - -<xsd:element name="ProteinAccString" type="xsd:string"/> -<xsd:element name="HelloStringIn" type="xsd:string"/> -<xsd:element name="HelloStringOut" type="xsd:string"/> -<xsd:element name="ProfileAcc" type="xsd:string"/> - -<xsd:element name="OperonParams" type="tns:ParamsType"/> -<xsd:element name="RegulatorParams" type="tns:ParamsType"/> -<xsd:element name="ProfileParameterParams" type="tns:ParamsType"/> -<xsd:element name="ExpressionFromGeneParams" type="tns:ParamsType"/> -<xsd:element name="GenomeParams" type="tns:ParamsType"/> - <xsd:complexType name="ParamsType"> - - <xsd:sequence> - <xsd:element name="idtype" type="xsd:string"/> - <xsd:element name="id" type="xsd:string"/> - </xsd:sequence> - </xsd:complexType> - -<xsd:element name="UniprotAccArray" type="tns:StringArrayType"/> -<xsd:complexType name="StringArrayType"> - <xsd:sequence> - <xsd:element name="str" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/> - - </xsd:sequence> -</xsd:complexType> - -<xsd:element name="ArrayOfOperonResult" type="tns:OperonResultArrayType"/> -<xsd:complexType name="OperonResultArrayType"> - <xsd:sequence> - <xsd:element name="OperonResult" type="tns:OperonResultType" minOccurs="0" maxOccurs="unbounded"/> - </xsd:sequence> -</xsd:complexType> -<xsd:complexType name="OperonResultType"> - <xsd:sequence> - <xsd:element name="gene_acc" type="xsd:string"/> - - <xsd:element name="short_name" type="xsd:string"/> - <xsd:element name="gene_name" type="xsd:string"/> - <xsd:element name="orf_id" type="xsd:string"/> - <xsd:element name="operon_acc" type="xsd:string"/> - <xsd:element name="operon_name" type="xsd:string"/> - <xsd:element name="references" type="xsd:string"/> - </xsd:sequence> -</xsd:complexType> - -<xsd:element name="ArrayOfRegulatorResult" type="tns:RegulatorResultArrayType"/> - -<xsd:complexType name="RegulatorResultArrayType"> - <xsd:sequence> - <xsd:element name="RegulatorResult" type="tns:RegulatorResultType" minOccurs="0" maxOccurs="unbounded"/> - </xsd:sequence> -</xsd:complexType> -<xsd:complexType name="RegulatorResultType"> - <xsd:sequence> - <xsd:element name="protein_acc" type="xsd:string"/> - <xsd:element name="short_name" type="xsd:string"/> - <xsd:element name="protein_name" type="xsd:string"/> - - <xsd:element name="orf_id" type="xsd:string"/> - <xsd:element name="mode_of_action" type="xsd:string"/> - <xsd:element name="promoter_acc" type="xsd:string"/> - <xsd:element name="promoter_name" type="xsd:string"/> - <xsd:element name="site_acc" type="xsd:string"/> - <xsd:element name="site_name" type="xsd:string"/> - <xsd:element name="sequence" type="xsd:string"/> - <xsd:element name="references" type="xsd:string"/> - </xsd:sequence> - -</xsd:complexType> - -<xsd:element name="ArrayOfProfileParameterResult" type="tns:ProfileParameterResultArrayType"/> -<xsd:complexType name="ProfileParameterResultArrayType"> - <xsd:sequence> - <xsd:element name="ProfileParameterResult" type="tns:ProfileParameterResultType" minOccurs="0" maxOccurs="unbounded"/> - </xsd:sequence> -</xsd:complexType> -<xsd:complexType name="ProfileParameterResultType"> - <xsd:sequence> - <xsd:element name="profile_acc" type="xsd:string"/> - <xsd:element name="description" type="xsd:string"/> - - <xsd:element name="condition" type="xsd:string"/> - <xsd:element name="details" type="xsd:string"/> - <xsd:element name="genome_acc" type="xsd:string"/> - <xsd:element name="genome" type="xsd:string"/> - <xsd:element name="references" type="xsd:string"/> - </xsd:sequence> -</xsd:complexType> - -<xsd:element name="ArrayOfProfileResult" type="tns:ProfileResultArrayType"/> -<xsd:complexType name="ProfileResultArrayType"> - <xsd:sequence> - - <xsd:element name="ProfileResult" type="tns:ProfileResultType" minOccurs="0" maxOccurs="unbounded"/> - </xsd:sequence> -</xsd:complexType> -<xsd:complexType name="ProfileResultType"> - <xsd:sequence> - <xsd:element name="gene_acc" type="xsd:string"/> - <xsd:element name="orf_id" type="xsd:string"/> - <xsd:element name="short_name" type="xsd:string"/> - <xsd:element name="gene_name" type="xsd:string"/> - <xsd:element name="regulation" type="xsd:string"/> - - <xsd:element name="fold_change" type="xsd:string"/> - </xsd:sequence> -</xsd:complexType> - -<xsd:element name="ArrayOfExpressionFromGene" type="tns:ExpressionFromGeneArrayType"/> -<xsd:complexType name="ExpressionFromGeneArrayType"> - <xsd:sequence> - <xsd:element name="ExpressionFromGene" type="tns:ExpressionFromGeneType" minOccurs="0" maxOccurs="unbounded"/> - </xsd:sequence> -</xsd:complexType> -<xsd:complexType name="ExpressionFromGeneType"> - <xsd:sequence> - - <xsd:element name="profile_acc" type="xsd:string"/> - <xsd:element name="description" type="xsd:string"/> - <xsd:element name="condition" type="xsd:string"/> - <xsd:element name="regulation" type="xsd:string"/> - <xsd:element name="fold_change" type="xsd:string"/> - <xsd:element name="references" type="xsd:string"/> - </xsd:sequence> -</xsd:complexType> - -<xsd:element name="ArrayOfGenomeResult" type="tns:GenomeResultArrayType"/> - -<xsd:complexType name="GenomeResultArrayType"> - <xsd:sequence> - <xsd:element name="GenomeResult" type="tns:GenomeResultType" minOccurs="0" maxOccurs="unbounded"/> - </xsd:sequence> -</xsd:complexType> -<xsd:complexType name="GenomeResultType"> - <xsd:sequence> - <xsd:element name="genome_acc" type="xsd:string"/> - <xsd:element name="genome_name" type="xsd:string"/> - </xsd:sequence> - -</xsd:complexType> - -</xsd:schema> - -</wsdl:types> - -<message name='getOperonRequest'> - <part name='params' element='tns:OperonParams'/> -</message> -<message name='getOperonResponse'> - <part name='return' element='tns:ArrayOfOperonResult'/> -</message> - -<message name='getRegulatorsFromGeneRequest'> - <part name='params' element='tns:RegulatorParams'/> -</message> - -<message name='getRegulatorsFromGeneResponse'> - <part name='return' element='tns:ArrayOfRegulatorResult'/> -</message> - -<message name='getProfileParameterRequest'> - <part name='params' element='tns:ProfileParameterParams'/> -</message> -<message name='getProfileParameterResponse'> - <part name='return' element='tns:ArrayOfProfileParameterResult'/> -</message> - -<message name='getProfileRequest'> - <part name='params' element='tns:ProfileAcc'/> -</message> -<message name='getProfileResponse'> - <part name='return' element='tns:ArrayOfProfileResult'/> - -</message> - -<message name='getExpressionFromGeneRequest'> - <part name='params' element='tns:ExpressionFromGeneParams'/> -</message> -<message name='getExpressionFromGeneResponse'> - <part name='return' element='tns:ArrayOfExpressionFromGene'/> -</message> - -<message name='getGenomeRequest'> - <part name='params' element='tns:GenomeParams'/> -</message> -<message name='getGenomeResponse'> - <part name='return' element='tns:ArrayOfGenomeResult'/> - -</message> - -<message name='getUniProtAccRequest'> - <part name='protein_acc' element='tns:ProteinAccString'/> -</message> -<message name='getUniProtAccResponse'> - <part name='uniprot_acc' element='tns:UniprotAccArray'/> -</message> - -<message name='helloRequest'> - <part name='input' element='tns:HelloStringIn'/> -</message> -<message name='helloResponse'> - <part name='return' element='tns:HelloStringOut'/> -</message> - - -<portType name='prodoricPortType'> - - <operation name='getOperon'> - <input message='tns:getOperonRequest'/> - <output message='tns:getOperonResponse'/> - </operation> - - <operation name='getRegulatorsFromGene'> - <input message='tns:getRegulatorsFromGeneRequest'/> - <output message='tns:getRegulatorsFromGeneResponse'/> - </operation> - - <operation name='getProfileParameter'> - <input message='tns:getProfileParameterRequest'/> - <output message='tns:getProfileParameterResponse'/> - </operation> - - <operation name='getProfile'> - <input message='tns:getProfileRequest'/> - <output message='tns:getProfileResponse'/> - </operation> - - <operation name='getExpressionFromGene'> - <input message='tns:getExpressionFromGeneRequest'/> - <output message='tns:getExpressionFromGeneResponse'/> - </operation> - - <operation name='getGenome'> - <input message='tns:getGenomeRequest'/> - <output message='tns:getGenomeResponse'/> - </operation> - - <operation name='getUniProtAcc'> - <input message='tns:getUniProtAccRequest'/> - <output message='tns:getUniProtAccResponse'/> - </operation> - - <operation name='hello'> - <input message='tns:helloRequest'/> - <output message='tns:helloResponse'/> - </operation> - -</portType> - - -<binding name='prodoricBinding' type='tns:prodoricPortType'> - <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/> - - <operation name='getOperon'> - <soap:operation soapAction='ws.prodoric#getOperon'/> - <input> - <soap:body use='literal' namespace='ws.prodoric' /> - </input> - <output> - <soap:body use='literal' namespace='ws.prodoric' /> - </output> - </operation> - - <operation name='getRegulatorsFromGene'> - <soap:operation soapAction='ws.prodoric#getRegulatorsFromGene'/> - <input> - <soap:body use='literal' namespace='ws.prodoric' /> - </input> - <output> - <soap:body use='literal' namespace='ws.prodoric' /> - </output> - </operation> - - <operation name='getProfileParameter'> - <soap:operation soapAction='ws.prodoric#getProfileParameter'/> - <input> - <soap:body use='literal' namespace='ws.prodoric' /> - </input> - <output> - <soap:body use='literal' namespace='ws.prodoric' /> - </output> - </operation> - - <operation name='getProfile'> - <soap:operation soapAction='ws.prodoric#getProfile'/> - <input> - <soap:body use='literal' namespace='ws.prodoric' /> - </input> - <output> - <soap:body use='literal' namespace='ws.prodoric' /> - </output> - </operation> - - - <operation name='getExpressionFromGene'> - <soap:operation soapAction='ws.prodoric#getExpressionFromGene'/> - <input> - <soap:body use='literal' namespace='ws.prodoric' /> - </input> - <output> - <soap:body use='literal' namespace='ws.prodoric' /> - </output> - </operation> - - - <operation name='getGenome'> - <soap:operation soapAction='ws.prodoric#getGenome'/> - <input> - <soap:body use='literal' namespace='ws.prodoric' /> - </input> - <output> - <soap:body use='literal' namespace='ws.prodoric' /> - </output> - </operation> - - <operation name='getUniProtAcc'> - <soap:operation soapAction='ws.prodoric#getUniProtAcc'/> - <input> - <soap:body use='literal' namespace='ws.prodoric' /> - </input> - <output> - <soap:body use='literal' namespace='ws.prodoric' /> - </output> - </operation> - - <operation name='hello'> - <soap:operation soapAction='ws.prodoric#hello'/> - <input> - <soap:body use='literal' namespace='ws.prodoric' /> - </input> - <output> - <soap:body use='literal' namespace='ws.prodoric' /> - </output> - </operation> - -</binding> - - -<service name='prodoric_webservice'> - <port name='prodoricPort' binding='tns:prodoricBinding'> - <soap:address location='http://134.169.104.13/webservice/prodoric_server.php'/> - </port> - -</service> -</definitions> http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/2e8f451e/taverna-wsdl-generic/src/test/resources/testwsdls/whatizit.wsdl ---------------------------------------------------------------------- diff --git a/taverna-wsdl-generic/src/test/resources/testwsdls/whatizit.wsdl b/taverna-wsdl-generic/src/test/resources/testwsdls/whatizit.wsdl deleted file mode 100644 index b3016fa..0000000 --- a/taverna-wsdl-generic/src/test/resources/testwsdls/whatizit.wsdl +++ /dev/null @@ -1,233 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<definitions xmlns:tns="http://www.ebi.ac.uk/webservices/whatizit/ws" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.ebi.ac.uk/webservices/whatizit/ws" name="whatizit"> - - <types> - <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.ebi.ac.uk/webservices/whatizit/ws" version="1.0"> - - <xs:element xmlns:ns1="http://www.ebi.ac.uk/webservices/whatizit/ws" type="ns1:search" name="search"/> - <xs:complexType name="search"> - <xs:sequence> - <xs:element type="xs:string" minOccurs="0" name="pipelineName"/> - <xs:element type="xs:string" minOccurs="0" name="query"/> - - <xs:element name="limit"> - <xs:simpleType> - <xs:restriction base="xs:int"> - <xs:minInclusive value="0"/> - <xs:maxExclusive value="10000"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - </xs:sequence> - </xs:complexType> - - <xs:element xmlns:ns2="http://www.ebi.ac.uk/webservices/whatizit/ws" type="ns2:searchResponse" name="searchResponse"/> - <xs:complexType name="searchResponse"> - <xs:sequence> - <xs:element type="xs:string" minOccurs="0" name="return"/> - </xs:sequence> - </xs:complexType> - - <xs:element xmlns:ns3="http://www.ebi.ac.uk/webservices/whatizit/ws" type="ns3:WhatizitException" name="WhatizitException"/> - <xs:complexType name="WhatizitException"> - - <xs:sequence> - <xs:element type="xs:string" minOccurs="0" name="message"/> - </xs:sequence> - </xs:complexType> - - <xs:element xmlns:ns4="http://www.ebi.ac.uk/webservices/whatizit/ws" type="ns4:contact" name="contact"/> - <xs:complexType name="contact"> - <xs:sequence> - <xs:element type="xs:string" minOccurs="0" name="pipelineName"/> - - <xs:element type="xs:string" minOccurs="0" name="text"/> - <xs:element type="xs:boolean" name="convertToHtml"/> - </xs:sequence> - </xs:complexType> - - <xs:element xmlns:ns5="http://www.ebi.ac.uk/webservices/whatizit/ws" type="ns5:contactResponse" name="contactResponse"/> - <xs:complexType name="contactResponse"> - <xs:sequence> - <xs:element type="xs:string" minOccurs="0" name="return"/> - - </xs:sequence> - </xs:complexType> - - <xs:element xmlns:ns6="http://www.ebi.ac.uk/webservices/whatizit/ws" type="ns6:queryPmid" name="queryPmid"/> - <xs:complexType name="queryPmid"> - <xs:sequence> - <xs:element type="xs:string" minOccurs="0" name="pipelineName"/> - <xs:element type="xs:string" minOccurs="0" name="pmid"/> - </xs:sequence> - - </xs:complexType> - - <xs:element xmlns:ns7="http://www.ebi.ac.uk/webservices/whatizit/ws" type="ns7:queryPmidResponse" name="queryPmidResponse"/> - <xs:complexType name="queryPmidResponse"> - <xs:sequence> - <xs:element type="xs:string" minOccurs="0" name="return"/> - </xs:sequence> - </xs:complexType> - - <xs:element xmlns:ns8="http://www.ebi.ac.uk/webservices/whatizit/ws" type="ns8:getPipelinesStatus" name="getPipelinesStatus"/> - - <xs:complexType name="getPipelinesStatus"/> - - <xs:element xmlns:ns9="http://www.ebi.ac.uk/webservices/whatizit/ws" type="ns9:getPipelinesStatusResponse" name="getPipelinesStatusResponse"/> - <xs:complexType name="getPipelinesStatusResponse"> - <xs:sequence> - <xs:element xmlns:ns10="http://www.ebi.ac.uk/webservices/whatizit/ws" type="ns10:selectItem" minOccurs="0" name="return" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - - <xs:complexType name="selectItem"> - - <xs:sequence> - <xs:element type="xs:string" minOccurs="0" name="description"/> - <xs:element type="xs:boolean" name="disabled"/> - <xs:element type="xs:string" minOccurs="0" name="label"/> - <xs:element type="xs:anyType" minOccurs="0" name="value"/> - </xs:sequence> - </xs:complexType> - </xs:schema> - </types> - - - - <message name="contact"> - <part element="tns:contact" name="parameters"/> - </message> - - <message name="contactResponse"> - <part element="tns:contactResponse" name="parameters"/> - </message> - - <message name="WhatizitException"> - <part element="tns:WhatizitException" name="fault"/> - - </message> - - <message name="getPipelinesStatus"> - <part element="tns:getPipelinesStatus" name="parameters"/> - </message> - - <message name="getPipelinesStatusResponse"> - <part element="tns:getPipelinesStatusResponse" name="parameters"/> - </message> - - <message name="queryPmid"> - <part element="tns:queryPmid" name="parameters"/> - - </message> - - <message name="queryPmidResponse"> - <part element="tns:queryPmidResponse" name="parameters"/> - </message> - - <message name="search"> - <part element="tns:search" name="parameters"/> - </message> - - <message name="searchResponse"> - <part element="tns:searchResponse" name="parameters"/> - - </message> - - - <portType name="whatizit"> - <operation name="contact"> - <input message="tns:contact"/> - <output message="tns:contactResponse"/> - <fault message="tns:WhatizitException" name="WhatizitException"/> - </operation> - <operation name="getPipelinesStatus"> - <input message="tns:getPipelinesStatus"/> - - <output message="tns:getPipelinesStatusResponse"/> - <fault message="tns:WhatizitException" name="WhatizitException"/> - </operation> - <operation name="queryPmid"> - <input message="tns:queryPmid"/> - <output message="tns:queryPmidResponse"/> - <fault message="tns:WhatizitException" name="WhatizitException"/> - </operation> - <operation name="search"> - - <input message="tns:search"/> - <output message="tns:searchResponse"/> - <fault message="tns:WhatizitException" name="WhatizitException"/> - </operation> - </portType> - - <binding type="tns:whatizit" name="pipelineBinding"> - <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> - <operation name="contact"> - <soap:operation soapAction=""/> - - <input> - <soap:body use="literal"/> - </input> - <output> - <soap:body use="literal"/> - </output> - <fault name="WhatizitException"> - <soap:fault use="literal" name="WhatizitException"/> - </fault> - - </operation> - <operation name="getPipelinesStatus"> - <soap:operation soapAction=""/> - <input> - <soap:body use="literal"/> - </input> - <output> - <soap:body use="literal"/> - </output> - - <fault name="WhatizitException"> - <soap:fault use="literal" name="WhatizitException"/> - </fault> - </operation> - <operation name="queryPmid"> - <soap:operation soapAction=""/> - <input> - <soap:body use="literal"/> - </input> - - <output> - <soap:body use="literal"/> - </output> - <fault name="WhatizitException"> - <soap:fault use="literal" name="WhatizitException"/> - </fault> - </operation> - <operation name="search"> - <soap:operation soapAction=""/> - - <input> - <soap:body use="literal"/> - </input> - <output> - <mime:multipartRelated> - <mime:part> - <soap:body parts="" use="literal"/> - </mime:part> - <mime:part> - - <mime:content type="text/xml" part="parameters"/> - </mime:part> - </mime:multipartRelated> - </output> - <fault name="WhatizitException"> - <soap:fault use="literal" name="WhatizitException"/> - </fault> - </operation> - </binding> - - <service name="whatizit"> - <port binding="tns:pipelineBinding" name="pipeline"> - <soap:address location="http://www.ebi.ac.uk:80/webservices/whatizit/ws"/> - </port> - </service> -</definitions> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/2e8f451e/taverna-xpath-activity/pom.xml ---------------------------------------------------------------------- diff --git a/taverna-xpath-activity/pom.xml b/taverna-xpath-activity/pom.xml deleted file mode 100644 index 1012b73..0000000 --- a/taverna-xpath-activity/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.taverna.commonactivities</groupId> - <artifactId>taverna-common-activities</artifactId> - <version>2.1.0-incubating-SNAPSHOT</version> - </parent> - <artifactId>taverna-xpath-activity</artifactId> - <name>Apache Taverna XPath Activity</name> - <packaging>bundle</packaging> - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Import-Package>org.jaxen,*</Import-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - <dependencies> - <dependency> - <groupId>org.apache.taverna.engine</groupId> - <artifactId>taverna-reference-api</artifactId> - <version>${taverna.engine.version}</version> - </dependency> - <dependency> - <groupId>org.apache.taverna.engine</groupId> - <artifactId>taverna-workflowmodel-api</artifactId> - <version>${taverna.engine.version}</version> - </dependency> - - <dependency> - <groupId>org.dom4j</groupId> - <artifactId>com.springsource.org.dom4j</artifactId> - <version>${dom4j.version}</version> - </dependency> - <dependency> - <groupId>org.jaxen</groupId> - <artifactId>com.springsource.org.jaxen</artifactId> - <version>${jaxen.version}</version> - </dependency> - </dependencies> -</project> http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/2e8f451e/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivity.java ---------------------------------------------------------------------- diff --git a/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivity.java b/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivity.java deleted file mode 100644 index 260eb5a..0000000 --- a/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivity.java +++ /dev/null @@ -1,211 +0,0 @@ -package net.sf.taverna.t2.activities.xpath; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import net.sf.taverna.t2.invocation.InvocationContext; -import net.sf.taverna.t2.reference.ErrorDocumentService; -import net.sf.taverna.t2.reference.ReferenceService; -import net.sf.taverna.t2.reference.T2Reference; -import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractAsynchronousActivity; -import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException; -import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback; - -import org.dom4j.Document; -import org.dom4j.DocumentException; -import org.dom4j.DocumentHelper; -import org.dom4j.InvalidXPathException; -import org.dom4j.Node; -import org.dom4j.XPath; -import org.dom4j.XPathException; - -import com.fasterxml.jackson.databind.JsonNode; - -/** - * Enhanced XPath activity. - * - * @author Sergejs Aleksejevs - */ -public class XPathActivity extends AbstractAsynchronousActivity<JsonNode> { - - public static final String URI = "http://ns.taverna.org.uk/2010/activity/xpath"; - - // These ports are default ones (and only ones - XPath activity will not have dynamic ports) - public static final String IN_XML = "xml_text"; - public static final String OUT_TEXT = "nodelist"; - public static final String OUT_XML = "nodelistAsXML"; - - private static final String SINGLE_VALUE_TEXT = "firstNode"; - private static final String SINGLE_VALUE_XML = "firstNodeAsXML"; - - // Configuration bean for this activity - essentially defines a particular instance - // of the activity through the values of its parameters - private JsonNode json; - - @Override - public JsonNode getConfiguration() { - return this.json; - } - - @Override - public void configure(JsonNode json) throws ActivityConfigurationException { - // Check configBean is valid - if (!XPathUtils.isValid(json)) { - throw new ActivityConfigurationException("Invalid configuration of XPath activity..."); - // TODO - check this - } - - // Store for getConfiguration() - this.json = json; - } - - protected void configurePorts() { - // ---- REMOVE OLD PORTS ---- - - // In case we are being reconfigured - remove existing ports first to avoid duplicates - removeInputs(); - removeOutputs(); - - // ---- CREATE NEW INPUTS AND OUTPUTS ---- - - // all ports in this activity are static, so no dependency on the values in config bean - - // single input port: the input XML text will be treated as String for now - addInput(IN_XML, 0, true, null, String.class); - - addOutput(SINGLE_VALUE_TEXT, 0); - addOutput(SINGLE_VALUE_XML, 0); - addOutput(OUT_TEXT, 1); - addOutput(OUT_XML, 1); - } - - /** - * This method executes pre-configured instance of XPath activity. - */ - @Override - public void executeAsynch(final Map<String, T2Reference> inputs, - final AsynchronousActivityCallback callback) { - // Don't execute service directly now, request to be run asynchronously - callback.requestRun(new Runnable() { - @Override - @SuppressWarnings("unchecked") - public void run() { - - InvocationContext context = callback.getContext(); - ReferenceService referenceService = context.getReferenceService(); - - // ---- RESOLVE INPUT ---- - - String xmlInput = (String) referenceService.renderIdentifier(inputs.get(IN_XML), - String.class, context); - - // ---- DO THE ACTUAL SERVICE INVOCATION ---- - - List<Node> matchingNodes = new ArrayList<Node>(); - - // only attempt to execute XPath expression if there is some input data - if (xmlInput != null && xmlInput.length() > 0) { - // XPath configuration is taken from the config bean - try { - XPath expr = DocumentHelper.createXPath(json.get("xpathExpression").textValue()); - Map<String, String> xpathNamespaceMap = new HashMap<>(); - for (JsonNode namespaceMapping : json.get("xpathNamespaceMap")) { - xpathNamespaceMap.put(namespaceMapping.get("prefix").textValue(), - namespaceMapping.get("uri").textValue()); - } - expr.setNamespaceURIs(xpathNamespaceMap); - Document doc = DocumentHelper.parseText(xmlInput); - matchingNodes = expr.selectNodes(doc); - } catch (InvalidXPathException e) { - callback.fail("Incorrect XPath Expression -- XPath processing library " - + "reported the following error: " + e.getMessage(), e); - - // make sure we don't call callback.receiveResult later - return; - } catch (DocumentException e) { - callback.fail("XML document was not valid -- XPath processing library " - + "reported the following error: " + e.getMessage(), e); - - // make sure we don't call callback.receiveResult later - return; - } catch (XPathException e) { - callback.fail( - "Unexpected error has occurred while executing the XPath expression. " - + "-- XPath processing library reported the following error:\n" - + e.getMessage(), e); - - // make sure we don't call callback.receiveResult later - return; - } - } - - // --- PREPARE OUTPUTS --- - - List<String> outNodesText = new ArrayList<String>(); - List<String> outNodesXML = new ArrayList<String>(); - Object textValue = null; - Object xmlValue = null; - - for (Object o : matchingNodes) { - if (o instanceof Node) { - Node n = (Node) o; - if (n.getStringValue() != null - && n.getStringValue().length() > 0) { - outNodesText.add(n.getStringValue()); - if (textValue == null) - textValue = n.getStringValue(); - } - outNodesXML.add(n.asXML()); - if (xmlValue == null) - xmlValue = n.asXML(); - } else { - outNodesText.add(o.toString()); - if (textValue == null) - textValue = o.toString(); - } - } - - // ---- REGISTER OUTPUTS ---- - - Map<String, T2Reference> outputs = new HashMap<String, T2Reference>(); - if (textValue == null) { - ErrorDocumentService errorDocService = referenceService - .getErrorDocumentService(); - textValue = errorDocService.registerError( - "No value produced", 0, callback.getContext()); - } - - if (xmlValue == null) { - ErrorDocumentService errorDocService = referenceService - .getErrorDocumentService(); - xmlValue = errorDocService.registerError( - "No value produced", 0, callback.getContext()); - } - - T2Reference firstNodeAsText = referenceService.register( - textValue, 0, true, context); - outputs.put(SINGLE_VALUE_TEXT, firstNodeAsText); - - T2Reference firstNodeAsXml = referenceService.register( - xmlValue, 0, true, context); - outputs.put(SINGLE_VALUE_XML, firstNodeAsXml); - - T2Reference outNodesAsText = referenceService.register( - outNodesText, 1, true, context); - outputs.put(OUT_TEXT, outNodesAsText); - - T2Reference outNodesAsXML = referenceService.register( - outNodesXML, 1, true, context); - outputs.put(OUT_XML, outNodesAsXML); - - // return map of output data, with empty index array as this is - // the only and final result (this index parameter is used if - // pipelining output) - callback.receiveResult(outputs, new int[0]); - } - }); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/2e8f451e/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivityConfigurationBean.java ---------------------------------------------------------------------- diff --git a/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivityConfigurationBean.java b/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivityConfigurationBean.java deleted file mode 100644 index 12bd536..0000000 --- a/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivityConfigurationBean.java +++ /dev/null @@ -1,145 +0,0 @@ -package net.sf.taverna.t2.activities.xpath; - -import static net.sf.taverna.t2.activities.xpath.XPathActivity.URI; -import static org.dom4j.DocumentHelper.createXPath; - -import java.io.Serializable; -import java.net.URI; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import net.sf.taverna.t2.workflowmodel.processor.config.ConfigurationBean; -import net.sf.taverna.t2.workflowmodel.processor.config.ConfigurationProperty; - -import org.dom4j.DocumentException; -import org.dom4j.InvalidXPathException; - -/** - * - * @author Sergejs Aleksejevs - */ -@ConfigurationBean(uri = URI + "#Config") -public class XPathActivityConfigurationBean implements Serializable { - // --- CONSTANTS --- - public static final int XPATH_VALID = XPathUtils.XPATH_VALID; - public static final int XPATH_EMPTY = XPathUtils.XPATH_EMPTY; - public static final int XPATH_INVALID = XPathUtils.XPATH_INVALID; - - private String xmlDocument; - private String xpathExpression; - private Map<String, String> xpathNamespaceMap; - - /** - * @return An instance of the {@link XPathActivityConfigurationBean} - * pre-configured with default settings for all parameters. - * @throws DocumentException - */ - public static XPathActivityConfigurationBean getDefaultInstance() { - // document will not be set - XPathActivityConfigurationBean defaultBean = new XPathActivityConfigurationBean(); - defaultBean.setXpathExpression("/"); - defaultBean.setXpathNamespaceMap(new HashMap<String, String>(0)); - - return (defaultBean); - } - - /** - * Validates an XPath expression. - * - * @return {@link XPathActivityConfigurationBean#XPATH_VALID XPATH_VALID} - - * if the expression is valid;<br/> - * {@link XPathActivityConfigurationBean#XPATH_EMPTY XPATH_EMPTY} - - * if expression is empty;<br/> - * {@link XPathActivityConfigurationBean#XPATH_INVALID - * XPATH_INVALID} - if the expression is invalid / ill-formed.<br/> - */ - public static int validateXPath(String xpathExpressionToValidate) { - // no XPath expression - if (xpathExpressionToValidate == null - || xpathExpressionToValidate.trim().isEmpty()) { - return XPATH_EMPTY; - } - - try { - // try to parse the XPath expression... - createXPath(xpathExpressionToValidate.trim()); - // ...success - return XPATH_VALID; - } catch (InvalidXPathException e) { - // ...failed to parse the XPath expression: notify of the error - return XPATH_INVALID; - } - } - - /** - * Tests validity of the configuration held in this bean. - * - * @return <code>true</code> if the configuration in the bean is valid; - * <code>false</code> otherwise. - */ - public boolean isValid() { - return (xpathExpression != null - && validateXPath(xpathExpression) == XPATH_VALID && getXpathNamespaceMap() != null); - } - - public String getXmlDocument() { - return xmlDocument; - } - - @ConfigurationProperty(name = "exampleXmlDocument", label = "Example XML document", required = false) - public void setXmlDocument(String xmlDocument) { - this.xmlDocument = xmlDocument; - } - - public String getXpathExpression() { - return xpathExpression; - } - - @ConfigurationProperty(name = "xpathExpression", label = "XPath expression") - public void setXpathExpression(String xpathExpression) { - this.xpathExpression = xpathExpression; - } - - public Map<String, String> getXpathNamespaceMap() { - return xpathNamespaceMap; - } - - public void setXpathNamespaceMap(Map<String, String> xpathNamespaceMap) { - this.xpathNamespaceMap = xpathNamespaceMap; - } - - @ConfigurationProperty(name = "xpathNamespaceMap", label = "XPath Namespace Map", required = false) - public void setXpathNamespaceMap(Set<NamespaceMapping> xpathNamespaceMap) { - Map<String, String> namespaceMap = new HashMap<String, String>(); - for (NamespaceMapping namespaceMapping : xpathNamespaceMap) { - namespaceMap.put(namespaceMapping.getPrefix(), namespaceMapping.getUri().toASCIIString()); - } - setXpathNamespaceMap(namespaceMap); - } - - @ConfigurationBean(uri = URI + "/NamespaceMapping") - public static class NamespaceMapping { - private String prefix; - - private URI uri; - - public String getPrefix() { - return prefix; - } - - @ConfigurationProperty(name = "prefix", label = "Namespace Prefix") - public void setPrefix(String prefix) { - this.prefix = prefix; - } - - public URI getUri() { - return uri; - } - - @ConfigurationProperty(name = "uri", label = "Namespace URI") - public void setUri(URI uri) { - this.uri = uri; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/2e8f451e/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivityFactory.java ---------------------------------------------------------------------- diff --git a/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivityFactory.java b/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivityFactory.java deleted file mode 100644 index c5c8e18..0000000 --- a/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivityFactory.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2011 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - ******************************************************************************/ -package net.sf.taverna.t2.activities.xpath; - -import static net.sf.taverna.t2.activities.xpath.XPathActivity.IN_XML; -import static net.sf.taverna.t2.activities.xpath.XPathActivity.OUT_TEXT; -import static net.sf.taverna.t2.activities.xpath.XPathActivity.OUT_XML; - -import java.io.IOException; -import java.net.URI; -import java.util.HashSet; -import java.util.Set; - -import net.sf.taverna.t2.workflowmodel.Edits; -import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException; -import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory; -import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort; -import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityOutputPort; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; - -/** - * An {@link ActivityFactory} for creating <code>XPathActivity</code>. - * - * @author David Withers - */ -public class XPathActivityFactory implements ActivityFactory { - - private Edits edits; - - @Override - public XPathActivity createActivity() { - return new XPathActivity(); - } - - @Override - public URI getActivityType() { - return URI.create(XPathActivity.URI); - } - - @Override - public JsonNode getActivityConfigurationSchema() { - ObjectMapper objectMapper = new ObjectMapper(); - try { - return objectMapper.readTree(getClass().getResource("/schema.json")); - } catch (IOException e) { - return objectMapper.createObjectNode(); - } - } - - @Override - public Set<ActivityInputPort> getInputPorts(JsonNode configuration) - throws ActivityConfigurationException { - Set<ActivityInputPort> outputPorts = new HashSet<>(); - outputPorts.add(edits.createActivityInputPort(IN_XML, 0, true, null, - String.class)); - return outputPorts; - } - - @Override - public Set<ActivityOutputPort> getOutputPorts(JsonNode configuration) - throws ActivityConfigurationException { - Set<ActivityOutputPort> outputPorts = new HashSet<>(); - outputPorts.add(edits.createActivityOutputPort(OUT_TEXT, 1, 1)); - outputPorts.add(edits.createActivityOutputPort(OUT_XML, 1, 1)); - return outputPorts; - } - - public void setEdits(Edits edits) { - this.edits = edits; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/2e8f451e/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivityHealthCheck.java ---------------------------------------------------------------------- diff --git a/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivityHealthCheck.java b/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivityHealthCheck.java deleted file mode 100644 index adf10d2..0000000 --- a/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivityHealthCheck.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.sf.taverna.t2.activities.xpath; - -import net.sf.taverna.t2.visit.VisitKind; -import net.sf.taverna.t2.visit.Visitor; - -/** - * A <code>XPathActivityHealthCheck</code> is a kind of visit that determines if - * the corresponding XPath activity in a workflow (normally an Activity) will - * work during a workflow run. - * - * @author Sergejs Aleksejevs - */ -public class XPathActivityHealthCheck extends VisitKind { - - // The following values indicate the type of results that can be associated - // with a VisitReport generated by a health-checking visitor. - - public static final int CORRECTLY_CONFIGURED = 0; - public static final int EMPTY_XPATH_EXPRESSION = 5; - public static final int INVALID_XPATH_EXPRESSION = 10; - public static final int GENERAL_CONFIG_PROBLEM = 15; - - public static final int NO_EXAMPLE_DOCUMENT = 20; - public static final int MISSING_NAMESPACE_MAPPINGS = 25; - - @Override - public Class<? extends Visitor<?>> getVisitorClass() { - return XPathActivityHealthChecker.class; - } - - private static class Singleton { - private static XPathActivityHealthCheck instance = new XPathActivityHealthCheck(); - } - - public static XPathActivityHealthCheck getInstance() { - return Singleton.instance; - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/2e8f451e/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivityHealthChecker.java ---------------------------------------------------------------------- diff --git a/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivityHealthChecker.java b/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivityHealthChecker.java deleted file mode 100644 index 7058841..0000000 --- a/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathActivityHealthChecker.java +++ /dev/null @@ -1,139 +0,0 @@ -package net.sf.taverna.t2.activities.xpath; - -import static net.sf.taverna.t2.activities.xpath.XPathActivityHealthCheck.CORRECTLY_CONFIGURED; -import static net.sf.taverna.t2.activities.xpath.XPathActivityHealthCheck.EMPTY_XPATH_EXPRESSION; -import static net.sf.taverna.t2.activities.xpath.XPathActivityHealthCheck.GENERAL_CONFIG_PROBLEM; -import static net.sf.taverna.t2.activities.xpath.XPathActivityHealthCheck.INVALID_XPATH_EXPRESSION; -import static net.sf.taverna.t2.activities.xpath.XPathActivityHealthCheck.MISSING_NAMESPACE_MAPPINGS; -import static net.sf.taverna.t2.activities.xpath.XPathActivityHealthCheck.NO_EXAMPLE_DOCUMENT; -import static net.sf.taverna.t2.activities.xpath.XPathUtils.XPATH_EMPTY; -import static net.sf.taverna.t2.activities.xpath.XPathUtils.XPATH_INVALID; -import static net.sf.taverna.t2.activities.xpath.XPathUtils.isValid; -import static net.sf.taverna.t2.activities.xpath.XPathUtils.validateXPath; -import static net.sf.taverna.t2.visit.VisitReport.getWorstStatus; -import static net.sf.taverna.t2.visit.VisitReport.Status.OK; -import static net.sf.taverna.t2.visit.VisitReport.Status.SEVERE; -import static net.sf.taverna.t2.visit.VisitReport.Status.WARNING; -import static net.sf.taverna.t2.workflowmodel.health.HealthCheck.NO_PROBLEM; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import net.sf.taverna.t2.visit.VisitKind; -import net.sf.taverna.t2.visit.VisitReport; -import net.sf.taverna.t2.visit.VisitReport.Status; -import net.sf.taverna.t2.workflowmodel.health.HealthChecker; - -import com.fasterxml.jackson.databind.JsonNode; - -/** - * A {@link HealthChecker} for a {@link XPathActivity}. - * - * @author Sergejs Aleksejevs - */ -public class XPathActivityHealthChecker implements HealthChecker<XPathActivity> { - @Override - public boolean canVisit(Object subject) { - return (subject instanceof XPathActivity); - } - - @Override - public VisitReport visit(XPathActivity activity, List<Object> ancestors) { - VisitKind kind = XPathActivityHealthCheck.getInstance(); - /* collection of validation reports that this health checker will create */ - List<VisitReport> reports = new ArrayList<VisitReport>(); - - JsonNode configBean = activity.getConfiguration(); - if (isValid(configBean)) { - reports.add(new VisitReport(kind, activity, - "XPath Activity is configured correctly", - CORRECTLY_CONFIGURED, OK)); - } else { - int xpathStatus = validateXPath(configBean.get("xpathExpression") - .textValue()); - if (xpathStatus == XPATH_EMPTY) { - reports.add(new VisitReport(kind, activity, - "XPath Activity - XPath expression is missing", - EMPTY_XPATH_EXPRESSION, SEVERE)); - } else if (xpathStatus == XPATH_INVALID) { - reports.add(new VisitReport(kind, activity, - "XPath Activity - XPath expression is invalid", - INVALID_XPATH_EXPRESSION, SEVERE)); - } else { - reports.add(new VisitReport(kind, activity, - "XPath Activity - bad configuration", - GENERAL_CONFIG_PROBLEM, SEVERE)); - } - } - - // warn if there is no example XML document - if (!configBean.has("exampleXmlDocument") - || configBean.get("exampleXmlDocument").textValue().trim() - .length() == 0) { - reports.add(new VisitReport(kind, activity, - "XPath activity - no example XML document", - NO_EXAMPLE_DOCUMENT, WARNING)); - } - - // warn if there are no namespace mappings - if (hasMissingNamespaceMappings(configBean)) { - reports.add(new VisitReport(kind, activity, - "XPath activity - has missing namespace mappings", - MISSING_NAMESPACE_MAPPINGS, SEVERE)); - } - - // collect all reports together - Status worstStatus = getWorstStatus(reports); - VisitReport report = new VisitReport(kind, activity, - "XPath Activity Report", NO_PROBLEM, worstStatus, reports); - - return report; - } - - /** - * Health check for the XPath activity only involves verifying details in - * the configuration bean - that is quick. - */ - @Override - public boolean isTimeConsuming() { - return false; - } - - private boolean hasMissingNamespaceMappings(JsonNode json) { - List<String> missingNamespaces = new ArrayList<String>(); - - for (String xpathLeg : json.get("xpathExpression").textValue() - .split("/")) { - String[] legFragments = xpathLeg.split(":"); - if (legFragments.length == 2) { - /* - * two fragments - the first is the prefix; check if it's in the - * mappings table - */ - String fragment = legFragments[0]; - if (fragment.startsWith("@")) { - if (fragment.length() == 1) - continue; - fragment = fragment.substring(1); - } - Map<String, String> xpathNamespaceMap = null; - if (json.has("xpathNamespaceMap")) { - xpathNamespaceMap = new HashMap<>(); - for (JsonNode namespaceMapping : json - .get("xpathNamespaceMap")) - xpathNamespaceMap.put(namespaceMapping.get("prefix") - .textValue(), namespaceMapping.get("uri") - .textValue()); - } - if (xpathNamespaceMap == null || xpathNamespaceMap.isEmpty() - || !xpathNamespaceMap.containsKey(fragment)) - missingNamespaces.add(fragment); - } - } - - return ! missingNamespaces.isEmpty(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/2e8f451e/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathUtils.java ---------------------------------------------------------------------- diff --git a/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathUtils.java b/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathUtils.java deleted file mode 100644 index c5f0787..0000000 --- a/taverna-xpath-activity/src/main/java/net/sf/taverna/t2/activities/xpath/XPathUtils.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2013 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - ******************************************************************************/ -package net.sf.taverna.t2.activities.xpath; - -import static org.dom4j.DocumentHelper.createXPath; - -import org.dom4j.DocumentHelper; -import org.dom4j.InvalidXPathException; - -import com.fasterxml.jackson.databind.JsonNode; - -/** - * Utility methods for validating xpath expressions. - * - * @author David Withers - */ -public class XPathUtils { - - public static final int XPATH_VALID = 1; - public static final int XPATH_EMPTY = 0; - public static final int XPATH_INVALID = -1; - - /** - * Validates an XPath expression. - * - * @return {@link XPathActivityConfigurationBean#XPATH_VALID XPATH_VALID} - - * if the expression is valid;<br/> - * {@link XPathActivityConfigurationBean#XPATH_EMPTY XPATH_EMPTY} - - * if expression is empty;<br/> - * {@link XPathActivityConfigurationBean#XPATH_INVALID - * XPATH_INVALID} - if the expression is invalid / ill-formed.<br/> - */ - public static int validateXPath(String xpathExpressionToValidate) { - // no XPath expression - if (xpathExpressionToValidate == null - || xpathExpressionToValidate.trim().isEmpty()) { - return XPATH_EMPTY; - } - - try { - // try to parse the XPath expression... - createXPath(xpathExpressionToValidate.trim()); - // ...success - return XPATH_VALID; - } catch (InvalidXPathException e) { - // ...failed to parse the XPath expression: notify of the error - return XPATH_INVALID; - } - } - - /** - * Tests validity of the configuration held. - * - * @return <code>true</code> if the configuration in the bean is valid; - * <code>false</code> otherwise. - */ - public static boolean isValid(JsonNode json) { - return (json.has("xpathExpression") - && validateXPath(json.get("xpathExpression").textValue()) == XPATH_VALID && json - .has("xpathNamespaceMap")); - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/2e8f451e/taverna-xpath-activity/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.report.explainer.VisitExplainer ---------------------------------------------------------------------- diff --git a/taverna-xpath-activity/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.report.explainer.VisitExplainer b/taverna-xpath-activity/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.report.explainer.VisitExplainer deleted file mode 100644 index cb85b26..0000000 --- a/taverna-xpath-activity/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.report.explainer.VisitExplainer +++ /dev/null @@ -1 +0,0 @@ -net.sf.taverna.t2.activities.xpath.XPathActivityHealthCheckVisitExplainer \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/2e8f451e/taverna-xpath-activity/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker ---------------------------------------------------------------------- diff --git a/taverna-xpath-activity/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker b/taverna-xpath-activity/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker deleted file mode 100644 index 0e69024..0000000 --- a/taverna-xpath-activity/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker +++ /dev/null @@ -1 +0,0 @@ -net.sf.taverna.t2.activities.xpath.XPathActivityHealthChecker \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/2e8f451e/taverna-xpath-activity/src/main/resources/META-INF/spring/xpath-activity-context-osgi.xml ---------------------------------------------------------------------- diff --git a/taverna-xpath-activity/src/main/resources/META-INF/spring/xpath-activity-context-osgi.xml b/taverna-xpath-activity/src/main/resources/META-INF/spring/xpath-activity-context-osgi.xml deleted file mode 100644 index 69d23b2..0000000 --- a/taverna-xpath-activity/src/main/resources/META-INF/spring/xpath-activity-context-osgi.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:beans="http://www.springframework.org/schema/beans" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/osgi - http://www.springframework.org/schema/osgi/spring-osgi.xsd"> - - <service ref="XPathActivityHealthChecker" interface="net.sf.taverna.t2.workflowmodel.health.HealthChecker" /> - - <service ref="xPathActivityFactory" interface="net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory" /> - - <reference id="edits" interface="net.sf.taverna.t2.workflowmodel.Edits" /> - -</beans:beans> http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/2e8f451e/taverna-xpath-activity/src/main/resources/META-INF/spring/xpath-activity-context.xml ---------------------------------------------------------------------- diff --git a/taverna-xpath-activity/src/main/resources/META-INF/spring/xpath-activity-context.xml b/taverna-xpath-activity/src/main/resources/META-INF/spring/xpath-activity-context.xml deleted file mode 100644 index 983d4e5..0000000 --- a/taverna-xpath-activity/src/main/resources/META-INF/spring/xpath-activity-context.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd"> - - <bean id="XPathActivityHealthChecker" class="net.sf.taverna.t2.activities.xpath.XPathActivityHealthChecker" /> - - <bean id="xPathActivityFactory" class="net.sf.taverna.t2.activities.xpath.XPathActivityFactory"> - <property name="edits" ref="edits" /> - </bean> - -</beans> http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/2e8f451e/taverna-xpath-activity/src/main/resources/schema.json ---------------------------------------------------------------------- diff --git a/taverna-xpath-activity/src/main/resources/schema.json b/taverna-xpath-activity/src/main/resources/schema.json deleted file mode 100644 index 81f9f78..0000000 --- a/taverna-xpath-activity/src/main/resources/schema.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-03/schema#", - "id": "http://ns.taverna.org.uk/2010/activity/xpath.schema.json", - "title": "XPath activity configuration", - "type": "object", - "properties": { - "@context": { - "description": "JSON-LD context for interpreting the configuration as RDF", - "required": true, - "enum": ["http://ns.taverna.org.uk/2010/activity/xpath.context.json"] - }, - "exampleXmlDocument": { - "title": "Example XML document", - "type": "string", - "required": false, - }, - "xpathExpression": { - "title": "XPath expression", - "type": "string", - "required": true, - }, - "xpathNamespaceMap": { - "title": "XPath Namespace Map", - "type": "array", - "required": false, - "items": { "type": "object", "$ref": "#/definitions/namespaceMapping" } - } - }, - "definitions": { - "namespaceMapping": { - "properties": { - "prefix": { - "title": "Namespace Prefix", - "type": "string", - "required": true - }, - "uri": { - "title": "Namespace URI, - "type": "string", - "required": true - } - } - } - } -}