diff --git a/src/main/java/org/gcube/accounting/datamodel/AggregatedUsageRecord.java b/src/main/java/org/gcube/accounting/datamodel/AggregatedUsageRecord.java index 49b3f86..8586ac7 100644 --- a/src/main/java/org/gcube/accounting/datamodel/AggregatedUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/AggregatedUsageRecord.java @@ -4,27 +4,20 @@ package org.gcube.accounting.datamodel; import org.gcube.accounting.exception.InvalidValueException; -import org.gcube.accounting.exception.NotAggregatableRecorsExceptions; +import org.gcube.accounting.exception.NotAggregatableRecordsExceptions; /** * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ */ -public interface AggregatedUsageRecord extends UsageRecord { +public interface AggregatedUsageRecord extends SingleUsageRecord { public T getAggregatedUsageRecord(B b) throws InvalidValueException ; /** * Aggregate the Record provided as parameter with this record if Aggregatable - * @throws NotAggregatableRecorsExceptions + * @throws NotAggregatableRecordsExceptions */ - public void aggregate(T record) throws NotAggregatableRecorsExceptions; + public void aggregate(T record) throws NotAggregatableRecordsExceptions; - /* * - * - * @param records - * @return - * / - public Collection aggregate(List records); - */ } diff --git a/src/main/java/org/gcube/accounting/datamodel/AggregationStrategy.java b/src/main/java/org/gcube/accounting/datamodel/AggregationStrategy.java index b091588..499abb9 100644 --- a/src/main/java/org/gcube/accounting/datamodel/AggregationStrategy.java +++ b/src/main/java/org/gcube/accounting/datamodel/AggregationStrategy.java @@ -9,7 +9,7 @@ import java.security.NoSuchAlgorithmException; import java.util.HashSet; import java.util.Set; -import org.gcube.accounting.exception.NotAggregatableRecorsExceptions; +import org.gcube.accounting.exception.NotAggregatableRecordsExceptions; /** * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ @@ -58,21 +58,21 @@ public abstract class AggregationStrategy aggregatedUsageRecord = ((AggregatedUsageRecord) t); aggregatedUsageRecord.aggregate(aggregatedUsageRecord.getAggregatedUsageRecord(record)); - throw new NotAggregatableRecorsExceptions(""); - }catch(NotAggregatableRecorsExceptions e){ + throw new NotAggregatableRecordsExceptions(""); + }catch(NotAggregatableRecordsExceptions e){ throw e; }catch(Exception ex){ - throw new NotAggregatableRecorsExceptions(ex.getCause()); + throw new NotAggregatableRecordsExceptions(ex.getCause()); } } diff --git a/src/main/java/org/gcube/accounting/datamodel/implementations/aggregated/JobUsageRecord.java b/src/main/java/org/gcube/accounting/datamodel/implementations/aggregated/JobUsageRecord.java index d4b95ee..45adb93 100644 --- a/src/main/java/org/gcube/accounting/datamodel/implementations/aggregated/JobUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/implementations/aggregated/JobUsageRecord.java @@ -8,7 +8,7 @@ import java.util.Map; import org.gcube.accounting.datamodel.AggregatedUsageRecord; import org.gcube.accounting.exception.InvalidValueException; -import org.gcube.accounting.exception.NotAggregatableRecorsExceptions; +import org.gcube.accounting.exception.NotAggregatableRecordsExceptions; /** * This Class is for library internal use only @@ -47,7 +47,7 @@ public class JobUsageRecord extends org.gcube.accounting.datamodel.implementatio */ @Override public void aggregate(JobUsageRecord record) - throws NotAggregatableRecorsExceptions { + throws NotAggregatableRecordsExceptions { // TODO Auto-generated method stub } diff --git a/src/main/java/org/gcube/accounting/datamodel/implementations/aggregated/PortletUsageRecord.java b/src/main/java/org/gcube/accounting/datamodel/implementations/aggregated/PortletUsageRecord.java index 5623f15..f2332ad 100644 --- a/src/main/java/org/gcube/accounting/datamodel/implementations/aggregated/PortletUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/implementations/aggregated/PortletUsageRecord.java @@ -8,7 +8,7 @@ import java.util.Map; import org.gcube.accounting.datamodel.AggregatedUsageRecord; import org.gcube.accounting.exception.InvalidValueException; -import org.gcube.accounting.exception.NotAggregatableRecorsExceptions; +import org.gcube.accounting.exception.NotAggregatableRecordsExceptions; /** * This Class is for library internal use only @@ -48,7 +48,7 @@ public class PortletUsageRecord extends org.gcube.accounting.datamodel.implement */ @Override public void aggregate(PortletUsageRecord record) - throws NotAggregatableRecorsExceptions { + throws NotAggregatableRecordsExceptions { // TODO Auto-generated method stub } diff --git a/src/main/java/org/gcube/accounting/datamodel/implementations/aggregated/StorageUsageRecord.java b/src/main/java/org/gcube/accounting/datamodel/implementations/aggregated/StorageUsageRecord.java index 27ae417..b7f1502 100644 --- a/src/main/java/org/gcube/accounting/datamodel/implementations/aggregated/StorageUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/implementations/aggregated/StorageUsageRecord.java @@ -8,7 +8,7 @@ import java.util.Map; import org.gcube.accounting.datamodel.AggregatedUsageRecord; import org.gcube.accounting.exception.InvalidValueException; -import org.gcube.accounting.exception.NotAggregatableRecorsExceptions; +import org.gcube.accounting.exception.NotAggregatableRecordsExceptions; /** * This Class is for library internal use only @@ -47,7 +47,7 @@ public class StorageUsageRecord extends org.gcube.accounting.datamodel.implement */ @Override public void aggregate(StorageUsageRecord record) - throws NotAggregatableRecorsExceptions { + throws NotAggregatableRecordsExceptions { // TODO Auto-generated method stub } diff --git a/src/main/java/org/gcube/accounting/exception/NotAggregatableRecorsExceptions.java b/src/main/java/org/gcube/accounting/exception/NotAggregatableRecordsExceptions.java similarity index 52% rename from src/main/java/org/gcube/accounting/exception/NotAggregatableRecorsExceptions.java rename to src/main/java/org/gcube/accounting/exception/NotAggregatableRecordsExceptions.java index b7c8d5b..3493590 100644 --- a/src/main/java/org/gcube/accounting/exception/NotAggregatableRecorsExceptions.java +++ b/src/main/java/org/gcube/accounting/exception/NotAggregatableRecordsExceptions.java @@ -7,26 +7,26 @@ package org.gcube.accounting.exception; * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ * */ -public class NotAggregatableRecorsExceptions extends Exception { +public class NotAggregatableRecordsExceptions extends Exception { /** * Generated serial Version UID */ private static final long serialVersionUID = -1477792189431118048L; - public NotAggregatableRecorsExceptions() { + public NotAggregatableRecordsExceptions() { super(); } - public NotAggregatableRecorsExceptions(String message) { + public NotAggregatableRecordsExceptions(String message) { super(message); } - public NotAggregatableRecorsExceptions(Throwable cause) { + public NotAggregatableRecordsExceptions(Throwable cause) { super(cause); } - public NotAggregatableRecorsExceptions(String message, Throwable cause) { + public NotAggregatableRecordsExceptions(String message, Throwable cause) { super(message, cause); } } diff --git a/src/main/java/org/gcube/accounting/persistence/Persistence.java b/src/main/java/org/gcube/accounting/persistence/Persistence.java index 00b2c24..9acbf90 100644 --- a/src/main/java/org/gcube/accounting/persistence/Persistence.java +++ b/src/main/java/org/gcube/accounting/persistence/Persistence.java @@ -8,7 +8,7 @@ import java.util.ServiceLoader; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import org.gcube.accounting.datamodel.SingleUsageRecord; +import org.gcube.accounting.datamodel.BasicUsageRecord; import org.gcube.accounting.datamodel.UsageRecord; import org.gcube.accounting.datamodel.implementations.ServiceUsageRecord; import org.gcube.accounting.exception.InvalidValueException; @@ -81,7 +81,7 @@ public abstract class Persistence { } } - public static SingleUsageRecord createTestUsageRecord(){ + public static BasicUsageRecord createTestUsageRecord(){ ServiceUsageRecord serviceUsageRecord = new ServiceUsageRecord(); try { serviceUsageRecord.setConsumerId("accounting"); @@ -158,7 +158,7 @@ public abstract class Persistence { */ protected abstract void reallyAccount(UsageRecord usageRecord) throws Exception; - private void accountWithFallback(SingleUsageRecord usageRecord) throws Exception { + private void accountWithFallback(BasicUsageRecord usageRecord) throws Exception { String persistenceName = getInstance().getClass().getSimpleName(); try { //logger.debug("Going to account {} using {}", usageRecord, persistenceName); @@ -187,7 +187,7 @@ public abstract class Persistence { * so that the {@link #UsageRecord} can be recorder later. * @param usageRecord the {@link #UsageRecord} to persist */ - public void account(final SingleUsageRecord usageRecord){ + public void account(final BasicUsageRecord usageRecord){ Runnable runnable = new Runnable(){ @Override public void run(){ diff --git a/src/test/java/org/gcube/accounting/datamodel/persistence/PersistenceTest.java b/src/test/java/org/gcube/accounting/datamodel/persistence/PersistenceTest.java index 567e56f..58a520d 100644 --- a/src/test/java/org/gcube/accounting/datamodel/persistence/PersistenceTest.java +++ b/src/test/java/org/gcube/accounting/datamodel/persistence/PersistenceTest.java @@ -6,7 +6,7 @@ package org.gcube.accounting.datamodel.persistence; import java.util.Calendar; import java.util.GregorianCalendar; -import org.gcube.accounting.datamodel.SingleUsageRecord; +import org.gcube.accounting.datamodel.BasicUsageRecord; import org.gcube.accounting.persistence.Persistence; import org.junit.Test; import org.slf4j.Logger; @@ -36,7 +36,7 @@ public class PersistenceTest { int quantity = 3000; Calendar startTestTime = new GregorianCalendar(); for(int i=0; i< quantity; i++){ - SingleUsageRecord usageRecord = Persistence.createTestUsageRecord(); + BasicUsageRecord usageRecord = Persistence.createTestUsageRecord(); persistence.account(usageRecord); } Calendar stopTestTime = new GregorianCalendar();