This commit is contained in:
Gianpaolo Coro 2012-01-27 13:21:58 +00:00
parent 7400d2ed4e
commit 050f05795c
1 changed files with 0 additions and 83 deletions

View File

@ -1,83 +0,0 @@
package org.gcube.dataanalysis.ecoengine.test.generations;
import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
import org.gcube.dataanalysis.ecoengine.interfaces.Generator;
import org.gcube.dataanalysis.ecoengine.processing.factories.GeneratorsFactory;
public class GenerationHSPECValidation {
/**
* example of parallel processing on a single machine the procedure will generate a new table for a distribution on suitable species
*
*/
public static void main(String[] args) throws Exception {
Generator generator = GeneratorsFactory.getGenerator(testConfigSuitable());
generate(generator);
}
private static void generate(Generator generator) throws Exception {
if (generator != null) {
GenerationHSPECValidation tgs = new GenerationHSPECValidation();
ThreadCalculator tc = tgs.new ThreadCalculator(generator);
Thread t = new Thread(tc);
t.start();
while (generator.getStatus() < 100) {
String resLoad = generator.getResourceLoad();
String ress = generator.getResources();
String species = generator.getLoad();
System.out.println("LOAD: " + resLoad);
System.out.println("RESOURCES: " + ress);
System.out.println("SPECIES: " + species);
System.out.println("STATUS: " + generator.getStatus());
Thread.sleep(1000);
}
} else
AnalysisLogger.getLogger().trace("Generator Algorithm Not Supported");
}
public class ThreadCalculator implements Runnable {
Generator dg;
public ThreadCalculator(Generator dg) {
this.dg = dg;
}
public void run() {
try {
dg.generate();
} catch (Exception e) {
}
}
}
private static AlgorithmConfiguration testConfigSuitable() {
AlgorithmConfiguration config = new AlgorithmConfiguration();
config.setParam("DistributionTable","hspec_validation_automatic");
config.setParam("ConfigPath","./cfg/");
config.setParam("CsquarecodesTable","hcaf_d");
config.setParam("EnvelopeTable","hspen_validation");
config.setParam("CreateTable","true");
config.setNumberOfResources(2);
config.setParam("DatabaseUserName","gcube");
config.setParam("DatabasePassword","d4science2");
config.setParam("DatabaseURL","jdbc:postgresql://localhost/testdb");
config.setModel("AQUAMAPS_SUITABLE");
return config;
}
}