ref 6078:TDM - Create a new widget to support operations's invocation on DataMiner
https://support.d4science.org/issues/6078 Updated to support DataMiner git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/data-miner-manager-cl@146607 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
48b63393a7
commit
c956205b61
|
@ -12,7 +12,6 @@ import org.gcube.data.analysis.dataminermanagercl.shared.process.ComputationStat
|
||||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
||||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorsClassification;
|
import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorsClassification;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Client of service
|
* Client of service
|
||||||
|
@ -21,15 +20,14 @@ import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorsClassi
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class SClient implements Serializable{
|
public abstract class SClient implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 7087349607933493388L;
|
private static final long serialVersionUID = 7087349607933493388L;
|
||||||
|
|
||||||
public SClient() {
|
public SClient() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the list of operators
|
* Retrieve the list of operators
|
||||||
*
|
*
|
||||||
|
@ -38,31 +36,44 @@ public abstract class SClient implements Serializable{
|
||||||
*/
|
*/
|
||||||
public abstract List<OperatorsClassification> getOperatorsClassifications()
|
public abstract List<OperatorsClassification> getOperatorsClassifications()
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the operator by id
|
* Retrieve the operator by id
|
||||||
*
|
*
|
||||||
* @param id operator id
|
* @param id
|
||||||
|
* operator id
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public abstract Operator getOperatorById(String id) throws Exception;
|
public abstract Operator getOperatorById(String id) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get input paramters of the operator
|
* Get input paramters of the operator
|
||||||
*
|
*
|
||||||
* @param operator operator
|
* @param operator
|
||||||
|
* operator
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public abstract List<Parameter> getInputParameters(Operator operator)
|
public abstract List<Parameter> getInputParameters(Operator operator)
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Get output paramters of the operator
|
||||||
|
*
|
||||||
|
* @param operator
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public abstract List<Parameter> getOutputParameters(Operator operator)
|
||||||
|
throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start Computation
|
* Start Computation
|
||||||
*
|
*
|
||||||
* @param operator operator
|
* @param operator
|
||||||
|
* operator
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -72,19 +83,19 @@ public abstract class SClient implements Serializable{
|
||||||
/**
|
/**
|
||||||
* Cancel a computation
|
* Cancel a computation
|
||||||
*
|
*
|
||||||
* @param computationId computation Id
|
* @param computationId
|
||||||
|
* computation Id
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public abstract String cancelComputation(ComputationId computationId)
|
public abstract String cancelComputation(ComputationId computationId)
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Computation Status
|
* Get Computation Status
|
||||||
*
|
*
|
||||||
* @param computationId computation Id
|
* @param computationId
|
||||||
|
* computation Id
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -104,13 +115,14 @@ public abstract class SClient implements Serializable{
|
||||||
/**
|
/**
|
||||||
* Get Computation Data by computation properties
|
* Get Computation Data by computation properties
|
||||||
*
|
*
|
||||||
* @param computationProperties computation properties
|
* @param computationProperties
|
||||||
|
* computation properties
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public abstract ComputationData getComputationDataByComputationProperties(
|
public abstract ComputationData getComputationDataByComputationProperties(
|
||||||
Map<String, String> computationProperties) throws Exception;
|
Map<String, String> computationProperties) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resubmit a computation only by computation properties
|
* Resubmit a computation only by computation properties
|
||||||
*
|
*
|
||||||
|
@ -120,10 +132,10 @@ public abstract class SClient implements Serializable{
|
||||||
*/
|
*/
|
||||||
public abstract ComputationId resubmitComputation(
|
public abstract ComputationId resubmitComputation(
|
||||||
Map<String, String> computationProperties) throws Exception;
|
Map<String, String> computationProperties) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SClient";
|
return "SClient";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -783,7 +783,7 @@ public class SClient4WPS extends SClient {
|
||||||
public List<Parameter> getInputParameters(Operator operator)
|
public List<Parameter> getInputParameters(Operator operator)
|
||||||
throws ServiceException {
|
throws ServiceException {
|
||||||
try {
|
try {
|
||||||
logger.debug("Parameters of algorithm " + operator.getId());
|
logger.debug("Input Parameters of algorithm " + operator.getId());
|
||||||
|
|
||||||
ProcessInformations processInformations;
|
ProcessInformations processInformations;
|
||||||
try {
|
try {
|
||||||
|
@ -810,12 +810,50 @@ public class SClient4WPS extends SClient {
|
||||||
return parameters;
|
return parameters;
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error("Error in getInputParameters: "+e.getLocalizedMessage(),e);
|
||||||
e.printStackTrace();
|
|
||||||
throw new ServiceException(e.getLocalizedMessage());
|
throw new ServiceException(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Parameter> getOutputParameters(Operator operator)
|
||||||
|
throws Exception {
|
||||||
|
try {
|
||||||
|
logger.debug("Output Parameters of algorithm " + operator.getId());
|
||||||
|
|
||||||
|
ProcessInformations processInformations;
|
||||||
|
try {
|
||||||
|
processInformations = describeProcess(operator.getId());
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.error("GetParameters: " + e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new ServiceException(e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.debug("ProcessInformation: " + processInformations);
|
||||||
|
|
||||||
|
List<Parameter> parameters = new ArrayList<>();
|
||||||
|
|
||||||
|
Parameter outputParameter;
|
||||||
|
for (OutputDescriptionType outputDesc : processInformations
|
||||||
|
.getOutputs()) {
|
||||||
|
outputParameter = WPS2DM.convert2DMType(outputDesc);
|
||||||
|
logger.debug("OutputParameter: " + outputParameter);
|
||||||
|
parameters.add(outputParameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.debug("Parameters: " + parameters);
|
||||||
|
return parameters;
|
||||||
|
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.error("Error in getOutputParameters: "+e.getLocalizedMessage(),e);
|
||||||
|
throw new ServiceException(e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ComputationId startComputation(Operator operator)
|
public ComputationId startComputation(Operator operator)
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class BionymLocalTest extends TestCase {
|
||||||
DataMinerService dataMinerService = new DataMinerService();
|
DataMinerService dataMinerService = new DataMinerService();
|
||||||
SClient sClient = dataMinerService.getClient();
|
SClient sClient = dataMinerService.getClient();
|
||||||
Operator operator = sClient
|
Operator operator = sClient
|
||||||
.getOperatorById("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.BIONYM_LOCAL");
|
.getOperatorById(OperatorId.BIONYM_LOCAL.toString());
|
||||||
|
|
||||||
if (operator == null) {
|
if (operator == null) {
|
||||||
logger.error("Operator not found");
|
logger.error("Operator not found");
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class CsquareColumnCreatorTest extends TestCase {
|
||||||
DataMinerService dataMinerService = new DataMinerService();
|
DataMinerService dataMinerService = new DataMinerService();
|
||||||
SClient sClient = dataMinerService.getClient();
|
SClient sClient = dataMinerService.getClient();
|
||||||
Operator csquareColumnCreatorOperator = sClient
|
Operator csquareColumnCreatorOperator = sClient
|
||||||
.getOperatorById("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.CSQUARE_COLUMN_CREATOR");
|
.getOperatorById(OperatorId.CSQUARE_COLUMN_CREATOR.toString());
|
||||||
|
|
||||||
if (csquareColumnCreatorOperator == null) {
|
if (csquareColumnCreatorOperator == null) {
|
||||||
logger.error("Operator not found");
|
logger.error("Operator not found");
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
package org.gcube.data.analysis.dataminermanagercl.test;
|
package org.gcube.data.analysis.dataminermanagercl.test;
|
||||||
|
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
@ -12,6 +16,8 @@ import org.gcube.data.analysis.dataminermanagercl.server.monitor.DMMonitorListen
|
||||||
import org.gcube.data.analysis.dataminermanagercl.shared.Constants;
|
import org.gcube.data.analysis.dataminermanagercl.shared.Constants;
|
||||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.OutputData;
|
import org.gcube.data.analysis.dataminermanagercl.shared.data.OutputData;
|
||||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationId;
|
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationId;
|
||||||
|
import org.gcube.data.analysis.dataminermanagercl.shared.data.output.FileResource;
|
||||||
|
import org.gcube.data.analysis.dataminermanagercl.shared.data.output.ImageResource;
|
||||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.output.MapResource;
|
import org.gcube.data.analysis.dataminermanagercl.shared.data.output.MapResource;
|
||||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.output.Resource;
|
import org.gcube.data.analysis.dataminermanagercl.shared.data.output.Resource;
|
||||||
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.ColumnListParameter;
|
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.ColumnListParameter;
|
||||||
|
@ -39,7 +45,7 @@ public class DBScanTest extends TestCase {
|
||||||
DataMinerService dataMinerService = new DataMinerService();
|
DataMinerService dataMinerService = new DataMinerService();
|
||||||
SClient sClient = dataMinerService.getClient();
|
SClient sClient = dataMinerService.getClient();
|
||||||
Operator dBScanOperator = sClient
|
Operator dBScanOperator = sClient
|
||||||
.getOperatorById("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.clusterers.DBSCAN");
|
.getOperatorById(OperatorId.DBSCAN.toString());
|
||||||
|
|
||||||
if (dBScanOperator == null) {
|
if (dBScanOperator == null) {
|
||||||
logger.error("Operator not found");
|
logger.error("Operator not found");
|
||||||
|
@ -129,8 +135,43 @@ public class DBScanTest extends TestCase {
|
||||||
if (resource.isMap()) {
|
if (resource.isMap()) {
|
||||||
MapResource mapResource = (MapResource) resource;
|
MapResource mapResource = (MapResource) resource;
|
||||||
for (String key : mapResource.getMap().keySet()) {
|
for (String key : mapResource.getMap().keySet()) {
|
||||||
logger.debug("Entry: " + key + " = "
|
|
||||||
+ mapResource.getMap().get(key));
|
|
||||||
|
Resource res = mapResource.getMap().get(key);
|
||||||
|
switch (res.getResourceType()) {
|
||||||
|
case FILE:
|
||||||
|
FileResource fileResource = (FileResource) res;
|
||||||
|
String fileName=retrieveFileName(fileResource.getUrl());
|
||||||
|
logger.debug("Entry: " + key + " = "
|
||||||
|
+ mapResource.getMap().get(key)+", FileName="+fileName);
|
||||||
|
break;
|
||||||
|
case IMAGE:
|
||||||
|
ImageResource imageResource = (ImageResource) res;
|
||||||
|
String imageName=retrieveFileName(imageResource.getLink());
|
||||||
|
logger.debug("Entry: " + key + " = "
|
||||||
|
+ mapResource.getMap().get(key)+", ImageName="+imageName);
|
||||||
|
break;
|
||||||
|
case MAP:
|
||||||
|
logger.debug("Entry: " + key + " = "
|
||||||
|
+ mapResource.getMap().get(key));
|
||||||
|
break;
|
||||||
|
case OBJECT:
|
||||||
|
logger.debug("Entry: " + key + " = "
|
||||||
|
+ mapResource.getMap().get(key));
|
||||||
|
break;
|
||||||
|
case TABULAR:
|
||||||
|
//TableResource tableResource = (TableResource) res;
|
||||||
|
//String tableName=retrieveFileName(tableResource.getLink());
|
||||||
|
logger.debug("Entry: " + key + " = "
|
||||||
|
+ mapResource.getMap().get(key));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
logger.debug("Entry: " + key + " = "
|
||||||
|
+ mapResource.getMap().get(key));
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,4 +228,36 @@ public class DBScanTest extends TestCase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String retrieveFileName(String url) {
|
||||||
|
String fileName = "output";
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
URL urlObj;
|
||||||
|
urlObj = new URL(url);
|
||||||
|
|
||||||
|
HttpURLConnection connection = (HttpURLConnection) urlObj
|
||||||
|
.openConnection();
|
||||||
|
connection.setRequestMethod("GET");
|
||||||
|
String contentDisposition = connection
|
||||||
|
.getHeaderField("Content-Disposition");
|
||||||
|
Pattern regex = Pattern.compile("(?<=filename=\").*?(?=\")");
|
||||||
|
Matcher regexMatcher = regex.matcher(contentDisposition);
|
||||||
|
if (regexMatcher.find()) {
|
||||||
|
fileName = regexMatcher.group();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileName == null || fileName.isEmpty()) {
|
||||||
|
fileName = "output";
|
||||||
|
}
|
||||||
|
|
||||||
|
return fileName;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.error(
|
||||||
|
"Error retrieving file name: " + e.getLocalizedMessage(), e);
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
package org.gcube.data.analysis.dataminermanagercl.test;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.gcube.data.analysis.dataminermanagercl.server.DataMinerService;
|
||||||
|
import org.gcube.data.analysis.dataminermanagercl.server.dmservice.SClient;
|
||||||
|
import org.gcube.data.analysis.dataminermanagercl.shared.Constants;
|
||||||
|
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
|
||||||
|
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Giancarlo Panichi email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DataMinerParametersTest extends TestCase {
|
||||||
|
private static Logger logger = LoggerFactory
|
||||||
|
.getLogger(DataMinerParametersTest.class);
|
||||||
|
|
||||||
|
|
||||||
|
public void testExecute() {
|
||||||
|
|
||||||
|
if (Constants.TEST_ENABLE) {
|
||||||
|
logger.debug("Test Parameters");
|
||||||
|
try {
|
||||||
|
DataMinerService dataMinerService = new DataMinerService();
|
||||||
|
SClient sClient = dataMinerService.getClient();
|
||||||
|
Operator dBScanOperator = sClient
|
||||||
|
.getOperatorById(OperatorId.DBSCAN.toString());
|
||||||
|
|
||||||
|
if (dBScanOperator == null) {
|
||||||
|
logger.error("Operator not found");
|
||||||
|
} else {
|
||||||
|
logger.debug("Operator Name: " + dBScanOperator.getName()
|
||||||
|
+ " (" + dBScanOperator.getId() + ")");
|
||||||
|
logger.debug("Operator: " + dBScanOperator);
|
||||||
|
List<Parameter> inputParameters = sClient
|
||||||
|
.getInputParameters(dBScanOperator);
|
||||||
|
logger.debug("Parameters: " + inputParameters);
|
||||||
|
for (Parameter parameter : inputParameters) {
|
||||||
|
logger.debug("Input Parameter:" + parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Parameter> outputParameters = sClient
|
||||||
|
.getOutputParameters(dBScanOperator);
|
||||||
|
logger.debug("Output Parameters: " + inputParameters);
|
||||||
|
for (Parameter parameter : outputParameters) {
|
||||||
|
logger.debug("Output Parameter:" + parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
assertTrue("Success", true);
|
||||||
|
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.error(e.getLocalizedMessage(),e);
|
||||||
|
assertTrue("Error", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
assertTrue("Success", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -38,9 +38,11 @@ public class DataMinerServiceTest extends TestCase {
|
||||||
if(firstCategory.getOperators()!=null&& !firstCategory.getOperators().isEmpty()){
|
if(firstCategory.getOperators()!=null&& !firstCategory.getOperators().isEmpty()){
|
||||||
Operator operator=firstCategory.getOperators().get(0);
|
Operator operator=firstCategory.getOperators().get(0);
|
||||||
logger.debug("First Operator: "+operator);
|
logger.debug("First Operator: "+operator);
|
||||||
List<Parameter> parameters=sClient.getInputParameters(operator);
|
List<Parameter> inputParameters=sClient.getInputParameters(operator);
|
||||||
logger.debug("Parameters: "+parameters);
|
logger.debug("Input Parameters: "+inputParameters);
|
||||||
|
|
||||||
|
List<Parameter> outputParameters=sClient.getOutputParameters(operator);
|
||||||
|
logger.debug("Output Parameters: "+outputParameters);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Operators void");
|
logger.debug("Operators void");
|
||||||
|
@ -67,7 +69,7 @@ public class DataMinerServiceTest extends TestCase {
|
||||||
public void testOperarorName() {
|
public void testOperarorName() {
|
||||||
|
|
||||||
if (Constants.TEST_ENABLE) {
|
if (Constants.TEST_ENABLE) {
|
||||||
logger.debug("Test DBScan");
|
logger.debug("Test Operators Name");
|
||||||
try {
|
try {
|
||||||
DataMinerService dataMinerService=new DataMinerService();
|
DataMinerService dataMinerService=new DataMinerService();
|
||||||
SClient sClient = dataMinerService.getClient();
|
SClient sClient = dataMinerService.getClient();
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class ListDBInfoTest extends TestCase {
|
||||||
DataMinerService dataMinerService=new DataMinerService();
|
DataMinerService dataMinerService=new DataMinerService();
|
||||||
SClient sClient = dataMinerService.getClient();
|
SClient sClient = dataMinerService.getClient();
|
||||||
Operator operator = sClient
|
Operator operator = sClient
|
||||||
.getOperatorById("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.LISTDBINFO");
|
.getOperatorById(OperatorId.LISTDBINFO.toString());
|
||||||
|
|
||||||
if (operator == null) {
|
if (operator == null) {
|
||||||
logger.error("Operator not found");
|
logger.error("Operator not found");
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class ListDBNameTest extends TestCase {
|
||||||
DataMinerService dataMinerService=new DataMinerService();
|
DataMinerService dataMinerService=new DataMinerService();
|
||||||
SClient sClient = dataMinerService.getClient();
|
SClient sClient = dataMinerService.getClient();
|
||||||
Operator operator = sClient
|
Operator operator = sClient
|
||||||
.getOperatorById("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.LISTDBNAMES");
|
.getOperatorById(OperatorId.LISTDBNAMES.toString());
|
||||||
|
|
||||||
if (operator == null) {
|
if (operator == null) {
|
||||||
logger.error("Operator not found");
|
logger.error("Operator not found");
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class ListDBSchemaTest extends TestCase {
|
||||||
DataMinerService dataMinerService=new DataMinerService();
|
DataMinerService dataMinerService=new DataMinerService();
|
||||||
SClient sClient = dataMinerService.getClient();
|
SClient sClient = dataMinerService.getClient();
|
||||||
Operator operator = sClient
|
Operator operator = sClient
|
||||||
.getOperatorById("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.LISTDBSCHEMA");
|
.getOperatorById(OperatorId.LISTDBSCHEMA.toString());
|
||||||
|
|
||||||
if (operator == null) {
|
if (operator == null) {
|
||||||
logger.error("Operator not found");
|
logger.error("Operator not found");
|
||||||
|
|
|
@ -35,10 +35,10 @@ public class ListTablesTest extends TestCase {
|
||||||
if (Constants.TEST_ENABLE) {
|
if (Constants.TEST_ENABLE) {
|
||||||
logger.debug("Test ListTables");
|
logger.debug("Test ListTables");
|
||||||
try {
|
try {
|
||||||
DataMinerService dataMinerService=new DataMinerService();
|
DataMinerService dataMinerService = new DataMinerService();
|
||||||
SClient sClient = dataMinerService.getClient();
|
SClient sClient = dataMinerService.getClient();
|
||||||
Operator operator = sClient
|
Operator operator = sClient
|
||||||
.getOperatorById("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.LISTTABLES");
|
.getOperatorById(OperatorId.LISTTABLES.toString());
|
||||||
|
|
||||||
if (operator == null) {
|
if (operator == null) {
|
||||||
logger.error("Operator not found");
|
logger.error("Operator not found");
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
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>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum OperatorId {
|
||||||
|
DBSCAN(
|
||||||
|
"org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.clusterers.DBSCAN"), CSQUARE_COLUMN_CREATOR(
|
||||||
|
"org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.CSQUARE_COLUMN_CREATOR"), BIONYM_LOCAL(
|
||||||
|
"org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.BIONYM_LOCAL"), LISTDBINFO(
|
||||||
|
"org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.LISTDBINFO"), LISTDBNAMES(
|
||||||
|
"org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.LISTDBNAMES"), LISTDBSCHEMA(
|
||||||
|
"org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.LISTDBSCHEMA"), LISTTABLES(
|
||||||
|
"org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.LISTTABLES");
|
||||||
|
;
|
||||||
|
/**
|
||||||
|
* @param text
|
||||||
|
*/
|
||||||
|
private OperatorId(final String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final String id;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static OperatorId getOperatorIdFromId(String id) {
|
||||||
|
for (OperatorId operatorId : values()) {
|
||||||
|
if (operatorId.id.compareToIgnoreCase(id) == 0) {
|
||||||
|
return operatorId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue