From f3446308e9789772edcc2f902b62abbf0869d835 Mon Sep 17 00:00:00 2001 From: Alessandro Pieve Date: Fri, 30 Sep 2016 12:44:58 +0000 Subject: [PATCH] First Release git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-aggregator-se-plugin@132194 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../plugin/AccountingAggregatorPlugin.java | 46 ++++++------------- .../accounting/aggregator/plugin/Tests.java | 15 ++++-- 2 files changed, 26 insertions(+), 35 deletions(-) diff --git a/src/main/java/org/gcube/accounting/aggregator/plugin/AccountingAggregatorPlugin.java b/src/main/java/org/gcube/accounting/aggregator/plugin/AccountingAggregatorPlugin.java index a4b3132..fffbb90 100644 --- a/src/main/java/org/gcube/accounting/aggregator/plugin/AccountingAggregatorPlugin.java +++ b/src/main/java/org/gcube/accounting/aggregator/plugin/AccountingAggregatorPlugin.java @@ -1,7 +1,5 @@ package org.gcube.accounting.aggregator.plugin; - - import java.io.File; import java.io.Serializable; import java.text.SimpleDateFormat; @@ -63,6 +61,17 @@ public class AccountingAggregatorPlugin extends Plugin inputs) throws Exception { - countInsert=0; countDelete=0; - if(inputs == null || inputs.isEmpty()){ logger.debug("{} inputs {}", this.getClass().getSimpleName(), inputs); throw new Exception("Inputs null"); } - //Type :HOURLY,DAILY,MONTHLY,YEARLY //Interval: Number of hour,day,month,year if (!inputs.containsKey("type") || !inputs.containsKey("interval")) @@ -126,12 +118,6 @@ public class AccountingAggregatorPlugin extends Plugin map = getMapFromString(document); + @SuppressWarnings("rawtypes") AggregatedRecord record = (AggregatedRecord)RecordUtility.getRecord(map); aggregate.aggregate(record); - //insert an elaborate row into list JsonDocument for memory document elaborate String identifier=(String) row.document().content().get("id"); - JsonDocument documentJson = JsonDocument.create(identifier, row.document().content()); documentElaborate.add(documentJson); return true; @@ -394,6 +376,7 @@ public class AccountingAggregatorPlugin extends Plugin inputs = new HashMap(); //type aggregation inputs.put("type",AggregationType.DAILY.name()); //period to be processed inputs.put("interval",1 ); - - /* OPTIONAL INPUT */ //change to time - inputs.put("startTime", 10); + inputs.put("startTime", 20); //specify bucket - //inputs.put("bucket","accounting_service"); + inputs.put("bucket","accounting_service"); //current scope inputs.put("currentScope",true);