diff --git a/build.xml b/build.xml index 0d0149c1f0e9cb372cd1fbae88c38c9336813cd6..9842d741bf01054c45f2d01e2041d37779aa838a 100644 --- a/build.xml +++ b/build.xml @@ -245,7 +245,7 @@ group="fr.inrialpes.exmo.align" desc="Alignment server" main="fr.inrialpes.exmo.align.service.AlignmentService" - path="procalign.jar osgi/osgi-core.jar jade/jade.jar jade/iiop.jar jade/http.jar jdbc/mysql-connector-java.jar jdbc/postgresql-jdbc4.jar servlet/servlet-api.jar jetty/jetty.jar jetty/jetty-util.jar xerces/xercesImpl.jar"> + path="procalign.jar osgi/osgi-core.jar jade/jade.jar jade/iiop.jar jade/http.jar jdbc/mysql-connector-java.jar jdbc/postgresql-jdbc4.jar servlet/servlet-api.jar jetty/jetty.jar jetty/jetty-util.jar xerces/xercesImpl.jar lang/commons-lang3.jar"> <files> <fileset dir="classes"> <include name="fr/inrialpes/exmo/align/service/**/*.class"/> @@ -538,6 +538,7 @@ <onepom file="slf4j/log4j-over-slf4j" /> <onepom file="lucene/lucene-core" /> <onepom file="lucene/lucene-analyzers-common" /> + <onepom file="lang/commons-lang3" /> <onepom file="ontosim/ontosim" /> <onepom file="osgi/osgi-core" /> <onepom file="owlapi10/api" /> diff --git a/html/img/depend.png b/html/img/depend.png index 08c16d1eb69817330abe25c24dbb2be92c4ad4d6..88a52da97ab122815f9fc3dde641f00619d90e02 100644 Binary files a/html/img/depend.png and b/html/img/depend.png differ diff --git a/html/lib.html b/html/lib.html index ffbdabd9403ab28f1ed62a342c447c8322b122c9..c86c6596ac24d156788a8005aac8b479b72e1fbe 100644 --- a/html/lib.html +++ b/html/lib.html @@ -130,6 +130,10 @@ and this will compile again. servlet-api.jar [<a href="https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewLicense-Start">Sun Binary Code License</a>]</dt> <dd>Required and shipped with Jetty. This is part of Java 2 Enterprise Edition</dd> +<dt><a href="http://commons.apache.org/proper/commons-lang/">Apache Commons Lang</a> 3.3: + commons-lang3.jar + [<a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache</a>]</dt> +<dd>Required for escaping strings for various formats (XML, JSON)</dd> </dl> <h3>Required for the Agent/JADE plug-in</h3> diff --git a/html/relnotes.html b/html/relnotes.html index eeef101576b5d24f443961fb52288aa5e359c381..9e69bff18c1e22ceda9dbc7e660aa060228c7cb8 100644 --- a/html/relnotes.html +++ b/html/relnotes.html @@ -37,9 +37,8 @@ The development of 4 versions continues. <h2>Under development (you can contribute)</h2> <p><ul compact="1"> -<li>Add a JSON interface (server)</li> -<li>Provide several URIs for the same alignment (server)</li> -<li>Implement database store for EDOAL (server)</li> +<li>Provide several URIs for the same alignment (serv)</li> +<li>Implement database store for EDOAL (serv)</li> <li>Add simple "harder" test generator (gen)</li> <li>Add simple "hidden" test generator (gen)</li> <li>Add a <tt>dependsOn</tt> alignment property (api)</li> @@ -49,12 +48,12 @@ The development of 4 versions continues. <li>Integrate some basic reasoning (impl).</li> <li>Complete tutorial4 with distributed reasoning.</li> <li>Genericize evaluators in <tt>GraphEvaluator</tt> and <tt>GenPlot</tt> (eval)</li> -<li>Implementation of a provenance metadata tag (server/impl)</li> +<li>Implementation of a provenance metadata tag (serv/impl)</li> <li>Replace <tt>DistanceAlignment</tt> and <tt>Similarity</tt> with a version more in line with <a href="http://ontosim.gforge.inria.fr">OntoSim</a> (impl)</tt> <!--li>Implemented transformations in EDOAL (edoal)</li--> -<li>Improve HTML interface layout and usability (server)</li> -<li>Implement metadata edition (server)</li> -<li>Implement correspondence selection (server)</li> +<li>Improve HTML interface layout and usability (serv)</li> +<li>Implement metadata edition (serv)</li> +<li>Implement correspondence selection (serv)</li> <li>Automatically switch to correct <tt>ontowrap</tt> implementation in parsers (parser)</li> <li>Render alignments as module descriptions (impl)</li> <li>Implement extensive evaluation framework (impl)</li> @@ -81,6 +80,7 @@ with a warning: <li>Implemented <tt>translateMessage()</tt> and <tt>rewriteQuery()</tt> in <tt>BasicAlignment</tt> (impl)</li> <li>Reorganised AlignmentServices into transport (HTTP) and service (HTML/Web service) (serv)</li> <li>Enabled query translation in interface (serv)</li> +<li>Added JSON interface for server (serv)</li> <li>Added a command-line utility for query translation (cli)</li> <li>Added a guard forbiding to create a <tt>BasicCell</tt> with null objects (impl)</li> <li>Added httpcore library necessary for tutorial4 (tutorial/lib)</li> diff --git a/html/rest.html b/html/rest.html index c534352eb037ab0094c888309bb62de5392ae4be..ceae913656962f2fe1c80ac0dca37d279ba73cc0 100644 --- a/html/rest.html +++ b/html/rest.html @@ -19,7 +19,7 @@ and parameters are given in the classical URL syntax, e.g., debug=true&level=1. </p> <p> -The result of these requests are provided in XML. +The result of these requests are provided in XML (default) or JSON. In the sequel, we describe the various request types. They can be obtained by: <div class="terminal"> @@ -315,16 +315,17 @@ or </p> <h3>translate<a name="translate"></a></h3> -<p>Translates a message (resp. a query) with regard to an alignment.</p> -<p>URL: http://aserv.inrialpes.fr/rest/ <b>translate</b> ? <b>id</b> = <URI></p> +<p>Translates a query with regard to an alignment.</p> +<p>URL: http://aserv.inrialpes.fr/rest/ <b>translate</b> ? <b>id</b> = <URI> & <b>query</b> = <SPARQL></p> <p>Parameters: <br /><b>id:</b> the URI of the alignment used for the translation. +<br /><b>query:</b> the query to be translated. </p> <p>Result:<br /> <div class="xml"> <translateResponse> <in-reply-to> MessageId </in-reply-to> - Metadata in RDF + <result> The translated query </result> </translateResponse> </div> </p> diff --git a/lib/lang/commons-lang3.jar b/lib/lang/commons-lang3.jar new file mode 100644 index 0000000000000000000000000000000000000000..1c93c7f97178f40ccf584ab50d75fc1817f8518d Binary files /dev/null and b/lib/lang/commons-lang3.jar differ diff --git a/lib/lang/commons-lang3.pom b/lib/lang/commons-lang3.pom new file mode 100644 index 0000000000000000000000000000000000000000..835ab1b33e2f0ea822998758c43548f7f33f55ca --- /dev/null +++ b/lib/lang/commons-lang3.pom @@ -0,0 +1,723 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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. +--> +<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/maven-v4_0_0.xsd"> + <parent> + <groupId>org.apache.commons</groupId> + <artifactId>commons-parent</artifactId> + <version>33</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.3</version> + <name>Apache Commons Lang</name> + + <inceptionYear>2001</inceptionYear> + <description> + Apache Commons Lang, a package of Java utility classes for the + classes that are in java.lang's hierarchy, or are considered to be so + standard as to justify existence in java.lang. +</description> + + <url>http://commons.apache.org/proper/commons-lang/</url> + + <packaging>jar</packaging> + <licenses> + <license> + <name>Apache License Version 2.0, January 2004</name> + <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> + </license> + </licenses> + + <issueManagement> + <system>jira</system> + <url>http://issues.apache.org/jira/browse/LANG</url> + </issueManagement> + + <scm> + <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/lang/trunk</connection> + <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/lang/trunk</developerConnection> + <url>http://svn.apache.org/viewvc/commons/proper/lang/trunk</url> + </scm> + + <developers> + <developer> + <name>Daniel Rall</name> + <id>dlr</id> + <email>dlr@finemaltcoding.com</email> + <organization>CollabNet, Inc.</organization> + <roles> + <role>Java Developer</role> + </roles> + </developer> + <developer> + <name>Stephen Colebourne</name> + <id>scolebourne</id> + <email>scolebourne@joda.org</email> + <organization>SITA ATS Ltd</organization> + <timezone>0</timezone> + <roles> + <role>Java Developer</role> + </roles> + </developer> + <developer> + <name>Henri Yandell</name> + <id>bayard</id> + <email>bayard@apache.org</email> + <organization /> + <roles> + <role>Java Developer</role> + </roles> + </developer> + <developer> + <name>Steven Caswell</name> + <id>scaswell</id> + <email>stevencaswell@apache.org</email> + <organization /> + <roles> + <role>Java Developer</role> + </roles> + <timezone>-5</timezone> + </developer> + <developer> + <name>Robert Burrell Donkin</name> + <id>rdonkin</id> + <email>rdonkin@apache.org</email> + <organization /> + <roles> + <role>Java Developer</role> + </roles> + </developer> + <developer> + <name>Gary D. Gregory</name> + <id>ggregory</id> + <email>ggregory@apache.org</email> + <timezone>-5</timezone> + <roles> + <role>Java Developer</role> + </roles> + </developer> + <developer> + <name>Fredrik Westermarck</name> + <id>fredrik</id> + <email /> + <organization /> + <roles> + <role>Java Developer</role> + </roles> + </developer> + <developer> + <name>James Carman</name> + <id>jcarman</id> + <email>jcarman@apache.org</email> + <organization>Carman Consulting, Inc.</organization> + <roles> + <role>Java Developer</role> + </roles> + </developer> + <developer> + <name>Niall Pemberton</name> + <id>niallp</id> + <roles> + <role>Java Developer</role> + </roles> + </developer> + <developer> + <name>Matt Benson</name> + <id>mbenson</id> + <roles> + <role>Java Developer</role> + </roles> + </developer> + <developer> + <name>Joerg Schaible</name> + <id>joehni</id> + <email>joerg.schaible@gmx.de</email> + <roles> + <role>Java Developer</role> + </roles> + <timezone>+1</timezone> + </developer> + <developer> + <name>Oliver Heger</name> + <id>oheger</id> + <email>oheger@apache.org</email> + <timezone>+1</timezone> + <roles> + <role>Java Developer</role> + </roles> + </developer> + <developer> + <name>Paul Benedict</name> + <id>pbenedict</id> + <email>pbenedict@apache.org</email> + <roles> + <role>Java Developer</role> + </roles> + </developer> + <developer> + <name>Benedikt Ritter</name> + <id>britter</id> + <email>britter@apache.org</email> + <roles> + <role>Java Developer</role> + </roles> + </developer> + <developer> + <name>Duncan Jones</name> + <id>djones</id> + <email>djones@apache.org</email> + <timezone>0</timezone> + <roles> + <role>Java Developer</role> + </roles> + </developer> + </developers> + <contributors> + <contributor> + <name>C. Scott Ananian</name> + </contributor> + <contributor> + <name>Chris Audley</name> + </contributor> + <contributor> + <name>Stephane Bailliez</name> + </contributor> + <contributor> + <name>Michael Becke</name> + </contributor> + <contributor> + <name>Benjamin Bentmann</name> + </contributor> + <contributor> + <name>Ola Berg</name> + </contributor> + <contributor> + <name>Nathan Beyer</name> + </contributor> + <contributor> + <name>Stefan Bodewig</name> + </contributor> + <contributor> + <name>Janek Bogucki</name> + </contributor> + <contributor> + <name>Mike Bowler</name> + </contributor> + <contributor> + <name>Sean Brown</name> + </contributor> + <contributor> + <name>Alexander Day Chaffee</name> + </contributor> + <contributor> + <name>Al Chou</name> + </contributor> + <contributor> + <name>Greg Coladonato</name> + </contributor> + <contributor> + <name>Maarten Coene</name> + </contributor> + <contributor> + <name>Justin Couch</name> + </contributor> + <contributor> + <name>Michael Davey</name> + </contributor> + <contributor> + <name>Norm Deane</name> + </contributor> + <contributor> + <name>Morgan Delagrange</name> + </contributor> + <contributor> + <name>Ringo De Smet</name> + </contributor> + <contributor> + <name>Russel Dittmar</name> + </contributor> + <contributor> + <name>Steve Downey</name> + </contributor> + <contributor> + <name>Matthias Eichel</name> + </contributor> + <contributor> + <name>Christopher Elkins</name> + </contributor> + <contributor> + <name>Chris Feldhacker</name> + </contributor> + <contributor> + <name>Roland Foerther</name> + </contributor> + <contributor> + <name>Pete Gieser</name> + </contributor> + <contributor> + <name>Jason Gritman</name> + </contributor> + <contributor> + <name>Matthew Hawthorne</name> + </contributor> + <contributor> + <name>Michael Heuer</name> + </contributor> + <contributor> + <name>Chas Honton</name> + </contributor> + <contributor> + <name>Chris Hyzer</name> + </contributor> + <contributor> + <name>Paul Jack</name> + </contributor> + <contributor> + <name>Marc Johnson</name> + </contributor> + <contributor> + <name>Shaun Kalley</name> + </contributor> + <contributor> + <name>Tetsuya Kaneuchi</name> + </contributor> + <contributor> + <name>Nissim Karpenstein</name> + </contributor> + <contributor> + <name>Ed Korthof</name> + </contributor> + <contributor> + <name>Holger Krauth</name> + </contributor> + <contributor> + <name>Rafal Krupinski</name> + </contributor> + <contributor> + <name>Rafal Krzewski</name> + </contributor> + <contributor> + <name>David Leppik</name> + </contributor> + <contributor> + <name>Eli Lindsey</name> + </contributor> + <contributor> + <name>Sven Ludwig</name> + </contributor> + <contributor> + <name>Craig R. McClanahan</name> + </contributor> + <contributor> + <name>Rand McNeely</name> + </contributor> + <contributor> + <name>Hendrik Maryns</name> + </contributor> + <contributor> + <name>Dave Meikle</name> + </contributor> + <contributor> + <name>Nikolay Metchev</name> + </contributor> + <contributor> + <name>Kasper Nielsen</name> + </contributor> + <contributor> + <name>Tim O'Brien</name> + </contributor> + <contributor> + <name>Brian S O'Neill</name> + </contributor> + <contributor> + <name>Andrew C. Oliver</name> + </contributor> + <contributor> + <name>Alban Peignier</name> + </contributor> + <contributor> + <name>Moritz Petersen</name> + </contributor> + <contributor> + <name>Dmitri Plotnikov</name> + </contributor> + <contributor> + <name>Neeme Praks</name> + </contributor> + <contributor> + <name>Eric Pugh</name> + </contributor> + <contributor> + <name>Stephen Putman</name> + </contributor> + <contributor> + <name>Travis Reeder</name> + </contributor> + <contributor> + <name>Antony Riley</name> + </contributor> + <contributor> + <name>Valentin Rocher</name> + </contributor> + <contributor> + <name>Scott Sanders</name> + </contributor> + <contributor> + <name>Ralph Schaer</name> + </contributor> + <contributor> + <name>Henning P. Schmiedehausen</name> + </contributor> + <contributor> + <name>Sean Schofield</name> + </contributor> + <contributor> + <name>Robert Scholte</name> + </contributor> + <contributor> + <name>Reuben Sivan</name> + </contributor> + <contributor> + <name>Ville Skytta</name> + </contributor> + <contributor> + <name>David M. Sledge</name> + </contributor> + <contributor> + <name>Michael A. Smith</name> + </contributor> + <contributor> + <name>Jan Sorensen</name> + </contributor> + <contributor> + <name>Glen Stampoultzis</name> + </contributor> + <contributor> + <name>Scott Stanchfield</name> + </contributor> + <contributor> + <name>Jon S. Stevens</name> + </contributor> + <contributor> + <name>Sean C. Sullivan</name> + </contributor> + <contributor> + <name>Ashwin Suresh</name> + </contributor> + <contributor> + <name>Helge Tesgaard</name> + </contributor> + <contributor> + <name>Arun Mammen Thomas</name> + </contributor> + <contributor> + <name>Masato Tezuka</name> + </contributor> + <contributor> + <name>Daniel Trebbien</name> + </contributor> + <contributor> + <name>Jeff Varszegi</name> + </contributor> + <contributor> + <name>Chris Webb</name> + </contributor> + <contributor> + <name>Mario Winterer</name> + </contributor> + <contributor> + <name>Stepan Koltsov</name> + </contributor> + <contributor> + <name>Holger Hoffstatte</name> + </contributor> + <contributor> + <name>Derek C. Ashmore</name> + </contributor> + <contributor> + <name>Sebastien Riou</name> + </contributor> + <contributor> + <name>Allon Mureinik</name> + </contributor> + <contributor> + <name>Adam Hooper</name> + </contributor> + <contributor> + <name>Chris Karcher</name> + </contributor> + </contributors> + + <!-- Lang should depend on very little --> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.11</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.4</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.easymock</groupId> + <artifactId>easymock</artifactId> + <version>3.2</version> + <scope>test</scope> + </dependency> + </dependencies> + + <distributionManagement> + <site> + <id>apache.website</id> + <name>Apache Commons Site</name> + <url>scm:svn:https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-lang/</url> + </site> + </distributionManagement> + + <properties> + <project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <maven.compiler.source>1.6</maven.compiler.source> + <maven.compiler.target>1.6</maven.compiler.target> + <!-- + This is also used to generate download_xxx file name. + To override this when generating the download page: + + mvn commons:download-page -Dcommons.componentid=lang + + The above seems to change the download page name but not any other + properties that depend on the componentid. + --> + <commons.componentid>lang3</commons.componentid> + <!-- Current 3.x release series --> + <commons.release.version>3.3</commons.release.version> + <commons.release.desc>(Java 6.0+)</commons.release.desc> + <!-- Previous 2.x release series --> + <commons.release.2.version>2.6</commons.release.2.version> + <commons.release.2.desc>(Requires Java 1.2 or later)</commons.release.2.desc> + <!-- Override generated name --> + <commons.release.2.name>commons-lang-${commons.release.2.version}</commons.release.2.name> + <commons.jira.id>LANG</commons.jira.id> + <commons.jira.pid>12310481</commons.jira.pid> + + <commons.site.path>lang</commons.site.path> + <commons.scmPubUrl>https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-lang</commons.scmPubUrl> + <commons.scmPubCheckoutDirectory>site-content</commons.scmPubCheckoutDirectory> + </properties> + + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <id>plain</id> + <configuration> + <includes> + <include>**/*Test.java</include> + </includes> + <runOrder>random</runOrder> + </configuration> + </execution> + <!-- <execution> <id>security-manager-test</id> <phase>integration-test</phase> <goals> <goal>test</goal> </goals> <configuration> + <includes> <include>**/*Test.java</include> </includes> <argLine>-Djava.security.manager -Djava.security.policy=${basedir}/src/test/resources/java.policy</argLine> + </configuration> </execution> --> + </executions> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptors> + <descriptor>src/assembly/bin.xml</descriptor> + <descriptor>src/assembly/src.xml</descriptor> + </descriptors> + <tarLongFileMode>gnu</tarLongFileMode> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-scm-publish-plugin</artifactId> + <configuration> + <ignorePathsToDelete> + <ignorePathToDelete>javadocs</ignorePathToDelete> + </ignorePathsToDelete> + </configuration> + </plugin> + </plugins> + + </build> + + <reporting> + <plugins> + <plugin> + <artifactId>maven-checkstyle-plugin</artifactId> + <version>2.9.1</version> + <configuration> + <configLocation>${basedir}/checkstyle.xml</configLocation> + <enableRulesSummary>false</enableRulesSummary> + </configuration> + <reportSets> + <reportSet> + <reports> + <report>checkstyle</report> + </reports> + </reportSet> + </reportSets> + </plugin> + <!-- Requires setting 'export MAVEN_OPTS="-Xmx512m" ' --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> + <version>2.5.2</version> + <configuration> + <threshold>Normal</threshold> + <effort>Default</effort> + <excludeFilterFile>${basedir}/findbugs-exclude-filter.xml</excludeFilterFile> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>cobertura-maven-plugin</artifactId> + <version>2.5.1</version> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>clirr-maven-plugin</artifactId> + <version>2.4</version> + <configuration> + <minSeverity>info</minSeverity> + </configuration> + </plugin> + <plugin> + <artifactId>maven-pmd-plugin</artifactId> + <version>3.0.1</version> + <configuration> + <targetJdk>${maven.compile.target}</targetJdk> + </configuration> + <reportSets> + <reportSet> + <reports> + <report>pmd</report> + <report>cpd</report> + </reports> + </reportSet> + </reportSets> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>taglist-maven-plugin</artifactId> + <version>2.4</version> + <configuration> + <tags> + <tag>TODO</tag> + <tag>NOPMD</tag> + <tag>NOTE</tag> + </tags> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>javancss-maven-plugin</artifactId> + <version>2.0</version> + </plugin> + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <configuration> + <excludes> + <exclude>site-content/**</exclude> + <exclude>src/site/resources/download_lang.cgi</exclude> + <exclude>src/site/resources/release-notes/RELEASE-NOTES-*.txt</exclude> + <exclude>src/test/resources/lang-708-input.txt</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </reporting> + + <profiles> + <profile> + <id>setup-checkout</id> + <activation> + <file> + <missing>site-content</missing> + </file> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.7</version> + <executions> + <execution> + <id>prepare-checkout</id> + <phase>pre-site</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <tasks> + <exec executable="svn"> + <arg line="checkout --depth immediates ${commons.scmPubUrl} ${commons.scmPubCheckoutDirectory}" /> + </exec> + + <exec executable="svn"> + <arg line="update --set-depth exclude ${commons.scmPubCheckoutDirectory}/javadocs" /> + </exec> + + <pathconvert pathsep=" " property="dirs"> + <dirset dir="${commons.scmPubCheckoutDirectory}" includes="*" /> + </pathconvert> + <exec executable="svn"> + <arg line="update --set-depth infinity ${dirs}" /> + </exec> + </tasks> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> diff --git a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java index 354d5c4ede7f6315c439e2c391f5ebcf5a8c8b8e..ca642fa89922e58839deb8eff78e88b91dcd035a 100644 --- a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java +++ b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java @@ -61,9 +61,6 @@ import org.semanticweb.owl.align.AlignmentVisitor; import org.semanticweb.owl.align.AlignmentException; import org.semanticweb.owl.align.Evaluator; -//import org.reflections.Reflections; -//import org.reflections.util.ConfigurationBuilder; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -486,7 +483,7 @@ public class AServProtocolManager implements Service { writer.flush(); writer.close(); } - return new RenderedAlignment(newId(),mess,serverId,mess.getSender(),result.toString(),(Properties)null); + return new RenderedAlignment(newId(),mess,serverId,mess.getSender(),result.toString(),params); } diff --git a/src/fr/inrialpes/exmo/align/service/WSAServProfile.java b/src/fr/inrialpes/exmo/align/service/WSAServProfile.java index 6625a82225476556acd5843a8990595260bb091a..cb499af7d5ed89c4b2c99c2753e70845c8f369d1 100644 --- a/src/fr/inrialpes/exmo/align/service/WSAServProfile.java +++ b/src/fr/inrialpes/exmo/align/service/WSAServProfile.java @@ -90,6 +90,9 @@ public class WSAServProfile implements AlignmentServiceProfile { private AServProtocolManager manager; private static String wsdlSpec = ""; + private final static String svcNS = "\n xml:base='"+Namespace.ALIGNSVC.prefix+"'"+ + "\n xmlns='"+Namespace.ALIGNSVC.prefix+"'"; + private boolean restful = false; private String myId; @@ -223,8 +226,6 @@ public class WSAServProfile implements AlignmentServiceProfile { String message = null; Properties newparameters = null; Message answer = null; - String svcNS = "\n xml:base='"+Namespace.ALIGNSVC.prefix+"'"+ - "\n xmlns='"+Namespace.ALIGNSVC.prefix+"'"; String msg = ""; // Set parameters if necessary @@ -264,39 +265,58 @@ public class WSAServProfile implements AlignmentServiceProfile { // Process the action if ( perf.equals("WSDL") || method.equals("wsdl") || method.equals("wsdlRequest") ) { msg += wsdlAnswer( !restful ); - } else if ( method.equals("listalignmentsRequest") || method.equals("listalignments") ) { - msg += " <listalignmentsResponse"+svcNS+">\n <alignmentList>\n"; - if ( newparameters.getProperty("msgid") != null ) { - msg += " <in-reply-to>"+newparameters.getProperty("msgid")+"</in-reply-to>\n"; - } - for( Alignment al: manager.alignments() ){ - String id = al.getExtension(Namespace.ALIGNMENT.uri, Annotations.ID); - msg += " <alid>"+id+"</alid>\n"; + } else if ( method.equals("listalignmentsRequest") || method.equals("listalignments") ) { // -> List of URI + String res = ""; + if ( param.getProperty("returnType") == HTTPResponse.MIME_JSON ) { + res = "{ \"type\" : \"listalignmentsResponse\",\n \"answer\" : ["; + boolean first = true; + for( Alignment al: manager.alignments() ){ + String id = al.getExtension(Namespace.ALIGNMENT.uri, Annotations.ID); + if ( first ) { + res += "\n \""+id+"\""; + first = false; + } else { + res += ",\n \""+id+"\""; + } + } + res += "\n]}"; + } else { + res = " <listalignmentsResponse "+svcNS+">\n"; + if ( newparameters.getProperty("msgid") != null ) { + res += " <in-reply-to>"+newparameters.getProperty("msgid")+"</in-reply-to>\n"; + } + res += " <alignmentList>\n"; + for( Alignment al: manager.alignments() ){ + String id = al.getExtension(Namespace.ALIGNMENT.uri, Annotations.ID); + res += " <alid>"+id+"</alid>\n"; + } + res += " </alignmentList>\n </listalignmentsResponse>\n"; } - msg += " </alignmentList>\n </listalignmentsResponse>\n"; - // -> List of URI + return res; } else if ( method.equals("listmethodsRequest") || method.equals("listmethods") ) { // -> List of String - msg += getClasses( "listmethodsResponse", svcNS, manager.listmethods(), newparameters ); + msg += getClasses( "listmethodsResponse", manager.listmethods(), param.getProperty("returnType"), newparameters ); } else if ( method.equals("listrenderersRequest") || method.equals("listrenderers") ) { // -> List of String - msg += getClasses( "listrenderersResponse", svcNS, manager.listrenderers(), newparameters ); + msg += getClasses( "listrenderersResponse", manager.listrenderers(), param.getProperty("returnType"), newparameters ); } else if ( method.equals("listservicesRequest") || method.equals("listservices") ) { // -> List of String - msg += getClasses( "listservicesResponse", svcNS, manager.listservices(), newparameters ); + msg += getClasses( "listservicesResponse", manager.listservices(), param.getProperty("returnType"), newparameters ); } else if ( method.equals("listevaluatorsRequest") || method.equals("listevaluators") ) { // -> List of String - msg += getClasses( "listevaluatorsResponse", svcNS, manager.listevaluators(), newparameters ); + msg += getClasses( "listevaluatorsResponse", manager.listevaluators(), param.getProperty("returnType"), newparameters ); } else if ( method.equals("storeRequest") || method.equals("store") ) { // URI -> URI if ( newparameters.getProperty( "id" ) == null ) { answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null); } else { answer = manager.store( new Message(newId(),(Message)null,myId,serverURL,newparameters.getProperty( "id" ), newparameters) ); } - msg += " <storeResponse"+svcNS+">\n"+answer.SOAPString()+" </storeResponse>\n"; + msg += render( "storeResponse", answer, param.getProperty("returnType"), newparameters); + //msg += " <storeResponse"+svcNS+">\n"+answer.SOAPString()+" </storeResponse>\n"; } else if ( method.equals("invertRequest") || method.equals("invert") ) { // URI -> URI if ( newparameters.getProperty( "id" ) == null ) { answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null); } else { answer = manager.inverse( new Message(newId(),(Message)null,myId,serverURL, newparameters.getProperty( "id" ), newparameters) ); } - msg += " <invertResponse"+svcNS+">\n"+answer.SOAPString()+" </invertResponse>\n"; + msg += render( "invertResponse", answer, param.getProperty("returnType"), newparameters); + //msg += " <invertResponse"+svcNS+">\n"+answer.SOAPString()+" </invertResponse>\n"; } else if ( method.equals("trimRequest") || method.equals("trim") ) { // URI * string * float -> URI if ( newparameters.getProperty( "id" ) == null ) { answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null); @@ -308,7 +328,8 @@ public class WSAServProfile implements AlignmentServiceProfile { } answer = manager.trim( new Message(newId(),(Message)null,myId,serverURL,newparameters.getProperty( "id" ), newparameters) ); } - msg += " <trimResponse"+svcNS+">\n"+answer.SOAPString()+" </trimResponse>\n"; + msg += render( "trimResponse", answer, param.getProperty("returnType"), newparameters); + //msg += " <trimResponse"+svcNS+">\n"+answer.SOAPString()+" </trimResponse>\n"; } else if ( method.equals("matchRequest") || method.equals("match") ) { // URL * URL * URI * String * boolean * (newparameters) -> URI if ( newparameters.getProperty( "onto1" ) == null ) { answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null); @@ -317,7 +338,8 @@ public class WSAServProfile implements AlignmentServiceProfile { } else { answer = manager.align( new Message(newId(),(Message)null,myId,serverURL,"", newparameters) ); } - msg += " <matchResponse"+svcNS+">\n"+answer.SOAPString()+"</matchResponse>\n"; + msg += render( "matchResponse", answer, param.getProperty("returnType"), newparameters); + //msg += " <matchResponse"+svcNS+">\n"+answer.SOAPString()+"</matchResponse>\n"; } else if ( method.equals("align") ) { // URL * URL * (newparameters) -> URI // This is a dummy method for emulating a WSAlignement service if ( newparameters.getProperty( "onto1" ) == null ) { @@ -346,6 +368,7 @@ public class WSAServProfile implements AlignmentServiceProfile { } } } + /*/ TOSEE msg += " <alignResponse"+svcNS+">\n"; if ( answer instanceof ErrorMsg ) { msg += answer.SOAPString(); @@ -354,7 +377,8 @@ public class WSAServProfile implements AlignmentServiceProfile { // This should be returned in answer.getParameters() msg += " <result>\n" + answer.getContent() + " </result>\n"; } - msg += " </alignResponse>\n"; + msg += " </alignResponse>\n";*/ + msg += render( "alignResponse", answer, param.getProperty("returnType"), newparameters); } else if ( method.equals("correspRequest") || method.equals("corresp") ) { // URI * URI * boolean * (newparameters) -> URI* if ( newparameters.getProperty( "id" ) == null ) { answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null); @@ -363,14 +387,16 @@ public class WSAServProfile implements AlignmentServiceProfile { } else { answer = manager.findCorrespondences( new Message(newId(),(Message)null,myId,serverURL,"", newparameters) ); } - msg += " <correspResponse"+svcNS+">\n"+answer.SOAPString()+" </correspResponse>\n"; + msg += render( "correspResponse", answer, param.getProperty("returnType"), newparameters); + //msg += " <correspResponse"+svcNS+">\n"+answer.SOAPString()+" </correspResponse>\n"; } else if ( method.equals("findRequest") || method.equals("find") ) { // URI * URI -> List of URI if ( newparameters.getProperty( "onto1" ) == null && newparameters.getProperty( "onto2" ) == null ) { answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null); } else { answer = manager.existingAlignments( new Message(newId(),(Message)null,myId,serverURL,"", newparameters) ); } - msg += " <findResponse"+svcNS+">\n"+answer.SOAPString()+" </findResponse>\n"; + msg += render( "findResponse", answer, param.getProperty("returnType"), newparameters); + //msg += " <findResponse"+svcNS+">\n"+answer.SOAPString()+" </findResponse>\n"; } else if ( method.equals("retrieveRequest") || method.equals("retrieve")) { // URI * method -> XML if ( newparameters.getProperty( "id" ) == null ) { answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null); @@ -380,6 +406,7 @@ public class WSAServProfile implements AlignmentServiceProfile { newparameters.setProperty( "embedded", "true" ); answer = manager.render( new Message(newId(),(Message)null,myId,serverURL, "", newparameters) ); } + /*/ TOSEE msg += " <retrieveResponse"+svcNS+">\n"; if ( answer instanceof ErrorMsg ) { msg += answer.SOAPString(); @@ -388,7 +415,8 @@ public class WSAServProfile implements AlignmentServiceProfile { // This should be returned in answer.getParameters() msg += " <result>\n" + answer.getContent() + " \n</result>"; } - msg += "\n </retrieveResponse>\n"; + msg += "\n </retrieveResponse>\n";*/ + msg += render( "retrieveResponse", answer, param.getProperty("returnType"), newparameters); } else if ( method.equals("metadataRequest") || method.equals("metadata") ) { // URI -> XML if ( newparameters.getProperty( "id" ) == null ) { answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null); @@ -397,7 +425,8 @@ public class WSAServProfile implements AlignmentServiceProfile { newparameters.setProperty( "method", "fr.inrialpes.exmo.align.impl.renderer.XMLMetadataRendererVisitor"); answer = manager.render( new Message(newId(),(Message)null,myId,serverURL, "", newparameters) ); } - msg += " <metadataResponse"+svcNS+">\n"+answer.SOAPString()+"\n </metadataResponse>\n"; + msg += render( "metadataResponse", answer, param.getProperty("returnType"), newparameters); + //msg += " <metadataResponse"+svcNS+">\n"+answer.SOAPString()+"\n </metadataResponse>\n"; } else if ( method.equals("loadRequest") || method.equals("load") ) { // URL -> URI if ( newparameters.getProperty( "url" ) == null && param.getProperty( "filename" ) != null ) { @@ -408,7 +437,8 @@ public class WSAServProfile implements AlignmentServiceProfile { answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null); } answer = manager.load( new Message(newId(),(Message)null,myId,serverURL,"", newparameters) ); - msg += " <loadResponse"+svcNS+">\n"+answer.SOAPString()+" </loadResponse>\n"; + msg += render( "loadResponse", answer, param.getProperty("returnType"), newparameters); + //msg += " <loadResponse"+svcNS+">\n"+answer.SOAPString()+" </loadResponse>\n"; /* // JE2009: This has never been in use. } else if ( method.equals("loadfileRequest") ) { // XML -> URI @@ -420,10 +450,21 @@ public class WSAServProfile implements AlignmentServiceProfile { msg += " <loadResponse"+svcNS+">\n"+answer.SOAPString()+" </loadResponse>\n"; */ } else if ( method.equals("translateRequest") ) { // XML * URI -> XML - // Not done yet - msg += " <translateResponse "+svcNS+">\n"+" </translateResponse>\n"; + if ( newparameters.getProperty( "id" ) == null ) { + answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null); + } else if ( newparameters.getProperty( "query" ) == null ) { + answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null); + } else { + answer = manager.translate( new Message(newId(),(Message)null,myId,serverURL,"", newparameters) ); + } + msg += render( "translateResponse", answer, param.getProperty("returnType"), newparameters); + //msg += " <translateResponse "+svcNS+">\n"+answer.SOAPString()+" </translateResponse>\n"; } else { - msg += " <UnRecognizedAction "+svcNS+"/>\n"; + if ( param.getProperty("returnType") == HTTPResponse.MIME_JSON ) { + msg += "{ \"type\" : \"UnRecognizedAction\" }"; + } else { + msg += " <UnRecognizedAction "+svcNS+"/>\n"; + } } if ( restful ) { @@ -437,6 +478,52 @@ public class WSAServProfile implements AlignmentServiceProfile { "</"+Namespace.SOAP_ENV.shortCut+":Envelope>\n"; } } + + public String render( String type, Message mess, String mimeType, Properties param ) { + String res; + if ( mimeType == HTTPResponse.MIME_JSON ) { + res = "{ \"type\" : \""+type+"\",\n"; + if ( param.getProperty("msgid") != null ) { + res += " \"in-reply-to\" : \""+param.getProperty("msgid")+"\",\n"; + } + res += " \"answer\" : "+mess.JSONString()+" }"; + } else { + res = " <"+type+" "+svcNS+">\n"; + if ( param.getProperty("msgid") != null ) { + res += " <in-reply-to>"+param.getProperty("msgid")+"</in-reply-to>\n"; + } + res += mess.SOAPString()+"\n </"+type+">\n"; + } + return res; + } + + private String getClasses( String type, Set<String> classlist, String mimeType, Properties param ){ + String res = ""; + if ( mimeType == HTTPResponse.MIME_JSON ) { + res = "{ \"type\" : \""+type+"\",\n \"answer\" : ["; + boolean first = true; + for( String mt: classlist ) { + if ( first ) { + res += "\n \""+mt+"\""; + first = false; + } else { + res += ",\n \""+mt+"\""; + } + } + res += "\n]}"; + } else { + res = " <"+type+" "+svcNS+">\n"; + if ( param.getProperty("msgid") != null ) { + res += " <in-reply-to>"+param.getProperty("msgid")+"</in-reply-to>\n"; + } + res += " <classList>\n"; + for( String mt: classlist ) { + res += " <classname>"+mt+"</classname>\n"; + } + res += " </classList>\n </"+type+">\n"; + } + return res; + } public static String wsdlAnswer( boolean embedded ) { if ( embedded ) return wsdlSpec; @@ -476,26 +563,4 @@ public class WSAServProfile implements AlignmentServiceProfile { private int newId() { return localId++; } - private String buildAnswer( String tag, Message answer, Properties param ){ - String res = " <"+tag+">\n"; - if ( param.getProperty("msgid") != null ) { - res += " <in-reply-to>"+param.getProperty("msgid")+"</in-reply-to>\n"; - } - res += answer.SOAPString(); - res += " </"+tag+">\n"; - return res; - } - - private String getClasses( String tag, String ns, Set<String> classlist, Properties param ){ - String res = " <"+tag+ns+">\n <classList>\n"; - if ( param.getProperty("msgid") != null ) { - res += " <in-reply-to>"+param.getProperty("msgid")+"</in-reply-to>\n"; - } - for( String mt: classlist ) { - res += " <classname>"+mt+"</classname>\n"; - } - res += " </classList>\n </"+tag+">\n"; - return res; - } - } diff --git a/src/fr/inrialpes/exmo/align/service/msg/AlignmentId.java b/src/fr/inrialpes/exmo/align/service/msg/AlignmentId.java index d7be9ddf4004de1fe01874baaca0577749c6fc5c..8b32160dddbf204f60e77324440bb63976b0bfea 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/AlignmentId.java +++ b/src/fr/inrialpes/exmo/align/service/msg/AlignmentId.java @@ -52,10 +52,10 @@ public class AlignmentId extends Success { return "Alignment ID: <a href=\"../rest/retrieve?method=fr.inrialpes.exmo.align.impl.renderer.HTMLRendererVisitor&id="+getContent()+"\">"+getPretty(getContent())+"</a> "; } public String RESTString(){ - return "<alid>"+getContent()+"</alid>"; + return "<alid>"+content+"</alid>"; } public String JSONString(){ - return "{ \"type\" : \"AlignmentId\",\n \"content\" : \""+content+"\"\n}"; + return "\""+content+"\""; } } diff --git a/src/fr/inrialpes/exmo/align/service/msg/AlignmentIds.java b/src/fr/inrialpes/exmo/align/service/msg/AlignmentIds.java index 3b751e99a9b1ae74dd3ae93438a500f2e1d309f2..abf927dc634a46a20af2cd6a051f23130a1f6f0f 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/AlignmentIds.java +++ b/src/fr/inrialpes/exmo/align/service/msg/AlignmentIds.java @@ -102,15 +102,14 @@ public class AlignmentIds extends Success { } public String JSONString(){ - String msg = "{ \"type\" : \"AlignmentIds\",\n"; - msg += " \"alignmentIds\" : ["; + String msg = "["; String id[] = content.split(" "); for ( int i = id.length-1; i >= 0; i-- ){ if ( id[i].trim() != "" ) { msg += " \""+id[i].trim()+"\",\n"; } } - msg += " ]\n}\n"; + msg += "]"; return msg; } } diff --git a/src/fr/inrialpes/exmo/align/service/msg/AlignmentMetadata.java b/src/fr/inrialpes/exmo/align/service/msg/AlignmentMetadata.java index 2f2441101c0c57278af3eb2cac68ea4969edc064..f017b395621aa4117aaff15ff4c86e5c4dbfbf48 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/AlignmentMetadata.java +++ b/src/fr/inrialpes/exmo/align/service/msg/AlignmentMetadata.java @@ -36,12 +36,12 @@ public class AlignmentMetadata extends Success { return "Metadata not implemented"; } public String RESTString(){ - return "<id>"+surrogate+"</id>"+"<in-reply-to>"+inReplyTo+"</in-reply-to><metadata>"+content+"</metadata>"; + return "<metadata>"+content+"</metadata>"; } public String SOAPString(){ - return "<id>"+surrogate+"</id>"+"<in-reply-to>"+inReplyTo+"</in-reply-to><metadata>"+content+"</metadata>"; + return "<metadata>"+content+"</metadata>"; } public String JSONString(){ - return "{ \"type\" : \"AlignmentMetadata\",\n \"id\" : \"+surrogate+\",\n \"in-reply-to\" : \"+inReplyTo+\",\n \"content\" : \""+content+"\"\n}"; + return "{ \"type\" : \"AlignmentMetadata\",\n \"content\" : \""+content+"\"\n}"; } } diff --git a/src/fr/inrialpes/exmo/align/service/msg/CannotRenderAlignment.java b/src/fr/inrialpes/exmo/align/service/msg/CannotRenderAlignment.java index 68439c08593535b9b675da4f370405ae8affb1d7..8cee1d1fb48207b5e9e61c127747346c7ef08054 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/CannotRenderAlignment.java +++ b/src/fr/inrialpes/exmo/align/service/msg/CannotRenderAlignment.java @@ -34,9 +34,9 @@ public class CannotRenderAlignment extends ErrorMsg { return "Cannot render alignment "+content; } public String RESTString(){ - return "<CannotRenderAlignment>"+content+"</CannotRenderAlignment>"; + return "<CannotRenderAlignment>"+getXMLContent()+"</CannotRenderAlignment>"; } public String JSONString(){ - return "{ \"type\" : \"CannotRenderAlignment\",\n \"content\" : \""+getContent()+"\"\n}"; + return "{ \"type\" : \"CannotRenderAlignment\",\n \"content\" : \""+getJSONContent()+"\"\n}"; } } diff --git a/src/fr/inrialpes/exmo/align/service/msg/ErrorMsg.java b/src/fr/inrialpes/exmo/align/service/msg/ErrorMsg.java index cf9e5299471c3c03b86a15be970484cb43ada23b..27bbb5b03e070d6fe5565f143399dbb7a176ec4f 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/ErrorMsg.java +++ b/src/fr/inrialpes/exmo/align/service/msg/ErrorMsg.java @@ -43,7 +43,7 @@ public class ErrorMsg extends Message { return message; } public String RESTString(){ - return "<error>" + content + "</error>"; + return "<error>" + getXMLContent() + "</error>"; } public String HTMLRESTString(){ return HTMLString(); @@ -57,6 +57,6 @@ public class ErrorMsg extends Message { return res; } public String JSONString(){ - return "{ \"type\" : \"ErrorMsg\",\n \"content\" : \""+content+"\"\n}"; + return "{ \"type\" : \"ErrorMsg\", \"content\" : \""+getJSONContent()+"\" }"; } } diff --git a/src/fr/inrialpes/exmo/align/service/msg/EvaluationId.java b/src/fr/inrialpes/exmo/align/service/msg/EvaluationId.java index b867ce2c506a7feaebdaac141c8390f73f9a4bd6..8734cf436f109b3fb895e7e50828fb719c1410ca 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/EvaluationId.java +++ b/src/fr/inrialpes/exmo/align/service/msg/EvaluationId.java @@ -46,7 +46,7 @@ public class EvaluationId extends Success { return "<alid>"+content+"</alid>"; } public String JSONString(){ - return "{ \"type\" : \"EvaluationId\",\n \"id\" : \""+content+"\"}"; + return "{ \"type\" : \"EvaluationId\", \"id\" : \""+content+"\" }"; } } diff --git a/src/fr/inrialpes/exmo/align/service/msg/Message.java b/src/fr/inrialpes/exmo/align/service/msg/Message.java index ff3f8eac865111dcc005f82e6f5594eaeb7192da..355fef1c715a52790f224b0d94eff2712a7d877a 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/Message.java +++ b/src/fr/inrialpes/exmo/align/service/msg/Message.java @@ -22,6 +22,8 @@ package fr.inrialpes.exmo.align.service.msg; import java.util.Properties; +import org.apache.commons.lang3.StringEscapeUtils; + /** * Contains the messages that should be sent according to the protocol */ @@ -48,8 +50,11 @@ public class Message { return "<h1>Message</h1><dl><dt>id:</dt><dd>"+surrogate+"</dd><dt>sender:</dt><dd>"+sender+"</dd><dt>receiver:</dt><dd>"+receiver+"</dd><dt>in-reply-to:</dt><dd>"+inReplyTo+"</dd><dt>content:</dt><dd>"+content+"</dd></dl>"; } + /** + * This must return an XML object, typically an attribute. + */ public String RESTString(){ - return "<ErrorMsg/>"; + return "<Message>"+getXMLContent()+"</Message>"; } /** @@ -60,11 +65,14 @@ public class Message { } public String SOAPString(){ - return "<id>"+surrogate+"</id>"+"<sender>"+sender+"</sender>" + "<receiver>"+receiver+"</receiver>" + "<in-reply-to>" + inReplyTo+ "</in-reply-to>" + "<content>" + content + "</content>"; + return "<id>"+surrogate+"</id>"+"<sender>"+sender+"</sender>" + "<receiver>"+receiver+"</receiver>" + "<in-reply-to>" + inReplyTo+ "</in-reply-to>" + "<content>" +getXMLContent()+ "</content>"; } + /** + * This must return a JSON object, that will typically be an attribute value. + */ public String JSONString(){ - return "{ \"id\" : \""+surrogate+"\",\n \"sender\" : \""+sender+"\",\n \"receiver\" : \""+receiver+"\",\n \"in-reply-to\" : \"" + inReplyTo+ "\",\n \"content\" : \"" + content + "\"\n}"; + return "\""+getJSONContent()+"\""; } public int getId () { @@ -83,6 +91,14 @@ public class Message { return content; } + public String getXMLContent() { + return StringEscapeUtils.escapeXml11(content); + } + + public String getJSONContent() { + return StringEscapeUtils.escapeJson(content); + } + public String getSender() { return sender; } diff --git a/src/fr/inrialpes/exmo/align/service/msg/NonConformParameters.java b/src/fr/inrialpes/exmo/align/service/msg/NonConformParameters.java index a2acc2b65f06b6d61cbb82e3bc2aa61223c11e44..6731707f612ad94e1059ed81fb41e0ff794be27b 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/NonConformParameters.java +++ b/src/fr/inrialpes/exmo/align/service/msg/NonConformParameters.java @@ -36,10 +36,10 @@ public class NonConformParameters extends ErrorMsg { return "<h1>Non conform parameters</h1><dl><dt>id:</dt><dd>"+surrogate+"</dd><dt>sender:</dt><dd>"+sender+"</dd><dt>receiver:</dt><dd>"+receiver+"</dd><dt>in-reply-to:</dt><dd>"+inReplyTo+"</dd><dt>content:</dt><dd>"+content+"</dd></dl>"; } public String RESTString(){ - return "<NonConformParameters>" + content + "</NonConformParameters>"; + return "<NonConformParameters>" + getXMLContent() + "</NonConformParameters>"; } public String JSONString(){ - return "{ \"type\" : \"NonConformParameters\",\n \"content\" : \""+content+"\"\n}"; + return "{ \"type\" : \"NonConformParameters\",\n \"content\" : \""+getJSONContent()+"\"\n}"; } } diff --git a/src/fr/inrialpes/exmo/align/service/msg/OntologyURI.java b/src/fr/inrialpes/exmo/align/service/msg/OntologyURI.java index 24ddd0309682d51c5913f385127e587a8bb6a311..8f8731902604a808a7ab4d283bb5b4ab44cbceb5 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/OntologyURI.java +++ b/src/fr/inrialpes/exmo/align/service/msg/OntologyURI.java @@ -38,8 +38,6 @@ public class OntologyURI extends Success { return "<uri>"+content+"</uri>"; } public String JSONString(){ - String res = "{ \"type\" : \"OntologyURI\",\n"; - res += " \"uri\" : \""+content+"\"\n}\n"; - return res; + return "{ \"type\" : \"OntologyURI\", \"uri\" : \""+content+"\" }"; } } diff --git a/src/fr/inrialpes/exmo/align/service/msg/RenderedAlignment.java b/src/fr/inrialpes/exmo/align/service/msg/RenderedAlignment.java index 3325ddab3185e2459699e2f20adda492b4d4d345..829f960941b36822deba5966018e55dec3cd1d4d 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/RenderedAlignment.java +++ b/src/fr/inrialpes/exmo/align/service/msg/RenderedAlignment.java @@ -31,12 +31,20 @@ public class RenderedAlignment extends Success { public RenderedAlignment ( int surr, Message rep, String from, String to, String cont, Properties param ) { super( surr, rep, from, to, cont, param ); } - // THIS CONTENT SHOULD BE ESCAPED: XMLSTRINGENCODDE? public String RESTString(){ - return "<alignment>"+content+"</alignment>"; + String method = (parameters==null)?null:parameters.getProperty( "method" ); + if ( method != null && method.equals("fr.inrialpes.exmo.align.impl.renderer.RDFRendererVisitor" ) ) { + return "<alignment>"+content+"</alignment>"; + } else { + return "<alignment>"+getXMLContent()+"</alignment>"; + } } - // THIS CONTENT SHOULD BE ESCAPED: STRINGENCODDE? public String JSONString(){ - return "{ \"type\" : \"RenderedAlignment\",\n \"content\" : \""+content+"\"\n}"; + String method = (parameters==null)?null:parameters.getProperty( "method" ); + if ( method != null && method.equals("fr.inrialpes.exmo.align.impl.renderer.JSONRendererVisitor" ) ) { + return content; + } else { + return "\""+getJSONContent()+"\""; + } } } diff --git a/src/fr/inrialpes/exmo/align/service/msg/RunTimeError.java b/src/fr/inrialpes/exmo/align/service/msg/RunTimeError.java index 99203688c50130b500964cacc135f82169bb57dd..0404bd6af59a2f8c637e5557799f25f1144aef66 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/RunTimeError.java +++ b/src/fr/inrialpes/exmo/align/service/msg/RunTimeError.java @@ -31,12 +31,12 @@ public class RunTimeError extends ErrorMsg { super( surr, rep, from, to, cont, param ); } public String RESTString(){ - return "<RunTimeError>"+content+"</RunTimeError>"; + return "<RunTimeError>"+getXMLContent()+"</RunTimeError>"; } public String HTMLString(){ return "Cannot process: "+content; } public String JSONString(){ - return "{ \"type\" : \"RunTimeError\",\n \"content\" : \""+content+"\"\n}"; + return "{ \"type\" : \"RunTimeError\",\n \"content\" : \""+getJSONContent()+"\"\n}"; } } diff --git a/src/fr/inrialpes/exmo/align/service/msg/Success.java b/src/fr/inrialpes/exmo/align/service/msg/Success.java index 620374f4ab8fbebe204b8f227e9cabc68a7c808b..39fc3f39db3ebdd874c2d28a52360ac61b60ce35 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/Success.java +++ b/src/fr/inrialpes/exmo/align/service/msg/Success.java @@ -32,7 +32,7 @@ public class Success extends Message { super( surr, rep, from, to, cont, param ); } public String RESTString(){ - return "<content>"+content+"</content>"; + return "<content>"+getXMLContent()+"</content>"; } public String SOAPString(){ String res = " <msgid>"+surrogate+"</msgid>\n"; @@ -45,7 +45,7 @@ public class Success extends Message { String res = "{ \"type\" : \"Success\",\n"; res += " \"id\" : \""+surrogate+"\",\n"; if ( inReplyTo != null ) res += " \"in-reply-to\" : \""+inReplyTo+"\",\n"; - res += " \"content\" : \""+content+"\"\n}\n"; + res += " \"content\" : \""+getJSONContent()+"\"\n}\n"; return res; } } diff --git a/src/fr/inrialpes/exmo/align/service/msg/TranslatedMessage.java b/src/fr/inrialpes/exmo/align/service/msg/TranslatedMessage.java index 2404cb785647b3378239c3dcfe5804abbc0b1622..ae35c4c88394d3b304acc89f9ead4b1d4624fa0f 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/TranslatedMessage.java +++ b/src/fr/inrialpes/exmo/align/service/msg/TranslatedMessage.java @@ -35,9 +35,9 @@ public class TranslatedMessage extends Success { return content; } public String RESTString(){ - return "<message>"+content+"</message>"; + return "<message>"+getXMLContent()+"</message>"; } public String JSONString(){ - return "{ \"type\" : \"TranslatedMessage\",\n \"content\" : \""+content+"\"\n}"; + return "{ \"type\" : \"TranslatedMessage\", \"content\" : \""+getJSONContent()+"\" }"; } } diff --git a/src/fr/inrialpes/exmo/align/service/msg/UnknownAlignment.java b/src/fr/inrialpes/exmo/align/service/msg/UnknownAlignment.java index 4323ff24c2f31648ca6bd5b4191c60878c85ddfc..bfc5998f18e8b7c10f94cf5803e59f0ab4b32951 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/UnknownAlignment.java +++ b/src/fr/inrialpes/exmo/align/service/msg/UnknownAlignment.java @@ -31,12 +31,12 @@ public class UnknownAlignment extends ErrorMsg { super( surr, rep, from, to, cont, param ); } public String RESTString(){ - return "<UnknownAlignment>"+content+"</UnknownAlignment>"; + return "<UnknownAlignment>"+getXMLContent()+"</UnknownAlignment>"; } public String HTMLString(){ return "Unknown alignment: "+content; } public String JSONString(){ - return "{ \"type\" : \"UnknownAlignment\",\n \"content\" : \""+content+"\"\n}"; + return "{ \"type\" : \"UnknownAlignment\",\n \"content\" : \""+getJSONContent()+"\"\n}"; } } diff --git a/src/fr/inrialpes/exmo/align/service/msg/UnknownMethod.java b/src/fr/inrialpes/exmo/align/service/msg/UnknownMethod.java index 823d1575d0d6a8fe02875f91279a07d4fc41bedf..2de814b415078c0eb6491b751fa8eb90413df8e4 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/UnknownMethod.java +++ b/src/fr/inrialpes/exmo/align/service/msg/UnknownMethod.java @@ -34,9 +34,9 @@ public class UnknownMethod extends ErrorMsg { return "Unknown method: "+content; } public String RESTString() { - return "<UnknownMethod>"+content+"</UnknownMethod>"; + return "<UnknownMethod>"+getXMLContent()+"</UnknownMethod>"; } public String JSONString(){ - return "{ \"type\" : \"UnknownMethod\",\n \"content\" : \""+getContent()+"\"\n}"; + return "{ \"type\" : \"UnknownMethod\",\n \"content\" : \""+getJSONContent()+"\"\n}"; } } diff --git a/src/fr/inrialpes/exmo/align/service/msg/UnreachableAlignment.java b/src/fr/inrialpes/exmo/align/service/msg/UnreachableAlignment.java index 8080950eaaf99b115493c90b2753db23b6ab59cb..e512d0d3bc4504447d538b045caeadfdebbfb0aa 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/UnreachableAlignment.java +++ b/src/fr/inrialpes/exmo/align/service/msg/UnreachableAlignment.java @@ -31,12 +31,12 @@ public class UnreachableAlignment extends ErrorMsg { super( surr, rep, from, to, cont, param ); } public String RESTString() { - return "<UnreachableAlignment>"+content+"</UnreachableAlignment>"; + return "<UnreachableAlignment>"+getXMLContent()+"</UnreachableAlignment>"; } public String HTMLString() { return "Unreachable alignment: "+content; } public String JSONString(){ - return "{ \"type\" : \"UnreachableAlignment\",\n \"content\" : \""+content+"\"\n}"; + return "{ \"type\" : \"UnreachableAlignment\",\n \"content\" : \""+getJSONContent()+"\"\n}"; } } diff --git a/src/fr/inrialpes/exmo/align/service/msg/UnreachableOntology.java b/src/fr/inrialpes/exmo/align/service/msg/UnreachableOntology.java index 2230ebba746c185d2f23185c246db37cd56fe2c5..ebdd67bc249ef760e0a29b4f8efc3938ea181ebd 100644 --- a/src/fr/inrialpes/exmo/align/service/msg/UnreachableOntology.java +++ b/src/fr/inrialpes/exmo/align/service/msg/UnreachableOntology.java @@ -31,12 +31,12 @@ public class UnreachableOntology extends ErrorMsg { super( surr, rep, from, to, cont, param ); } public String RESTString() { - return "<UnreachableOntology>"+content+"</UnreachableOntology>"; + return "<UnreachableOntology>"+getXMLContent()+"</UnreachableOntology>"; } public String HTMLString() { return "Unreachable ontology: "+content; } public String JSONString(){ - return "{ \"type\" : \"UnreachableOntology\",\n \"content\" : \""+content+"\"\n}"; + return "{ \"type\" : \"UnreachableOntology\",\n \"content\" : \""+getJSONContent()+"\"\n}"; } }