git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineGeoSpatialExtension@85682 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ebe5cc9cb0
commit
7adb33b2ca
|
@ -48,14 +48,15 @@ public class MapsComparator extends DataAnalysis {
|
||||||
static String t1 = "TimeIndex_1";
|
static String t1 = "TimeIndex_1";
|
||||||
static String t2 = "TimeIndex_2";
|
static String t2 = "TimeIndex_2";
|
||||||
static String valuesThr = "ValuesComparisonThreshold";
|
static String valuesThr = "ValuesComparisonThreshold";
|
||||||
float status = 0;
|
float status;
|
||||||
|
|
||||||
public List<StatisticalType> inputs = new ArrayList<StatisticalType>();
|
public List<StatisticalType> inputs = new ArrayList<StatisticalType>();
|
||||||
public LinkedHashMap<String, String> outputParameters = new LinkedHashMap<String, String>();
|
public LinkedHashMap<String, String> outputParameters = new LinkedHashMap<String, String>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
AnalysisLogger.getLogger().debug("Initialization");
|
AnalysisLogger.getLogger().debug("Maps Comparator Initialization");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -100,6 +101,7 @@ public class MapsComparator extends DataAnalysis {
|
||||||
|
|
||||||
// delete this force
|
// delete this force
|
||||||
String scope = config.getGcubeScope();
|
String scope = config.getGcubeScope();
|
||||||
|
AnalysisLogger.getLogger().debug("MapsComparator: Externally set scope "+scope);
|
||||||
if (scope == null)
|
if (scope == null)
|
||||||
scope = ScopeProvider.instance.get();
|
scope = ScopeProvider.instance.get();
|
||||||
|
|
||||||
|
@ -306,6 +308,7 @@ public class MapsComparator extends DataAnalysis {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getStatus() {
|
public float getStatus() {
|
||||||
|
AnalysisLogger.getLogger().debug("Maps Comparator Status: "+status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
|
import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
|
||||||
import org.gcube.dataanalysis.ecoengine.interfaces.StandardLocalExternalAlgorithm;
|
import org.gcube.dataanalysis.ecoengine.interfaces.StandardLocalExternalAlgorithm;
|
||||||
import org.gcube.dataanalysis.ecoengine.utils.DatabaseFactory;
|
import org.gcube.dataanalysis.ecoengine.utils.DatabaseFactory;
|
||||||
|
@ -67,7 +68,11 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
|
||||||
protected void process() throws Exception {
|
protected void process() throws Exception {
|
||||||
try {
|
try {
|
||||||
log("Beginning process");
|
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
|
//initialize Gis DB parameters
|
||||||
String databaseJdbc = getInputParameter(dburlParameterName);
|
String databaseJdbc = getInputParameter(dburlParameterName);
|
||||||
String databaseUser = getInputParameter(dbuserParameterName);
|
String databaseUser = getInputParameter(dbuserParameterName);
|
||||||
|
@ -174,7 +179,7 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
|
||||||
username = usernameP;
|
username = usernameP;
|
||||||
|
|
||||||
String layerName = config.getParam(layerNameParameter);
|
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
|
//analyzing response
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
log("Error in generating map - dropping gis table");
|
log("Error in generating map - dropping gis table");
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class PointsMapsCreator extends MapsCreator {
|
||||||
List<TableTemplates> templates = new ArrayList<TableTemplates>();
|
List<TableTemplates> templates = new ArrayList<TableTemplates>();
|
||||||
addRemoteDatabaseInput(databaseParameterName, dburlParameterName, dbuserParameterName, dbpasswordParameterName, "driver", "dialect");
|
addRemoteDatabaseInput(databaseParameterName, dburlParameterName, dbuserParameterName, dbpasswordParameterName, "driver", "dialect");
|
||||||
templates.add(TableTemplates.GENERIC);
|
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");
|
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 xColumn = new ColumnType(inputTableParameter, xParameter, "The column containing longitude information", "", false);
|
||||||
ColumnType yColumn = new ColumnType(inputTableParameter, yParameter, "The column containing latitude 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();
|
AlgorithmConfiguration config = new AlgorithmConfiguration();
|
||||||
config.setConfigPath("./cfg/");
|
config.setConfigPath("./cfg/");
|
||||||
config.setPersistencePath("./cfg/");
|
config.setPersistencePath("./cfg/");
|
||||||
config.setGcubeScope("/gcube");
|
config.setGcubeScope("/gcube/devsec");
|
||||||
config.setParam("DatabaseUserName", "utente");
|
config.setParam("DatabaseUserName", "utente");
|
||||||
config.setParam("DatabasePassword", "d4science");
|
config.setParam("DatabasePassword", "d4science");
|
||||||
config.setParam("DatabaseURL", "jdbc:postgresql://statistical-manager.d.d4science.research-infrastructures.eu/testdb");
|
config.setParam("DatabaseURL", "jdbc:postgresql://statistical-manager.d.d4science.research-infrastructures.eu/testdb");
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class PolygonMapsCreator extends MapsCreator {
|
||||||
List<TableTemplates> templates = new ArrayList<TableTemplates>();
|
List<TableTemplates> templates = new ArrayList<TableTemplates>();
|
||||||
addRemoteDatabaseInput(databaseParameterName, dburlParameterName, dbuserParameterName, dbpasswordParameterName, "driver", "dialect");
|
addRemoteDatabaseInput(databaseParameterName, dburlParameterName, dbuserParameterName, dbpasswordParameterName, "driver", "dialect");
|
||||||
templates.add(TableTemplates.GENERIC);
|
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");
|
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 xColumn = new ColumnType(inputTableParameter, xParameter, "The column containing longitude information", "", false);
|
||||||
ColumnType yColumn = new ColumnType(inputTableParameter, yParameter, "The column containing latitude information", "", false);
|
ColumnType yColumn = new ColumnType(inputTableParameter, yParameter, "The column containing latitude information", "", false);
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class SpeciesDistributionsMapsCreatorFromCsquares extends MapsCreator {
|
||||||
List<TableTemplates> templates = new ArrayList<TableTemplates>();
|
List<TableTemplates> templates = new ArrayList<TableTemplates>();
|
||||||
addRemoteDatabaseInput(databaseParameterName, dburlParameterName, dbuserParameterName, dbpasswordParameterName, "driver", "dialect");
|
addRemoteDatabaseInput(databaseParameterName, dburlParameterName, dbuserParameterName, dbpasswordParameterName, "driver", "dialect");
|
||||||
templates.add(TableTemplates.GENERIC);
|
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");
|
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 xColumn = new ColumnType(inputTableParameter, csquareParameter, "The column containing csquare codes", "", false);
|
||||||
ColumnType probabilityDimension = new ColumnType(inputTableParameter, probabilityParameter, "The column containing probability information", "", false);
|
ColumnType probabilityDimension = new ColumnType(inputTableParameter, probabilityParameter, "The column containing probability information", "", false);
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class SpeciesDistributionsMapsCreatorFromPoints extends MapsCreator {
|
||||||
List<TableTemplates> templates = new ArrayList<TableTemplates>();
|
List<TableTemplates> templates = new ArrayList<TableTemplates>();
|
||||||
addRemoteDatabaseInput(databaseParameterName, dburlParameterName, dbuserParameterName, dbpasswordParameterName, "driver", "dialect");
|
addRemoteDatabaseInput(databaseParameterName, dburlParameterName, dbuserParameterName, dbpasswordParameterName, "driver", "dialect");
|
||||||
templates.add(TableTemplates.GENERIC);
|
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");
|
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 xColumn = new ColumnType(inputTableParameter, xParameter, "The column containing longitude information", "", false);
|
||||||
ColumnType yColumn = new ColumnType(inputTableParameter, yParameter, "The column containing latitude information", "", false);
|
ColumnType yColumn = new ColumnType(inputTableParameter, yParameter, "The column containing latitude information", "", false);
|
||||||
|
|
|
@ -34,7 +34,9 @@ public class PolyMapMetadata {
|
||||||
GSLayerEncoder le = new GSLayerEncoder();
|
GSLayerEncoder le = new GSLayerEncoder();
|
||||||
le.setDefaultStyle(defaultStyle);
|
le.setDefaultStyle(defaultStyle);
|
||||||
le.setEnabled(true);
|
le.setEnabled(true);
|
||||||
|
AnalysisLogger.getLogger().debug("Filling Metadata");
|
||||||
GcubeISOMetadata meta = fillMeta(resolution, username, layerName, scope, tableName,purpose, credits, keyword);
|
GcubeISOMetadata meta = fillMeta(resolution, username, layerName, scope, tableName,purpose, credits, keyword);
|
||||||
|
AnalysisLogger.getLogger().debug("Getting GIS from scope "+scope);
|
||||||
GISInterface gis = GISInterface.get();
|
GISInterface gis = GISInterface.get();
|
||||||
Configuration gnConfig = gis.getGeoNetworkReader().getConfiguration();
|
Configuration gnConfig = gis.getGeoNetworkReader().getConfiguration();
|
||||||
AnalysisLogger.getLogger().debug("Using the following GNetwork:" + gnConfig.getGeoNetworkEndpoint());
|
AnalysisLogger.getLogger().debug("Using the following GNetwork:" + gnConfig.getGeoNetworkEndpoint());
|
||||||
|
@ -54,9 +56,12 @@ public class PolyMapMetadata {
|
||||||
if (scope == null)
|
if (scope == null)
|
||||||
scope = ScopeProvider.instance.get();
|
scope = ScopeProvider.instance.get();
|
||||||
|
|
||||||
|
AnalysisLogger.getLogger().debug("Setting scope for filling Meta");
|
||||||
ScopeProvider.instance.set(scope);
|
ScopeProvider.instance.set(scope);
|
||||||
|
|
||||||
|
AnalysisLogger.getLogger().debug("Fulfilling metadata");
|
||||||
GcubeISOMetadata meta = new GcubeISOMetadata();
|
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.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.setCreationDate(new Date(System.currentTimeMillis()));
|
||||||
meta.setExtent((DefaultExtent) DefaultExtent.WORLD);
|
meta.setExtent((DefaultExtent) DefaultExtent.WORLD);
|
||||||
|
@ -82,6 +87,7 @@ public class PolyMapMetadata {
|
||||||
meta.addKeyword(keyword, generalThesaurus);
|
meta.addKeyword(keyword, generalThesaurus);
|
||||||
meta.addKeyword(tableName,generalThesaurus);
|
meta.addKeyword(tableName,generalThesaurus);
|
||||||
meta.addTopicCategory(TopicCategory.BIOTA);
|
meta.addTopicCategory(TopicCategory.BIOTA);
|
||||||
|
AnalysisLogger.getLogger().debug("Fulfilling done");
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue