1.x branch (first created for gCube 2.12)
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/branches/information-system/ic-client/1.0@67187 82a268e6-3cf1-43bd-a215-b396298e98cfsmartgears_4
commit
219d07154f
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>ic-client</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1,6 @@
|
||||
gCube System - License
|
||||
------------------------------------------------------------
|
||||
|
||||
The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
The software and documentation is provided by its authors/distributors "as is" and no expressed or
|
||||
implied warranty is given for its use, quality or fitness for a particular case.
|
@ -0,0 +1,2 @@
|
||||
* Fabio Simeoni (fabio.simeoni@fao.org), FAO of the UN, Italy
|
||||
* Lucio Lelii (lucio.lelii@isti.cnr.it), CNR, Italy
|
@ -0,0 +1,39 @@
|
||||
The gCube System - ${name}
|
||||
----------------------
|
||||
|
||||
This work has been partially supported by the following European projects: DILIGENT (FP6-2003-IST-2), D4Science (FP7-INFRA-2007-1.2.2),
|
||||
D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2), and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil).
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
* Fabio Simeoni (fabio.simeoni@fao.org), FAO of the UN, Italy
|
||||
* Lucio Lelii (lucio.lelii@isti.cnr.it), CNR, Italy
|
||||
|
||||
Version and Release Date
|
||||
------------------------
|
||||
${version}
|
||||
|
||||
Description
|
||||
-----------
|
||||
${description}
|
||||
|
||||
Download information
|
||||
--------------------
|
||||
|
||||
Source code is available from SVN:
|
||||
${scm.url}
|
||||
|
||||
Binaries can be downloaded from:
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
Documentation is available on-line from the Projects Documentation Wiki:
|
||||
https://gcube.wiki.gcube-system.org/gcube/index.php
|
||||
|
||||
|
||||
Licensing
|
||||
---------
|
||||
|
||||
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
|
@ -0,0 +1,5 @@
|
||||
<ReleaseNotes>
|
||||
<Changeset component="${build.finalName}" date="--todo--">
|
||||
<Change>First Release</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
@ -0,0 +1,38 @@
|
||||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||
<id>servicearchive</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<baseDirectory>/</baseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
<includes>
|
||||
<include>README</include>
|
||||
<include>LICENSE</include>
|
||||
<include>INSTALL</include>
|
||||
<include>MAINTAINERS</include>
|
||||
<include>changelog.xml</include>
|
||||
<include>profile.xml</include>
|
||||
</includes>
|
||||
<fileMode>755</fileMode>
|
||||
<filtered>true</filtered>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<files>
|
||||
<file>
|
||||
<source>target/${build.finalName}.jar</source>
|
||||
<outputDirectory>/${artifactId}</outputDirectory>
|
||||
</file>
|
||||
<file>
|
||||
<source>${distroDirectory}/svnpath.txt</source>
|
||||
<outputDirectory>/${artifactId}</outputDirectory>
|
||||
<filtered>true</filtered>
|
||||
</file>
|
||||
</files>
|
||||
</assembly>
|
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<ID />
|
||||
<Type>Service</Type>
|
||||
<Profile>
|
||||
<Description>${description}</Description>
|
||||
<Class>InformationSystem</Class>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>1.0.0</Version>
|
||||
<Packages>
|
||||
<Software>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>${version}</Version>
|
||||
<MavenCoordinates>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
<version>${version}</version>
|
||||
</MavenCoordinates>
|
||||
<Files>
|
||||
<File>${build.finalName}.jar</File>
|
||||
</Files>
|
||||
</Software>
|
||||
</Packages>
|
||||
</Profile>
|
||||
</Resource>
|
||||
|
@ -0,0 +1 @@
|
||||
${scm.url}
|
@ -0,0 +1,127 @@
|
||||
<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.gcube.tools</groupId>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>ic-client</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<name>Information Collector Client</name>
|
||||
<description>Client API for the Information Collector service</description>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/${project.artifactId}</connection>
|
||||
<developerConnection>scm:svn:https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/${project.artifactId}</developerConnection>
|
||||
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/${project.artifactId}</url>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<distroDirectory>distro</distroDirectory>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-scope</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>discovery-client</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources</groupId>
|
||||
<artifactId>common-gcore-resources</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-gcore-stubs</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.6.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.6.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-profile</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>target</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>profile.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>servicearchive</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,206 @@
|
||||
package org.gcube.resources.discovery.icclient;
|
||||
|
||||
import static org.gcube.common.scope.impl.ScopeBean.Type.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.resources.discovery.icclient.stubs.MalformedQueryException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class Helper {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(Helper.class);
|
||||
|
||||
public static String queryAddAuthenticationControl(String expression) throws MalformedQueryException
|
||||
{
|
||||
|
||||
String scope = ScopeProvider.instance.get();
|
||||
|
||||
if (scope==null || !new ScopeBean(scope).is(VRE))
|
||||
return expression;
|
||||
|
||||
int wherePathIndex=0;
|
||||
int returnPathIndex=0;
|
||||
int collIndexEnd=0;
|
||||
int collIndexStart=0;
|
||||
boolean whereFinded=false;
|
||||
String forInsertFinal="";
|
||||
String whereInsertFinal="";
|
||||
String temp="";
|
||||
|
||||
String forPropertiesString="\n *VAR* in *COLLECTION*/Data/child::*[local-name()='Scopes'] \n";
|
||||
String forString=" *VAR* in *COLLECTION*/Scopes \n";
|
||||
String authString=" (contains(*VAR*//Scope,'"+scope+"') or contains(*VAR*//Scope,'"+scope.substring(0,scope.lastIndexOf("/"))+"')) ";
|
||||
String authStringNormal=" contains(*VAR*//Scope,'"+scope+"') ";
|
||||
|
||||
String queryFiltered;
|
||||
List<Pair> collInsert= new ArrayList<Pair>();
|
||||
Pattern wherePattern= Pattern.compile("where");
|
||||
//mathcing , $result in $outer/Data
|
||||
Pattern inSubResult= Pattern.compile("(,\\s*([^\\s]*)\\s*in\\s*([^\\s]*)\\s*)(where|order\\sby|return)");
|
||||
Pattern returnPattern= Pattern.compile("order\\sby|return");
|
||||
|
||||
|
||||
Pattern collectionPattern= Pattern.compile("[^\\s]*\\s*in\\s*collection\\s*[^\\s,]*");
|
||||
Pattern varPattern= Pattern.compile("[^\\s]*");
|
||||
Pattern resourcePattern= Pattern.compile("\\scollection\\s*\\([^\\)]*.*/Resource", Pattern.DOTALL);
|
||||
Pattern propertiesPattern=Pattern.compile("\\scollection\\s*\\([^\\)]*.*/Document", Pattern.DOTALL);
|
||||
Matcher varMat;
|
||||
Matcher resourceMat;
|
||||
Matcher collMat=collectionPattern.matcher(expression);
|
||||
collMat.reset();
|
||||
String forStringTemp="";
|
||||
while (collMat.find(collIndexEnd))
|
||||
{
|
||||
|
||||
try{
|
||||
collIndexEnd=collMat.end();
|
||||
temp=collMat.group();
|
||||
collIndexStart=collMat.start();
|
||||
}catch(IllegalStateException e){
|
||||
log.warn("error parsing collection statement");
|
||||
}
|
||||
varMat= varPattern.matcher(temp);
|
||||
boolean propBool=false;
|
||||
if (temp.contains("/Properties"))
|
||||
{
|
||||
resourceMat= propertiesPattern.matcher(temp);
|
||||
propBool=true;
|
||||
}
|
||||
else resourceMat=resourcePattern.matcher(temp);
|
||||
varMat.lookingAt();
|
||||
resourceMat.find();
|
||||
String tempPath="";
|
||||
try{
|
||||
tempPath= temp.substring(resourceMat.end());
|
||||
if (propBool)
|
||||
{
|
||||
String resourceMatString= resourceMat.group();
|
||||
forStringTemp=forPropertiesString.replace("*VAR*","$entry"+collInsert.size()+"ValueAuth" ).replace("*COLLECTION*", resourceMatString );
|
||||
Pair c= new Pair("let "+varMat.group()+" := "+" $entry"+collInsert.size()+"ValueAuth/.."+tempPath, true);
|
||||
collInsert.add(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
String resourceMatString= resourceMat.group();
|
||||
forStringTemp=forString.replace("*VAR*","$entry"+collInsert.size()+"ValueAuth" ).replace("*COLLECTION*",resourceMatString );
|
||||
Pair c= new Pair("let "+varMat.group()+" := "+" $entry"+collInsert.size()+"ValueAuth/.."+tempPath, (resourceMatString.contains("/Profiles/RunningInstance") || resourceMatString.contains("/Profiles/GHN") || resourceMatString.contains("/Profiles/Service")));
|
||||
collInsert.add(c);
|
||||
}
|
||||
}catch(IllegalStateException e){ log.debug("error parsing statement");}
|
||||
expression=expression.substring(0, collIndexStart)+ forStringTemp +expression.substring(collIndexEnd);
|
||||
collMat=collectionPattern.matcher(expression);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (collInsert.size()==0) return expression;
|
||||
//concat the let statements
|
||||
|
||||
|
||||
for (int i=0; i<collInsert.size(); i++)
|
||||
{
|
||||
if (i==collInsert.size()-1){
|
||||
if(collInsert.get(i).isStrangeBehaviour())
|
||||
whereInsertFinal+=authString.replace("*VAR*", "$entry"+i+"ValueAuth");
|
||||
else whereInsertFinal+=authStringNormal.replace("*VAR*", "$entry"+i+"ValueAuth");
|
||||
}else{
|
||||
if(collInsert.get(i).isStrangeBehaviour())
|
||||
whereInsertFinal+=authString.replace("*VAR*", "$entry"+i+"ValueAuth")+" and " ;
|
||||
else whereInsertFinal+=authStringNormal.replace("*VAR*", "$entry"+i+"ValueAuth")+" and " ;
|
||||
}
|
||||
forInsertFinal+="\n"+collInsert.get(i).getToInsert()+" ";
|
||||
}
|
||||
|
||||
Matcher whereMat=wherePattern.matcher(expression);
|
||||
Matcher inSubResultMat= inSubResult.matcher(expression);
|
||||
Matcher returnMat=returnPattern.matcher(expression);
|
||||
whereMat.reset();
|
||||
returnMat.reset();
|
||||
whereFinded=whereMat.find();
|
||||
returnMat.find();
|
||||
String inSubResultString="";
|
||||
try{
|
||||
inSubResultMat.find();
|
||||
inSubResultString= inSubResultMat.group(1);
|
||||
}catch(Exception e){}
|
||||
try{
|
||||
|
||||
wherePathIndex=whereMat.start();
|
||||
}catch(IllegalStateException e){ log.debug("where not found");}
|
||||
try{
|
||||
returnPathIndex=returnMat.start();
|
||||
}catch(IllegalStateException e){ log.error("error parsing return statement"); throw new MalformedQueryException("error parsing return statement");}
|
||||
if (whereFinded)
|
||||
queryFiltered=expression.substring(0,wherePathIndex)+"\nwhere "+whereInsertFinal
|
||||
+" and ("+expression.substring(wherePathIndex+5, returnPathIndex)+" ) \n"+expression.substring(returnPathIndex);
|
||||
else
|
||||
queryFiltered=expression.substring(0,returnPathIndex)+ "\nwhere "+whereInsertFinal+" \n "+expression.substring(returnPathIndex);
|
||||
|
||||
//logger.trace("queryFiltered to match: " + queryFiltered);
|
||||
Pattern letPattern=Pattern.compile("let.*:=", Pattern.DOTALL);
|
||||
Matcher letMat=letPattern.matcher(queryFiltered);
|
||||
whereMat=wherePattern.matcher(queryFiltered);
|
||||
whereMat.reset();
|
||||
whereMat.find();
|
||||
|
||||
boolean letFinded=letMat.find(collIndexStart);
|
||||
int letPathIndex=0;
|
||||
try{
|
||||
|
||||
wherePathIndex=whereMat.start();
|
||||
if (letFinded) letPathIndex=letMat.start();
|
||||
}catch(IllegalStateException e){ log.error("error parsing let statement"); throw new MalformedQueryException("error parsing let statement");}
|
||||
|
||||
|
||||
if (!letFinded) {
|
||||
queryFiltered=queryFiltered.substring(0,wherePathIndex)+forInsertFinal +queryFiltered.substring(wherePathIndex);
|
||||
}
|
||||
else {
|
||||
queryFiltered=queryFiltered.substring(0,letPathIndex)+forInsertFinal+queryFiltered.substring(letPathIndex);
|
||||
}
|
||||
queryFiltered=queryFiltered.replace(inSubResultString, "");
|
||||
|
||||
if (inSubResultString.compareTo("")!=0){
|
||||
String firstVar=inSubResultMat.group(2);
|
||||
String replaceVar=inSubResultMat.group(3);
|
||||
queryFiltered= queryFiltered.replace(firstVar, replaceVar);
|
||||
//System.out.println(firstVar);
|
||||
//System.out.println(replaceVar);
|
||||
}
|
||||
|
||||
log.trace("submitting filtered query: {}",queryFiltered);
|
||||
|
||||
return queryFiltered;
|
||||
}
|
||||
|
||||
|
||||
private static class Pair {
|
||||
private String toInsert;
|
||||
//is strange Behaviour is true if we are searching for RI , GHN or Service
|
||||
private boolean isStrangeBehaviour;
|
||||
|
||||
public Pair(String toInsert, boolean isStrangeBehaviour){
|
||||
this.toInsert= toInsert;
|
||||
this.isStrangeBehaviour= isStrangeBehaviour;
|
||||
}
|
||||
|
||||
public String getToInsert(){
|
||||
return this.toInsert;
|
||||
}
|
||||
|
||||
public boolean isStrangeBehaviour(){
|
||||
return this.isStrangeBehaviour;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,103 @@
|
||||
package org.gcube.resources.discovery.icclient;
|
||||
|
||||
import static org.gcube.common.clients.stubs.jaxws.StubFactory.*;
|
||||
import static org.gcube.data.streams.dsl.Streams.*;
|
||||
import static org.gcube.resources.discovery.icclient.stubs.CollectorConstants.*;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.xml.ws.soap.SOAPFaultException;
|
||||
|
||||
import org.gcube.common.clients.stubs.jaxws.JAXWSUtils;
|
||||
import org.gcube.common.scope.api.ServiceMap;
|
||||
import org.gcube.data.streams.Stream;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryException;
|
||||
import org.gcube.resources.discovery.client.api.InvalidResultException;
|
||||
import org.gcube.resources.discovery.client.queries.api.Query;
|
||||
import org.gcube.resources.discovery.icclient.stubs.CollectorStub;
|
||||
import org.gcube.resources.discovery.icclient.stubs.MalformedQueryException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* An {@link DiscoveryClient} that submits queries to the Information Collector, without parsing the results.
|
||||
*
|
||||
*/
|
||||
public class ICClient implements DiscoveryClient<String> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ICClient.class);
|
||||
|
||||
//result split pattern
|
||||
private static final Pattern pattern = Pattern.compile("<Record>(.*?)</Record>", Pattern.DOTALL);
|
||||
|
||||
|
||||
public List<String> submit(Query query) throws DiscoveryException {
|
||||
|
||||
try {
|
||||
CollectorStub stub = getStub();
|
||||
String results = callService(query, stub);
|
||||
return splitIntoList(results);
|
||||
}
|
||||
catch(MalformedQueryException e) {
|
||||
throw new DiscoveryException("malformed query "+query.expression(),e);
|
||||
}
|
||||
catch(SOAPFaultException e) {
|
||||
throw new RuntimeException(JAXWSUtils.remoteCause(e));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Stream<String> submitForStream(Query query) throws DiscoveryException, InvalidResultException {
|
||||
// TODO: use real streaming if and when IC will support it
|
||||
return convert(submit(query));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//helper
|
||||
private String callService(Query query, CollectorStub stub) {
|
||||
|
||||
String expression = query.expression();
|
||||
|
||||
log.info("executing query {}",expression);
|
||||
|
||||
long time = System.currentTimeMillis();
|
||||
|
||||
String submittedExpression = Helper.queryAddAuthenticationControl(expression);
|
||||
|
||||
String response = stub.execute(submittedExpression);
|
||||
|
||||
log.info("executed query {} in {} ms",expression,System.currentTimeMillis()-time);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
//helper
|
||||
private CollectorStub getStub() {
|
||||
|
||||
//find endpoint address in service map currently in scope
|
||||
String address = ServiceMap.instance.endpoint(localname);
|
||||
|
||||
//obtain a JAXWS stub configured for gCube calls
|
||||
return stubFor(collector).at(URI.create(address));
|
||||
}
|
||||
|
||||
//helper
|
||||
private List<String> splitIntoList(String response) {
|
||||
|
||||
List<String> results = new ArrayList<String>();
|
||||
|
||||
Matcher m = pattern.matcher(response);
|
||||
|
||||
while (m.find())
|
||||
results.add(m.group(1).trim());
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
package org.gcube.resources.discovery.icclient;
|
||||
|
||||
import static java.lang.String.*;
|
||||
import static org.gcube.resources.discovery.client.queries.impl.XQuery.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.common.resources.gcore.GCoreEndpoint;
|
||||
import org.gcube.common.resources.gcore.GenericResource;
|
||||
import org.gcube.common.resources.gcore.HostingNode;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.common.resources.gcore.ServiceInstance;
|
||||
import org.gcube.common.resources.gcore.Software;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.api.ResultParser;
|
||||
import org.gcube.resources.discovery.client.impl.DelegateClient;
|
||||
import org.gcube.resources.discovery.client.impl.JAXBParser;
|
||||
import org.gcube.resources.discovery.client.queries.impl.XQuery;
|
||||
|
||||
/**
|
||||
* Factory of {@link XQuery}s and {@link DiscoveryClient}s for the Information Collector service.
|
||||
*
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
*/
|
||||
public class ICFactory {
|
||||
|
||||
// known query parameters, indexed by resource type
|
||||
private static Map<Class<?>, Map<String, String>> registry = new HashMap<Class<?>, Map<String, String>>();
|
||||
|
||||
public static final String nsDeclaration = "declare namespace ic = 'http://gcube-system.org/namespaces/informationsystem/registry';";
|
||||
|
||||
public static final String instancesNSDeclaration = nsDeclaration+
|
||||
"declare namespace gcube = 'http://gcube-system.org/namespaces/common/core/porttypes/GCUBEProvider';";
|
||||
|
||||
private final static String profile_range = "collection('/db/Profiles/%1$s')//Document/Data/ic:Profile/Resource";
|
||||
|
||||
// registers parameters for known queries
|
||||
static {
|
||||
|
||||
register(GenericResource.class,
|
||||
params().add(ns, nsDeclaration).add(range, format(profile_range, "GenericResource")).build());
|
||||
register(ServiceEndpoint.class,
|
||||
params().add(ns, nsDeclaration).add(range, format(profile_range, "RuntimeResource")).build());
|
||||
register(ServiceInstance.class,
|
||||
params().add(ns, instancesNSDeclaration).add(range, "collection('/db/Properties')//Document").build());
|
||||
register(GCoreEndpoint.class,
|
||||
params().add(ns, nsDeclaration).add(range, format(profile_range, "RunningInstance")).build());
|
||||
register(Software.class,
|
||||
params().add(ns, nsDeclaration).add(range, format(profile_range, "Service")).build());
|
||||
register(HostingNode.class,
|
||||
params().add(ns, nsDeclaration).add(range, format(profile_range, "GHN")).build());
|
||||
|
||||
}
|
||||
|
||||
// helper
|
||||
private static void register(Class<?> type, Map<String, String> parameters) throws IllegalStateException {
|
||||
if (registry.containsKey(type))
|
||||
throw new IllegalStateException("a query is already registered for type" + type);
|
||||
else
|
||||
registry.put(type, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link XQuery} for a given resource type.
|
||||
*
|
||||
* @param type the resource type
|
||||
* @return the query
|
||||
* @throws IllegalStateException if a query for the resource type has not been previously registered
|
||||
*/
|
||||
public static XQuery queryFor(Class<?> type) throws IllegalStateException {
|
||||
|
||||
if (registry.containsKey(type))
|
||||
return new XQuery(registry.get(type));
|
||||
else
|
||||
throw new IllegalStateException("no query registered for " + type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link DiscoveryClient} that submits queries to the Information Collector service and parses query results with a
|
||||
* given resource type.
|
||||
*
|
||||
* @param type the resource type
|
||||
* @return the client
|
||||
*/
|
||||
public static <R> DiscoveryClient<R> clientFor(Class<R> type) {
|
||||
return new DelegateClient<R>(new JAXBParser<R>(type), new ICClient());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link DiscoveryClient} that submits queries to the Information Collector service without
|
||||
* parsing the results.
|
||||
*
|
||||
* @return the client
|
||||
*/
|
||||
public static DiscoveryClient<String> client() {
|
||||
return new ICClient();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link DiscoveryClient} that submits queries to the Information Collector service and parses query results with a
|
||||
* given {@link ResultParser}.
|
||||
*
|
||||
* @param parser the resource parser
|
||||
* @return the client
|
||||
*/
|
||||
public static <R> DiscoveryClient<R> clientWith(ResultParser<R> parser) {
|
||||
return new DelegateClient<R>(parser, new ICClient());
|
||||
}
|
||||
|
||||
// utils
|
||||
|
||||
public static ParameterBuilder params() {
|
||||
return new ParameterBuilder();
|
||||
}
|
||||
|
||||
public static class ParameterBuilder {
|
||||
|
||||
private Map<String, String> params = new HashMap<String, String>();
|
||||
|
||||
public ParameterBuilder add(String name, String value) {
|
||||
params.put(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Map<String, String> build() {
|
||||
return params;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package org.gcube.resources.discovery.icclient.stubs;
|
||||
|
||||
import static org.gcube.common.clients.stubs.jaxws.GCoreServiceBuilder.*;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.gcube.common.clients.stubs.jaxws.GCoreService;
|
||||
|
||||
/**
|
||||
* Stub-related constants.
|
||||
*
|
||||
* @author Fabio Simeoni
|
||||
*
|
||||
*/
|
||||
public class CollectorConstants {
|
||||
|
||||
//public constants
|
||||
public static final String namespace = "http://gcube-system.org/namespaces/informationsystem/collector/XQueryAccess/service";
|
||||
public static final String localname = "XQueryAccessService";
|
||||
public static final QName name = new QName(namespace,localname);
|
||||
|
||||
public static String service_class="InformationSystem";
|
||||
public static String service_name="IS-Collector";
|
||||
|
||||
//package-private constants for JAXWS interface annotations
|
||||
static final String target_namespace = "http://gcube-system.org/namespaces/informationsystem/collector/XQueryAccess";
|
||||
static final String portType = "XQueryAccessPortType";
|
||||
static final String port = "XQueryAccessPortTypePort";
|
||||
|
||||
public final static GCoreService<CollectorStub> collector = service().withName(name).
|
||||
coordinates(service_class, service_name).
|
||||
andInterface(CollectorStub.class);
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package org.gcube.resources.discovery.icclient.stubs;
|
||||
|
||||
import static org.gcube.resources.discovery.icclient.stubs.CollectorConstants.*;
|
||||
|
||||
import javax.jws.WebMethod;
|
||||
import javax.jws.WebParam;
|
||||
import javax.jws.WebResult;
|
||||
import javax.jws.WebService;
|
||||
import javax.xml.ws.soap.SOAPFaultException;
|
||||
|
||||
/**
|
||||
* A local interface to the resource discovery service.
|
||||
*
|
||||
*
|
||||
*/
|
||||
@WebService(name=portType,targetNamespace=target_namespace)
|
||||
public interface CollectorStub {
|
||||
|
||||
/**
|
||||
* Executes a {@link QueryStub}.
|
||||
* @param query the query
|
||||
* @return the query results
|
||||
* @throws MalformedQueryException if the query is malformed
|
||||
* @throws SOAPFaultException if the query cannot be executed
|
||||
*/
|
||||
@WebMethod(operationName="XQueryExecute")
|
||||
@WebResult(name="Dataset")
|
||||
String execute(@WebParam(name="XQueryExpression") String query) throws MalformedQueryException;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package org.gcube.resources.discovery.icclient.stubs;
|
||||
|
||||
import javax.xml.ws.WebFault;
|
||||
|
||||
/**
|
||||
* Thrown by {@link CollectorStub#execute(String)} when the query cannot be submitted to the Information Collector
|
||||
* service.
|
||||
*/
|
||||
@WebFault(name = "XQueryFaultType")
|
||||
public class MalformedQueryException extends RuntimeException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates an instance with a given message and an {@link AxisFaultInfo} payload
|
||||
* @param message the message
|
||||
* @param info the payload
|
||||
*/
|
||||
public MalformedQueryException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
@ -0,0 +1,220 @@
|
||||
package org.acme;
|
||||
|
||||
import static java.lang.String.*;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.*;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementRef;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.gcube.common.resources.gcore.GCoreEndpoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||
import org.gcube.common.resources.gcore.ServiceInstance;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.Query;
|
||||
import org.gcube.resources.discovery.client.queries.impl.XQuery;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class APIClient {
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() {
|
||||
|
||||
ScopeProvider.instance.set("/gcube/devsec");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void allServiceEndpoints() {
|
||||
|
||||
|
||||
//pick a predefined query
|
||||
Query query = queryFor(ServiceEndpoint.class);
|
||||
|
||||
//pick a client that knows how to parse those resources
|
||||
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||
|
||||
//execute query in current scope
|
||||
List<ServiceEndpoint> resources = client.submit(query);
|
||||
|
||||
System.out.println(resources);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void someServiceEndpoints() {
|
||||
|
||||
|
||||
XQuery query = queryFor(ServiceEndpoint.class);
|
||||
query.addCondition("$resource/Profile/Category/text() eq 'Database'");
|
||||
query.setResult("$resource/Profile/AccessPoint/Interface/Endpoint/text()");
|
||||
|
||||
DiscoveryClient<String> client = client();
|
||||
|
||||
List<String> resources = client.submit(query);
|
||||
|
||||
System.out.println(resources);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void someServiceEndpointAddresses() {
|
||||
|
||||
|
||||
XQuery query = queryFor(ServiceEndpoint.class);
|
||||
query.addCondition("$resource/Profile/Category/text() eq 'Database'");
|
||||
query.setResult("$resource/Profile/AccessPoint/Interface/Endpoint/text()");
|
||||
|
||||
DiscoveryClient<String> client = client();
|
||||
|
||||
List<String> addresses = client.submit(query);
|
||||
|
||||
System.out.println(addresses);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void someGCoreServiceEndpointAddresses() {
|
||||
|
||||
|
||||
XQuery query = queryFor(GCoreEndpoint.class);
|
||||
query.addCondition("$resource/Profile/ServiceClass/text() eq 'DataAccess'");
|
||||
query.addCondition("$resource/Profile/ServiceName/text() eq 'tree-manager-service'");
|
||||
query.addVariable("$entry","$resource/Profile/AccessPoint/RunningInstanceInterfaces/Endpoint");
|
||||
query.addCondition("$entry/@EntryName/string() eq 'gcube/data/tm/binder'");
|
||||
query.setResult("$entry/text()");
|
||||
|
||||
DiscoveryClient<String> client = client();
|
||||
|
||||
List<String> addresses = client.submit(query);
|
||||
|
||||
System.out.println(addresses);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void someCustomServiceEndpointResults() {
|
||||
|
||||
|
||||
XQuery query = queryFor(ServiceEndpoint.class);
|
||||
query.addCondition("$resource/Profile/Category/text() eq 'Database'");
|
||||
query.setResult("<perfect>" +
|
||||
"<id>{$resource/ID/text()}</id>" +
|
||||
"{$resource/Profile/AccessPoint}" +
|
||||
"</perfect>");
|
||||
|
||||
DiscoveryClient<PerfectResult> client = clientFor(PerfectResult.class);
|
||||
|
||||
List<PerfectResult> results = client.submit(query);
|
||||
|
||||
for (PerfectResult result : results) {
|
||||
System.out.println(result.id+":"+result.ap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@XmlRootElement(name="perfect")
|
||||
private static class PerfectResult {
|
||||
|
||||
@XmlElement(name="id")
|
||||
String id;
|
||||
|
||||
@XmlElementRef
|
||||
AccessPoint ap;
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void someServiceEndpointsAccessData() {
|
||||
|
||||
|
||||
XQuery query = queryFor(ServiceEndpoint.class);
|
||||
query.addCondition("$resource/Profile/Category/text() eq 'Database'")
|
||||
.setResult("$resource/Profile/AccessPoint");
|
||||
|
||||
DiscoveryClient<AccessPoint> client = clientFor(AccessPoint.class);
|
||||
|
||||
List<AccessPoint> accesspoints = client.submit(query);
|
||||
|
||||
for (AccessPoint point : accesspoints) {
|
||||
System.out.println(point.name()+":"+point.address());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void someServiceInstances() {
|
||||
|
||||
|
||||
XQuery query = queryFor(ServiceInstance.class);
|
||||
query.addCondition("$resource/Data/gcube:ServiceClass/text() eq 'DataAccess'").
|
||||
addCondition("$resource/Data/gcube:ServiceName/text() eq 'tree-manager-service'");
|
||||
|
||||
DiscoveryClient<ServiceInstance> client = clientFor(ServiceInstance.class);
|
||||
|
||||
List<ServiceInstance> props = client.submit(query);
|
||||
|
||||
|
||||
|
||||
System.out.println(props);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void someServiceInstanceReferences() {
|
||||
|
||||
|
||||
XQuery query = queryFor(ServiceInstance.class);
|
||||
query.addCondition("$resource/Data/gcube:ServiceClass/text() eq 'DataAccess'").
|
||||
addCondition("$resource/Data/gcube:ServiceName/text() eq 'tree-manager-service'")
|
||||
.addCondition(format("$resource/Source/text()[ends-with(.,'%1s')]","gcube/data/tm/binder"));
|
||||
|
||||
DiscoveryClient<ServiceInstance> client = clientFor(ServiceInstance.class);
|
||||
|
||||
List<ServiceInstance> refs = client.submit(query);
|
||||
|
||||
System.out.println(refs);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void someServiceInstanceProperties() {
|
||||
|
||||
|
||||
XQuery query = queryFor(ServiceInstance.class);
|
||||
query.addNamespace("tm",URI.create("http://gcube-system.org/namespaces/data/tm")).
|
||||
addCondition("$resource/Data/tm:Plugin/name/text() eq 'species-tree-plugin'");
|
||||
|
||||
DiscoveryClient<ServiceInstance> client = clientFor(ServiceInstance.class);
|
||||
|
||||
List<ServiceInstance> props = client.submit(query);
|
||||
|
||||
System.out.println(props);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void someServiceEndpointsProperties() {
|
||||
|
||||
|
||||
XQuery query = queryFor(ServiceEndpoint.class);
|
||||
query.addVariable("$prop", "$resource/Profile/AccessPoint/Properties/Property").
|
||||
addCondition("$prop/Name/text() eq 'dbname'").
|
||||
addCondition("$prop/Value/text() eq 'timeseries'").
|
||||
setResult("$resource/Profile/AccessPoint/Interface/Endpoint/text()");
|
||||
|
||||
DiscoveryClient<String> client = client();
|
||||
|
||||
List<String> props = client.submit(query);
|
||||
|
||||
System.out.println(props);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package org.acme;
|
||||
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.common.resources.gcore.GenericResource;
|
||||
import org.gcube.common.resources.gcore.ServiceInstance;
|
||||
import org.gcube.resources.discovery.client.queries.api.Query;
|
||||
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
|
||||
import org.gcube.resources.discovery.client.queries.impl.XQuery;
|
||||
import org.gcube.resources.discovery.client.queries.impl.QueryTemplate;
|
||||
|
||||
public class QueryClient {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
//a custom query: client entirely exposed to query language
|
||||
Query q1 = new QueryBox("my query");
|
||||
System.out.println(q1);
|
||||
|
||||
//a custom template query: client provides template and parameters previously gathered
|
||||
Map<String,String> params = params().add("param","query").build();
|
||||
Query q2 = new QueryTemplate("my <param/>",params);
|
||||
System.out.println(q2);
|
||||
|
||||
//another custom template query: client provides template and parameters in a phased manner
|
||||
QueryTemplate q2bis = new QueryTemplate("my <param/>",params);
|
||||
q2bis.addParameter("param","newquery");
|
||||
System.out.println(q2bis);
|
||||
|
||||
//a predefined simple query: client adds conditions
|
||||
XQuery q3 = queryFor(GenericResource.class);
|
||||
System.out.println(q3);
|
||||
q3.addCondition("$resource/a/simple/condition/string() eq value");
|
||||
System.out.println(q3);
|
||||
|
||||
//a predefined simple query: clients customises results
|
||||
XQuery q4 = queryFor(GenericResource.class);
|
||||
q4.setResult("$resource/ID");
|
||||
q4.setResult("$resource/ID");
|
||||
System.out.println(q4);
|
||||
|
||||
XQuery q5 = queryFor(ServiceInstance.class);
|
||||
q5.addVariable("$other", "$resource/some/prop");
|
||||
System.out.println(q5);
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package org.acme;
|
||||
|
||||
import static org.gcube.common.clients.stubs.jaxws.StubFactory.*;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.*;
|
||||
import static org.gcube.resources.discovery.icclient.stubs.CollectorConstants.*;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.xml.ws.soap.SOAPFaultException;
|
||||
|
||||
import org.gcube.common.clients.stubs.jaxws.JAXWSUtils;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.api.ServiceMap;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.gcube.resources.discovery.icclient.stubs.CollectorStub;
|
||||
|
||||
public class StubClient {
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
//when needed, setup tcpmon and decomment to see messages on the wire for debugging purposes
|
||||
//StubFactory.setProxy("localhost", 8081);
|
||||
|
||||
ScopeProvider.instance.set("/gcube/devsec");
|
||||
|
||||
String address = ServiceMap.instance.endpoint(localname);
|
||||
|
||||
CollectorStub proxy = stubFor(collector).at(URI.create(address));
|
||||
|
||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||
|
||||
try {
|
||||
|
||||
System.out.println(query.expression());
|
||||
String response = proxy.execute(query.expression());
|
||||
System.err.println(response);
|
||||
}
|
||||
catch(SOAPFaultException e) {
|
||||
throw new RuntimeException(JAXWSUtils.remoteCause(e));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue