From 7adb33b2ca7e7ca451358b5ce18c111b38063615 Mon Sep 17 00:00:00 2001 From: Gianpaolo Coro Date: Tue, 19 Nov 2013 11:32:56 +0000 Subject: [PATCH] git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineGeoSpatialExtension@85682 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../dataanalysis/geo/algorithms/MapsComparator.java | 7 +++++-- .../gcube/dataanalysis/geo/algorithms/MapsCreator.java | 9 +++++++-- .../dataanalysis/geo/algorithms/PointsMapsCreator.java | 4 ++-- .../dataanalysis/geo/algorithms/PolygonMapsCreator.java | 2 +- .../SpeciesDistributionsMapsCreatorFromCsquares.java | 2 +- .../SpeciesDistributionsMapsCreatorFromPoints.java | 2 +- .../org/gcube/dataanalysis/geo/meta/PolyMapMetadata.java | 8 +++++++- 7 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/gcube/dataanalysis/geo/algorithms/MapsComparator.java b/src/main/java/org/gcube/dataanalysis/geo/algorithms/MapsComparator.java index 4735228..6dd3ef7 100644 --- a/src/main/java/org/gcube/dataanalysis/geo/algorithms/MapsComparator.java +++ b/src/main/java/org/gcube/dataanalysis/geo/algorithms/MapsComparator.java @@ -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 inputs = new ArrayList(); public LinkedHashMap outputParameters = new LinkedHashMap(); @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; } diff --git a/src/main/java/org/gcube/dataanalysis/geo/algorithms/MapsCreator.java b/src/main/java/org/gcube/dataanalysis/geo/algorithms/MapsCreator.java index 667cb3a..d8a1a95 100644 --- a/src/main/java/org/gcube/dataanalysis/geo/algorithms/MapsCreator.java +++ b/src/main/java/org/gcube/dataanalysis/geo/algorithms/MapsCreator.java @@ -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"); diff --git a/src/main/java/org/gcube/dataanalysis/geo/algorithms/PointsMapsCreator.java b/src/main/java/org/gcube/dataanalysis/geo/algorithms/PointsMapsCreator.java index 040ec19..54038f2 100644 --- a/src/main/java/org/gcube/dataanalysis/geo/algorithms/PointsMapsCreator.java +++ b/src/main/java/org/gcube/dataanalysis/geo/algorithms/PointsMapsCreator.java @@ -29,7 +29,7 @@ public class PointsMapsCreator extends MapsCreator { List templates = new ArrayList(); 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"); diff --git a/src/main/java/org/gcube/dataanalysis/geo/algorithms/PolygonMapsCreator.java b/src/main/java/org/gcube/dataanalysis/geo/algorithms/PolygonMapsCreator.java index f99fb08..9617340 100644 --- a/src/main/java/org/gcube/dataanalysis/geo/algorithms/PolygonMapsCreator.java +++ b/src/main/java/org/gcube/dataanalysis/geo/algorithms/PolygonMapsCreator.java @@ -29,7 +29,7 @@ public class PolygonMapsCreator extends MapsCreator { List templates = new ArrayList(); 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); diff --git a/src/main/java/org/gcube/dataanalysis/geo/algorithms/SpeciesDistributionsMapsCreatorFromCsquares.java b/src/main/java/org/gcube/dataanalysis/geo/algorithms/SpeciesDistributionsMapsCreatorFromCsquares.java index 48dd2ee..d7ff4cd 100644 --- a/src/main/java/org/gcube/dataanalysis/geo/algorithms/SpeciesDistributionsMapsCreatorFromCsquares.java +++ b/src/main/java/org/gcube/dataanalysis/geo/algorithms/SpeciesDistributionsMapsCreatorFromCsquares.java @@ -29,7 +29,7 @@ public class SpeciesDistributionsMapsCreatorFromCsquares extends MapsCreator { List templates = new ArrayList(); 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); diff --git a/src/main/java/org/gcube/dataanalysis/geo/algorithms/SpeciesDistributionsMapsCreatorFromPoints.java b/src/main/java/org/gcube/dataanalysis/geo/algorithms/SpeciesDistributionsMapsCreatorFromPoints.java index 91c7b30..2830e97 100644 --- a/src/main/java/org/gcube/dataanalysis/geo/algorithms/SpeciesDistributionsMapsCreatorFromPoints.java +++ b/src/main/java/org/gcube/dataanalysis/geo/algorithms/SpeciesDistributionsMapsCreatorFromPoints.java @@ -29,7 +29,7 @@ public class SpeciesDistributionsMapsCreatorFromPoints extends MapsCreator { List templates = new ArrayList(); 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); diff --git a/src/main/java/org/gcube/dataanalysis/geo/meta/PolyMapMetadata.java b/src/main/java/org/gcube/dataanalysis/geo/meta/PolyMapMetadata.java index b1e013e..195e6d2 100644 --- a/src/main/java/org/gcube/dataanalysis/geo/meta/PolyMapMetadata.java +++ b/src/main/java/org/gcube/dataanalysis/geo/meta/PolyMapMetadata.java @@ -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; }