ref 8471:TDM - DataMiner Manager - Support Java 8 compatibility

https://support.d4science.org/issues/8471

Updated to support Java 8 compatibility

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/data-miner-manager-cl@148441 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-05-10 10:44:22 +00:00
parent 96afbb80b4
commit 6ecf825ad0
77 changed files with 1107 additions and 1313 deletions

View File

@ -1,12 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/data-miner-manager-cl-1.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/java"> <classpathentry kind="src" output="target/data-miner-manager-cl-1.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry including="**/*.java" kind="src" path="src/main/resources"/> <classpathentry excluding="**" kind="src" output="target/data-miner-manager-cl-1.3.0-SNAPSHOT/WEB-INF/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"> <classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
@ -18,16 +22,16 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/> <attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/data-miner-manager-cl-1.2.0-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/data-miner-manager-cl-1.3.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<faceted-project> <faceted-project>
<installed facet="java" version="1.7"/>
<installed facet="jst.utility" version="1.0"/> <installed facet="jst.utility" version="1.0"/>
<installed facet="java" version="1.7"/>
</faceted-project> </faceted-project>

View File

@ -1,16 +1,23 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="org.gcube.data.analysis.data-miner-manager-cl.1-2-0"> <Changeset component="org.gcube.data.analysis.data-miner-manager-cl.1-3-0"
date="2017-06-12">
<Change>Support Java 8 compatibility [ticket #8471]</Change>
</Changeset>
<Changeset component="org.gcube.data.analysis.data-miner-manager-cl.1-2-0"
date="2017-05-01">
<Change>Updated to support DataMinerManagerWidget [ticket #6078] <Change>Updated to support DataMinerManagerWidget [ticket #6078]
</Change> </Change>
<Change>Fixed load balancing [ticket #7576]</Change> <Change>Fixed load balancing [ticket #7576]</Change>
</Changeset> </Changeset>
<Changeset component="org.gcube.data.analysis.data-miner-manager-cl.1-1-0"> <Changeset component="org.gcube.data.analysis.data-miner-manager-cl.1-1-0"
date="2017-03-20">
<Change>Updated Monitor interface</Change> <Change>Updated Monitor interface</Change>
<Change>Added encoded parameters in equivalent http request [ticket <Change>Added encoded parameters in equivalent http request [ticket
#7167] #7167]
</Change> </Change>
</Changeset> </Changeset>
<Changeset component="org.gcube.data.analysis.data-miner-manager-cl.1-0-0"> <Changeset component="org.gcube.data.analysis.data-miner-manager-cl.1-0-0"
date="2017-02-14">
<Change>first release</Change> <Change>first release</Change>
</Changeset> </Changeset>
</ReleaseNotes> </ReleaseNotes>

View File

@ -11,7 +11,7 @@
<groupId>org.gcube.data.analysis</groupId> <groupId>org.gcube.data.analysis</groupId>
<artifactId>data-miner-manager-cl</artifactId> <artifactId>data-miner-manager-cl</artifactId>
<version>1.2.0-SNAPSHOT</version> <version>1.3.0-SNAPSHOT</version>
<name>data-miner-manager-cl</name> <name>data-miner-manager-cl</name>
<description>DataMiner Manager Client Library</description> <description>DataMiner Manager Client Library</description>

View File

@ -16,8 +16,8 @@ import org.slf4j.LoggerFactory;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class DataMinerService { public class DataMinerService {
@ -28,17 +28,17 @@ public class DataMinerService {
/** /**
* *
* @param userName
* @param scope
* @param token
* @return
* @throws Exception
*/ */
public DataMinerService() { public DataMinerService() {
// cachedSClients= new HashMap<>(); // cachedSClients= new HashMap<>();
} }
/**
*
* @return SClient
* @throws Exception
* exception
*/
public SClient getClient() throws Exception { public SClient getClient() throws Exception {
ServiceCredentials serviceCredential = getServiceCredentials(); ServiceCredentials serviceCredential = getServiceCredentials();
@ -62,6 +62,14 @@ public class DataMinerService {
} }
/**
*
* @param token
* token
* @return SClient
* @throws Exception
* Exception
*/
public SClient getClient(String token) throws Exception { public SClient getClient(String token) throws Exception {
ServiceCredentials serviceCredential = getServiceCredentials(token); ServiceCredentials serviceCredential = getServiceCredentials(token);
@ -88,14 +96,14 @@ public class DataMinerService {
/** /**
* *
* @param token * @param token
* token
* @param serviceAddressUrl * @param serviceAddressUrl
* valid url for example: * service address url
* <span>http://dataminer1-devnext.d4science.org/wps/</span> * @return SClient
* @return
* @throws Exception * @throws Exception
* exception
*/ */
public SClient getClient(String token, String serviceAddressUrl) public SClient getClient(String token, String serviceAddressUrl) throws Exception {
throws Exception {
ServiceCredentials serviceCredential = getServiceCredentials(token); ServiceCredentials serviceCredential = getServiceCredentials(token);
@ -104,8 +112,7 @@ public class DataMinerService {
* !cachedSClients.containsKey(serviceCredential.getScope())) { * !cachedSClients.containsKey(serviceCredential.getScope())) {
*/ */
SClientBuilder sBuilder = new SClient4WPSBuilder(serviceCredential, SClientBuilder sBuilder = new SClient4WPSBuilder(serviceCredential, serviceAddressUrl);
serviceAddressUrl);
SClientDirector director = new SClientDirector(); SClientDirector director = new SClientDirector();
director.setSClientBuilder(sBuilder); director.setSClientBuilder(sBuilder);
director.constructSClient(); director.constructSClient();
@ -143,16 +150,14 @@ public class DataMinerService {
userName = entry.getClientInfo().getId(); userName = entry.getClientInfo().getId();
scope = entry.getContext(); scope = entry.getContext();
} catch (Exception e) { } catch (Exception e) {
logger.error("Error Retrieving token credentials: " logger.error("Error Retrieving token credentials: " + e.getLocalizedMessage());
+ e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
throw new ServiceException(e.getLocalizedMessage(), e); throw new ServiceException(e.getLocalizedMessage(), e);
} }
} }
ServiceCredentials serviceCredential = new ServiceCredentials(userName, ServiceCredentials serviceCredential = new ServiceCredentials(userName, scope, token);
scope, token);
logger.debug("Credential: " + serviceCredential); logger.debug("Credential: " + serviceCredential);
@ -160,8 +165,7 @@ public class DataMinerService {
} }
private ServiceCredentials getServiceCredentials(String token) private ServiceCredentials getServiceCredentials(String token) throws ServiceException {
throws ServiceException {
String userName = null; String userName = null;
String scope = null; String scope = null;
@ -173,10 +177,8 @@ public class DataMinerService {
} else { } else {
logger.debug("Production Mode"); logger.debug("Production Mode");
if (token == null || token.isEmpty()) { if (token == null || token.isEmpty()) {
logger.error("Error Retrieving token credentials: token=" logger.error("Error Retrieving token credentials: token=" + token);
+ token); throw new ServiceException("Error Retrieving token credentials: token=" + token);
throw new ServiceException(
"Error Retrieving token credentials: token=" + token);
} }
try { try {
@ -185,16 +187,14 @@ public class DataMinerService {
userName = entry.getClientInfo().getId(); userName = entry.getClientInfo().getId();
scope = entry.getContext(); scope = entry.getContext();
} catch (Exception e) { } catch (Exception e) {
logger.error("Error Retrieving token credentials: " logger.error("Error Retrieving token credentials: " + e.getLocalizedMessage());
+ e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
throw new ServiceException(e.getLocalizedMessage(), e); throw new ServiceException(e.getLocalizedMessage(), e);
} }
} }
ServiceCredentials serviceCredential = new ServiceCredentials(userName, ServiceCredentials serviceCredential = new ServiceCredentials(userName, scope, token);
scope, token);
logger.debug("Credential: " + serviceCredential); logger.debug("Credential: " + serviceCredential);

View File

@ -16,8 +16,8 @@ import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorsClassi
* *
* Client of service * Client of service
* *
* @author giancarlo email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public abstract class SClient implements Serializable { public abstract class SClient implements Serializable {
@ -31,19 +31,20 @@ public abstract class SClient implements Serializable {
/** /**
* Retrieve the list of operators * Retrieve the list of operators
* *
* @return * @return list of operators classification
* @throws Exception * @throws Exception
* exception
*/ */
public abstract List<OperatorsClassification> getOperatorsClassifications() public abstract List<OperatorsClassification> getOperatorsClassifications() throws Exception;
throws Exception;
/** /**
* Retrieve the operator by id * Retrieve the operator by id
* *
* @param id * @param id
* operator id * operator id
* @return * @return operator
* @throws Exception * @throws Exception
* exception
*/ */
public abstract Operator getOperatorById(String id) throws Exception; public abstract Operator getOperatorById(String id) throws Exception;
@ -52,86 +53,90 @@ public abstract class SClient implements Serializable {
* *
* @param operator * @param operator
* operator * operator
* @return * @return list of parameter
* @throws Exception * @throws Exception
* exception
*/ */
public abstract List<Parameter> getInputParameters(Operator operator) public abstract List<Parameter> getInputParameters(Operator operator) throws Exception;
throws Exception;
/** /**
* *
* Get output paramters of the operator * Get output paramters of the operator
* *
* @param operator * @param operator
* @return * operator
* @return list of parameter
* @throws Exception * @throws Exception
* exception
*/ */
public abstract List<Parameter> getOutputParameters(Operator operator) public abstract List<Parameter> getOutputParameters(Operator operator) throws Exception;
throws Exception;
/** /**
* Start Computation * Start Computation
* *
* @param operator * @param operator
* operator * operator
* @return * @return computation id
* @throws Exception * @throws Exception
* exception
*/ */
public abstract ComputationId startComputation(Operator operator) public abstract ComputationId startComputation(Operator operator) throws Exception;
throws Exception;
/** /**
* Cancel a computation * Cancel a computation
* *
* @param computationId * @param computationId
* computation Id * computation Id
* @return * @return cancel
* @throws Exception * @throws Exception
* exception
*/ */
public abstract String cancelComputation(ComputationId computationId) public abstract String cancelComputation(ComputationId computationId) throws Exception;
throws Exception;
/** /**
* Get Computation Status * Get Computation Status
* *
* @param computationId * @param computationId
* computation Id * computation Id
* @return * @return computation status
* @throws Exception * @throws Exception
* exception
*/ */
public abstract ComputationStatus getComputationStatus( public abstract ComputationStatus getComputationStatus(ComputationId computationId) throws Exception;
ComputationId computationId) throws Exception;
/** /**
* Get Output of computation * Get Output of computation
* *
* @param computationId * @param computationId
* @return * computation id
* @return output data
* @throws Exception * @throws Exception
* exception
*/ */
public abstract OutputData getOutputDataByComputationId( public abstract OutputData getOutputDataByComputationId(ComputationId computationId) throws Exception;
ComputationId computationId) throws Exception;
/** /**
* Get Computation Data by computation properties * Get Computation Data by computation properties
* *
* @param computationProperties * @param computationProperties
* computation properties * computation properties
* @return * @return computation data
* @throws Exception * @throws Exception
* exception
*/ */
public abstract ComputationData getComputationDataByComputationProperties( public abstract ComputationData getComputationDataByComputationProperties(Map<String, String> computationProperties)
Map<String, String> computationProperties) throws Exception; throws Exception;
/** /**
* Resubmit a computation only by computation properties * Resubmit a computation only by computation properties
* *
* @param computationProperties * @param computationProperties
* @return * map of computation properties
* @return computation id
* @throws Exception * @throws Exception
* exception
*/ */
public abstract ComputationId resubmitComputation( public abstract ComputationId resubmitComputation(Map<String, String> computationProperties) throws Exception;
Map<String, String> computationProperties) throws Exception;
@Override @Override
public String toString() { public String toString() {

View File

@ -8,13 +8,12 @@ import org.slf4j.LoggerFactory;
/** /**
* Builder of Client 4 WPS Service * Builder of Client 4 WPS Service
* *
* @author "Giancarlo Panichi" email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class SClient4WPSBuilder extends SClientBuilder { public class SClient4WPSBuilder extends SClientBuilder {
private static Logger logger = LoggerFactory private static Logger logger = LoggerFactory.getLogger(SClient4WPSBuilder.class);
.getLogger(SClient4WPSBuilder.class);
private ServiceCredentials serviceCredendials; private ServiceCredentials serviceCredendials;
private String serviceAddressUrl; private String serviceAddressUrl;
private boolean useUrl; private boolean useUrl;
@ -22,6 +21,7 @@ public class SClient4WPSBuilder extends SClientBuilder {
/** /**
* *
* @param serviceCredentials * @param serviceCredentials
* service credentials
*/ */
public SClient4WPSBuilder(ServiceCredentials serviceCredentials) { public SClient4WPSBuilder(ServiceCredentials serviceCredentials) {
this.serviceCredendials = serviceCredentials; this.serviceCredendials = serviceCredentials;
@ -31,12 +31,12 @@ public class SClient4WPSBuilder extends SClientBuilder {
/** /**
* *
* @param serviceCredentials * @param serviceCredentials
* service credentials
* @param serviceAddressUrl * @param serviceAddressUrl
* valid url for example: * valid url for example:
* <span>http://dataminer1-devnext.d4science.org/wps/</span> * <span>http://dataminer1-devnext.d4science.org/wps/</span>
*/ */
public SClient4WPSBuilder(ServiceCredentials serviceCredentials, public SClient4WPSBuilder(ServiceCredentials serviceCredentials, String serviceAddressUrl) {
String serviceAddressUrl) {
this.serviceCredendials = serviceCredentials; this.serviceCredendials = serviceCredentials;
this.serviceAddressUrl = serviceAddressUrl; this.serviceAddressUrl = serviceAddressUrl;
this.useUrl = true; this.useUrl = true;

View File

@ -3,8 +3,8 @@ package org.gcube.data.analysis.dataminermanagercl.server.dmservice;
/** /**
* Abstract class for build client of service * Abstract class for build client of service
* *
* @author "Giancarlo Panichi" email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public abstract class SClientBuilder { public abstract class SClientBuilder {

View File

@ -5,8 +5,8 @@ package org.gcube.data.analysis.dataminermanagercl.server.dmservice;
/** /**
* Director * Director
* *
* @author "Giancarlo Panichi" * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class SClientDirector { public class SClientDirector {

View File

@ -3,8 +3,8 @@ package org.gcube.data.analysis.dataminermanagercl.server.dmservice;
/** /**
* Specification * Specification
* *
* @author "Giancarlo Panichi" email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class SClientSpec { public class SClientSpec {

View File

@ -5,7 +5,7 @@ import org.n52.wps.client.AbstractClientGETRequest;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class DClientDescribeProcessRequest extends AbstractClientGETRequest { public class DClientDescribeProcessRequest extends AbstractClientGETRequest {

View File

@ -10,7 +10,7 @@ import net.opengis.wps.x100.ProcessDescriptionType;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ProcessInformations implements Serializable { public class ProcessInformations implements Serializable {

View File

@ -5,7 +5,7 @@ import java.io.Serializable;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ResponseWPS implements Serializable { public class ResponseWPS implements Serializable {

View File

@ -43,15 +43,14 @@ import org.xml.sax.SAXException;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class SClient4WPSSession implements Serializable { public class SClient4WPSSession implements Serializable {
private static final long serialVersionUID = -1387670579312851370L; private static final long serialVersionUID = -1387670579312851370L;
private static Logger logger = LoggerFactory private static Logger logger = LoggerFactory.getLogger(SClient4WPSSession.class);
.getLogger(SClient4WPSSession.class);
private static final String OGC_OWS_URI = "http://www.opengeospatial.net/ows"; private static final String OGC_OWS_URI = "http://www.opengeospatial.net/ows";
private static String SUPPORTED_VERSION = "1.0.0"; private static String SUPPORTED_VERSION = "1.0.0";
@ -70,8 +69,7 @@ public class SClient4WPSSession implements Serializable {
*/ */
public SClient4WPSSession(String user, String password) { public SClient4WPSSession(String user, String password) {
super(); super();
logger.debug("Create SClient4WPSSession: [user=" + user logger.debug("Create SClient4WPSSession: [user=" + user + ", password=" + password + "]");
+ ", password=" + password + "]");
this.user = user; this.user = user;
this.password = password; this.password = password;
options = new XmlOptions(); options = new XmlOptions();
@ -90,6 +88,7 @@ public class SClient4WPSSession implements Serializable {
* further identification of the service. * further identification of the service.
* @return true, if connect succeeded, false else. * @return true, if connect succeeded, false else.
* @throws WPSClientException * @throws WPSClientException
* WPSClientException
*/ */
public boolean connect(String url) throws WPSClientException { public boolean connect(String url) throws WPSClientException {
@ -111,11 +110,9 @@ public class SClient4WPSSession implements Serializable {
ProcessDescriptionsDocument processDescs = describeAllProcesses(url); ProcessDescriptionsDocument processDescs = describeAllProcesses(url);
if (processDescs != null && capsDoc != null) { if (processDescs != null && capsDoc != null) {
logger.debug("Adding processes descriptions to logged services " logger.debug("Adding processes descriptions to logged services " + url);
+ url);
processDescriptions.put(url, processDescs); processDescriptions.put(url, processDescs);
logger.debug("ProcessDescriptions key: " logger.debug("ProcessDescriptions key: " + processDescriptions.keySet());
+ processDescriptions.keySet());
return true; return true;
} else { } else {
@ -135,6 +132,7 @@ public class SClient4WPSSession implements Serializable {
* further identification of the service. * further identification of the service.
* @return true, if connect succeeded, false else. * @return true, if connect succeeded, false else.
* @throws WPSClientException * @throws WPSClientException
* WPSClientException
*/ */
public boolean connectForMonitoring(String url) throws WPSClientException { public boolean connectForMonitoring(String url) throws WPSClientException {
logger.debug("CONNECT"); logger.debug("CONNECT");
@ -151,6 +149,7 @@ public class SClient4WPSSession implements Serializable {
* removes a service from the session * removes a service from the session
* *
* @param url * @param url
* url
*/ */
public void disconnect(String url) { public void disconnect(String url) {
/* /*
@ -163,7 +162,7 @@ public class SClient4WPSSession implements Serializable {
/** /**
* returns the serverIDs of all loggedServices * returns the serverIDs of all loggedServices
* *
* @return * @return list of server ids
*/ */
public List<String> getLoggedServices() { public List<String> getLoggedServices() {
if (loggedServices != null && loggedServices.keySet() != null) { if (loggedServices != null && loggedServices.keySet() != null) {
@ -178,6 +177,7 @@ public class SClient4WPSSession implements Serializable {
* the session. in normal case it should return true :) * the session. in normal case it should return true :)
* *
* @param serverID * @param serverID
* server id
* @return success * @return success
*/ */
public boolean descriptionsAvailableInCache(String serverID) { public boolean descriptionsAvailableInCache(String serverID) {
@ -185,14 +185,16 @@ public class SClient4WPSSession implements Serializable {
} }
/** /**
* returns the cached processdescriptions of a service. * Returns the cached processdescriptions of a service.
* *
* @param serverID *
* @return success * @param wpsUrl
* url
* @return process descriptions document
* @throws IOException * @throws IOException
* IOException
*/ */
private ProcessDescriptionsDocument getProcessDescriptionsFromCache( private ProcessDescriptionsDocument getProcessDescriptionsFromCache(String wpsUrl) throws IOException {
String wpsUrl) throws IOException {
if (!descriptionsAvailableInCache(wpsUrl)) { if (!descriptionsAvailableInCache(wpsUrl)) {
try { try {
connect(wpsUrl); connect(wpsUrl);
@ -204,17 +206,18 @@ public class SClient4WPSSession implements Serializable {
} }
/** /**
* return the processDescription for a specific process from Cache.
* *
* @param serverID * @param serverID
* server id
* @param processID * @param processID
* process id
* @return a ProcessDescription for a specific process from Cache. * @return a ProcessDescription for a specific process from Cache.
* @throws IOException * @throws IOException
* IOException
*/ */
public ProcessDescriptionType getProcessDescription(String serverID, public ProcessDescriptionType getProcessDescription(String serverID, String processID) throws IOException {
String processID) throws IOException { ProcessDescriptionType[] processes = getProcessDescriptionsFromCache(serverID).getProcessDescriptions()
ProcessDescriptionType[] processes = getProcessDescriptionsFromCache( .getProcessDescriptionArray();
serverID).getProcessDescriptions().getProcessDescriptionArray();
for (ProcessDescriptionType process : processes) { for (ProcessDescriptionType process : processes) {
if (process.getIdentifier().getStringValue().equals(processID)) { if (process.getIdentifier().getStringValue().equals(processID)) {
return process; return process;
@ -230,15 +233,18 @@ public class SClient4WPSSession implements Serializable {
* the URL of the WPS * the URL of the WPS
* @return An Array of ProcessDescriptions * @return An Array of ProcessDescriptions
* @throws IOException * @throws IOException
* IOException
*/ */
public ProcessDescriptionType[] getAllProcessDescriptions(String wpsUrl) public ProcessDescriptionType[] getAllProcessDescriptions(String wpsUrl) throws IOException {
throws IOException { return getProcessDescriptionsFromCache(wpsUrl).getProcessDescriptions().getProcessDescriptionArray();
return getProcessDescriptionsFromCache(wpsUrl).getProcessDescriptions()
.getProcessDescriptionArray();
} }
/** /**
* looks up, if the service exists already in session. * looks up, if the service exists already in session.
*
* @param serverID
* server id
* @return true if registered
*/ */
public boolean serviceAlreadyRegistered(String serverID) { public boolean serviceAlreadyRegistered(String serverID) {
return loggedServices.containsKey(serverID); return loggedServices.containsKey(serverID);
@ -248,7 +254,8 @@ public class SClient4WPSSession implements Serializable {
* provides you the cached capabilities for a specified service. * provides you the cached capabilities for a specified service.
* *
* @param url * @param url
* @return * url
* @return CapabilitiesDocument
*/ */
public CapabilitiesDocument getWPSCaps(String url) { public CapabilitiesDocument getWPSCaps(String url) {
return loggedServices.get(url); return loggedServices.get(url);
@ -261,18 +268,18 @@ public class SClient4WPSSession implements Serializable {
* descriptions will not be cached, so only transient information! * descriptions will not be cached, so only transient information!
* *
* @param url * @param url
* @return * url
* @return process descriptions document
* @throws WPSClientException * @throws WPSClientException
* WPSClientException
*/ */
public ProcessDescriptionsDocument describeAllProcesses(String url) public ProcessDescriptionsDocument describeAllProcesses(String url) throws WPSClientException {
throws WPSClientException {
CapabilitiesDocument doc = loggedServices.get(url); CapabilitiesDocument doc = loggedServices.get(url);
if (doc == null) { if (doc == null) {
logger.warn("serviceCaps are null, perhaps server does not exist"); logger.warn("serviceCaps are null, perhaps server does not exist");
return null; return null;
} }
ProcessBriefType[] processes = doc.getCapabilities() ProcessBriefType[] processes = doc.getCapabilities().getProcessOfferings().getProcessArray();
.getProcessOfferings().getProcessArray();
String[] processIDs = new String[processes.length]; String[] processIDs = new String[processes.length];
for (int i = 0; i < processIDs.length; i++) { for (int i = 0; i < processIDs.length; i++) {
processIDs[i] = processes[i].getIdentifier().getStringValue(); processIDs[i] = processes[i].getIdentifier().getStringValue();
@ -288,24 +295,22 @@ public class SClient4WPSSession implements Serializable {
* @param processIDs * @param processIDs
* one or more processIDs * one or more processIDs
* @param serverID * @param serverID
* server id
* @throws WPSClientException * @throws WPSClientException
* WPSClientExpcetion
*/ */
public ProcessDescriptionsDocument describeProcess(String[] processIDs, public ProcessDescriptionsDocument describeProcess(String[] processIDs, String serverID) throws WPSClientException {
String serverID) throws WPSClientException {
CapabilitiesDocument caps = this.loggedServices.get(serverID); CapabilitiesDocument caps = this.loggedServices.get(serverID);
Operation[] operations = caps.getCapabilities().getOperationsMetadata() Operation[] operations = caps.getCapabilities().getOperationsMetadata().getOperationArray();
.getOperationArray();
String url = null; String url = null;
for (Operation operation : operations) { for (Operation operation : operations) {
if (operation.getName().equals("DescribeProcess")) { if (operation.getName().equals("DescribeProcess")) {
url = operation.getDCPArray()[0].getHTTP().getGetArray()[0] url = operation.getDCPArray()[0].getHTTP().getGetArray()[0].getHref();
.getHref();
} }
} }
if (url == null) { if (url == null) {
throw new WPSClientException( throw new WPSClientException("Missing DescribeOperation in Capabilities");
"Missing DescribeOperation in Capabilities");
} }
return retrieveDescriptionViaGET(processIDs, url); return retrieveDescriptionViaGET(processIDs, url);
} }
@ -313,23 +318,23 @@ public class SClient4WPSSession implements Serializable {
/** /**
* Executes a process at a WPS * Executes a process at a WPS
* *
* @param url * @param serverID
* url of server not the entry additionally defined in the caps. * server id
* @param execute * @param execute
* Execute document * Execute document
* @param rawData
* true if is raw data
* @return either an ExecuteResponseDocument or an InputStream if asked for * @return either an ExecuteResponseDocument or an InputStream if asked for
* RawData or an Exception Report * RawData or an Exception Report
* @throws WPSClientException WPSClientException
*/ */
private Object execute(String serverID, ExecuteDocument execute, private Object execute(String serverID, ExecuteDocument execute, boolean rawData) throws WPSClientException {
boolean rawData) throws WPSClientException {
CapabilitiesDocument caps = loggedServices.get(serverID); CapabilitiesDocument caps = loggedServices.get(serverID);
Operation[] operations = caps.getCapabilities().getOperationsMetadata() Operation[] operations = caps.getCapabilities().getOperationsMetadata().getOperationArray();
.getOperationArray();
String url = null; String url = null;
for (Operation operation : operations) { for (Operation operation : operations) {
if (operation.getName().equals("Execute")) { if (operation.getName().equals("Execute")) {
url = operation.getDCPArray()[0].getHTTP().getPostArray()[0] url = operation.getDCPArray()[0].getHTTP().getPostArray()[0].getHref();
.getHref();
} }
} }
if (url == null) { if (url == null) {
@ -343,17 +348,19 @@ public class SClient4WPSSession implements Serializable {
/** /**
* Executes a process at a WPS * Executes a process at a WPS
* *
* @param url *
* url of server not the entry additionally defined in the caps. *
* @param serverID
* server id
* @param execute * @param execute
* Execute document * exceute document
* @return either an ExecuteResponseDocument or an InputStream if asked for * @return either an ExecuteResponseDocument or an InputStream if asked for
* RawData or an Exception Report * RawData or an Exception Report
* @throws WPSClientException
* WPSClientException
*/ */
public Object execute(String serverID, ExecuteDocument execute) public Object execute(String serverID, ExecuteDocument execute) throws WPSClientException {
throws WPSClientException { if (execute.getExecute().isSetResponseForm() == true && execute.getExecute().isSetResponseForm() == true
if (execute.getExecute().isSetResponseForm() == true
&& execute.getExecute().isSetResponseForm() == true
&& execute.getExecute().getResponseForm().isSetRawDataOutput() == true) { && execute.getExecute().getResponseForm().isSetRawDataOutput() == true) {
return execute(serverID, execute, true); return execute(serverID, execute, true);
} else { } else {
@ -362,8 +369,7 @@ public class SClient4WPSSession implements Serializable {
} }
private CapabilitiesDocument retrieveCapsViaGET(String url) private CapabilitiesDocument retrieveCapsViaGET(String url) throws WPSClientException {
throws WPSClientException {
logger.debug("retrieveCapsViaGET: " + url); logger.debug("retrieveCapsViaGET: " + url);
ClientCapabiltiesRequest req = new ClientCapabiltiesRequest(); ClientCapabiltiesRequest req = new ClientCapabiltiesRequest();
url = req.getRequest(url); url = req.getRequest(url);
@ -376,50 +382,41 @@ public class SClient4WPSSession implements Serializable {
logger.debug("Base64 encoded auth string: " + encoded); logger.debug("Base64 encoded auth string: " + encoded);
URL urlObj = new URL(url); URL urlObj = new URL(url);
HttpURLConnection connection = (HttpURLConnection) urlObj HttpURLConnection connection = (HttpURLConnection) urlObj.openConnection();
.openConnection();
connection.setRequestMethod("GET"); connection.setRequestMethod("GET");
connection.setDoOutput(true); connection.setDoOutput(true);
connection.setRequestProperty("Authorization", "Basic " + encoded); connection.setRequestProperty("Authorization", "Basic " + encoded);
InputStream is = connection.getInputStream(); InputStream is = connection.getInputStream();
Document doc = checkInputStream(is); Document doc = checkInputStream(is);
CapabilitiesDocument capabilitiesDocument = CapabilitiesDocument.Factory CapabilitiesDocument capabilitiesDocument = CapabilitiesDocument.Factory.parse(doc, options);
.parse(doc, options);
return capabilitiesDocument; return capabilitiesDocument;
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
e.printStackTrace(); e.printStackTrace();
throw new WPSClientException( throw new WPSClientException("Capabilities URL seems to be unvalid: " + url, e);
"Capabilities URL seems to be unvalid: " + url, e);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
throw new WPSClientException( throw new WPSClientException("Error occured while retrieving capabilities from url: " + url, e);
"Error occured while retrieving capabilities from url: "
+ url, e);
} catch (XmlException e) { } catch (XmlException e) {
e.printStackTrace(); e.printStackTrace();
throw new WPSClientException("Error occured while parsing XML", e); throw new WPSClientException("Error occured while parsing XML", e);
} }
} }
private ProcessDescriptionsDocument retrieveDescriptionViaGET( private ProcessDescriptionsDocument retrieveDescriptionViaGET(String[] processIDs, String url)
String[] processIDs, String url) throws WPSClientException { throws WPSClientException {
try { try {
logger.debug("RetrieveDescription GET: " + processIDs + " url:" logger.debug("RetrieveDescription GET: " + processIDs + " url:" + url);
+ url);
Path tempFile = Files.createTempFile("WPSProcessDescriptions", Path tempFile = Files.createTempFile("WPSProcessDescriptions", "txt");
"txt");
List<String> lines = new ArrayList<>(); List<String> lines = new ArrayList<>();
lines.add("<wps:ProcessDescriptions xmlns:wps=\"http://www.opengis.net/wps/1.0.0\" " lines.add("<wps:ProcessDescriptions xmlns:wps=\"http://www.opengis.net/wps/1.0.0\" "
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ "xmlns:ows=\"http://www.opengis.net/ows/1.1\" " + "xmlns:ows=\"http://www.opengis.net/ows/1.1\" "
+ "xsi:schemaLocation=\"http://www.opengis.net/wps/1.0.0 " + "xsi:schemaLocation=\"http://www.opengis.net/wps/1.0.0 "
+ "http://schemas.opengis.net/wps/1.0.0/wpsDescribeProcess_response.xsd\" " + "http://schemas.opengis.net/wps/1.0.0/wpsDescribeProcess_response.xsd\" " + "xml:lang=\"en-US\" "
+ "xml:lang=\"en-US\" "
+ "service=\"WPS\" version=\"1.0.0\">"); + "service=\"WPS\" version=\"1.0.0\">");
Files.write(tempFile, lines, Charset.defaultCharset(), Files.write(tempFile, lines, Charset.defaultCharset(), StandardOpenOption.APPEND);
StandardOpenOption.APPEND);
for (String processId : processIDs) { for (String processId : processIDs) {
String[] process = { processId }; String[] process = { processId };
@ -428,42 +425,36 @@ public class SClient4WPSSession implements Serializable {
String requestURL = req.getRequest(url); String requestURL = req.getRequest(url);
String authString = user + ":" + password; String authString = user + ":" + password;
//logger.debug("auth string: " + authString); // logger.debug("auth string: " + authString);
byte[] authEncBytes = Base64 byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
.encodeBase64(authString.getBytes());
String encoded = new String(authEncBytes); String encoded = new String(authEncBytes);
//logger.debug("Base64 encoded auth string: " + encoded); // logger.debug("Base64 encoded auth string: " + encoded);
URL urlObj = new URL(requestURL); URL urlObj = new URL(requestURL);
HttpURLConnection connection = (HttpURLConnection) urlObj HttpURLConnection connection = (HttpURLConnection) urlObj.openConnection();
.openConnection();
connection.setRequestMethod("GET"); connection.setRequestMethod("GET");
connection.setDoOutput(true); connection.setDoOutput(true);
connection.setRequestProperty("Authorization", "Basic " connection.setRequestProperty("Authorization", "Basic " + encoded);
+ encoded);
InputStream is = connection.getInputStream(); InputStream is = connection.getInputStream();
lines=retrievesSingleDescription(is); lines = retrievesSingleDescription(is);
Files.write(tempFile, lines, Charset.defaultCharset(), Files.write(tempFile, lines, Charset.defaultCharset(), StandardOpenOption.APPEND);
StandardOpenOption.APPEND);
} }
lines = new ArrayList<>(); lines = new ArrayList<>();
lines.add("</wps:ProcessDescriptions>"); lines.add("</wps:ProcessDescriptions>");
Files.write(tempFile, lines, Charset.defaultCharset(), Files.write(tempFile, lines, Charset.defaultCharset(), StandardOpenOption.APPEND);
StandardOpenOption.APPEND);
logger.debug(tempFile.toString()); logger.debug(tempFile.toString());
Document doc=null; Document doc = null;
try (InputStream inputStream = Files.newInputStream(tempFile, try (InputStream inputStream = Files.newInputStream(tempFile, StandardOpenOption.READ)) {
StandardOpenOption.READ)){
doc = checkInputStream(inputStream); doc = checkInputStream(inputStream);
} }
ProcessDescriptionsDocument processDescriptionsDocument = ProcessDescriptionsDocument.Factory.parse(doc, options); ProcessDescriptionsDocument processDescriptionsDocument = ProcessDescriptionsDocument.Factory.parse(doc,
options);
Files.delete(tempFile); Files.delete(tempFile);
return processDescriptionsDocument; return processDescriptionsDocument;
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
logger.error("URL seems not to be valid"); logger.error("URL seems not to be valid");
e.printStackTrace(); e.printStackTrace();
@ -471,23 +462,19 @@ public class SClient4WPSSession implements Serializable {
} catch (IOException e) { } catch (IOException e) {
logger.error("Error occured while receiving data"); logger.error("Error occured while receiving data");
e.printStackTrace(); e.printStackTrace();
throw new WPSClientException("Error occured while receiving data", throw new WPSClientException("Error occured while receiving data", e);
e);
} catch (XmlException e) { } catch (XmlException e) {
logger.error("Error occured while parsing ProcessDescription document"); logger.error("Error occured while parsing ProcessDescription document");
e.printStackTrace(); e.printStackTrace();
throw new WPSClientException( throw new WPSClientException("Error occured while parsing ProcessDescription document", e);
"Error occured while parsing ProcessDescription document",
e);
} catch (Throwable e) { } catch (Throwable e) {
logger.error(e.getLocalizedMessage()); logger.error(e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
throw new WPSClientException(e.getLocalizedMessage(), throw new WPSClientException(e.getLocalizedMessage(), new Exception(e));
new Exception(e));
} }
} }
protected List<String> retrievesSingleDescription(InputStream is) throws WPSClientException { protected List<String> retrievesSingleDescription(InputStream is) throws WPSClientException {
try { try {
BufferedReader br = new BufferedReader(new InputStreamReader(is)); BufferedReader br = new BufferedReader(new InputStreamReader(is));
@ -536,13 +523,11 @@ public class SClient4WPSSession implements Serializable {
} catch (Throwable e) { } catch (Throwable e) {
logger.error(e.getLocalizedMessage()); logger.error(e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
throw new WPSClientException(e.getLocalizedMessage(), throw new WPSClientException(e.getLocalizedMessage(), new Exception(e));
new Exception(e));
} }
} }
private InputStream retrieveDataViaPOST(XmlObject obj, String urlString) private InputStream retrieveDataViaPOST(XmlObject obj, String urlString) throws WPSClientException {
throws WPSClientException {
try { try {
logger.debug("RetrieveDataViaPost(): " + urlString); logger.debug("RetrieveDataViaPost(): " + urlString);
String authString = user + ":" + password; String authString = user + ":" + password;
@ -584,45 +569,34 @@ public class SClient4WPSSession implements Serializable {
logger.debug("Document: " + doc); logger.debug("Document: " + doc);
if (doc == null) { if (doc == null) {
logger.error("Document is null"); logger.error("Document is null");
throw new WPSClientException( throw new WPSClientException("Error in check input stream: Document is null");
"Error in check input stream: Document is null");
} }
if (getFirstElementNode(doc.getFirstChild()).getLocalName().equals( if (getFirstElementNode(doc.getFirstChild()).getLocalName().equals("ExceptionReport")
"ExceptionReport") && getFirstElementNode(doc.getFirstChild()).getNamespaceURI().equals(OGC_OWS_URI)) {
&& getFirstElementNode(doc.getFirstChild())
.getNamespaceURI().equals(OGC_OWS_URI)) {
try { try {
ExceptionReportDocument exceptionDoc = ExceptionReportDocument.Factory ExceptionReportDocument exceptionDoc = ExceptionReportDocument.Factory.parse(doc);
.parse(doc);
logger.debug(exceptionDoc.xmlText(options)); logger.debug(exceptionDoc.xmlText(options));
throw new WPSClientException( throw new WPSClientException("Error occured while executing query", exceptionDoc);
"Error occured while executing query", exceptionDoc);
} catch (XmlException e) { } catch (XmlException e) {
throw new WPSClientException( throw new WPSClientException("Error while parsing ExceptionReport retrieved from server", e);
"Error while parsing ExceptionReport retrieved from server",
e);
} }
} else { } else {
logger.debug("No Exception Report"); logger.debug("No Exception Report");
} }
return doc; return doc;
} catch (SAXException e) { } catch (SAXException e) {
logger.error("Error while parsing input: " logger.error("Error while parsing input: " + e.getLocalizedMessage());
+ e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
throw new WPSClientException("Error while parsing input", e); throw new WPSClientException("Error while parsing input", e);
} catch (IOException e) { } catch (IOException e) {
logger.error("Error occured while transfer: " logger.error("Error occured while transfer: " + e.getLocalizedMessage());
+ e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
throw new WPSClientException("Error occured while transfer", e); throw new WPSClientException("Error occured while transfer", e);
} catch (ParserConfigurationException e) { } catch (ParserConfigurationException e) {
logger.error("Error occured, parser is not correctly configured: " logger.error("Error occured, parser is not correctly configured: " + e.getLocalizedMessage());
+ e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
throw new WPSClientException( throw new WPSClientException("Error occured, parser is not correctly configured", e);
"Error occured, parser is not correctly configured", e);
} catch (WPSClientException e) { } catch (WPSClientException e) {
throw e; throw e;
} }
@ -650,8 +624,8 @@ public class SClient4WPSSession implements Serializable {
* @return * @return
* @throws WPSClientException * @throws WPSClientException
*/ */
private Object retrieveExecuteResponseViaPOST(String url, private Object retrieveExecuteResponseViaPOST(String url, ExecuteDocument doc, boolean rawData)
ExecuteDocument doc, boolean rawData) throws WPSClientException { throws WPSClientException {
InputStream is = retrieveDataViaPOST(doc, url); InputStream is = retrieveDataViaPOST(doc, url);
if (rawData) { if (rawData) {
return is; return is;
@ -665,16 +639,15 @@ public class SClient4WPSSession implements Serializable {
try { try {
erDoc = ExceptionReportDocument.Factory.parse(documentObj); erDoc = ExceptionReportDocument.Factory.parse(documentObj);
} catch (XmlException e1) { } catch (XmlException e1) {
throw new WPSClientException( throw new WPSClientException("Error occured while parsing executeResponse", e);
"Error occured while parsing executeResponse", e);
} }
return erDoc; return erDoc;
} }
} }
public String[] getProcessNames(String url) throws IOException { public String[] getProcessNames(String url) throws IOException {
ProcessDescriptionType[] processes = getProcessDescriptionsFromCache( ProcessDescriptionType[] processes = getProcessDescriptionsFromCache(url).getProcessDescriptions()
url).getProcessDescriptions().getProcessDescriptionArray(); .getProcessDescriptionArray();
String[] processNames = new String[processes.length]; String[] processNames = new String[processes.length];
for (int i = 0; i < processNames.length; i++) { for (int i = 0; i < processNames.length; i++) {
processNames[i] = processes[i].getIdentifier().getStringValue(); processNames[i] = processes[i].getIdentifier().getStringValue();
@ -685,15 +658,17 @@ public class SClient4WPSSession implements Serializable {
/** /**
* Executes a process at a WPS * Executes a process at a WPS
* *
* @param url *
* @param urlString
* url of server not the entry additionally defined in the caps. * url of server not the entry additionally defined in the caps.
* @param executeAsGETString * @param executeAsGETString
* KVP Execute request * KVP Execute request
* @return either an ExecuteResponseDocument or an InputStream if asked for * @return either an ExecuteResponseDocument or an InputStream if asked for
* RawData or an Exception Report * RawData or an Exception Report
* @throws WPSClientException
* WSPClientException
*/ */
public Object executeViaGET(String urlString, String executeAsGETString) public Object executeViaGET(String urlString, String executeAsGETString) throws WPSClientException {
throws WPSClientException {
urlString = urlString + executeAsGETString; urlString = urlString + executeAsGETString;
logger.debug("ExecuteViaGet() Url: " + urlString); logger.debug("ExecuteViaGet() Url: " + urlString);
try { try {
@ -727,28 +702,22 @@ public class SClient4WPSSession implements Serializable {
erDoc = ExceptionReportDocument.Factory.parse(doc); erDoc = ExceptionReportDocument.Factory.parse(doc);
} catch (XmlException e1) { } catch (XmlException e1) {
e1.printStackTrace(); e1.printStackTrace();
throw new WPSClientException( throw new WPSClientException("Error occured while parsing executeResponse", e);
"Error occured while parsing executeResponse", e);
} }
throw new WPSClientException( throw new WPSClientException("Error occured while parsing executeResponse", erDoc);
"Error occured while parsing executeResponse", erDoc);
} }
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
e.printStackTrace(); e.printStackTrace();
throw new WPSClientException( throw new WPSClientException("Capabilities URL seems to be unvalid: " + urlString, e);
"Capabilities URL seems to be unvalid: " + urlString, e);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
throw new WPSClientException( throw new WPSClientException("Error occured while retrieving capabilities from url: " + urlString, e);
"Error occured while retrieving capabilities from url: "
+ urlString, e);
} }
} }
public String cancelComputation(String url, String computationId) public String cancelComputation(String url, String computationId) throws WPSClientException {
throws WPSClientException {
try { try {
String authString = user + ":" + password; String authString = user + ":" + password;
@ -759,8 +728,7 @@ public class SClient4WPSSession implements Serializable {
url += "?id=" + computationId; url += "?id=" + computationId;
URL urlObj = new URL(url); URL urlObj = new URL(url);
HttpURLConnection connection = (HttpURLConnection) urlObj HttpURLConnection connection = (HttpURLConnection) urlObj.openConnection();
.openConnection();
connection.setRequestMethod("GET"); connection.setRequestMethod("GET");
connection.setDoOutput(true); connection.setDoOutput(true);
connection.setRequestProperty("Authorization", "Basic " + encoded); connection.setRequestProperty("Authorization", "Basic " + encoded);
@ -768,13 +736,10 @@ public class SClient4WPSSession implements Serializable {
return responseMessage; return responseMessage;
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
e.printStackTrace(); e.printStackTrace();
throw new WPSClientException( throw new WPSClientException("Capabilities URL seems to be unvalid: " + url, e);
"Capabilities URL seems to be unvalid: " + url, e);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
throw new WPSClientException( throw new WPSClientException("Error occured while retrieving capabilities from url: " + url, e);
"Error occured while retrieving capabilities from url: "
+ url, e);
} }
} }

View File

@ -34,6 +34,12 @@ import org.gcube.data.analysis.dataminermanagercl.shared.parameters.WKTParameter
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class WPS2DM { public class WPS2DM {
private final static String SEPARATOR = "|"; private final static String SEPARATOR = "|";
@ -42,30 +48,32 @@ public class WPS2DM {
/** /**
* *
* @param title * @param title
* title
* @param minOcc * @param minOcc
* min occurences
* @param maxOcc * @param maxOcc
* max occurences
* @param rangeOccs * @param rangeOccs
* range occurences
* @param id * @param id
* id
* @param crs * @param crs
* @return * crs
* @return Parameter
*/ */
public static Parameter manageBoundingBoxInformation(String title, public static Parameter manageBoundingBoxInformation(String title, int minOcc, int maxOcc, int rangeOccs, String id,
int minOcc, int maxOcc, int rangeOccs, String id, String crs) { String crs) {
Parameter converted = null; Parameter converted = null;
title = "Bounding Box Input in OGC 06-121r3 spec. E.g. 102,46,103,47,urn:ogc:def:crs:EPSG:4328 " title = "Bounding Box Input in OGC 06-121r3 spec. E.g. 102,46,103,47,urn:ogc:def:crs:EPSG:4328 " + title;
+ title;
if (crs != null && crs.length() > 0) if (crs != null && crs.length() > 0)
title += " Supported CRS " + crs; title += " Supported CRS " + crs;
title = buildParameterDescription(title, null, null, minOcc, maxOcc, title = buildParameterDescription(title, null, null, minOcc, maxOcc, null);
null);
if ((maxOcc == 1) || (maxOcc < 0) || (maxOcc == 0)) if ((maxOcc == 1) || (maxOcc < 0) || (maxOcc == 0))
converted = new ObjectParameter(id, title, String.class.getName(), converted = new ObjectParameter(id, title, String.class.getName(), " ");
" ");
else else
converted = new ListParameter(id, title, String.class.getName(), converted = new ListParameter(id, title, String.class.getName(), SEPARATOR);
SEPARATOR);
return converted; return converted;
} }
@ -73,18 +81,25 @@ public class WPS2DM {
/** /**
* *
* @param title * @param title
* title
* @param minOcc * @param minOcc
* min occurences
* @param maxOcc * @param maxOcc
* max occurences
* @param rangeOccs * @param rangeOccs
* range occurrences
* @param defaultValue * @param defaultValue
* default value
* @param id * @param id
* id
* @param uoms * @param uoms
* uoms
* @param type * @param type
* @return * type
* @return Parameter
*/ */
public static Parameter manageLiteral(String title, int minOcc, int maxOcc, public static Parameter manageLiteral(String title, int minOcc, int maxOcc, int rangeOccs, String defaultValue,
int rangeOccs, String defaultValue, String id, String uoms, String id, String uoms, DomainMetadataType type) {
DomainMetadataType type) {
Parameter converted = null; Parameter converted = null;
logger.debug("WPS type:" + type.getStringValue()); logger.debug("WPS type:" + type.getStringValue());
String guessedType = guessWPSLiteralType(type); String guessedType = guessWPSLiteralType(type);
@ -96,8 +111,7 @@ public class WPS2DM {
logger.debug("Guessed default value: " + defaultValue); logger.debug("Guessed default value: " + defaultValue);
title = buildParameterDescription(title, null, uoms, minOcc, maxOcc, title = buildParameterDescription(title, null, uoms, minOcc, maxOcc, defaultValue);
defaultValue);
if ((maxOcc == 1) || (maxOcc < 0) || (maxOcc == 0)) { if ((maxOcc == 1) || (maxOcc < 0) || (maxOcc == 0)) {
if (title != null && !title.isEmpty()) { if (title != null && !title.isEmpty()) {
if (title.contains("[a sequence of names of columns from ")) { if (title.contains("[a sequence of names of columns from ")) {
@ -111,72 +125,56 @@ public class WPS2DM {
logger.debug("Machter end: " + matcher.end()); logger.debug("Machter end: " + matcher.end());
logger.debug("Machter Group Count: " + matcher.groupCount()); logger.debug("Machter Group Count: " + matcher.groupCount());
String referredTabularParameterName = matcher.group(1); String referredTabularParameterName = matcher.group(1);
logger.debug("Matcher referredTabularParameterName: " logger.debug("Matcher referredTabularParameterName: " + referredTabularParameterName);
+ referredTabularParameterName);
String separator = matcher.group(2); String separator = matcher.group(2);
logger.debug("Matcher separator: " + separator); logger.debug("Matcher separator: " + separator);
converted = new ColumnListParameter(id, title, converted = new ColumnListParameter(id, title, referredTabularParameterName, separator);
referredTabularParameterName, separator);
} else { } else {
if (title.contains("[the name of a column from ")) { if (title.contains("[the name of a column from ")) {
Pattern pattern = Pattern Pattern pattern = Pattern.compile("the name of a column from (\\w+)");
.compile("the name of a column from (\\w+)");
Matcher matcher = pattern.matcher(title); Matcher matcher = pattern.matcher(title);
logger.debug("Machter title: " + title); logger.debug("Machter title: " + title);
logger.debug("Machter find: " + matcher.find()); logger.debug("Machter find: " + matcher.find());
logger.debug("Machter group: " + matcher.group()); logger.debug("Machter group: " + matcher.group());
logger.debug("Machter start: " + matcher.start()); logger.debug("Machter start: " + matcher.start());
logger.debug("Machter end: " + matcher.end()); logger.debug("Machter end: " + matcher.end());
logger.debug("Machter Group Count: " logger.debug("Machter Group Count: " + matcher.groupCount());
+ matcher.groupCount());
String referredTabularParameterName = matcher.group(1); String referredTabularParameterName = matcher.group(1);
logger.debug("Matcher referredTabularParameterName: " logger.debug("Matcher referredTabularParameterName: " + referredTabularParameterName);
+ referredTabularParameterName);
converted = new ColumnParameter(id, title, converted = new ColumnParameter(id, title, referredTabularParameterName, defaultValue);
referredTabularParameterName, defaultValue);
} else { } else {
if (title if (title.contains("[a sequence of values separated by ")) {
.contains("[a sequence of values separated by ")) { Pattern pattern = Pattern.compile("a sequence of values separated by (\\p{ASCII})");
Pattern pattern = Pattern
.compile("a sequence of values separated by (\\p{ASCII})");
Matcher matcher = pattern.matcher(title); Matcher matcher = pattern.matcher(title);
logger.debug("Machter title: " + title); logger.debug("Machter title: " + title);
logger.debug("Machter find: " + matcher.find()); logger.debug("Machter find: " + matcher.find());
logger.debug("Machter group: " + matcher.group()); logger.debug("Machter group: " + matcher.group());
logger.debug("Machter start: " + matcher.start()); logger.debug("Machter start: " + matcher.start());
logger.debug("Machter end: " + matcher.end()); logger.debug("Machter end: " + matcher.end());
logger.debug("Machter Group Count: " logger.debug("Machter Group Count: " + matcher.groupCount());
+ matcher.groupCount());
String separator = matcher.group(1); String separator = matcher.group(1);
logger.debug("Matcher separator: " + separator); logger.debug("Matcher separator: " + separator);
converted = new ListParameter(id, title, converted = new ListParameter(id, title, guessedType, separator);
guessedType, separator);
} else { } else {
if (title.contains("[WKT_")) { if (title.contains("[WKT_")) {
logger.debug("WKT parameter: " + title); logger.debug("WKT parameter: " + title);
converted = retrieveWKTParameter(id, title, converted = retrieveWKTParameter(id, title, defaultValue);
defaultValue);
} else { } else {
if (title.contains("[DATE]")) { if (title.contains("[DATE]")) {
logger.debug("DATE parameter: " + title); logger.debug("DATE parameter: " + title);
title = title.replace("[DATE]", ""); title = title.replace("[DATE]", "");
converted = new DateParameter(id, title, converted = new DateParameter(id, title, defaultValue);
defaultValue);
} else { } else {
if (title.contains("[TIME]")) { if (title.contains("[TIME]")) {
logger.debug("TIME parameter: " + title); logger.debug("TIME parameter: " + title);
title = title.replace("[TIME]", ""); title = title.replace("[TIME]", "");
converted = new TimeParameter(id, converted = new TimeParameter(id, title, defaultValue);
title, defaultValue);
} else { } else {
converted = new ObjectParameter( converted = new ObjectParameter(id, title, guessPrimitiveType(guessedType),
id,
title,
guessPrimitiveType(guessedType),
defaultValue); defaultValue);
} }
} }
@ -186,78 +184,59 @@ public class WPS2DM {
} }
} else { } else {
converted = new ObjectParameter(id, title, converted = new ObjectParameter(id, title, guessPrimitiveType(guessedType), defaultValue);
guessPrimitiveType(guessedType), defaultValue);
} }
} else { } else {
if(guessedType.compareTo(Boolean.class.getName())==0){ if (guessedType.compareTo(Boolean.class.getName()) == 0) {
converted = new ObjectParameter(id, title, guessedType, defaultValue); converted = new ObjectParameter(id, title, guessedType, defaultValue);
} else { } else {
converted = new ListParameter(id, title, String.class.getName(), converted = new ListParameter(id, title, String.class.getName(), SEPARATOR);
SEPARATOR);
} }
} }
return converted; return converted;
} }
private static Parameter retrieveWKTParameter(String id, String title, private static Parameter retrieveWKTParameter(String id, String title, String defaultValue) {
String defaultValue) {
if (title.contains("[WKT_POINT]")) { if (title.contains("[WKT_POINT]")) {
title = title.replace("[WKT_POINT]", ""); title = title.replace("[WKT_POINT]", "");
return new WKTParameter(id, title, WKTGeometryType.Point, return new WKTParameter(id, title, WKTGeometryType.Point, defaultValue);
defaultValue);
} else { } else {
if (title.contains("[WKT_LINESTRING]")) { if (title.contains("[WKT_LINESTRING]")) {
title = title.replace("[WKT_LINESTRING]", ""); title = title.replace("[WKT_LINESTRING]", "");
return new WKTParameter(id, title, WKTGeometryType.LineString, return new WKTParameter(id, title, WKTGeometryType.LineString, defaultValue);
defaultValue);
} else { } else {
if (title.contains("[WKT_POLYGON]")) { if (title.contains("[WKT_POLYGON]")) {
title = title.replace("[WKT_POLYGON]", ""); title = title.replace("[WKT_POLYGON]", "");
return new WKTParameter(id, title, WKTGeometryType.Polygon, return new WKTParameter(id, title, WKTGeometryType.Polygon, defaultValue);
defaultValue);
} else { } else {
if (title.contains("[WKT_CIRCLE]")) { if (title.contains("[WKT_CIRCLE]")) {
title = title.replace("[WKT_CIRCLE]", ""); title = title.replace("[WKT_CIRCLE]", "");
return new WKTParameter(id, title, return new WKTParameter(id, title, WKTGeometryType.Circle, defaultValue);
WKTGeometryType.Circle, defaultValue);
} else { } else {
if (title.contains("[WKT_TRIANGLE]")) { if (title.contains("[WKT_TRIANGLE]")) {
title = title.replace("[WKT_TRIANGLE]", ""); title = title.replace("[WKT_TRIANGLE]", "");
return new WKTParameter(id, title, return new WKTParameter(id, title, WKTGeometryType.Triangle, defaultValue);
WKTGeometryType.Triangle, defaultValue);
} else { } else {
if (title.contains("[WKT_SQUARE]")) { if (title.contains("[WKT_SQUARE]")) {
title = title.replace("[WKT_SQUARE]", ""); title = title.replace("[WKT_SQUARE]", "");
return new WKTParameter(id, title, return new WKTParameter(id, title, WKTGeometryType.Square, defaultValue);
WKTGeometryType.Square, defaultValue);
} else { } else {
if (title.contains("[WKT_PENTAGON]")) { if (title.contains("[WKT_PENTAGON]")) {
title = title.replace("[WKT_PENTAGON]", ""); title = title.replace("[WKT_PENTAGON]", "");
return new WKTParameter(id, title, return new WKTParameter(id, title, WKTGeometryType.Pentagon, defaultValue);
WKTGeometryType.Pentagon,
defaultValue);
} else { } else {
if (title.contains("[WKT_HEXAGON]")) { if (title.contains("[WKT_HEXAGON]")) {
title = title.replace("[WKT_HEXAGON]", title = title.replace("[WKT_HEXAGON]", "");
""); return new WKTParameter(id, title, WKTGeometryType.Hexagon, defaultValue);
return new WKTParameter(id, title,
WKTGeometryType.Hexagon,
defaultValue);
} else { } else {
if (title.contains("[WKT_BOX]")) { if (title.contains("[WKT_BOX]")) {
title = title.replace("[WKT_BOX]", title = title.replace("[WKT_BOX]", "");
""); return new WKTParameter(id, title, WKTGeometryType.Box, defaultValue);
return new WKTParameter(id, title,
WKTGeometryType.Box,
defaultValue);
} else { } else {
return new WKTParameter(id, title, return new WKTParameter(id, title, WKTGeometryType.Polygon, defaultValue);
WKTGeometryType.Polygon,
defaultValue);
} }
} }
} }
@ -272,18 +251,25 @@ public class WPS2DM {
/** /**
* *
* @param maxMegaBytes * @param maxMegaBytes
* max mega bytes
* @param title * @param title
* title
* @param minOcc * @param minOcc
* min occurences
* @param maxOcc * @param maxOcc
* max occurences
* @param rangeOccs * @param rangeOccs
* range occurences
* @param id * @param id
* id
* @param defaultType * @param defaultType
* @return * default type
* @param supportedTypes
* supported types
* @return Parameter
*/ */
public static Parameter manageComplexData(String maxMegaBytes, public static Parameter manageComplexData(String maxMegaBytes, String title, int minOcc, int maxOcc, int rangeOccs,
String title, int minOcc, int maxOcc, int rangeOccs, String id, String id, ComplexDataDescriptionType defaultType, ComplexDataDescriptionType[] supportedTypes) {
ComplexDataDescriptionType defaultType,
ComplexDataDescriptionType[] supportedTypes) {
Parameter converted = null; Parameter converted = null;
String mimeType = null; String mimeType = null;
String schema = null; String schema = null;
@ -303,68 +289,56 @@ public class WPS2DM {
supportedMimeTypes.add(supported.getMimeType()); supportedMimeTypes.add(supported.getMimeType());
} }
// rebuild title // rebuild title
title = buildParameterDescription(title, maxMegaBytes, null, minOcc, title = buildParameterDescription(title, maxMegaBytes, null, minOcc, maxOcc, null);
maxOcc, null);
if ((maxOcc == 1) || (maxOcc < 0) || (maxOcc == 0)) { if ((maxOcc == 1) || (maxOcc < 0) || (maxOcc == 0)) {
if (title != null && !title.isEmpty()) { if (title != null && !title.isEmpty()) {
if (title.contains("[a http link to a table")) { if (title.contains("[a http link to a table")) {
converted = new TabularParameter(id, title, " ", converted = new TabularParameter(id, title, " ", new ArrayList<String>(), mimeType,
new ArrayList<String>(), mimeType,
supportedMimeTypes); supportedMimeTypes);
} else { } else {
if (title.contains("[a http link to a file")) { if (title.contains("[a http link to a file")) {
converted = new FileParameter(id, title, mimeType, converted = new FileParameter(id, title, mimeType, supportedMimeTypes);
supportedMimeTypes);
} else { } else {
if (title.contains("[a sequence of http links")) { if (title.contains("[a sequence of http links")) {
Pattern pattern = Pattern Pattern pattern = Pattern.compile(
.compile("\\[a sequence of http links separated by (\\p{ASCII}) , each indicating a table"); "\\[a sequence of http links separated by (\\p{ASCII}) , each indicating a table");
Matcher matcher = pattern.matcher(title); Matcher matcher = pattern.matcher(title);
boolean match = false; boolean match = false;
if (match = matcher.find()) { if (match = matcher.find()) {
logger.debug("Machter title: " + title); logger.debug("Machter title: " + title);
logger.debug("Machter find: " + match); logger.debug("Machter find: " + match);
logger.debug("Machter group: " logger.debug("Machter group: " + matcher.group());
+ matcher.group()); logger.debug("Machter start: " + matcher.start());
logger.debug("Machter start: "
+ matcher.start());
logger.debug("Machter end: " + matcher.end()); logger.debug("Machter end: " + matcher.end());
logger.debug("Machter Group Count: " logger.debug("Machter Group Count: " + matcher.groupCount());
+ matcher.groupCount());
String separator = matcher.group(1); String separator = matcher.group(1);
logger.debug("Matcher separator: " + separator); logger.debug("Matcher separator: " + separator);
converted = new TabularListParameter(id, title, converted = new TabularListParameter(id, title, separator, mimeType,
separator, mimeType, supportedMimeTypes); supportedMimeTypes);
} else { } else {
converted = new FileParameter(id, title, converted = new FileParameter(id, title, mimeType, supportedMimeTypes);
mimeType, supportedMimeTypes);
} }
} else { } else {
converted = new FileParameter(id, title, mimeType, converted = new FileParameter(id, title, mimeType, supportedMimeTypes);
supportedMimeTypes);
} }
} }
} }
} else { } else {
converted = new FileParameter(id, title, mimeType, converted = new FileParameter(id, title, mimeType, supportedMimeTypes);
supportedMimeTypes);
} }
} else { } else {
converted = new FileParameter(id, title, mimeType, converted = new FileParameter(id, title, mimeType, supportedMimeTypes);
supportedMimeTypes);
} }
return converted; return converted;
} }
public static Parameter convert2DMType(InputDescriptionType wpsType) public static Parameter convert2DMType(InputDescriptionType wpsType) throws ServiceException {
throws ServiceException {
try { try {
String id = wpsType.getIdentifier().getStringValue(); String id = wpsType.getIdentifier().getStringValue();
String title = wpsType.getTitle() != null ? wpsType.getTitle() String title = wpsType.getTitle() != null ? wpsType.getTitle().getStringValue() : "";
.getStringValue() : "";
int minOcc = wpsType.getMinOccurs().intValue(); int minOcc = wpsType.getMinOccurs().intValue();
int maxOcc = wpsType.getMaxOccurs().intValue(); int maxOcc = wpsType.getMaxOccurs().intValue();
int rangeOccs = maxOcc - minOcc; int rangeOccs = maxOcc - minOcc;
@ -372,30 +346,24 @@ public class WPS2DM {
rangeOccs = 1; rangeOccs = 1;
// default // default
Parameter converted = new ObjectParameter(id, title, Parameter converted = new ObjectParameter(id, title, String.class.getName(), " ");
String.class.getName(), " ");
if (rangeOccs > 1) if (rangeOccs > 1)
converted = new ListParameter(id, title, converted = new ListParameter(id, title, String.class.getName(), SEPARATOR);
String.class.getName(), SEPARATOR);
// Bounding Boxes // Bounding Boxes
if (wpsType.isSetBoundingBoxData()) { if (wpsType.isSetBoundingBoxData()) {
logger.debug("Conversion to DM Type->" + id logger.debug("Conversion to DM Type->" + id + " is a Bounding Box Input");
+ " is a Bounding Box Input"); converted = manageBoundingBoxInformation(title, minOcc, maxOcc, rangeOccs, id,
converted = manageBoundingBoxInformation(title, minOcc, maxOcc, wpsType.getBoundingBoxData().getDefault().getCRS());
rangeOccs, id, wpsType.getBoundingBoxData()
.getDefault().getCRS());
} }
// Literals // Literals
else if (wpsType.isSetLiteralData()) { else if (wpsType.isSetLiteralData()) {
logger.debug("Conversion to DM Type->" + id logger.debug("Conversion to DM Type->" + id + " is a Literal Input");
+ " is a Literal Input");
LiteralInputType literal = wpsType.getLiteralData(); LiteralInputType literal = wpsType.getLiteralData();
String uoms = literal.getUOMs() == null ? "" : literal String uoms = literal.getUOMs() == null ? "" : literal.getUOMs().getDefault().getUOM().getStringValue();
.getUOMs().getDefault().getUOM().getStringValue();
String defaultValue = literal.getDefaultValue(); String defaultValue = literal.getDefaultValue();
converted = manageLiteral(title, minOcc, maxOcc, rangeOccs, converted = manageLiteral(title, minOcc, maxOcc, rangeOccs, defaultValue, id, uoms,
defaultValue, id, uoms, literal.getDataType()); literal.getDataType());
AllowedValues allowedValues = literal.getAllowedValues(); AllowedValues allowedValues = literal.getAllowedValues();
if (allowedValues != null) { if (allowedValues != null) {
ValueType[] values = allowedValues.getValueArray(); ValueType[] values = allowedValues.getValueArray();
@ -407,35 +375,27 @@ public class WPS2DM {
} }
if (values.length > 1) { if (values.length > 1) {
ObjectParameter conv = (ObjectParameter) converted; ObjectParameter conv = (ObjectParameter) converted;
if (conv.getType() != null if (conv.getType() != null && !conv.getType().isEmpty()
&& !conv.getType().isEmpty() && conv.getType().compareToIgnoreCase(Boolean.class.getName()) != 0) {
&& conv.getType().compareToIgnoreCase( converted = new EnumParameter(conv.getName(), conv.getDescription(), enumValues,
Boolean.class.getName()) != 0){
converted = new EnumParameter(conv.getName(),
conv.getDescription(), enumValues,
conv.getDefaultValue()); conv.getDefaultValue());
} }
} }
} }
} else if (wpsType.isSetComplexData()) { } else if (wpsType.isSetComplexData()) {
logger.debug("Conversion to DM Type->" + id logger.debug("Conversion to DM Type->" + id + " is a Complex Input");
+ " is a Complex Input"); SupportedComplexDataInputType complex = wpsType.getComplexData();
SupportedComplexDataInputType complex = wpsType String maxMegaBytes = complex.getMaximumMegabytes() != null ? complex.getMaximumMegabytes().toString()
.getComplexData(); : "1";
String maxMegaBytes = complex.getMaximumMegabytes() != null ? complex
.getMaximumMegabytes().toString() : "1";
logger.debug("Max Megabytes: " + maxMegaBytes); logger.debug("Max Megabytes: " + maxMegaBytes);
converted = manageComplexData(maxMegaBytes, title, minOcc, converted = manageComplexData(maxMegaBytes, title, minOcc, maxOcc, rangeOccs, id,
maxOcc, rangeOccs, id, complex.getDefault().getFormat(), complex.getSupported().getFormatArray());
complex.getDefault().getFormat(), complex
.getSupported().getFormatArray());
} }
logger.debug("Conversion to DM Type->Name=" + id); logger.debug("Conversion to DM Type->Name=" + id);
logger.debug("Conversion to DM Type->Title=" + title); logger.debug("Conversion to DM Type->Title=" + title);
logger.debug("Conversion to DM Type->Number of Inputs to Manage=" logger.debug("Conversion to DM Type->Number of Inputs to Manage=" + rangeOccs);
+ rangeOccs);
return converted; return converted;
@ -449,12 +409,10 @@ public class WPS2DM {
public static Parameter convert2DMType(OutputDescriptionType wpsType) { public static Parameter convert2DMType(OutputDescriptionType wpsType) {
String id = wpsType.getIdentifier().getStringValue(); String id = wpsType.getIdentifier().getStringValue();
String title = wpsType.getTitle() != null ? wpsType.getTitle() String title = wpsType.getTitle() != null ? wpsType.getTitle().getStringValue() : "";
.getStringValue() : "";
// default // default
Parameter converted = new ObjectParameter(id, title, Parameter converted = new ObjectParameter(id, title, String.class.getName(), " ");
String.class.getName(), " ");
logger.debug("Conversion to DM Type->Output id:" + id); logger.debug("Conversion to DM Type->Output id:" + id);
logger.debug("Conversion to DM Type->Title:" + title); logger.debug("Conversion to DM Type->Title:" + title);
@ -468,16 +426,13 @@ public class WPS2DM {
else if (wpsType.isSetLiteralOutput()) { else if (wpsType.isSetLiteralOutput()) {
logger.debug("Literal Output"); logger.debug("Literal Output");
LiteralOutputType literal = wpsType.getLiteralOutput(); LiteralOutputType literal = wpsType.getLiteralOutput();
String uoms = literal.getUOMs() == null ? "" : literal.getUOMs() String uoms = literal.getUOMs() == null ? "" : literal.getUOMs().toString();
.toString(); converted = manageLiteral(title, -1, -1, -1, "", id, uoms, literal.getDataType());
converted = manageLiteral(title, -1, -1, -1, "", id, uoms,
literal.getDataType());
} else if (wpsType.isSetComplexOutput()) { } else if (wpsType.isSetComplexOutput()) {
logger.debug("Complex Output"); logger.debug("Complex Output");
SupportedComplexDataType complex = wpsType.getComplexOutput(); SupportedComplexDataType complex = wpsType.getComplexOutput();
converted = manageComplexData("", title, -1, -1, -1, id, complex converted = manageComplexData("", title, -1, -1, -1, id, complex.getDefault().getFormat(),
.getDefault().getFormat(), complex.getSupported() complex.getSupported().getFormatArray());
.getFormatArray());
} }
return converted; return converted;
@ -486,16 +441,21 @@ public class WPS2DM {
/** /**
* *
* @param title * @param title
* title
* @param maxMegabytes * @param maxMegabytes
* max mega bytes
* @param UoM * @param UoM
* uom
* @param minElements * @param minElements
* min elements
* @param maxElements * @param maxElements
* max elements
* @param defaultValue * @param defaultValue
* @return * default value
* @return description
*/ */
public static String buildParameterDescription(String title, public static String buildParameterDescription(String title, String maxMegabytes, String UoM, int minElements,
String maxMegabytes, String UoM, int minElements, int maxElements, int maxElements, String defaultValue) {
String defaultValue) {
String description = title; String description = title;
/* /*
@ -527,8 +487,7 @@ public class WPS2DM {
String typeS = type.getReference().trim(); String typeS = type.getReference().trim();
if (typeS.length() == 0) if (typeS.length() == 0)
return String.class.getName(); return String.class.getName();
else if (typeS.contains("float") || typeS.contains("double") else if (typeS.contains("float") || typeS.contains("double") || typeS.contains("decimal"))
|| typeS.contains("decimal"))
return Double.class.getName(); return Double.class.getName();
else if (typeS.contains("int")) else if (typeS.contains("int"))
return Integer.class.getName(); return Integer.class.getName();

View File

@ -18,7 +18,7 @@ import org.slf4j.LoggerFactory;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ComputationValueBuilder { public class ComputationValueBuilder {

View File

@ -13,8 +13,8 @@ import org.slf4j.LoggerFactory;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class InformationSystemUtils { public class InformationSystemUtils {

View File

@ -12,8 +12,8 @@ import org.slf4j.LoggerFactory;
/** /**
* DataManager basic Monitor * DataManager basic Monitor
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class DMMonitor { public class DMMonitor {

View File

@ -3,14 +3,12 @@ package org.gcube.data.analysis.dataminermanagercl.server.monitor;
/** /**
* Defines a listener for operation progress. * Defines a listener for operation progress.
* *
* @author "Giancarlo Panichi" * @author Giancarlo Panichi
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public interface DMMonitorListener { public interface DMMonitorListener {
/** /**
* Called when the operation is starting. * Called when the operation is starting.
*/ */
@ -18,31 +16,36 @@ public interface DMMonitorListener {
/** /**
* Called when there is a progress for the operation. * Called when there is a progress for the operation.
* @param elaborated the elaborated part. *
* @param elaborated
* the elaborated part.
*/ */
public void cancelled(); public void cancelled();
/** /**
* Called when the operation is complete * Called when the operation is complete
*
* @param percentage * @param percentage
* @param endDate * percentage
*/ */
public void complete(double percentage); public void complete(double percentage);
/** /**
* Called when the operation is failed * Called when the operation is failed
*
* @param message
* message
* @param exception * @param exception
* @param string * exception
*/ */
public void failed(String message, Exception exception); public void failed(String message, Exception exception);
/** /**
* Called when the operation is running * Called when the operation is running
*
* @param percentage * @param percentage
* percentage
*/ */
public void running(double percentage); public void running(double percentage);
} }

View File

@ -12,8 +12,8 @@ import org.slf4j.LoggerFactory;
/** /**
* *
* @author "Giancarlo Panichi" <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class DMMonitorTask extends TimerTask { public class DMMonitorTask extends TimerTask {

View File

@ -15,7 +15,7 @@ import org.slf4j.LoggerFactory;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class StorageUtil { public class StorageUtil {

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ServiceCredentials implements Serializable { public class ServiceCredentials implements Serializable {

View File

@ -3,7 +3,7 @@ package org.gcube.data.analysis.dataminermanagercl.shared;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class Constants { public class Constants {

View File

@ -6,7 +6,7 @@ package org.gcube.data.analysis.dataminermanagercl.shared;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class StringUtil { public class StringUtil {

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ColumnItem implements Serializable { public class ColumnItem implements Serializable {

View File

@ -8,8 +8,8 @@ import org.gcube.data.analysis.dataminermanagercl.shared.data.output.Resource;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class OutputData implements Serializable { public class OutputData implements Serializable {

View File

@ -5,8 +5,8 @@ import java.util.ArrayList;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class TableItemSimple implements Serializable { public class TableItemSimple implements Serializable {
@ -29,12 +29,17 @@ public class TableItemSimple implements Serializable {
} }
/** /**
*
* @param id
* id
* @param name * @param name
* name
* @param description * @param description
* description
* @param type * @param type
* type
*/ */
public TableItemSimple(String id, String name, String description, public TableItemSimple(String id, String name, String description, String type) {
String type) {
super(); super();
columns = new ArrayList<ColumnItem>(); columns = new ArrayList<ColumnItem>();
this.id = id; this.id = id;
@ -45,9 +50,13 @@ public class TableItemSimple implements Serializable {
} }
/** /**
* @param id2 *
* @param name2 * @param id
* @param description2 * id
* @param name
* name
* @param description
* description
*/ */
public TableItemSimple(String id, String name, String description) { public TableItemSimple(String id, String name, String description) {
super(); super();
@ -135,10 +144,8 @@ public class TableItemSimple implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "TableItemSimple [id=" + id + ", name=" + name return "TableItemSimple [id=" + id + ", name=" + name + ", description=" + description + ", type=" + type
+ ", description=" + description + ", type=" + type + ", columns=" + columns + ", tabularResource=" + tabularResource + "]";
+ ", columns=" + columns + ", tabularResource="
+ tabularResource + "]";
} }
} }

View File

@ -5,8 +5,8 @@ import java.util.LinkedHashMap;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ComputationData implements Serializable { public class ComputationData implements Serializable {

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ComputationId implements Serializable { public class ComputationId implements Serializable {

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ComputationItemPropertiesValue implements Serializable, public class ComputationItemPropertiesValue implements Serializable,

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ComputationValue implements Serializable { public class ComputationValue implements Serializable {

View File

@ -2,8 +2,8 @@ package org.gcube.data.analysis.dataminermanagercl.shared.data.computations;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ComputationValueFile extends ComputationValue { public class ComputationValueFile extends ComputationValue {

View File

@ -4,8 +4,8 @@ import java.util.ArrayList;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ComputationValueFileList extends ComputationValue { public class ComputationValueFileList extends ComputationValue {

View File

@ -2,8 +2,8 @@ package org.gcube.data.analysis.dataminermanagercl.shared.data.computations;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ComputationValueImage extends ComputationValue { public class ComputationValueImage extends ComputationValue {

View File

@ -3,7 +3,7 @@ package org.gcube.data.analysis.dataminermanagercl.shared.data.computations;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public enum ComputationValueType { public enum ComputationValueType {

View File

@ -5,8 +5,8 @@ package org.gcube.data.analysis.dataminermanagercl.shared.data.output;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class FileResource extends Resource { public class FileResource extends Resource {
@ -30,13 +30,17 @@ public class FileResource extends Resource {
/** /**
* *
* @param resourceId * @param resourceId
* resource id
* @param name * @param name
* name
* @param description * @param description
* description
* @param url * @param url
* url
* @param mimeType * @param mimeType
* mime type
*/ */
public FileResource(String resourceId, String name, String description, public FileResource(String resourceId, String name, String description, String url, String mimeType) {
String url, String mimeType) {
super(resourceId, name, description, ResourceType.FILE); super(resourceId, name, description, ResourceType.FILE);
this.url = url; this.url = url;
this.mimeType = mimeType; this.mimeType = mimeType;
@ -74,10 +78,9 @@ public class FileResource extends Resource {
@Override @Override
public String toString() { public String toString() {
return "FileResource [url=" + url + ", mimeType=" + mimeType return "FileResource [url=" + url + ", mimeType=" + mimeType + ", getResourceId()=" + getResourceId()
+ ", getResourceId()=" + getResourceId() + ", getName()=" + ", getName()=" + getName() + ", getDescription()=" + getDescription() + ", getResourceType()="
+ getName() + ", getDescription()=" + getDescription() + getResourceType() + "]";
+ ", getResourceType()=" + getResourceType() + "]";
} }
} }

View File

@ -5,8 +5,8 @@ package org.gcube.data.analysis.dataminermanagercl.shared.data.output;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ImageResource extends Resource { public class ImageResource extends Resource {
@ -29,12 +29,17 @@ public class ImageResource extends Resource {
/** /**
* *
* @param resourceId * @param resourceId
* resource id
* @param name * @param name
* name
* @param description * @param description
* description
* @param link * @param link
* link
* @param mimeType
* mime type
*/ */
public ImageResource(String resourceId, String name, String description, public ImageResource(String resourceId, String name, String description, String link, String mimeType) {
String link, String mimeType) {
super(resourceId, name, description, ResourceType.IMAGE); super(resourceId, name, description, ResourceType.IMAGE);
this.link = link; this.link = link;
this.mimeType = mimeType; this.mimeType = mimeType;
@ -51,6 +56,7 @@ public class ImageResource extends Resource {
/** /**
* *
* @param link * @param link
* link
*/ */
public void setLink(String link) { public void setLink(String link) {
this.link = link; this.link = link;
@ -66,10 +72,9 @@ public class ImageResource extends Resource {
@Override @Override
public String toString() { public String toString() {
return "ImagesResource [link=" + link + ", mimeType=" + mimeType return "ImagesResource [link=" + link + ", mimeType=" + mimeType + ", getResourceId()=" + getResourceId()
+ ", getResourceId()=" + getResourceId() + ", getName()=" + ", getName()=" + getName() + ", getDescription()=" + getDescription() + ", getResourceType()="
+ getName() + ", getDescription()=" + getDescription() + getResourceType() + "]";
+ ", getResourceType()=" + getResourceType() + "]";
} }
} }

View File

@ -8,8 +8,8 @@ import java.util.Map;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class MapResource extends Resource { public class MapResource extends Resource {

View File

@ -3,11 +3,10 @@
*/ */
package org.gcube.data.analysis.dataminermanagercl.shared.data.output; package org.gcube.data.analysis.dataminermanagercl.shared.data.output;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ObjectResource extends Resource { public class ObjectResource extends Resource {
@ -28,9 +27,16 @@ public class ObjectResource extends Resource {
/** /**
* *
* @param resourceId
* resource id
* @param name
* name
* @param description
* description
* @param value
* value
*/ */
public ObjectResource(String resourceId, String name, String description, public ObjectResource(String resourceId, String name, String description, String value) {
String value) {
super(resourceId, name, description, ResourceType.OBJECT); super(resourceId, name, description, ResourceType.OBJECT);
this.value = value; this.value = value;
} }
@ -43,8 +49,9 @@ public class ObjectResource extends Resource {
} }
/** /**
* @param url *
* the url to set * @param value
* value
*/ */
public void setValue(String value) { public void setValue(String value) {
this.value = value; this.value = value;
@ -52,10 +59,8 @@ public class ObjectResource extends Resource {
@Override @Override
public String toString() { public String toString() {
return "ObjectResource [value=" + value + ", getResourceId()=" return "ObjectResource [value=" + value + ", getResourceId()=" + getResourceId() + ", getName()=" + getName()
+ getResourceId() + ", getName()=" + getName() + ", getDescription()=" + getDescription() + ", getResourceType()=" + getResourceType() + "]";
+ ", getDescription()=" + getDescription()
+ ", getResourceType()=" + getResourceType() + "]";
} }
} }

View File

@ -8,7 +8,7 @@ import java.io.Serializable;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class Resource implements Serializable { public class Resource implements Serializable {
@ -35,12 +35,15 @@ public class Resource implements Serializable {
/** /**
* *
* @param resourceId * @param resourceId
* resource id
* @param name * @param name
* name
* @param description * @param description
* description
* @param resourceType * @param resourceType
* resource type
*/ */
public Resource(String resourceId, String name, String description, public Resource(String resourceId, String name, String description, ResourceType resourceType) {
ResourceType resourceType) {
super(); super();
this.resourceId = resourceId; this.resourceId = resourceId;
this.name = name; this.name = name;
@ -128,13 +131,10 @@ public class Resource implements Serializable {
return this.resourceType == ResourceType.IMAGE; return this.resourceType == ResourceType.IMAGE;
} }
@Override @Override
public String toString() { public String toString() {
return "Resource [resourceId=" + resourceId + ", name=" + name return "Resource [resourceId=" + resourceId + ", name=" + name + ", description=" + description
+ ", description=" + description + ", resourceType=" + ", resourceType=" + resourceType + "]";
+ resourceType + "]";
} }
} }

View File

@ -8,7 +8,7 @@ package org.gcube.data.analysis.dataminermanagercl.shared.data.output;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class TableResource extends Resource { public class TableResource extends Resource {

View File

@ -5,16 +5,14 @@ package org.gcube.data.analysis.dataminermanagercl.shared.exception;
/** /**
* *
* @author "Giancarlo Panichi" * @author Giancarlo Panichi
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ServiceException extends Exception { public class ServiceException extends Exception {
private static final long serialVersionUID = -2255657546267656458L; private static final long serialVersionUID = -2255657546267656458L;
/** /**
* *
*/ */
@ -24,15 +22,21 @@ public class ServiceException extends Exception {
/** /**
* @param message * @param message
* message
*/ */
public ServiceException(String message) { public ServiceException(String message) {
super(message); super(message);
} }
/**
public ServiceException(String message,Throwable t) { *
super(message,t); * @param message
* message
* @param throwable
* throwable
*/
public ServiceException(String message, Throwable throwable) {
super(message, throwable);
} }
} }

View File

@ -5,8 +5,8 @@ package org.gcube.data.analysis.dataminermanagercl.shared.parameters;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ColumnListParameter extends Parameter { public class ColumnListParameter extends Parameter {

View File

@ -5,8 +5,8 @@ package org.gcube.data.analysis.dataminermanagercl.shared.parameters;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ColumnParameter extends Parameter { public class ColumnParameter extends Parameter {
@ -28,9 +28,16 @@ public class ColumnParameter extends Parameter {
/** /**
* *
* @param name
* name
* @param description
* description
* @param referredTabularParameterName
* referred tabular parameter name
* @param defaultColumn
* default column
*/ */
public ColumnParameter(String name, String description, public ColumnParameter(String name, String description, String referredTabularParameterName, String defaultColumn) {
String referredTabularParameterName, String defaultColumn) {
super(name, ParameterType.COLUMN, description); super(name, ParameterType.COLUMN, description);
this.referredTabularParameterName = referredTabularParameterName; this.referredTabularParameterName = referredTabularParameterName;
this.defaultColumn = defaultColumn; this.defaultColumn = defaultColumn;
@ -40,8 +47,7 @@ public class ColumnParameter extends Parameter {
* @param referredTabularParameterName * @param referredTabularParameterName
* the referredTabularParameterName to set * the referredTabularParameterName to set
*/ */
public void setReferredTabularParameterName( public void setReferredTabularParameterName(String referredTabularParameterName) {
String referredTabularParameterName) {
this.referredTabularParameterName = referredTabularParameterName; this.referredTabularParameterName = referredTabularParameterName;
} }
@ -60,8 +66,9 @@ public class ColumnParameter extends Parameter {
} }
/** /**
* @param defaultValue *
* the defaultValue to set * @param defaultColumn
* default column
*/ */
public void setDefaultColumn(String defaultColumn) { public void setDefaultColumn(String defaultColumn) {
this.defaultColumn = defaultColumn; this.defaultColumn = defaultColumn;
@ -69,11 +76,9 @@ public class ColumnParameter extends Parameter {
@Override @Override
public String toString() { public String toString() {
return "ColumnParameter [referredTabularParameterName=" return "ColumnParameter [referredTabularParameterName=" + referredTabularParameterName + ", defaultColumn="
+ referredTabularParameterName + ", defaultColumn=" + defaultColumn + ", value=" + value + ", name=" + name + ", description=" + description + ", typology="
+ defaultColumn + ", value=" + value + ", name=" + name + typology + "]";
+ ", description=" + description + ", typology=" + typology
+ "]";
} }
} }

View File

@ -5,8 +5,8 @@ package org.gcube.data.analysis.dataminermanagercl.shared.parameters;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class DateParameter extends Parameter { public class DateParameter extends Parameter {
@ -23,9 +23,13 @@ public class DateParameter extends Parameter {
} }
/** /**
* @param type *
* @param name
* name
* @param description
* description
* @param defaultValue * @param defaultValue
* @param value * default value
*/ */
public DateParameter(String name, String description, String defaultValue) { public DateParameter(String name, String description, String defaultValue) {
super(name, ParameterType.DATE, description); super(name, ParameterType.DATE, description);
@ -49,9 +53,8 @@ public class DateParameter extends Parameter {
@Override @Override
public String toString() { public String toString() {
return "DateParameter [defaultValue=" + defaultValue + ", value=" return "DateParameter [defaultValue=" + defaultValue + ", value=" + value + ", name=" + name + ", description="
+ value + ", name=" + name + ", description=" + description + description + ", typology=" + typology + "]";
+ ", typology=" + typology + "]";
} }
} }

View File

@ -8,8 +8,8 @@ import java.util.List;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class EnumParameter extends Parameter { public class EnumParameter extends Parameter {
@ -27,19 +27,24 @@ public class EnumParameter extends Parameter {
} }
/** /**
* @param type *
* @param name
* name
* @param description
* description
* @param values
* list of values
* @param defaultValue * @param defaultValue
* @param value * default value
*/ */
public EnumParameter(String name, String description, List<String> values, public EnumParameter(String name, String description, List<String> values, String defaultValue) {
String defaultValue) {
super(name, ParameterType.ENUM, description); super(name, ParameterType.ENUM, description);
this.values = values; this.values = values;
this.defaultValue = defaultValue; this.defaultValue = defaultValue;
} }
/** /**
* @return the defaultValue * @return the default value
*/ */
public String getDefaultValue() { public String getDefaultValue() {
return defaultValue; return defaultValue;
@ -47,7 +52,7 @@ public class EnumParameter extends Parameter {
/** /**
* @param defaultValue * @param defaultValue
* the defaultValue to set * the default value to set
*/ */
public void setDefaultValue(String defaultValue) { public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue; this.defaultValue = defaultValue;
@ -74,10 +79,8 @@ public class EnumParameter extends Parameter {
@Override @Override
public String toString() { public String toString() {
return "EnumParameter [values=" + values + ", defaultValue=" return "EnumParameter [values=" + values + ", defaultValue=" + defaultValue + ", value=" + value + ", name="
+ defaultValue + ", value=" + value + ", name=" + name + name + ", description=" + description + ", typology=" + typology + "]";
+ ", description=" + description + ", typology=" + typology
+ "]";
} }
} }

View File

@ -7,8 +7,8 @@ import java.util.ArrayList;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class FileParameter extends Parameter { public class FileParameter extends Parameter {
@ -28,12 +28,16 @@ public class FileParameter extends Parameter {
/** /**
* *
* @param name * @param name
* name
* @param description * @param description
* @param fileName * description
* @param mimeType * @param defaultMimeType
* default mime type
* @param supportedMimeTypes
* supported mime type
*/ */
public FileParameter(String name, String description, public FileParameter(String name, String description, String defaultMimeType,
String defaultMimeType, ArrayList<String> supportedMimeTypes) { ArrayList<String> supportedMimeTypes) {
super(name, ParameterType.FILE, description); super(name, ParameterType.FILE, description);
this.defaultMimeType = defaultMimeType; this.defaultMimeType = defaultMimeType;
this.supportedMimeTypes = supportedMimeTypes; this.supportedMimeTypes = supportedMimeTypes;
@ -57,10 +61,9 @@ public class FileParameter extends Parameter {
@Override @Override
public String toString() { public String toString() {
return "FileParameter [value=" + value + ", defaultMimeType=" return "FileParameter [value=" + value + ", defaultMimeType=" + defaultMimeType + ", supportedMimeTypes="
+ defaultMimeType + ", supportedMimeTypes=" + supportedMimeTypes + ", name=" + name + ", description=" + description + ", typology=" + typology
+ supportedMimeTypes + ", name=" + name + ", description=" + "]";
+ description + ", typology=" + typology + "]";
} }
} }

View File

@ -3,11 +3,10 @@
*/ */
package org.gcube.data.analysis.dataminermanagercl.shared.parameters; package org.gcube.data.analysis.dataminermanagercl.shared.parameters;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ListParameter extends Parameter { public class ListParameter extends Parameter {
@ -25,11 +24,17 @@ public class ListParameter extends Parameter {
} }
/** /**
* @param defaultValue *
* @param value * @param name
* name
* @param description
* description
* @param type
* type
* @param separator
* separator
*/ */
public ListParameter(String name, String description, String type, public ListParameter(String name, String description, String type, String separator) {
String separator) {
super(name, ParameterType.LIST, description); super(name, ParameterType.LIST, description);
this.type = type; this.type = type;
this.separator = separator; this.separator = separator;
@ -50,7 +55,6 @@ public class ListParameter extends Parameter {
this.type = type; this.type = type;
} }
/** /**
* @return the separator * @return the separator
*/ */
@ -64,10 +68,8 @@ public class ListParameter extends Parameter {
@Override @Override
public String toString() { public String toString() {
return "ListParameter [type=" + type + ", value=" + value return "ListParameter [type=" + type + ", value=" + value + ", separator=" + separator + ", name=" + name
+ ", separator=" + separator + ", name=" + name + ", description=" + description + ", typology=" + typology + "]";
+ ", description=" + description + ", typology=" + typology
+ "]";
} }
} }

View File

@ -2,8 +2,8 @@ package org.gcube.data.analysis.dataminermanagercl.shared.parameters;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ObjectParameter extends Parameter { public class ObjectParameter extends Parameter {
@ -23,12 +23,15 @@ public class ObjectParameter extends Parameter {
/** /**
* *
* @param name * @param name
* name
* @param description * @param description
* description
* @param type * @param type
* type
* @param defaultValue * @param defaultValue
* default value
*/ */
public ObjectParameter(String name, String description, String type, public ObjectParameter(String name, String description, String type, String defaultValue) {
String defaultValue) {
super(name, ParameterType.OBJECT, description); super(name, ParameterType.OBJECT, description);
this.type = type; this.type = type;
this.defaultValue = defaultValue; this.defaultValue = defaultValue;
@ -66,10 +69,8 @@ public class ObjectParameter extends Parameter {
@Override @Override
public String toString() { public String toString() {
return "ObjectParameter [type=" + type + ", defaultValue=" return "ObjectParameter [type=" + type + ", defaultValue=" + defaultValue + ", value=" + value + ", name="
+ defaultValue + ", value=" + value + ", name=" + name + name + ", description=" + description + ", typology=" + typology + "]";
+ ", description=" + description + ", typology=" + typology
+ "]";
} }
} }

View File

@ -7,8 +7,8 @@ import java.io.Serializable;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public abstract class Parameter implements Serializable { public abstract class Parameter implements Serializable {
@ -30,13 +30,14 @@ public abstract class Parameter implements Serializable {
super(); super();
} }
/** /**
*
* @param name * @param name
* name
* @param type * @param type
* type
* @param description * @param description
* @param defaultValue * description
* @param value
*/ */
public Parameter(String name, ParameterType type, String description) { public Parameter(String name, ParameterType type, String description) {
super(); super();
@ -45,11 +46,11 @@ public abstract class Parameter implements Serializable {
this.description = description; this.description = description;
} }
public void setValue(String value){ public void setValue(String value) {
this.value=value; this.value = value;
} }
public String getValue(){ public String getValue() {
return value; return value;
} }
@ -93,10 +94,8 @@ public abstract class Parameter implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "Parameter [name=" + name + ", description=" + description return "Parameter [name=" + name + ", description=" + description + ", typology=" + typology + ", value="
+ ", typology=" + typology + ", value=" + value + "]"; + value + "]";
} }
} }

View File

@ -2,8 +2,8 @@ package org.gcube.data.analysis.dataminermanagercl.shared.parameters;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public enum ParameterType { public enum ParameterType {

View File

@ -7,8 +7,8 @@ import java.util.ArrayList;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class TabularListParameter extends Parameter { public class TabularListParameter extends Parameter {
@ -27,11 +27,19 @@ public class TabularListParameter extends Parameter {
} }
/** /**
* @param defaultValue *
* @param value * @param name
* name
* @param description
* description
* @param separator
* separator
* @param defaultMimeType
* default mime type
* @param supportedMimeTypes
* supported mime types
*/ */
public TabularListParameter(String name, String description, public TabularListParameter(String name, String description, String separator, String defaultMimeType,
String separator, String defaultMimeType,
ArrayList<String> supportedMimeTypes) { ArrayList<String> supportedMimeTypes) {
super(name, ParameterType.TABULAR_LIST, description); super(name, ParameterType.TABULAR_LIST, description);
this.separator = separator; this.separator = separator;
@ -87,11 +95,9 @@ public class TabularListParameter extends Parameter {
@Override @Override
public String toString() { public String toString() {
return "TabularListParameter [separator=" + separator + ", templates=" return "TabularListParameter [separator=" + separator + ", templates=" + templates + ", defaultMimeType="
+ templates + ", defaultMimeType=" + defaultMimeType + defaultMimeType + ", supportedMimeTypes=" + supportedMimeTypes + ", name=" + name + ", description="
+ ", supportedMimeTypes=" + supportedMimeTypes + ", name=" + description + ", typology=" + typology + ", value=" + value + "]";
+ name + ", description=" + description + ", typology="
+ typology + ", value=" + value + "]";
} }
} }

View File

@ -7,8 +7,8 @@ import java.util.ArrayList;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class TabularParameter extends Parameter { public class TabularParameter extends Parameter {
@ -18,9 +18,6 @@ public class TabularParameter extends Parameter {
private String defaultMimeType; private String defaultMimeType;
private ArrayList<String> supportedMimeTypes; private ArrayList<String> supportedMimeTypes;
/** /**
* *
*/ */
@ -32,11 +29,18 @@ public class TabularParameter extends Parameter {
/** /**
* *
* @param name * @param name
* name
* @param description * @param description
* description
* @param tableName * @param tableName
* table name
* @param defaultMimeType
* default mime type
* @param supportedMimeTypes
* supported mime type
*/ */
public TabularParameter(String name, String description, String tableName, public TabularParameter(String name, String description, String tableName, String defaultMimeType,
String defaultMimeType, ArrayList<String> supportedMimeTypes) { ArrayList<String> supportedMimeTypes) {
super(name, ParameterType.TABULAR, description); super(name, ParameterType.TABULAR, description);
this.value = tableName; this.value = tableName;
this.templates = null; this.templates = null;
@ -47,13 +51,20 @@ public class TabularParameter extends Parameter {
/** /**
* *
* @param name * @param name
* name
* @param description * @param description
* description
* @param tableName * @param tableName
* table name
* @param templates * @param templates
* templates
* @param defaultMimeType
* default mime type
* @param supportedMimeTypes
* supported mime types
*/ */
public TabularParameter(String name, String description, String tableName, public TabularParameter(String name, String description, String tableName, ArrayList<String> templates,
ArrayList<String> templates, String defaultMimeType, String defaultMimeType, ArrayList<String> supportedMimeTypes) {
ArrayList<String> supportedMimeTypes) {
super(name, ParameterType.TABULAR, description); super(name, ParameterType.TABULAR, description);
this.value = tableName; this.value = tableName;
this.templates = templates; this.templates = templates;
@ -95,11 +106,9 @@ public class TabularParameter extends Parameter {
@Override @Override
public String toString() { public String toString() {
return "TabularParameter [templates=" + templates return "TabularParameter [templates=" + templates + ", defaultMimeType=" + defaultMimeType
+ ", defaultMimeType=" + defaultMimeType + ", supportedMimeTypes=" + supportedMimeTypes + ", name=" + name + ", description=" + description
+ ", supportedMimeTypes=" + supportedMimeTypes + ", name=" + ", typology=" + typology + ", value=" + value + "]";
+ name + ", description=" + description + ", typology="
+ typology + ", value=" + value + "]";
} }
} }

View File

@ -5,8 +5,8 @@ package org.gcube.data.analysis.dataminermanagercl.shared.parameters;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class TimeParameter extends Parameter { public class TimeParameter extends Parameter {
@ -23,9 +23,13 @@ public class TimeParameter extends Parameter {
} }
/** /**
* @param type *
* @param name
* name
* @param description
* description
* @param defaultValue * @param defaultValue
* @param value * default value
*/ */
public TimeParameter(String name, String description, String defaultValue) { public TimeParameter(String name, String description, String defaultValue) {
super(name, ParameterType.TIME, description); super(name, ParameterType.TIME, description);
@ -49,9 +53,8 @@ public class TimeParameter extends Parameter {
@Override @Override
public String toString() { public String toString() {
return "TimeParameter [defaultValue=" + defaultValue + ", value=" return "TimeParameter [defaultValue=" + defaultValue + ", value=" + value + ", name=" + name + ", description="
+ value + ", name=" + name + ", description=" + description + description + ", typology=" + typology + "]";
+ ", typology=" + typology + "]";
} }
} }

View File

@ -6,16 +6,17 @@ import java.util.List;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public enum WKTGeometryType { public enum WKTGeometryType {
Point("Point"), LineString("LineString"), Polygon("Polygon"), Circle( Point("Point"), LineString("LineString"), Polygon("Polygon"), Circle("Circle"), Triangle("Triangle"), Square(
"Circle"), Triangle("Triangle"), Square("Square"), Pentagon( "Square"), Pentagon("Pentagon"), Hexagon("Hexagon"), Box("Box");
"Pentagon"), Hexagon("Hexagon"), Box("Box");
/** /**
* @param text *
* @param label
* label
*/ */
private WKTGeometryType(final String label) { private WKTGeometryType(final String label) {
this.label = label; this.label = label;
@ -39,7 +40,8 @@ public enum WKTGeometryType {
/** /**
* *
* @param label * @param label
* @return * label
* @return WKTGeometryType
*/ */
public static WKTGeometryType getFromLabel(String label) { public static WKTGeometryType getFromLabel(String label) {
if (label == null || label.isEmpty()) if (label == null || label.isEmpty())

View File

@ -3,11 +3,10 @@
*/ */
package org.gcube.data.analysis.dataminermanagercl.shared.parameters; package org.gcube.data.analysis.dataminermanagercl.shared.parameters;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class WKTParameter extends Parameter { public class WKTParameter extends Parameter {
@ -25,12 +24,17 @@ public class WKTParameter extends Parameter {
} }
/** /**
* @param type *
* @param name
* name
* @param description
* description
* @param wktGeometryType
* wkt geometry type
* @param defaultValue * @param defaultValue
* @param value * default value
*/ */
public WKTParameter(String name, String description, public WKTParameter(String name, String description, WKTGeometryType wktGeometryType, String defaultValue) {
WKTGeometryType wktGeometryType, String defaultValue) {
super(name, ParameterType.WKT, description); super(name, ParameterType.WKT, description);
this.wktGeometryType = wktGeometryType; this.wktGeometryType = wktGeometryType;
this.defaultValue = defaultValue; this.defaultValue = defaultValue;
@ -70,10 +74,8 @@ public class WKTParameter extends Parameter {
@Override @Override
public String toString() { public String toString() {
return "WKTParameter [wktGeometryType=" + wktGeometryType return "WKTParameter [wktGeometryType=" + wktGeometryType + ", defaultValue=" + defaultValue + ", value="
+ ", defaultValue=" + defaultValue + ", value=" + value + value + ", name=" + name + ", description=" + description + ", typology=" + typology + "]";
+ ", name=" + name + ", description=" + description
+ ", typology=" + typology + "]";
} }
} }

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ComputationStatus implements Serializable { public class ComputationStatus implements Serializable {

View File

@ -10,11 +10,10 @@ import java.util.List;
import org.gcube.data.analysis.dataminermanagercl.shared.StringUtil; import org.gcube.data.analysis.dataminermanagercl.shared.StringUtil;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter; import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class Operator implements Serializable, Comparable<Operator> { public class Operator implements Serializable, Comparable<Operator> {
@ -37,12 +36,15 @@ public class Operator implements Serializable, Comparable<Operator> {
/** /**
* @param id * @param id
* id
* @param briefDescription * @param briefDescription
* brief description
* @param description * @param description
* description
* @param category * @param category
* category
*/ */
public Operator(String id, String briefDescription, String description, public Operator(String id, String briefDescription, String description, OperatorCategory category) {
OperatorCategory category) {
super(); super();
this.id = id; this.id = id;
if (id != null) if (id != null)
@ -54,13 +56,18 @@ public class Operator implements Serializable, Comparable<Operator> {
/** /**
* @param id * @param id
* id
* @param briefDescription * @param briefDescription
* brief description
* @param description * @param description
* description
* @param category * @param category
* category
* @param hasImage * @param hasImage
* true if has image
*/ */
public Operator(String id, String briefDescription, String description, public Operator(String id, String briefDescription, String description, OperatorCategory category,
OperatorCategory category, boolean hasImage) { boolean hasImage) {
super(); super();
this.id = id; this.id = id;
if (id != null) if (id != null)
@ -71,15 +78,19 @@ public class Operator implements Serializable, Comparable<Operator> {
this.hasImage = hasImage; this.hasImage = hasImage;
} }
/** /**
* @param id * @param id
* id
* @param name
* name
* @param briefDescription * @param briefDescription
* brief description
* @param description * @param description
* description
* @param category * @param category
* category
*/ */
public Operator(String id, String name, String briefDescription, public Operator(String id, String name, String briefDescription, String description, OperatorCategory category) {
String description, OperatorCategory category) {
super(); super();
this.id = id; this.id = id;
if (name != null) if (name != null)
@ -89,18 +100,23 @@ public class Operator implements Serializable, Comparable<Operator> {
this.category = category; this.category = category;
} }
/** /**
* @param id * @param id
* id
* @param name * @param name
* name
* @param briefDescription * @param briefDescription
* brief description
* @param description * @param description
* description
* @param category * @param category
* category
* @param operatorParameters * @param operatorParameters
* operator parameters
* @param hasImage * @param hasImage
* true if has image
*/ */
public Operator(String id, String name, String briefDescription, public Operator(String id, String name, String briefDescription, String description, OperatorCategory category,
String description, OperatorCategory category,
List<Parameter> operatorParameters, boolean hasImage) { List<Parameter> operatorParameters, boolean hasImage) {
super(); super();
this.id = id; this.id = id;
@ -226,10 +242,8 @@ public class Operator implements Serializable, Comparable<Operator> {
@Override @Override
public String toString() { public String toString() {
return "Operator [id=" + id + ", name=" + name + ", briefDescription=" return "Operator [id=" + id + ", name=" + name + ", briefDescription=" + briefDescription + ", description="
+ briefDescription + ", description=" + description + description + ", operatorParameters=" + operatorParameters + ", hasImage=" + hasImage + "]";
+", operatorParameters="
+ operatorParameters + ", hasImage=" + hasImage + "]";
} }
@Override @Override

View File

@ -10,7 +10,7 @@ import java.util.List;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class OperatorCategory implements Serializable, Comparable<OperatorCategory> { public class OperatorCategory implements Serializable, Comparable<OperatorCategory> {
@ -32,8 +32,11 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
/** /**
* @param id * @param id
* id
* @param briefDescription * @param briefDescription
* brief description
* @param description * @param description
* description
*/ */
public OperatorCategory(String id, String briefDescription, String description) { public OperatorCategory(String id, String briefDescription, String description) {
super(); super();
@ -44,12 +47,17 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
} }
/** /**
* @param string *
* @param string2 * @param id
* @param string3 * id
* @param b * @param briefDescription
* brief description
* @param description
* description
* @param hasImage
* true if has image
*/ */
public OperatorCategory(String id, String briefDescription, String description, boolean hasImage) { public OperatorCategory(String id, String briefDescription, String description, boolean hasImage) {
super(); super();
this.id = id; this.id = id;
setNameFromId(); setNameFromId();
@ -58,15 +66,18 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
this.hasImage = hasImage; this.hasImage = hasImage;
} }
/** /**
*
* @param id * @param id
* id
* @param briefDescription * @param briefDescription
* brief description
* @param description * @param description
* description
* @param operators * @param operators
* list of operators
*/ */
public OperatorCategory(String id, String briefDescription, public OperatorCategory(String id, String briefDescription, String description, List<Operator> operators) {
String description, List<Operator> operators) {
super(); super();
this.id = id; this.id = id;
setNameFromId(); setNameFromId();
@ -75,15 +86,21 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
this.operators = operators; this.operators = operators;
} }
/** /**
*
* @param id * @param id
* id
* @param name
* name
* @param briefDescription * @param briefDescription
* brief description
* @param description * @param description
* description
* @param operators * @param operators
* list of operators
*/ */
public OperatorCategory(String id, String name, String briefDescription, public OperatorCategory(String id, String name, String briefDescription, String description,
String description, List<Operator> operators) { List<Operator> operators) {
super(); super();
this.id = id; this.id = id;
this.name = name; this.name = name;
@ -92,7 +109,6 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
this.operators = operators; this.operators = operators;
} }
/** /**
* @return the id * @return the id
*/ */
@ -101,7 +117,8 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
} }
/** /**
* @param id the id to set * @param id
* the id to set
*/ */
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
@ -115,7 +132,8 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
} }
/** /**
* @param briefDescription the briefDescription to set * @param briefDescription
* the briefDescription to set
*/ */
public void setBriefDescription(String briefDescription) { public void setBriefDescription(String briefDescription) {
this.briefDescription = briefDescription; this.briefDescription = briefDescription;
@ -129,7 +147,8 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
} }
/** /**
* @param description the description to set * @param description
* the description to set
*/ */
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
@ -143,7 +162,8 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
} }
/** /**
* @param operators the operators to set * @param operators
* the operators to set
*/ */
public void setOperators(List<Operator> operators) { public void setOperators(List<Operator> operators) {
this.operators = operators; this.operators = operators;
@ -157,11 +177,11 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
* *
*/ */
private void setNameFromId() { private void setNameFromId() {
if (id!=null) { if (id != null) {
String name = ""; String name = "";
boolean precUnderscore = true; boolean precUnderscore = true;
for (int i=0; i<id.length(); i++) { for (int i = 0; i < id.length(); i++) {
char c = id.charAt(i); char c = id.charAt(i);
if (c == '_') { if (c == '_') {
@ -178,7 +198,8 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
} }
/** /**
* @param name the name to set * @param name
* the name to set
*/ */
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
@ -196,24 +217,24 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
} }
/** /**
* @param hasImage the hasImage to set * @param hasImage
* the hasImage to set
*/ */
public void setHasImage(boolean hasImage) { public void setHasImage(boolean hasImage) {
this.hasImage = hasImage; this.hasImage = hasImage;
} }
public OperatorCategory clone() { public OperatorCategory clone() {
OperatorCategory op = new OperatorCategory(id, name, briefDescription, description, new ArrayList<Operator>(operators)); OperatorCategory op = new OperatorCategory(id, name, briefDescription, description,
new ArrayList<Operator>(operators));
op.setHasImage(hasImage); op.setHasImage(hasImage);
return op; return op;
} }
@Override @Override
public String toString() { public String toString() {
return "OperatorCategory [id=" + id + ", name=" + name return "OperatorCategory [id=" + id + ", name=" + name + ", briefDescription=" + briefDescription
+ ", briefDescription=" + briefDescription + ", description=" + ", description=" + description + ", operators=" + operators + ", hasImage=" + hasImage + "]";
+ description + ", operators=" + operators + ", hasImage="
+ hasImage + "]";
} }
@Override @Override
@ -221,6 +242,4 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
return id.compareTo(o.getId()); return id.compareTo(o.getId());
} }
} }

View File

@ -10,7 +10,7 @@ import java.util.List;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class OperatorsClassification implements Serializable { public class OperatorsClassification implements Serializable {
@ -26,6 +26,8 @@ public class OperatorsClassification implements Serializable {
/** /**
* *
* @param name
* name
*/ */
public OperatorsClassification(String name) { public OperatorsClassification(String name) {
super(); super();
@ -33,11 +35,15 @@ public class OperatorsClassification implements Serializable {
} }
/** /**
*
* @param name
* name
* @param operatorCategories * @param operatorCategories
* list of operator categories
* @param operators * @param operators
* list of operators
*/ */
public OperatorsClassification(String name, List<OperatorCategory> operatorCategories, public OperatorsClassification(String name, List<OperatorCategory> operatorCategories, List<Operator> operators) {
List<Operator> operators) {
this(name); this(name);
this.operatorCategories = operatorCategories; this.operatorCategories = operatorCategories;
this.operators = operators; this.operators = operators;
@ -51,7 +57,8 @@ public class OperatorsClassification implements Serializable {
} }
/** /**
* @param operatorCategories the operatorCategories to set * @param operatorCategories
* the operatorCategories to set
*/ */
public void setOperatorCategories(List<OperatorCategory> operatorCategories) { public void setOperatorCategories(List<OperatorCategory> operatorCategories) {
this.operatorCategories = operatorCategories; this.operatorCategories = operatorCategories;
@ -65,17 +72,18 @@ public class OperatorsClassification implements Serializable {
} }
/** /**
* @param operators the operators to set * @param operators
* the operators to set
*/ */
public void setOperators(List<Operator> operators) { public void setOperators(List<Operator> operators) {
this.operators = operators; this.operators = operators;
} }
public Operator getOperatorById(String id) { public Operator getOperatorById(String id) {
if (id==null) if (id == null)
return null; return null;
Operator operator = null; Operator operator = null;
for (Operator op: operators) for (Operator op : operators)
if (op.getId().contentEquals(id)) { if (op.getId().contentEquals(id)) {
operator = op; operator = op;
break; break;
@ -85,7 +93,7 @@ public class OperatorsClassification implements Serializable {
public OperatorCategory getCategoryById(String id) { public OperatorCategory getCategoryById(String id) {
OperatorCategory category = null; OperatorCategory category = null;
for (OperatorCategory cat: operatorCategories) for (OperatorCategory cat : operatorCategories)
if (cat.getId().contentEquals(id)) { if (cat.getId().contentEquals(id)) {
category = cat; category = cat;
break; break;
@ -101,7 +109,8 @@ public class OperatorsClassification implements Serializable {
} }
/** /**
* @param name the name to set * @param name
* the name to set
*/ */
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
@ -109,11 +118,8 @@ public class OperatorsClassification implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "OperatorsClassification [name=" + name return "OperatorsClassification [name=" + name + ", operatorCategories=" + operatorCategories + ", operators="
+ ", operatorCategories=" + operatorCategories + ", operators="
+ operators + "]"; + operators + "]";
} }
} }

View File

@ -6,87 +6,66 @@ package org.gcube.data.analysis.dataminermanagercl.shared.process;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class TemplateDescriptor { public class TemplateDescriptor {
public static TemplateDescriptor descriptors[] = { public static TemplateDescriptor descriptors[] = { new TemplateDescriptor("HCAF", "HCAF Data Set", ""),
new TemplateDescriptor("HCAF", "HCAF Data Set", ""), new TemplateDescriptor("OCCURRENCE_SPECIES", "Occurrence Species Data Set", ""),
new TemplateDescriptor("OCCURRENCE_SPECIES", "Occurrence Species Data Set", ""), new TemplateDescriptor("OCCURRENCE_AQUAMAPS", "Occurrence Aquamaps", ""),
new TemplateDescriptor("OCCURRENCE_AQUAMAPS", "Occurrence Aquamaps", ""), new TemplateDescriptor("HSPEN", "HSPEN Data Set", ""),
new TemplateDescriptor("HSPEN", "HSPEN Data Set", ""), new TemplateDescriptor("HSPEC", "HSPEC Data Set", ""),
new TemplateDescriptor("HSPEC", "HSPEC Data Set", ""), new TemplateDescriptor("CLUSTER", "Cluster Data Set", ""),
new TemplateDescriptor("CLUSTER", "Cluster Data Set", ""), new TemplateDescriptor("TRAININGSET", "Neural Network Training Set", ""),
new TemplateDescriptor("TRAININGSET", "Neural Network Training Set", ""), new TemplateDescriptor("TESTSET", "Neural Network Test Set", ""),
new TemplateDescriptor("TESTSET", "Neural Network Test Set", ""), new TemplateDescriptor("GENERIC", "Generic Data set", ""),
new TemplateDescriptor("GENERIC", "Generic Data set", ""), new TemplateDescriptor("MINMAXLAT", "Min Max Lat Data Set", ""),
new TemplateDescriptor("MINMAXLAT", "Min Max Lat Data Set", ""), new TemplateDescriptor("TIMESERIES", "time Series Data Set", ""), };
new TemplateDescriptor("TIMESERIES", "time Series Data Set", ""),
};
public static String[] s = new String[]{""}; public static String[] s = new String[] { "" };
public static Map<String, String[][]> map; public static Map<String, String[][]> map;
static { static {
map = new HashMap<String, String[][]>(); map = new HashMap<String, String[][]>();
map.put("HCAF", new String[][]{ map.put("HCAF", new String[][] { { "csquarecode", "string" }, { "depthmin", "real" }, { "depthmax", "real" },
{"csquarecode", "string"}, { "depthmean", "real" }, { "depthsd", "real" }, { "sstanmean", "real" }, { "sstansd", "real" },
{"depthmin", "real"}, { "sstmnmax", "real" }, { "sstmnmin", "real" }, { "sstmnrange", "real" }, { "sbtanmean", "real" },
{"depthmax", "real"}, { "salinitymean", "real" }, { "salinitysd", "real" }, { "salinitymax", "real" },
{"depthmean", "real"}, { "salinitymin", "real" }, { "salinitybmean", "real" }, { "primprodmean", "integer" },
{"depthsd", "real"}, { "iceconann", "real" }, { "iceconspr", "real" }, { "iceconsum", "real" }, { "iceconfal", "real" },
{"sstanmean", "real"}, { "iceconwin", "real" }, { "faoaream", "integer" }, { "eezall", "string" }, { "lme", "integer" },
{"sstansd", "real"}, { "landdist", "integer" }, { "oceanarea", "real" }, { "centerlat", "real" },
{"sstmnmax", "real"}, { "centerlong", "real" }, });
{"sstmnmin", "real"},
{"sstmnrange", "real"},
{"sbtanmean", "real"},
{"salinitymean", "real"},
{"salinitysd", "real"},
{"salinitymax", "real"},
{"salinitymin", "real"},
{"salinitybmean", "real"},
{"primprodmean", "integer"},
{"iceconann", "real"},
{"iceconspr", "real"},
{"iceconsum", "real"},
{"iceconfal", "real"},
{"iceconwin", "real"},
{"faoaream", "integer"},
{"eezall", "string"},
{"lme", "integer"},
{"landdist", "integer"},
{"oceanarea", "real"},
{"centerlat", "real"},
{"centerlong", "real"},
});
} }
public static TemplateDescriptor defaultDescriptor = descriptors[0]; public static TemplateDescriptor defaultDescriptor = descriptors[0];
// public enum Template { // public enum Template {
// HCAF, // HCAF,
// OCCURRENCE_SPECIES, // OCCURRENCE_SPECIES,
// OCCURRENCE_AQUAMAPS, // OCCURRENCE_AQUAMAPS,
// HSPEN, // HSPEN,
// HSPEC, // HSPEC,
// CLUSTER, // CLUSTER,
// TRAININGSET, // TRAININGSET,
// TESTSET, // TESTSET,
// GENERIC, // GENERIC,
// MINMAXLAT, // MINMAXLAT,
// TIMESERIES, // TIMESERIES,
// } // }
private String id, title, description; private String id, title, description;
/** /**
*
* @param id
* id
* @param title * @param title
* title
* @param description * @param description
* decription
*/ */
public TemplateDescriptor(String id, String title, String description) { public TemplateDescriptor(String id, String title, String description) {
super(); super();

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class Computations implements Serializable { public class Computations implements Serializable {

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/** /**
* *
* @author "Giancarlo Panichi" <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class DataMinerWorkArea implements Serializable { public class DataMinerWorkArea implements Serializable {
@ -23,6 +23,7 @@ public class DataMinerWorkArea implements Serializable {
/** /**
* *
* @param dataMinerWorkAreaFolder * @param dataMinerWorkAreaFolder
* DataMiner work area folder
*/ */
public DataMinerWorkArea(ItemDescription dataMinerWorkAreaFolder) { public DataMinerWorkArea(ItemDescription dataMinerWorkAreaFolder) {
super(); super();
@ -33,13 +34,16 @@ public class DataMinerWorkArea implements Serializable {
/** /**
* *
* @param dataMinerWorkAreaFolder * @param dataMinerWorkAreaFolder
* DataMiner work area folder
* @param inputDataSets * @param inputDataSets
* input data sets
* @param outputDataSets * @param outputDataSets
* output data sets
* @param computations * @param computations
* computations
*/ */
public DataMinerWorkArea(ItemDescription dataMinerWorkAreaFolder, public DataMinerWorkArea(ItemDescription dataMinerWorkAreaFolder, InputDataSets inputDataSets,
InputDataSets inputDataSets, OutputDataSets outputDataSets, OutputDataSets outputDataSets, Computations computations) {
Computations computations) {
super(); super();
this.dataMinerWorkAreaFolder = dataMinerWorkAreaFolder; this.dataMinerWorkAreaFolder = dataMinerWorkAreaFolder;
this.inputDataSets = inputDataSets; this.inputDataSets = inputDataSets;
@ -81,13 +85,8 @@ public class DataMinerWorkArea implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "DataMinerWorkArea [dataMinerWorkAreaFolder=" return "DataMinerWorkArea [dataMinerWorkAreaFolder=" + dataMinerWorkAreaFolder + ", inputDataSets="
+ dataMinerWorkAreaFolder + ", inputDataSets=" + inputDataSets + inputDataSets + ", outputDataSets=" + outputDataSets + ", computations=" + computations + "]";
+ ", outputDataSets=" + outputDataSets + ", computations="
+ computations + "]";
} }
} }

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class InputDataSets implements Serializable { public class InputDataSets implements Serializable {

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ItemDescription implements Serializable { public class ItemDescription implements Serializable {
@ -23,8 +23,7 @@ public class ItemDescription implements Serializable {
super(); super();
} }
public ItemDescription(String id, String name, String owner, String path, public ItemDescription(String id, String name, String owner, String path, String type) {
String type) {
super(); super();
this.id = id; this.id = id;
this.name = name; this.name = name;
@ -85,16 +84,14 @@ public class ItemDescription implements Serializable {
* Compare basic information with another ItemDescription not null * Compare basic information with another ItemDescription not null
* *
* @param itemDescription * @param itemDescription
* @return boolean * item description
* @return boolean true if comparison match
* *
*/ */
public boolean compareInfo(ItemDescription itemDescription){ public boolean compareInfo(ItemDescription itemDescription) {
if(itemDescription!=null && id.compareTo(itemDescription.getId())==0 && if (itemDescription != null && id.compareTo(itemDescription.getId()) == 0
name.compareTo(itemDescription.getName())==0 && && name.compareTo(itemDescription.getName()) == 0 && owner.compareTo(itemDescription.getOwner()) == 0
owner.compareTo(itemDescription.getOwner())==0 && && path.compareTo(itemDescription.getPath()) == 0 && type.compareTo(itemDescription.getType()) == 0) {
path.compareTo(itemDescription.getPath())==0 &&
type.compareTo(itemDescription.getType())==0
){
return true; return true;
} else { } else {
return false; return false;
@ -104,9 +101,8 @@ public class ItemDescription implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "ItemDescription [id=" + id + ", name=" + name + ", owner=" return "ItemDescription [id=" + id + ", name=" + name + ", owner=" + owner + ", path=" + path + ", type=" + type
+ owner + ", path=" + path + ", type=" + type + ", publicLink=" + ", publicLink=" + publicLink + "]";
+ publicLink + "]";
} }
} }

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class OutputDataSets implements Serializable { public class OutputDataSets implements Serializable {

View File

@ -23,8 +23,8 @@ import org.slf4j.LoggerFactory;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class BionymLocalTest extends TestCase { public class BionymLocalTest extends TestCase {

View File

@ -23,8 +23,8 @@ import org.slf4j.LoggerFactory;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class CsquareColumnCreatorTest extends TestCase { public class CsquareColumnCreatorTest extends TestCase {

View File

@ -31,8 +31,8 @@ import org.slf4j.LoggerFactory;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class DBScanTest extends TestCase { public class DBScanTest extends TestCase {

View File

@ -14,8 +14,8 @@ import org.slf4j.LoggerFactory;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class DataMinerParametersTest extends TestCase { public class DataMinerParametersTest extends TestCase {

View File

@ -15,8 +15,8 @@ import junit.framework.TestCase;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class DataMinerServiceTest extends TestCase { public class DataMinerServiceTest extends TestCase {

View File

@ -22,8 +22,8 @@ import org.slf4j.LoggerFactory;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ListDBInfoTest extends TestCase { public class ListDBInfoTest extends TestCase {

View File

@ -22,8 +22,8 @@ import org.slf4j.LoggerFactory;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ListDBNameTest extends TestCase { public class ListDBNameTest extends TestCase {

View File

@ -23,8 +23,8 @@ import org.slf4j.LoggerFactory;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ListDBSchemaTest extends TestCase { public class ListDBSchemaTest extends TestCase {

View File

@ -23,8 +23,8 @@ import org.slf4j.LoggerFactory;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public class ListTablesTest extends TestCase { public class ListTablesTest extends TestCase {

View File

@ -2,8 +2,8 @@ package org.gcube.data.analysis.dataminermanagercl.test;
/** /**
* *
* @author Giancarlo Panichi email: <a * @author Giancarlo Panichi
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> *
* *
*/ */
public enum OperatorId { public enum OperatorId {