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"?>
<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>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</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">
<attributes>
<attribute name="optional" value="true"/>
@ -18,16 +22,16 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</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>

View File

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

View File

@ -1,16 +1,23 @@
<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>
<Change>Fixed load balancing [ticket #7576]</Change>
</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>Added encoded parameters in equivalent http request [ticket
#7167]
</Change>
</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>
</Changeset>
</ReleaseNotes>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -43,15 +43,14 @@ import org.xml.sax.SAXException;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class SClient4WPSSession implements Serializable {
private static final long serialVersionUID = -1387670579312851370L;
private static Logger logger = LoggerFactory
.getLogger(SClient4WPSSession.class);
private static Logger logger = LoggerFactory.getLogger(SClient4WPSSession.class);
private static final String OGC_OWS_URI = "http://www.opengeospatial.net/ows";
private static String SUPPORTED_VERSION = "1.0.0";
@ -70,8 +69,7 @@ public class SClient4WPSSession implements Serializable {
*/
public SClient4WPSSession(String user, String password) {
super();
logger.debug("Create SClient4WPSSession: [user=" + user
+ ", password=" + password + "]");
logger.debug("Create SClient4WPSSession: [user=" + user + ", password=" + password + "]");
this.user = user;
this.password = password;
options = new XmlOptions();
@ -90,6 +88,7 @@ public class SClient4WPSSession implements Serializable {
* further identification of the service.
* @return true, if connect succeeded, false else.
* @throws WPSClientException
* WPSClientException
*/
public boolean connect(String url) throws WPSClientException {
@ -111,11 +110,9 @@ public class SClient4WPSSession implements Serializable {
ProcessDescriptionsDocument processDescs = describeAllProcesses(url);
if (processDescs != null && capsDoc != null) {
logger.debug("Adding processes descriptions to logged services "
+ url);
logger.debug("Adding processes descriptions to logged services " + url);
processDescriptions.put(url, processDescs);
logger.debug("ProcessDescriptions key: "
+ processDescriptions.keySet());
logger.debug("ProcessDescriptions key: " + processDescriptions.keySet());
return true;
} else {
@ -135,6 +132,7 @@ public class SClient4WPSSession implements Serializable {
* further identification of the service.
* @return true, if connect succeeded, false else.
* @throws WPSClientException
* WPSClientException
*/
public boolean connectForMonitoring(String url) throws WPSClientException {
logger.debug("CONNECT");
@ -151,6 +149,7 @@ public class SClient4WPSSession implements Serializable {
* removes a service from the session
*
* @param url
* url
*/
public void disconnect(String url) {
/*
@ -163,7 +162,7 @@ public class SClient4WPSSession implements Serializable {
/**
* returns the serverIDs of all loggedServices
*
* @return
* @return list of server ids
*/
public List<String> getLoggedServices() {
if (loggedServices != null && loggedServices.keySet() != null) {
@ -178,6 +177,7 @@ public class SClient4WPSSession implements Serializable {
* the session. in normal case it should return true :)
*
* @param serverID
* server id
* @return success
*/
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
* IOException
*/
private ProcessDescriptionsDocument getProcessDescriptionsFromCache(
String wpsUrl) throws IOException {
private ProcessDescriptionsDocument getProcessDescriptionsFromCache(String wpsUrl) throws IOException {
if (!descriptionsAvailableInCache(wpsUrl)) {
try {
connect(wpsUrl);
@ -204,17 +206,18 @@ public class SClient4WPSSession implements Serializable {
}
/**
* return the processDescription for a specific process from Cache.
*
* @param serverID
* server id
* @param processID
* process id
* @return a ProcessDescription for a specific process from Cache.
* @throws IOException
* IOException
*/
public ProcessDescriptionType getProcessDescription(String serverID,
String processID) throws IOException {
ProcessDescriptionType[] processes = getProcessDescriptionsFromCache(
serverID).getProcessDescriptions().getProcessDescriptionArray();
public ProcessDescriptionType getProcessDescription(String serverID, String processID) throws IOException {
ProcessDescriptionType[] processes = getProcessDescriptionsFromCache(serverID).getProcessDescriptions()
.getProcessDescriptionArray();
for (ProcessDescriptionType process : processes) {
if (process.getIdentifier().getStringValue().equals(processID)) {
return process;
@ -230,15 +233,18 @@ public class SClient4WPSSession implements Serializable {
* the URL of the WPS
* @return An Array of ProcessDescriptions
* @throws IOException
* IOException
*/
public ProcessDescriptionType[] getAllProcessDescriptions(String wpsUrl)
throws IOException {
return getProcessDescriptionsFromCache(wpsUrl).getProcessDescriptions()
.getProcessDescriptionArray();
public ProcessDescriptionType[] getAllProcessDescriptions(String wpsUrl) throws IOException {
return getProcessDescriptionsFromCache(wpsUrl).getProcessDescriptions().getProcessDescriptionArray();
}
/**
* looks up, if the service exists already in session.
*
* @param serverID
* server id
* @return true if registered
*/
public boolean serviceAlreadyRegistered(String serverID) {
return loggedServices.containsKey(serverID);
@ -248,7 +254,8 @@ public class SClient4WPSSession implements Serializable {
* provides you the cached capabilities for a specified service.
*
* @param url
* @return
* url
* @return CapabilitiesDocument
*/
public CapabilitiesDocument getWPSCaps(String url) {
return loggedServices.get(url);
@ -261,18 +268,18 @@ public class SClient4WPSSession implements Serializable {
* descriptions will not be cached, so only transient information!
*
* @param url
* @return
* url
* @return process descriptions document
* @throws WPSClientException
* WPSClientException
*/
public ProcessDescriptionsDocument describeAllProcesses(String url)
throws WPSClientException {
public ProcessDescriptionsDocument describeAllProcesses(String url) throws WPSClientException {
CapabilitiesDocument doc = loggedServices.get(url);
if (doc == null) {
logger.warn("serviceCaps are null, perhaps server does not exist");
return null;
}
ProcessBriefType[] processes = doc.getCapabilities()
.getProcessOfferings().getProcessArray();
ProcessBriefType[] processes = doc.getCapabilities().getProcessOfferings().getProcessArray();
String[] processIDs = new String[processes.length];
for (int i = 0; i < processIDs.length; i++) {
processIDs[i] = processes[i].getIdentifier().getStringValue();
@ -288,48 +295,46 @@ public class SClient4WPSSession implements Serializable {
* @param processIDs
* one or more processIDs
* @param serverID
* server id
* @throws WPSClientException
* WPSClientExpcetion
*/
public ProcessDescriptionsDocument describeProcess(String[] processIDs,
String serverID) throws WPSClientException {
public ProcessDescriptionsDocument describeProcess(String[] processIDs, String serverID) throws WPSClientException {
CapabilitiesDocument caps = this.loggedServices.get(serverID);
Operation[] operations = caps.getCapabilities().getOperationsMetadata()
.getOperationArray();
Operation[] operations = caps.getCapabilities().getOperationsMetadata().getOperationArray();
String url = null;
for (Operation operation : operations) {
if (operation.getName().equals("DescribeProcess")) {
url = operation.getDCPArray()[0].getHTTP().getGetArray()[0]
.getHref();
url = operation.getDCPArray()[0].getHTTP().getGetArray()[0].getHref();
}
}
if (url == null) {
throw new WPSClientException(
"Missing DescribeOperation in Capabilities");
throw new WPSClientException("Missing DescribeOperation in Capabilities");
}
return retrieveDescriptionViaGET(processIDs, url);
}
/**
* 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
* Execute document
* @param rawData
* true if is raw data
* @return either an ExecuteResponseDocument or an InputStream if asked for
* RawData or an Exception Report
* @throws WPSClientException WPSClientException
*/
private Object execute(String serverID, ExecuteDocument execute,
boolean rawData) throws WPSClientException {
private Object execute(String serverID, ExecuteDocument execute, boolean rawData) throws WPSClientException {
CapabilitiesDocument caps = loggedServices.get(serverID);
Operation[] operations = caps.getCapabilities().getOperationsMetadata()
.getOperationArray();
Operation[] operations = caps.getCapabilities().getOperationsMetadata().getOperationArray();
String url = null;
for (Operation operation : operations) {
if (operation.getName().equals("Execute")) {
url = operation.getDCPArray()[0].getHTTP().getPostArray()[0]
.getHref();
url = operation.getDCPArray()[0].getHTTP().getPostArray()[0].getHref();
}
}
if (url == null) {
@ -343,17 +348,19 @@ public class SClient4WPSSession implements Serializable {
/**
* 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
* Execute document
* exceute document
* @return either an ExecuteResponseDocument or an InputStream if asked for
* RawData or an Exception Report
* @throws WPSClientException
* WPSClientException
*/
public Object execute(String serverID, ExecuteDocument execute)
throws WPSClientException {
if (execute.getExecute().isSetResponseForm() == true
&& execute.getExecute().isSetResponseForm() == true
public Object execute(String serverID, ExecuteDocument execute) throws WPSClientException {
if (execute.getExecute().isSetResponseForm() == true && execute.getExecute().isSetResponseForm() == true
&& execute.getExecute().getResponseForm().isSetRawDataOutput() == true) {
return execute(serverID, execute, true);
} else {
@ -362,8 +369,7 @@ public class SClient4WPSSession implements Serializable {
}
private CapabilitiesDocument retrieveCapsViaGET(String url)
throws WPSClientException {
private CapabilitiesDocument retrieveCapsViaGET(String url) throws WPSClientException {
logger.debug("retrieveCapsViaGET: " + url);
ClientCapabiltiesRequest req = new ClientCapabiltiesRequest();
url = req.getRequest(url);
@ -376,50 +382,41 @@ public class SClient4WPSSession implements Serializable {
logger.debug("Base64 encoded auth string: " + encoded);
URL urlObj = new URL(url);
HttpURLConnection connection = (HttpURLConnection) urlObj
.openConnection();
HttpURLConnection connection = (HttpURLConnection) urlObj.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.setRequestProperty("Authorization", "Basic " + encoded);
InputStream is = connection.getInputStream();
Document doc = checkInputStream(is);
CapabilitiesDocument capabilitiesDocument = CapabilitiesDocument.Factory
.parse(doc, options);
CapabilitiesDocument capabilitiesDocument = CapabilitiesDocument.Factory.parse(doc, options);
return capabilitiesDocument;
} catch (MalformedURLException e) {
e.printStackTrace();
throw new WPSClientException(
"Capabilities URL seems to be unvalid: " + url, e);
throw new WPSClientException("Capabilities URL seems to be unvalid: " + url, e);
} catch (IOException e) {
e.printStackTrace();
throw new WPSClientException(
"Error occured while retrieving capabilities from url: "
+ url, e);
throw new WPSClientException("Error occured while retrieving capabilities from url: " + url, e);
} catch (XmlException e) {
e.printStackTrace();
throw new WPSClientException("Error occured while parsing XML", e);
}
}
private ProcessDescriptionsDocument retrieveDescriptionViaGET(
String[] processIDs, String url) throws WPSClientException {
private ProcessDescriptionsDocument retrieveDescriptionViaGET(String[] processIDs, String url)
throws WPSClientException {
try {
logger.debug("RetrieveDescription GET: " + processIDs + " url:"
+ url);
logger.debug("RetrieveDescription GET: " + processIDs + " url:" + url);
Path tempFile = Files.createTempFile("WPSProcessDescriptions",
"txt");
Path tempFile = Files.createTempFile("WPSProcessDescriptions", "txt");
List<String> lines = new ArrayList<>();
lines.add("<wps:ProcessDescriptions xmlns:wps=\"http://www.opengis.net/wps/1.0.0\" "
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ "xmlns:ows=\"http://www.opengis.net/ows/1.1\" "
+ "xsi:schemaLocation=\"http://www.opengis.net/wps/1.0.0 "
+ "http://schemas.opengis.net/wps/1.0.0/wpsDescribeProcess_response.xsd\" "
+ "xml:lang=\"en-US\" "
+ "http://schemas.opengis.net/wps/1.0.0/wpsDescribeProcess_response.xsd\" " + "xml:lang=\"en-US\" "
+ "service=\"WPS\" version=\"1.0.0\">");
Files.write(tempFile, lines, Charset.defaultCharset(),
StandardOpenOption.APPEND);
Files.write(tempFile, lines, Charset.defaultCharset(), StandardOpenOption.APPEND);
for (String processId : processIDs) {
String[] process = { processId };
@ -428,42 +425,36 @@ public class SClient4WPSSession implements Serializable {
String requestURL = req.getRequest(url);
String authString = user + ":" + password;
//logger.debug("auth string: " + authString);
byte[] authEncBytes = Base64
.encodeBase64(authString.getBytes());
// logger.debug("auth string: " + authString);
byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
String encoded = new String(authEncBytes);
//logger.debug("Base64 encoded auth string: " + encoded);
// logger.debug("Base64 encoded auth string: " + encoded);
URL urlObj = new URL(requestURL);
HttpURLConnection connection = (HttpURLConnection) urlObj
.openConnection();
HttpURLConnection connection = (HttpURLConnection) urlObj.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.setRequestProperty("Authorization", "Basic "
+ encoded);
connection.setRequestProperty("Authorization", "Basic " + encoded);
InputStream is = connection.getInputStream();
lines=retrievesSingleDescription(is);
Files.write(tempFile, lines, Charset.defaultCharset(),
StandardOpenOption.APPEND);
lines = retrievesSingleDescription(is);
Files.write(tempFile, lines, Charset.defaultCharset(), StandardOpenOption.APPEND);
}
lines = new ArrayList<>();
lines.add("</wps:ProcessDescriptions>");
Files.write(tempFile, lines, Charset.defaultCharset(),
StandardOpenOption.APPEND);
Files.write(tempFile, lines, Charset.defaultCharset(), StandardOpenOption.APPEND);
logger.debug(tempFile.toString());
Document doc=null;
try (InputStream inputStream = Files.newInputStream(tempFile,
StandardOpenOption.READ)){
Document doc = null;
try (InputStream inputStream = Files.newInputStream(tempFile, StandardOpenOption.READ)) {
doc = checkInputStream(inputStream);
}
ProcessDescriptionsDocument processDescriptionsDocument = ProcessDescriptionsDocument.Factory.parse(doc, options);
}
ProcessDescriptionsDocument processDescriptionsDocument = ProcessDescriptionsDocument.Factory.parse(doc,
options);
Files.delete(tempFile);
return processDescriptionsDocument;
} catch (MalformedURLException e) {
logger.error("URL seems not to be valid");
e.printStackTrace();
@ -471,23 +462,19 @@ public class SClient4WPSSession implements Serializable {
} catch (IOException e) {
logger.error("Error occured while receiving data");
e.printStackTrace();
throw new WPSClientException("Error occured while receiving data",
e);
throw new WPSClientException("Error occured while receiving data", e);
} catch (XmlException e) {
logger.error("Error occured while parsing ProcessDescription document");
e.printStackTrace();
throw new WPSClientException(
"Error occured while parsing ProcessDescription document",
e);
throw new WPSClientException("Error occured while parsing ProcessDescription document", e);
} catch (Throwable e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
throw new WPSClientException(e.getLocalizedMessage(),
new Exception(e));
throw new WPSClientException(e.getLocalizedMessage(), new Exception(e));
}
}
protected List<String> retrievesSingleDescription(InputStream is) throws WPSClientException {
protected List<String> retrievesSingleDescription(InputStream is) throws WPSClientException {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(is));
@ -536,13 +523,11 @@ public class SClient4WPSSession implements Serializable {
} catch (Throwable e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
throw new WPSClientException(e.getLocalizedMessage(),
new Exception(e));
throw new WPSClientException(e.getLocalizedMessage(), new Exception(e));
}
}
private InputStream retrieveDataViaPOST(XmlObject obj, String urlString)
throws WPSClientException {
private InputStream retrieveDataViaPOST(XmlObject obj, String urlString) throws WPSClientException {
try {
logger.debug("RetrieveDataViaPost(): " + urlString);
String authString = user + ":" + password;
@ -584,45 +569,34 @@ public class SClient4WPSSession implements Serializable {
logger.debug("Document: " + doc);
if (doc == null) {
logger.error("Document is null");
throw new WPSClientException(
"Error in check input stream: Document is null");
throw new WPSClientException("Error in check input stream: Document is null");
}
if (getFirstElementNode(doc.getFirstChild()).getLocalName().equals(
"ExceptionReport")
&& getFirstElementNode(doc.getFirstChild())
.getNamespaceURI().equals(OGC_OWS_URI)) {
if (getFirstElementNode(doc.getFirstChild()).getLocalName().equals("ExceptionReport")
&& getFirstElementNode(doc.getFirstChild()).getNamespaceURI().equals(OGC_OWS_URI)) {
try {
ExceptionReportDocument exceptionDoc = ExceptionReportDocument.Factory
.parse(doc);
ExceptionReportDocument exceptionDoc = ExceptionReportDocument.Factory.parse(doc);
logger.debug(exceptionDoc.xmlText(options));
throw new WPSClientException(
"Error occured while executing query", exceptionDoc);
throw new WPSClientException("Error occured while executing query", exceptionDoc);
} catch (XmlException e) {
throw new WPSClientException(
"Error while parsing ExceptionReport retrieved from server",
e);
throw new WPSClientException("Error while parsing ExceptionReport retrieved from server", e);
}
} else {
logger.debug("No Exception Report");
}
return doc;
} catch (SAXException e) {
logger.error("Error while parsing input: "
+ e.getLocalizedMessage());
logger.error("Error while parsing input: " + e.getLocalizedMessage());
e.printStackTrace();
throw new WPSClientException("Error while parsing input", e);
} catch (IOException e) {
logger.error("Error occured while transfer: "
+ e.getLocalizedMessage());
logger.error("Error occured while transfer: " + e.getLocalizedMessage());
e.printStackTrace();
throw new WPSClientException("Error occured while transfer", e);
} catch (ParserConfigurationException e) {
logger.error("Error occured, parser is not correctly configured: "
+ e.getLocalizedMessage());
logger.error("Error occured, parser is not correctly configured: " + e.getLocalizedMessage());
e.printStackTrace();
throw new WPSClientException(
"Error occured, parser is not correctly configured", e);
throw new WPSClientException("Error occured, parser is not correctly configured", e);
} catch (WPSClientException e) {
throw e;
}
@ -650,8 +624,8 @@ public class SClient4WPSSession implements Serializable {
* @return
* @throws WPSClientException
*/
private Object retrieveExecuteResponseViaPOST(String url,
ExecuteDocument doc, boolean rawData) throws WPSClientException {
private Object retrieveExecuteResponseViaPOST(String url, ExecuteDocument doc, boolean rawData)
throws WPSClientException {
InputStream is = retrieveDataViaPOST(doc, url);
if (rawData) {
return is;
@ -665,16 +639,15 @@ public class SClient4WPSSession implements Serializable {
try {
erDoc = ExceptionReportDocument.Factory.parse(documentObj);
} catch (XmlException e1) {
throw new WPSClientException(
"Error occured while parsing executeResponse", e);
throw new WPSClientException("Error occured while parsing executeResponse", e);
}
return erDoc;
}
}
public String[] getProcessNames(String url) throws IOException {
ProcessDescriptionType[] processes = getProcessDescriptionsFromCache(
url).getProcessDescriptions().getProcessDescriptionArray();
ProcessDescriptionType[] processes = getProcessDescriptionsFromCache(url).getProcessDescriptions()
.getProcessDescriptionArray();
String[] processNames = new String[processes.length];
for (int i = 0; i < processNames.length; i++) {
processNames[i] = processes[i].getIdentifier().getStringValue();
@ -685,15 +658,17 @@ public class SClient4WPSSession implements Serializable {
/**
* Executes a process at a WPS
*
* @param url
*
* @param urlString
* url of server not the entry additionally defined in the caps.
* @param executeAsGETString
* KVP Execute request
* @return either an ExecuteResponseDocument or an InputStream if asked for
* RawData or an Exception Report
* @throws WPSClientException
* WSPClientException
*/
public Object executeViaGET(String urlString, String executeAsGETString)
throws WPSClientException {
public Object executeViaGET(String urlString, String executeAsGETString) throws WPSClientException {
urlString = urlString + executeAsGETString;
logger.debug("ExecuteViaGet() Url: " + urlString);
try {
@ -727,28 +702,22 @@ public class SClient4WPSSession implements Serializable {
erDoc = ExceptionReportDocument.Factory.parse(doc);
} catch (XmlException e1) {
e1.printStackTrace();
throw new WPSClientException(
"Error occured while parsing executeResponse", e);
throw new WPSClientException("Error occured while parsing executeResponse", e);
}
throw new WPSClientException(
"Error occured while parsing executeResponse", erDoc);
throw new WPSClientException("Error occured while parsing executeResponse", erDoc);
}
} catch (MalformedURLException e) {
e.printStackTrace();
throw new WPSClientException(
"Capabilities URL seems to be unvalid: " + urlString, e);
throw new WPSClientException("Capabilities URL seems to be unvalid: " + urlString, e);
} catch (IOException e) {
e.printStackTrace();
throw new WPSClientException(
"Error occured while retrieving capabilities from url: "
+ urlString, e);
throw new WPSClientException("Error occured while retrieving capabilities from url: " + urlString, e);
}
}
public String cancelComputation(String url, String computationId)
throws WPSClientException {
public String cancelComputation(String url, String computationId) throws WPSClientException {
try {
String authString = user + ":" + password;
@ -759,8 +728,7 @@ public class SClient4WPSSession implements Serializable {
url += "?id=" + computationId;
URL urlObj = new URL(url);
HttpURLConnection connection = (HttpURLConnection) urlObj
.openConnection();
HttpURLConnection connection = (HttpURLConnection) urlObj.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.setRequestProperty("Authorization", "Basic " + encoded);
@ -768,13 +736,10 @@ public class SClient4WPSSession implements Serializable {
return responseMessage;
} catch (MalformedURLException e) {
e.printStackTrace();
throw new WPSClientException(
"Capabilities URL seems to be unvalid: " + url, e);
throw new WPSClientException("Capabilities URL seems to be unvalid: " + url, e);
} catch (IOException e) {
e.printStackTrace();
throw new WPSClientException(
"Error occured while retrieving capabilities from url: "
+ url, e);
throw new WPSClientException("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.LoggerFactory;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class WPS2DM {
private final static String SEPARATOR = "|";
@ -42,30 +48,32 @@ public class WPS2DM {
/**
*
* @param title
* title
* @param minOcc
* min occurences
* @param maxOcc
* max occurences
* @param rangeOccs
* range occurences
* @param id
* id
* @param crs
* @return
* crs
* @return Parameter
*/
public static Parameter manageBoundingBoxInformation(String title,
int minOcc, int maxOcc, int rangeOccs, String id, String crs) {
public static Parameter manageBoundingBoxInformation(String title, int minOcc, int maxOcc, int rangeOccs, String id,
String crs) {
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;
title = "Bounding Box Input in OGC 06-121r3 spec. E.g. 102,46,103,47,urn:ogc:def:crs:EPSG:4328 " + title;
if (crs != null && crs.length() > 0)
title += " Supported CRS " + crs;
title = buildParameterDescription(title, null, null, minOcc, maxOcc,
null);
title = buildParameterDescription(title, null, null, minOcc, maxOcc, null);
if ((maxOcc == 1) || (maxOcc < 0) || (maxOcc == 0))
converted = new ObjectParameter(id, title, String.class.getName(),
" ");
converted = new ObjectParameter(id, title, String.class.getName(), " ");
else
converted = new ListParameter(id, title, String.class.getName(),
SEPARATOR);
converted = new ListParameter(id, title, String.class.getName(), SEPARATOR);
return converted;
}
@ -73,18 +81,25 @@ public class WPS2DM {
/**
*
* @param title
* title
* @param minOcc
* min occurences
* @param maxOcc
* max occurences
* @param rangeOccs
* range occurrences
* @param defaultValue
* default value
* @param id
* id
* @param uoms
* uoms
* @param type
* @return
* type
* @return Parameter
*/
public static Parameter manageLiteral(String title, int minOcc, int maxOcc,
int rangeOccs, String defaultValue, String id, String uoms,
DomainMetadataType type) {
public static Parameter manageLiteral(String title, int minOcc, int maxOcc, int rangeOccs, String defaultValue,
String id, String uoms, DomainMetadataType type) {
Parameter converted = null;
logger.debug("WPS type:" + type.getStringValue());
String guessedType = guessWPSLiteralType(type);
@ -96,8 +111,7 @@ public class WPS2DM {
logger.debug("Guessed default value: " + defaultValue);
title = buildParameterDescription(title, null, uoms, minOcc, maxOcc,
defaultValue);
title = buildParameterDescription(title, null, uoms, minOcc, maxOcc, defaultValue);
if ((maxOcc == 1) || (maxOcc < 0) || (maxOcc == 0)) {
if (title != null && !title.isEmpty()) {
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 Group Count: " + matcher.groupCount());
String referredTabularParameterName = matcher.group(1);
logger.debug("Matcher referredTabularParameterName: "
+ referredTabularParameterName);
logger.debug("Matcher referredTabularParameterName: " + referredTabularParameterName);
String separator = matcher.group(2);
logger.debug("Matcher separator: " + separator);
converted = new ColumnListParameter(id, title,
referredTabularParameterName, separator);
converted = new ColumnListParameter(id, title, referredTabularParameterName, separator);
} else {
if (title.contains("[the name of a column from ")) {
Pattern pattern = Pattern
.compile("the name of a column from (\\w+)");
Pattern pattern = Pattern.compile("the name of a column from (\\w+)");
Matcher matcher = pattern.matcher(title);
logger.debug("Machter title: " + title);
logger.debug("Machter find: " + matcher.find());
logger.debug("Machter group: " + matcher.group());
logger.debug("Machter start: " + matcher.start());
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);
logger.debug("Matcher referredTabularParameterName: "
+ referredTabularParameterName);
logger.debug("Matcher referredTabularParameterName: " + referredTabularParameterName);
converted = new ColumnParameter(id, title,
referredTabularParameterName, defaultValue);
converted = new ColumnParameter(id, title, referredTabularParameterName, defaultValue);
} else {
if (title
.contains("[a sequence of values separated by ")) {
Pattern pattern = Pattern
.compile("a sequence of values separated by (\\p{ASCII})");
if (title.contains("[a sequence of values separated by ")) {
Pattern pattern = Pattern.compile("a sequence of values separated by (\\p{ASCII})");
Matcher matcher = pattern.matcher(title);
logger.debug("Machter title: " + title);
logger.debug("Machter find: " + matcher.find());
logger.debug("Machter group: " + matcher.group());
logger.debug("Machter start: " + matcher.start());
logger.debug("Machter end: " + matcher.end());
logger.debug("Machter Group Count: "
+ matcher.groupCount());
logger.debug("Machter Group Count: " + matcher.groupCount());
String separator = matcher.group(1);
logger.debug("Matcher separator: " + separator);
converted = new ListParameter(id, title,
guessedType, separator);
converted = new ListParameter(id, title, guessedType, separator);
} else {
if (title.contains("[WKT_")) {
logger.debug("WKT parameter: " + title);
converted = retrieveWKTParameter(id, title,
defaultValue);
converted = retrieveWKTParameter(id, title, defaultValue);
} else {
if (title.contains("[DATE]")) {
logger.debug("DATE parameter: " + title);
title = title.replace("[DATE]", "");
converted = new DateParameter(id, title,
defaultValue);
converted = new DateParameter(id, title, defaultValue);
} else {
if (title.contains("[TIME]")) {
logger.debug("TIME parameter: " + title);
title = title.replace("[TIME]", "");
converted = new TimeParameter(id,
title, defaultValue);
converted = new TimeParameter(id, title, defaultValue);
} else {
converted = new ObjectParameter(
id,
title,
guessPrimitiveType(guessedType),
converted = new ObjectParameter(id, title, guessPrimitiveType(guessedType),
defaultValue);
}
}
@ -186,78 +184,59 @@ public class WPS2DM {
}
} else {
converted = new ObjectParameter(id, title,
guessPrimitiveType(guessedType), defaultValue);
converted = new ObjectParameter(id, title, guessPrimitiveType(guessedType), defaultValue);
}
} else {
if(guessedType.compareTo(Boolean.class.getName())==0){
if (guessedType.compareTo(Boolean.class.getName()) == 0) {
converted = new ObjectParameter(id, title, guessedType, defaultValue);
} else {
converted = new ListParameter(id, title, String.class.getName(),
SEPARATOR);
converted = new ListParameter(id, title, String.class.getName(), SEPARATOR);
}
}
return converted;
}
private static Parameter retrieveWKTParameter(String id, String title,
String defaultValue) {
private static Parameter retrieveWKTParameter(String id, String title, String defaultValue) {
if (title.contains("[WKT_POINT]")) {
title = title.replace("[WKT_POINT]", "");
return new WKTParameter(id, title, WKTGeometryType.Point,
defaultValue);
return new WKTParameter(id, title, WKTGeometryType.Point, defaultValue);
} else {
if (title.contains("[WKT_LINESTRING]")) {
title = title.replace("[WKT_LINESTRING]", "");
return new WKTParameter(id, title, WKTGeometryType.LineString,
defaultValue);
return new WKTParameter(id, title, WKTGeometryType.LineString, defaultValue);
} else {
if (title.contains("[WKT_POLYGON]")) {
title = title.replace("[WKT_POLYGON]", "");
return new WKTParameter(id, title, WKTGeometryType.Polygon,
defaultValue);
return new WKTParameter(id, title, WKTGeometryType.Polygon, defaultValue);
} else {
if (title.contains("[WKT_CIRCLE]")) {
title = title.replace("[WKT_CIRCLE]", "");
return new WKTParameter(id, title,
WKTGeometryType.Circle, defaultValue);
return new WKTParameter(id, title, WKTGeometryType.Circle, defaultValue);
} else {
if (title.contains("[WKT_TRIANGLE]")) {
title = title.replace("[WKT_TRIANGLE]", "");
return new WKTParameter(id, title,
WKTGeometryType.Triangle, defaultValue);
return new WKTParameter(id, title, WKTGeometryType.Triangle, defaultValue);
} else {
if (title.contains("[WKT_SQUARE]")) {
title = title.replace("[WKT_SQUARE]", "");
return new WKTParameter(id, title,
WKTGeometryType.Square, defaultValue);
return new WKTParameter(id, title, WKTGeometryType.Square, defaultValue);
} else {
if (title.contains("[WKT_PENTAGON]")) {
title = title.replace("[WKT_PENTAGON]", "");
return new WKTParameter(id, title,
WKTGeometryType.Pentagon,
defaultValue);
return new WKTParameter(id, title, WKTGeometryType.Pentagon, defaultValue);
} else {
if (title.contains("[WKT_HEXAGON]")) {
title = title.replace("[WKT_HEXAGON]",
"");
return new WKTParameter(id, title,
WKTGeometryType.Hexagon,
defaultValue);
title = title.replace("[WKT_HEXAGON]", "");
return new WKTParameter(id, title, WKTGeometryType.Hexagon, defaultValue);
} else {
if (title.contains("[WKT_BOX]")) {
title = title.replace("[WKT_BOX]",
"");
return new WKTParameter(id, title,
WKTGeometryType.Box,
defaultValue);
title = title.replace("[WKT_BOX]", "");
return new WKTParameter(id, title, WKTGeometryType.Box, defaultValue);
} else {
return new WKTParameter(id, title,
WKTGeometryType.Polygon,
defaultValue);
return new WKTParameter(id, title, WKTGeometryType.Polygon, defaultValue);
}
}
}
@ -272,18 +251,25 @@ public class WPS2DM {
/**
*
* @param maxMegaBytes
* max mega bytes
* @param title
* title
* @param minOcc
* min occurences
* @param maxOcc
* max occurences
* @param rangeOccs
* range occurences
* @param id
* id
* @param defaultType
* @return
* default type
* @param supportedTypes
* supported types
* @return Parameter
*/
public static Parameter manageComplexData(String maxMegaBytes,
String title, int minOcc, int maxOcc, int rangeOccs, String id,
ComplexDataDescriptionType defaultType,
ComplexDataDescriptionType[] supportedTypes) {
public static Parameter manageComplexData(String maxMegaBytes, String title, int minOcc, int maxOcc, int rangeOccs,
String id, ComplexDataDescriptionType defaultType, ComplexDataDescriptionType[] supportedTypes) {
Parameter converted = null;
String mimeType = null;
String schema = null;
@ -303,68 +289,56 @@ public class WPS2DM {
supportedMimeTypes.add(supported.getMimeType());
}
// rebuild title
title = buildParameterDescription(title, maxMegaBytes, null, minOcc,
maxOcc, null);
title = buildParameterDescription(title, maxMegaBytes, null, minOcc, maxOcc, null);
if ((maxOcc == 1) || (maxOcc < 0) || (maxOcc == 0)) {
if (title != null && !title.isEmpty()) {
if (title.contains("[a http link to a table")) {
converted = new TabularParameter(id, title, " ",
new ArrayList<String>(), mimeType,
converted = new TabularParameter(id, title, " ", new ArrayList<String>(), mimeType,
supportedMimeTypes);
} else {
if (title.contains("[a http link to a file")) {
converted = new FileParameter(id, title, mimeType,
supportedMimeTypes);
converted = new FileParameter(id, title, mimeType, supportedMimeTypes);
} else {
if (title.contains("[a sequence of http links")) {
Pattern pattern = Pattern
.compile("\\[a sequence of http links separated by (\\p{ASCII}) , each indicating a table");
Pattern pattern = Pattern.compile(
"\\[a sequence of http links separated by (\\p{ASCII}) , each indicating a table");
Matcher matcher = pattern.matcher(title);
boolean match = false;
if (match = matcher.find()) {
logger.debug("Machter title: " + title);
logger.debug("Machter find: " + match);
logger.debug("Machter group: "
+ matcher.group());
logger.debug("Machter start: "
+ matcher.start());
logger.debug("Machter group: " + matcher.group());
logger.debug("Machter start: " + matcher.start());
logger.debug("Machter end: " + matcher.end());
logger.debug("Machter Group Count: "
+ matcher.groupCount());
logger.debug("Machter Group Count: " + matcher.groupCount());
String separator = matcher.group(1);
logger.debug("Matcher separator: " + separator);
converted = new TabularListParameter(id, title,
separator, mimeType, supportedMimeTypes);
converted = new TabularListParameter(id, title, separator, mimeType,
supportedMimeTypes);
} else {
converted = new FileParameter(id, title,
mimeType, supportedMimeTypes);
converted = new FileParameter(id, title, mimeType, supportedMimeTypes);
}
} else {
converted = new FileParameter(id, title, mimeType,
supportedMimeTypes);
converted = new FileParameter(id, title, mimeType, supportedMimeTypes);
}
}
}
} else {
converted = new FileParameter(id, title, mimeType,
supportedMimeTypes);
converted = new FileParameter(id, title, mimeType, supportedMimeTypes);
}
} else {
converted = new FileParameter(id, title, mimeType,
supportedMimeTypes);
converted = new FileParameter(id, title, mimeType, supportedMimeTypes);
}
return converted;
}
public static Parameter convert2DMType(InputDescriptionType wpsType)
throws ServiceException {
public static Parameter convert2DMType(InputDescriptionType wpsType) throws ServiceException {
try {
String id = wpsType.getIdentifier().getStringValue();
String title = wpsType.getTitle() != null ? wpsType.getTitle()
.getStringValue() : "";
String title = wpsType.getTitle() != null ? wpsType.getTitle().getStringValue() : "";
int minOcc = wpsType.getMinOccurs().intValue();
int maxOcc = wpsType.getMaxOccurs().intValue();
int rangeOccs = maxOcc - minOcc;
@ -372,30 +346,24 @@ public class WPS2DM {
rangeOccs = 1;
// default
Parameter converted = new ObjectParameter(id, title,
String.class.getName(), " ");
Parameter converted = new ObjectParameter(id, title, String.class.getName(), " ");
if (rangeOccs > 1)
converted = new ListParameter(id, title,
String.class.getName(), SEPARATOR);
converted = new ListParameter(id, title, String.class.getName(), SEPARATOR);
// Bounding Boxes
if (wpsType.isSetBoundingBoxData()) {
logger.debug("Conversion to DM Type->" + id
+ " is a Bounding Box Input");
converted = manageBoundingBoxInformation(title, minOcc, maxOcc,
rangeOccs, id, wpsType.getBoundingBoxData()
.getDefault().getCRS());
logger.debug("Conversion to DM Type->" + id + " is a Bounding Box Input");
converted = manageBoundingBoxInformation(title, minOcc, maxOcc, rangeOccs, id,
wpsType.getBoundingBoxData().getDefault().getCRS());
}
// Literals
else if (wpsType.isSetLiteralData()) {
logger.debug("Conversion to DM Type->" + id
+ " is a Literal Input");
logger.debug("Conversion to DM Type->" + id + " is a Literal Input");
LiteralInputType literal = wpsType.getLiteralData();
String uoms = literal.getUOMs() == null ? "" : literal
.getUOMs().getDefault().getUOM().getStringValue();
String uoms = literal.getUOMs() == null ? "" : literal.getUOMs().getDefault().getUOM().getStringValue();
String defaultValue = literal.getDefaultValue();
converted = manageLiteral(title, minOcc, maxOcc, rangeOccs,
defaultValue, id, uoms, literal.getDataType());
converted = manageLiteral(title, minOcc, maxOcc, rangeOccs, defaultValue, id, uoms,
literal.getDataType());
AllowedValues allowedValues = literal.getAllowedValues();
if (allowedValues != null) {
ValueType[] values = allowedValues.getValueArray();
@ -407,35 +375,27 @@ public class WPS2DM {
}
if (values.length > 1) {
ObjectParameter conv = (ObjectParameter) converted;
if (conv.getType() != null
&& !conv.getType().isEmpty()
&& conv.getType().compareToIgnoreCase(
Boolean.class.getName()) != 0){
converted = new EnumParameter(conv.getName(),
conv.getDescription(), enumValues,
if (conv.getType() != null && !conv.getType().isEmpty()
&& conv.getType().compareToIgnoreCase(Boolean.class.getName()) != 0) {
converted = new EnumParameter(conv.getName(), conv.getDescription(), enumValues,
conv.getDefaultValue());
}
}
}
} else if (wpsType.isSetComplexData()) {
logger.debug("Conversion to DM Type->" + id
+ " is a Complex Input");
SupportedComplexDataInputType complex = wpsType
.getComplexData();
String maxMegaBytes = complex.getMaximumMegabytes() != null ? complex
.getMaximumMegabytes().toString() : "1";
logger.debug("Conversion to DM Type->" + id + " is a Complex Input");
SupportedComplexDataInputType complex = wpsType.getComplexData();
String maxMegaBytes = complex.getMaximumMegabytes() != null ? complex.getMaximumMegabytes().toString()
: "1";
logger.debug("Max Megabytes: " + maxMegaBytes);
converted = manageComplexData(maxMegaBytes, title, minOcc,
maxOcc, rangeOccs, id,
complex.getDefault().getFormat(), complex
.getSupported().getFormatArray());
converted = manageComplexData(maxMegaBytes, title, minOcc, maxOcc, rangeOccs, id,
complex.getDefault().getFormat(), complex.getSupported().getFormatArray());
}
logger.debug("Conversion to DM Type->Name=" + id);
logger.debug("Conversion to DM Type->Title=" + title);
logger.debug("Conversion to DM Type->Number of Inputs to Manage="
+ rangeOccs);
logger.debug("Conversion to DM Type->Number of Inputs to Manage=" + rangeOccs);
return converted;
@ -449,12 +409,10 @@ public class WPS2DM {
public static Parameter convert2DMType(OutputDescriptionType wpsType) {
String id = wpsType.getIdentifier().getStringValue();
String title = wpsType.getTitle() != null ? wpsType.getTitle()
.getStringValue() : "";
String title = wpsType.getTitle() != null ? wpsType.getTitle().getStringValue() : "";
// default
Parameter converted = new ObjectParameter(id, title,
String.class.getName(), " ");
Parameter converted = new ObjectParameter(id, title, String.class.getName(), " ");
logger.debug("Conversion to DM Type->Output id:" + id);
logger.debug("Conversion to DM Type->Title:" + title);
@ -468,16 +426,13 @@ public class WPS2DM {
else if (wpsType.isSetLiteralOutput()) {
logger.debug("Literal Output");
LiteralOutputType literal = wpsType.getLiteralOutput();
String uoms = literal.getUOMs() == null ? "" : literal.getUOMs()
.toString();
converted = manageLiteral(title, -1, -1, -1, "", id, uoms,
literal.getDataType());
String uoms = literal.getUOMs() == null ? "" : literal.getUOMs().toString();
converted = manageLiteral(title, -1, -1, -1, "", id, uoms, literal.getDataType());
} else if (wpsType.isSetComplexOutput()) {
logger.debug("Complex Output");
SupportedComplexDataType complex = wpsType.getComplexOutput();
converted = manageComplexData("", title, -1, -1, -1, id, complex
.getDefault().getFormat(), complex.getSupported()
.getFormatArray());
converted = manageComplexData("", title, -1, -1, -1, id, complex.getDefault().getFormat(),
complex.getSupported().getFormatArray());
}
return converted;
@ -486,16 +441,21 @@ public class WPS2DM {
/**
*
* @param title
* title
* @param maxMegabytes
* max mega bytes
* @param UoM
* uom
* @param minElements
* min elements
* @param maxElements
* max elements
* @param defaultValue
* @return
* default value
* @return description
*/
public static String buildParameterDescription(String title,
String maxMegabytes, String UoM, int minElements, int maxElements,
String defaultValue) {
public static String buildParameterDescription(String title, String maxMegabytes, String UoM, int minElements,
int maxElements, String defaultValue) {
String description = title;
/*
@ -527,8 +487,7 @@ public class WPS2DM {
String typeS = type.getReference().trim();
if (typeS.length() == 0)
return String.class.getName();
else if (typeS.contains("float") || typeS.contains("double")
|| typeS.contains("decimal"))
else if (typeS.contains("float") || typeS.contains("double") || typeS.contains("decimal"))
return Double.class.getName();
else if (typeS.contains("int"))
return Integer.class.getName();
@ -538,7 +497,7 @@ public class WPS2DM {
return Short.class.getName();
else if (typeS.contains("boolean"))
return Boolean.class.getName();
}
return String.class.getName();
@ -552,7 +511,7 @@ public class WPS2DM {
}
public static String guessPrimitiveType(String type) {
if (type.equals(Integer.class.getName())) {
return Integer.class.getName();
} else if (type.equals(String.class.getName())) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,11 +3,10 @@
*/
package org.gcube.data.analysis.dataminermanagercl.shared.data.output;
/**
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*
*/
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,
String value) {
public ObjectResource(String resourceId, String name, String description, String value) {
super(resourceId, name, description, ResourceType.OBJECT);
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) {
this.value = value;
@ -52,10 +59,8 @@ public class ObjectResource extends Resource {
@Override
public String toString() {
return "ObjectResource [value=" + value + ", getResourceId()="
+ getResourceId() + ", getName()=" + getName()
+ ", getDescription()=" + getDescription()
+ ", getResourceType()=" + getResourceType() + "]";
return "ObjectResource [value=" + value + ", getResourceId()=" + getResourceId() + ", getName()=" + getName()
+ ", getDescription()=" + getDescription() + ", getResourceType()=" + getResourceType() + "]";
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
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.parameters.Parameter;
/**
*
* @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> {
@ -37,12 +36,15 @@ public class Operator implements Serializable, Comparable<Operator> {
/**
* @param id
* id
* @param briefDescription
* brief description
* @param description
* description
* @param category
* category
*/
public Operator(String id, String briefDescription, String description,
OperatorCategory category) {
public Operator(String id, String briefDescription, String description, OperatorCategory category) {
super();
this.id = id;
if (id != null)
@ -54,13 +56,18 @@ public class Operator implements Serializable, Comparable<Operator> {
/**
* @param id
* id
* @param briefDescription
* brief description
* @param description
* description
* @param category
* category
* @param hasImage
* true if has image
*/
public Operator(String id, String briefDescription, String description,
OperatorCategory category, boolean hasImage) {
public Operator(String id, String briefDescription, String description, OperatorCategory category,
boolean hasImage) {
super();
this.id = id;
if (id != null)
@ -71,15 +78,19 @@ public class Operator implements Serializable, Comparable<Operator> {
this.hasImage = hasImage;
}
/**
* @param id
* id
* @param name
* name
* @param briefDescription
* brief description
* @param description
* description
* @param category
* category
*/
public Operator(String id, String name, String briefDescription,
String description, OperatorCategory category) {
public Operator(String id, String name, String briefDescription, String description, OperatorCategory category) {
super();
this.id = id;
if (name != null)
@ -88,19 +99,24 @@ public class Operator implements Serializable, Comparable<Operator> {
this.description = description;
this.category = category;
}
/**
* @param id
* id
* @param name
* name
* @param briefDescription
* brief description
* @param description
* description
* @param category
* category
* @param operatorParameters
* operator parameters
* @param hasImage
* true if has image
*/
public Operator(String id, String name, String briefDescription,
String description, OperatorCategory category,
public Operator(String id, String name, String briefDescription, String description, OperatorCategory category,
List<Parameter> operatorParameters, boolean hasImage) {
super();
this.id = id;
@ -226,10 +242,8 @@ public class Operator implements Serializable, Comparable<Operator> {
@Override
public String toString() {
return "Operator [id=" + id + ", name=" + name + ", briefDescription="
+ briefDescription + ", description=" + description
+", operatorParameters="
+ operatorParameters + ", hasImage=" + hasImage + "]";
return "Operator [id=" + id + ", name=" + name + ", briefDescription=" + briefDescription + ", description="
+ description + ", operatorParameters=" + operatorParameters + ", hasImage=" + hasImage + "]";
}
@Override

View File

@ -10,30 +10,33 @@ import java.util.List;
/**
*
* @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> {
private static final long serialVersionUID = 7511425996378626337L;
private String id;
private String name;
private String name;
private String briefDescription;
private String description;
private String description;
private List<Operator> operators = new ArrayList<Operator>();
private boolean hasImage = false;
/**
*
*/
public OperatorCategory() {
super();
}
/**
* @param id
* id
* @param briefDescription
* brief description
* @param description
* description
*/
public OperatorCategory(String id, String briefDescription, String description) {
super();
@ -44,12 +47,17 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
}
/**
* @param string
* @param string2
* @param string3
* @param b
*
* @param id
* id
* @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();
this.id = id;
setNameFromId();
@ -58,15 +66,18 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
this.hasImage = hasImage;
}
/**
*
* @param id
* id
* @param briefDescription
* brief description
* @param description
* description
* @param operators
* list of operators
*/
public OperatorCategory(String id, String briefDescription,
String description, List<Operator> operators) {
public OperatorCategory(String id, String briefDescription, String description, List<Operator> operators) {
super();
this.id = id;
setNameFromId();
@ -75,15 +86,21 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
this.operators = operators;
}
/**
*
* @param id
* id
* @param name
* name
* @param briefDescription
* brief description
* @param description
* description
* @param operators
* list of operators
*/
public OperatorCategory(String id, String name, String briefDescription,
String description, List<Operator> operators) {
public OperatorCategory(String id, String name, String briefDescription, String description,
List<Operator> operators) {
super();
this.id = id;
this.name = name;
@ -92,7 +109,6 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
this.operators = operators;
}
/**
* @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) {
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) {
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) {
this.description = description;
@ -143,27 +162,28 @@ 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) {
this.operators = operators;
}
}
public void addOperator(Operator operator) {
this.operators.add(operator);
}
/**
*
*/
private void setNameFromId() {
if (id!=null) {
if (id != null) {
String name = "";
boolean precUnderscore = true;
for (int i=0; i<id.length(); i++) {
for (int i = 0; i < id.length(); i++) {
char c = id.charAt(i);
if (c == '_') {
precUnderscore = true;
name += " ";
@ -171,56 +191,55 @@ public class OperatorCategory implements Serializable, Comparable<OperatorCatego
name += (precUnderscore ? Character.toUpperCase(c) : Character.toLowerCase(c));
if (precUnderscore == true)
precUnderscore = false;
}
}
}
this.name = name;
}
}
/**
* @param name the name to set
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the name
*/
public String getName() {
return name;
}
public boolean hasImage() {
return hasImage;
}
/**
* @param hasImage the hasImage to set
* @param hasImage
* the hasImage to set
*/
public void setHasImage(boolean hasImage) {
this.hasImage = hasImage;
}
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);
return op;
}
@Override
public String toString() {
return "OperatorCategory [id=" + id + ", name=" + name
+ ", briefDescription=" + briefDescription + ", description="
+ description + ", operators=" + operators + ", hasImage="
+ hasImage + "]";
return "OperatorCategory [id=" + id + ", name=" + name + ", briefDescription=" + briefDescription
+ ", description=" + description + ", operators=" + operators + ", hasImage=" + hasImage + "]";
}
@Override
public int compareTo(OperatorCategory o) {
return id.compareTo(o.getId());
}
}

View File

@ -10,7 +10,7 @@ import java.util.List;
/**
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*
*/
public class OperatorsClassification implements Serializable {
@ -19,25 +19,31 @@ public class OperatorsClassification implements Serializable {
private String name;
private List<OperatorCategory> operatorCategories = new ArrayList<OperatorCategory>();
private List<Operator> operators = new ArrayList<Operator>();
public OperatorsClassification() {
super();
}
/**
*
* @param name
* name
*/
public OperatorsClassification(String name) {
super();
this.name = name;
}
/**
*
* @param name
* name
* @param operatorCategories
* list of operator categories
* @param operators
* list of operators
*/
public OperatorsClassification(String name, List<OperatorCategory> operatorCategories,
List<Operator> operators) {
public OperatorsClassification(String name, List<OperatorCategory> operatorCategories, List<Operator> operators) {
this(name);
this.operatorCategories = operatorCategories;
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) {
this.operatorCategories = operatorCategories;
@ -65,43 +72,45 @@ public class OperatorsClassification implements Serializable {
}
/**
* @param operators the operators to set
* @param operators
* the operators to set
*/
public void setOperators(List<Operator> operators) {
this.operators = operators;
}
public Operator getOperatorById(String id) {
if (id==null)
if (id == null)
return null;
Operator operator = null;
for (Operator op: operators)
for (Operator op : operators)
if (op.getId().contentEquals(id)) {
operator = op;
break;
}
return operator;
}
public OperatorCategory getCategoryById(String id) {
OperatorCategory category = null;
for (OperatorCategory cat: operatorCategories)
for (OperatorCategory cat : operatorCategories)
if (cat.getId().contentEquals(id)) {
category = cat;
break;
}
return category;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
@ -109,11 +118,8 @@ public class OperatorsClassification implements Serializable {
@Override
public String toString() {
return "OperatorsClassification [name=" + name
+ ", operatorCategories=" + operatorCategories + ", operators="
return "OperatorsClassification [name=" + name + ", operatorCategories=" + operatorCategories + ", operators="
+ operators + "]";
}
}

View File

@ -6,93 +6,72 @@ package org.gcube.data.analysis.dataminermanagercl.shared.process;
import java.util.HashMap;
import java.util.Map;
/**
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*
*/
public class TemplateDescriptor {
public static TemplateDescriptor descriptors[] = {
new TemplateDescriptor("HCAF", "HCAF Data Set", ""),
new TemplateDescriptor("OCCURRENCE_SPECIES", "Occurrence Species Data Set", ""),
new TemplateDescriptor("OCCURRENCE_AQUAMAPS", "Occurrence Aquamaps", ""),
new TemplateDescriptor("HSPEN", "HSPEN Data Set", ""),
new TemplateDescriptor("HSPEC", "HSPEC Data Set", ""),
new TemplateDescriptor("CLUSTER", "Cluster Data Set", ""),
new TemplateDescriptor("TRAININGSET", "Neural Network Training Set", ""),
new TemplateDescriptor("TESTSET", "Neural Network Test Set", ""),
new TemplateDescriptor("GENERIC", "Generic Data set", ""),
new TemplateDescriptor("MINMAXLAT", "Min Max Lat Data Set", ""),
new TemplateDescriptor("TIMESERIES", "time Series Data Set", ""),
};
public static TemplateDescriptor descriptors[] = { new TemplateDescriptor("HCAF", "HCAF Data Set", ""),
new TemplateDescriptor("OCCURRENCE_SPECIES", "Occurrence Species Data Set", ""),
new TemplateDescriptor("OCCURRENCE_AQUAMAPS", "Occurrence Aquamaps", ""),
new TemplateDescriptor("HSPEN", "HSPEN Data Set", ""),
new TemplateDescriptor("HSPEC", "HSPEC Data Set", ""),
new TemplateDescriptor("CLUSTER", "Cluster Data Set", ""),
new TemplateDescriptor("TRAININGSET", "Neural Network Training Set", ""),
new TemplateDescriptor("TESTSET", "Neural Network Test Set", ""),
new TemplateDescriptor("GENERIC", "Generic Data set", ""),
new TemplateDescriptor("MINMAXLAT", "Min Max Lat 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;
static {
map = new HashMap<String, String[][]>();
map.put("HCAF", new String[][]{
{"csquarecode", "string"},
{"depthmin", "real"},
{"depthmax", "real"},
{"depthmean", "real"},
{"depthsd", "real"},
{"sstanmean", "real"},
{"sstansd", "real"},
{"sstmnmax", "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"},
});
}
map.put("HCAF", new String[][] { { "csquarecode", "string" }, { "depthmin", "real" }, { "depthmax", "real" },
{ "depthmean", "real" }, { "depthsd", "real" }, { "sstanmean", "real" }, { "sstansd", "real" },
{ "sstmnmax", "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 enum Template {
// HCAF,
// OCCURRENCE_SPECIES,
// OCCURRENCE_AQUAMAPS,
// HSPEN,
// HSPEC,
// CLUSTER,
// TRAININGSET,
// TESTSET,
// GENERIC,
// MINMAXLAT,
// TIMESERIES,
// }
// public enum Template {
// HCAF,
// OCCURRENCE_SPECIES,
// OCCURRENCE_AQUAMAPS,
// HSPEN,
// HSPEC,
// CLUSTER,
// TRAININGSET,
// TESTSET,
// GENERIC,
// MINMAXLAT,
// TIMESERIES,
// }
private String id, title, description;
/**
*
* @param id
* id
* @param title
* title
* @param description
* decription
*/
public TemplateDescriptor(String id, String title, String description) {
super();
this.id = id;
this.title = title;
this.description = description;
this.description = description;
}
/**
@ -114,5 +93,5 @@ public class TemplateDescriptor {
*/
public String getTitle() {
return title;
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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