git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-dashboard-harvester-se-plugin@167641 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
302d29a607
commit
0de8fd20a6
|
@ -7,7 +7,9 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.gcube.dataharvest.dao.DatabaseManager;
|
||||
import org.gcube.dataharvest.datamodel.HarvestedData;
|
||||
|
@ -40,8 +42,8 @@ public class AccountingDataHarvesterPlugin extends Plugin<DataHarvestPluginDecla
|
|||
public static final String RERUN_INPUT_PARAMETER = "reRun";
|
||||
public static final String DRY_RUN_INPUT_PARAMETER = "dryRun";
|
||||
|
||||
public static final String SO_BIG_DATA_CONTEXT = "/d4science.research-infrastructures.eu/SoBigData";
|
||||
public static final String RESOURCE_CATALOGUE_CONTEXT = "/d4science.research-infrastructures.eu/SoBigData/ResourceCatalogue";
|
||||
|
||||
public static final String TAGME_CONTEXT = "/d4science.research-infrastructures.eu/SoBigData/TagMe";
|
||||
|
||||
protected Date start;
|
||||
|
@ -159,9 +161,13 @@ public class AccountingDataHarvesterPlugin extends Plugin<DataHarvestPluginDecla
|
|||
|
||||
if(context.startsWith(RESOURCE_CATALOGUE_CONTEXT)) {
|
||||
|
||||
// Adding trailing slash to SO_BIG_DATA_CONTEXT to avoid to get VO
|
||||
SortedSet<String> soBigDataContexts = getSoBigDataContexts(contexts, SO_BIG_DATA_CONTEXT + "/");
|
||||
|
||||
try {
|
||||
// Collecting info on Resource Catalogue (Dataset, Application, Deliverables, Methods)
|
||||
ResourceCatalogueHarvester resourceCatalogueHarvester = new ResourceCatalogueHarvester(start, end);
|
||||
resourceCatalogueHarvester.setContexts(contexts);
|
||||
List<HarvestedData> harvested = resourceCatalogueHarvester.getData();
|
||||
data.addAll(harvested);
|
||||
} catch(Exception e) {
|
||||
|
@ -171,6 +177,7 @@ public class AccountingDataHarvesterPlugin extends Plugin<DataHarvestPluginDecla
|
|||
try {
|
||||
// Collecting info on Data/Method download
|
||||
DataMethodDownloadHarvester dataMethodDownloadHarvester = new DataMethodDownloadHarvester(start, end);
|
||||
dataMethodDownloadHarvester.setContexts(contexts);
|
||||
List<HarvestedData> harvested = dataMethodDownloadHarvester.getData();
|
||||
data.addAll(harvested);
|
||||
} catch(Exception e) {
|
||||
|
@ -207,6 +214,17 @@ public class AccountingDataHarvesterPlugin extends Plugin<DataHarvestPluginDecla
|
|||
|
||||
}
|
||||
|
||||
|
||||
protected SortedSet<String> getSoBigDataContexts(Set<String> contexts, String base){
|
||||
SortedSet<String> filteredContext = new TreeSet<>();
|
||||
for(String context : contexts) {
|
||||
if(context.startsWith(SO_BIG_DATA_CONTEXT)){
|
||||
filteredContext.add(context);
|
||||
}
|
||||
}
|
||||
return filteredContext;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected void onStop() throws Exception {
|
||||
|
|
|
@ -2,23 +2,23 @@ package org.gcube.dataharvest.harvester.sobigdata;
|
|||
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.gcube.dataharvest.harvester.BasicHarvester;
|
||||
|
||||
public abstract class SoBigDataHarvester extends BasicHarvester {
|
||||
|
||||
protected List<String> contexts;
|
||||
protected SortedSet<String> contexts;
|
||||
|
||||
public SoBigDataHarvester(Date start, Date end) throws ParseException {
|
||||
super(start, end);
|
||||
}
|
||||
|
||||
public List<String> getContexts() {
|
||||
public SortedSet<String> getContexts() {
|
||||
return contexts;
|
||||
}
|
||||
|
||||
public void setContexts(List<String> contexts) {
|
||||
public void setContexts(SortedSet<String> contexts) {
|
||||
this.contexts = contexts;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue