Gianpaolo Coro 2013-11-19 11:32:56 +00:00
parent ebe5cc9cb0
commit 7adb33b2ca
7 changed files with 24 additions and 10 deletions

View File

@ -48,14 +48,15 @@ public class MapsComparator extends DataAnalysis {
static String t1 = "TimeIndex_1";
static String t2 = "TimeIndex_2";
static String valuesThr = "ValuesComparisonThreshold";
float status = 0;
float status;
public List<StatisticalType> inputs = new ArrayList<StatisticalType>();
public LinkedHashMap<String, String> outputParameters = new LinkedHashMap<String, String>();
@Override
public void init() throws Exception {
AnalysisLogger.getLogger().debug("Initialization");
AnalysisLogger.getLogger().debug("Maps Comparator Initialization");
}
@Override
@ -100,6 +101,7 @@ public class MapsComparator extends DataAnalysis {
// delete this force
String scope = config.getGcubeScope();
AnalysisLogger.getLogger().debug("MapsComparator: Externally set scope "+scope);
if (scope == null)
scope = ScopeProvider.instance.get();
@ -306,6 +308,7 @@ public class MapsComparator extends DataAnalysis {
@Override
public float getStatus() {
AnalysisLogger.getLogger().debug("Maps Comparator Status: "+status);
return status;
}

View File

@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
import org.gcube.dataanalysis.ecoengine.interfaces.StandardLocalExternalAlgorithm;
import org.gcube.dataanalysis.ecoengine.utils.DatabaseFactory;
@ -67,7 +68,11 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
protected void process() throws Exception {
try {
log("Beginning process");
log("Using scope:"+config.getGcubeScope());
log("Set scope from outside:"+config.getGcubeScope());
String scope = config.getGcubeScope();
if (scope == null)
scope = ScopeProvider.instance.get();
log("Using scope:"+scope);
//initialize Gis DB parameters
String databaseJdbc = getInputParameter(dburlParameterName);
String databaseUser = getInputParameter(dbuserParameterName);
@ -174,7 +179,7 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
username = usernameP;
String layerName = config.getParam(layerNameParameter);
PublishResponse response = PolyMapMetadata.publishTable(config.getGcubeScope(), gisTableName, resolution, username, layerName, defaultStyle, workspace, datastore, purpose, credits, keyword);
PublishResponse response = PolyMapMetadata.publishTable(scope, gisTableName, resolution, username, layerName, defaultStyle, workspace, datastore, purpose, credits, keyword);
//analyzing response
if (response == null) {
log("Error in generating map - dropping gis table");

View File

@ -29,7 +29,7 @@ public class PointsMapsCreator extends MapsCreator {
List<TableTemplates> templates = new ArrayList<TableTemplates>();
addRemoteDatabaseInput(databaseParameterName, dburlParameterName, dbuserParameterName, dbpasswordParameterName, "driver", "dialect");
templates.add(TableTemplates.GENERIC);
addStringInput(layerNameParameter, "The name of the layer to produce", "Statistical Prob. Distribution");
addStringInput(layerNameParameter, "The name of the layer to produce", "Points Map");
InputTable tinput = new InputTable(templates, inputTableParameter, "The table information to geo-spatialize");
ColumnType xColumn = new ColumnType(inputTableParameter, xParameter, "The column containing longitude information", "", false);
ColumnType yColumn = new ColumnType(inputTableParameter, yParameter, "The column containing latitude information", "", false);
@ -51,7 +51,7 @@ public class PointsMapsCreator extends MapsCreator {
AlgorithmConfiguration config = new AlgorithmConfiguration();
config.setConfigPath("./cfg/");
config.setPersistencePath("./cfg/");
config.setGcubeScope("/gcube");
config.setGcubeScope("/gcube/devsec");
config.setParam("DatabaseUserName", "utente");
config.setParam("DatabasePassword", "d4science");
config.setParam("DatabaseURL", "jdbc:postgresql://statistical-manager.d.d4science.research-infrastructures.eu/testdb");

View File

@ -29,7 +29,7 @@ public class PolygonMapsCreator extends MapsCreator {
List<TableTemplates> templates = new ArrayList<TableTemplates>();
addRemoteDatabaseInput(databaseParameterName, dburlParameterName, dbuserParameterName, dbpasswordParameterName, "driver", "dialect");
templates.add(TableTemplates.GENERIC);
addStringInput(layerNameParameter, "The name of the layer to produce", "Statistical Prob. Distribution");
addStringInput(layerNameParameter, "The name of the layer to produce", "Polygonal Map");
InputTable tinput = new InputTable(templates, inputTableParameter, "The table information to geo-spatialize");
ColumnType xColumn = new ColumnType(inputTableParameter, xParameter, "The column containing longitude information", "", false);
ColumnType yColumn = new ColumnType(inputTableParameter, yParameter, "The column containing latitude information", "", false);

View File

@ -29,7 +29,7 @@ public class SpeciesDistributionsMapsCreatorFromCsquares extends MapsCreator {
List<TableTemplates> templates = new ArrayList<TableTemplates>();
addRemoteDatabaseInput(databaseParameterName, dburlParameterName, dbuserParameterName, dbpasswordParameterName, "driver", "dialect");
templates.add(TableTemplates.GENERIC);
addStringInput(layerNameParameter, "The name of the layer to produce", "Statistical Prob. Distribution");
addStringInput(layerNameParameter, "The name of the layer to produce", "Species Prob Distribution Csqr");
InputTable tinput = new InputTable(templates, inputTableParameter, "The table information to geo-spatialize");
ColumnType xColumn = new ColumnType(inputTableParameter, csquareParameter, "The column containing csquare codes", "", false);
ColumnType probabilityDimension = new ColumnType(inputTableParameter, probabilityParameter, "The column containing probability information", "", false);

View File

@ -29,7 +29,7 @@ public class SpeciesDistributionsMapsCreatorFromPoints extends MapsCreator {
List<TableTemplates> templates = new ArrayList<TableTemplates>();
addRemoteDatabaseInput(databaseParameterName, dburlParameterName, dbuserParameterName, dbpasswordParameterName, "driver", "dialect");
templates.add(TableTemplates.GENERIC);
addStringInput(layerNameParameter, "The name of the layer to produce", "Statistical Prob. Distribution");
addStringInput(layerNameParameter, "The name of the layer to produce", "Species Prob Distribution Points");
InputTable tinput = new InputTable(templates, inputTableParameter, "The table information to geo-spatialize");
ColumnType xColumn = new ColumnType(inputTableParameter, xParameter, "The column containing longitude information", "", false);
ColumnType yColumn = new ColumnType(inputTableParameter, yParameter, "The column containing latitude information", "", false);

View File

@ -34,7 +34,9 @@ public class PolyMapMetadata {
GSLayerEncoder le = new GSLayerEncoder();
le.setDefaultStyle(defaultStyle);
le.setEnabled(true);
AnalysisLogger.getLogger().debug("Filling Metadata");
GcubeISOMetadata meta = fillMeta(resolution, username, layerName, scope, tableName,purpose, credits, keyword);
AnalysisLogger.getLogger().debug("Getting GIS from scope "+scope);
GISInterface gis = GISInterface.get();
Configuration gnConfig = gis.getGeoNetworkReader().getConfiguration();
AnalysisLogger.getLogger().debug("Using the following GNetwork:" + gnConfig.getGeoNetworkEndpoint());
@ -54,9 +56,12 @@ public class PolyMapMetadata {
if (scope == null)
scope = ScopeProvider.instance.get();
AnalysisLogger.getLogger().debug("Setting scope for filling Meta");
ScopeProvider.instance.set(scope);
AnalysisLogger.getLogger().debug("Fulfilling metadata");
GcubeISOMetadata meta = new GcubeISOMetadata();
AnalysisLogger.getLogger().debug("Fulfilling metadata Begin");
meta.setAbstractField("This metadata has been automatically generated from the Statistical Manager on the basis of a distribution of points and according the resolution of "+resolution+" degrees.");
meta.setCreationDate(new Date(System.currentTimeMillis()));
meta.setExtent((DefaultExtent) DefaultExtent.WORLD);
@ -82,6 +87,7 @@ public class PolyMapMetadata {
meta.addKeyword(keyword, generalThesaurus);
meta.addKeyword(tableName,generalThesaurus);
meta.addTopicCategory(TopicCategory.BIOTA);
AnalysisLogger.getLogger().debug("Fulfilling done");
return meta;
}