From 5de687d98314e48f009369714c6f1ce7d2a9f823 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 1 Jul 2015 09:02:45 +0000 Subject: [PATCH] refs #200: Create accouting-lib library https://support.d4science.org/issues/200 Reorganizing packages git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@115739 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../aggregation/JobUsageRecord.java | 2 +- .../aggregation/PortletUsageRecord.java | 2 +- .../aggregation/ServiceUsageRecord.java | 2 +- .../aggregation/StorageUsageRecord.java | 2 +- .../ServiceUsageRecordAggregationStrategy.java | 4 ++-- .../StorageUsageRecordAggregationStrategy.java | 4 ++-- .../scheduler/AggregationScheduler.java | 6 +++--- .../scheduler/BufferAggregationScheduler.java | 2 +- .../accounting/datamodel/BasicUsageRecord.java | 2 +- .../accounting/persistence/Persistence.java | 2 +- ...viceUsageRecordAggregationStrategyTest.java | 18 +++++++++--------- ...rageUsageRecordAggregationStrategyTest.java | 18 +++++++++--------- 12 files changed, 32 insertions(+), 32 deletions(-) rename src/main/java/org/gcube/accounting/{datamodel => }/aggregation/JobUsageRecord.java (95%) rename src/main/java/org/gcube/accounting/{datamodel => }/aggregation/PortletUsageRecord.java (95%) rename src/main/java/org/gcube/accounting/{datamodel => }/aggregation/ServiceUsageRecord.java (98%) rename src/main/java/org/gcube/accounting/{datamodel => }/aggregation/StorageUsageRecord.java (97%) rename src/main/java/org/gcube/accounting/{datamodel => }/aggregation/aggregationstrategy/ServiceUsageRecordAggregationStrategy.java (90%) rename src/main/java/org/gcube/accounting/{datamodel => }/aggregation/aggregationstrategy/StorageUsageRecordAggregationStrategy.java (90%) rename src/main/java/org/gcube/accounting/{datamodel => }/aggregation/scheduler/AggregationScheduler.java (95%) rename src/main/java/org/gcube/accounting/{datamodel => }/aggregation/scheduler/BufferAggregationScheduler.java (95%) diff --git a/src/main/java/org/gcube/accounting/datamodel/aggregation/JobUsageRecord.java b/src/main/java/org/gcube/accounting/aggregation/JobUsageRecord.java similarity index 95% rename from src/main/java/org/gcube/accounting/datamodel/aggregation/JobUsageRecord.java rename to src/main/java/org/gcube/accounting/aggregation/JobUsageRecord.java index 58880bb..38ee0e4 100644 --- a/src/main/java/org/gcube/accounting/datamodel/aggregation/JobUsageRecord.java +++ b/src/main/java/org/gcube/accounting/aggregation/JobUsageRecord.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.accounting.datamodel.aggregation; +package org.gcube.accounting.aggregation; import java.io.Serializable; import java.util.Map; diff --git a/src/main/java/org/gcube/accounting/datamodel/aggregation/PortletUsageRecord.java b/src/main/java/org/gcube/accounting/aggregation/PortletUsageRecord.java similarity index 95% rename from src/main/java/org/gcube/accounting/datamodel/aggregation/PortletUsageRecord.java rename to src/main/java/org/gcube/accounting/aggregation/PortletUsageRecord.java index c7c281e..12e6b31 100644 --- a/src/main/java/org/gcube/accounting/datamodel/aggregation/PortletUsageRecord.java +++ b/src/main/java/org/gcube/accounting/aggregation/PortletUsageRecord.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.accounting.datamodel.aggregation; +package org.gcube.accounting.aggregation; import java.io.Serializable; import java.util.Map; diff --git a/src/main/java/org/gcube/accounting/datamodel/aggregation/ServiceUsageRecord.java b/src/main/java/org/gcube/accounting/aggregation/ServiceUsageRecord.java similarity index 98% rename from src/main/java/org/gcube/accounting/datamodel/aggregation/ServiceUsageRecord.java rename to src/main/java/org/gcube/accounting/aggregation/ServiceUsageRecord.java index 8a2dcd4..a60a052 100644 --- a/src/main/java/org/gcube/accounting/datamodel/aggregation/ServiceUsageRecord.java +++ b/src/main/java/org/gcube/accounting/aggregation/ServiceUsageRecord.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.accounting.datamodel.aggregation; +package org.gcube.accounting.aggregation; import java.io.Serializable; import java.util.Calendar; diff --git a/src/main/java/org/gcube/accounting/datamodel/aggregation/StorageUsageRecord.java b/src/main/java/org/gcube/accounting/aggregation/StorageUsageRecord.java similarity index 97% rename from src/main/java/org/gcube/accounting/datamodel/aggregation/StorageUsageRecord.java rename to src/main/java/org/gcube/accounting/aggregation/StorageUsageRecord.java index 4f87963..44b7115 100644 --- a/src/main/java/org/gcube/accounting/datamodel/aggregation/StorageUsageRecord.java +++ b/src/main/java/org/gcube/accounting/aggregation/StorageUsageRecord.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.accounting.datamodel.aggregation; +package org.gcube.accounting.aggregation; import java.io.Serializable; import java.util.Calendar; diff --git a/src/main/java/org/gcube/accounting/datamodel/aggregation/aggregationstrategy/ServiceUsageRecordAggregationStrategy.java b/src/main/java/org/gcube/accounting/aggregation/aggregationstrategy/ServiceUsageRecordAggregationStrategy.java similarity index 90% rename from src/main/java/org/gcube/accounting/datamodel/aggregation/aggregationstrategy/ServiceUsageRecordAggregationStrategy.java rename to src/main/java/org/gcube/accounting/aggregation/aggregationstrategy/ServiceUsageRecordAggregationStrategy.java index 61c0424..70a710a 100644 --- a/src/main/java/org/gcube/accounting/datamodel/aggregation/aggregationstrategy/ServiceUsageRecordAggregationStrategy.java +++ b/src/main/java/org/gcube/accounting/aggregation/aggregationstrategy/ServiceUsageRecordAggregationStrategy.java @@ -1,10 +1,10 @@ /** * */ -package org.gcube.accounting.datamodel.aggregation.aggregationstrategy; +package org.gcube.accounting.aggregation.aggregationstrategy; +import org.gcube.accounting.aggregation.ServiceUsageRecord; import org.gcube.accounting.datamodel.AggregationStrategy; -import org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord; import org.gcube.accounting.exception.NotAggregatableRecordsExceptions; /** diff --git a/src/main/java/org/gcube/accounting/datamodel/aggregation/aggregationstrategy/StorageUsageRecordAggregationStrategy.java b/src/main/java/org/gcube/accounting/aggregation/aggregationstrategy/StorageUsageRecordAggregationStrategy.java similarity index 90% rename from src/main/java/org/gcube/accounting/datamodel/aggregation/aggregationstrategy/StorageUsageRecordAggregationStrategy.java rename to src/main/java/org/gcube/accounting/aggregation/aggregationstrategy/StorageUsageRecordAggregationStrategy.java index 5212e7d..96ad2c1 100644 --- a/src/main/java/org/gcube/accounting/datamodel/aggregation/aggregationstrategy/StorageUsageRecordAggregationStrategy.java +++ b/src/main/java/org/gcube/accounting/aggregation/aggregationstrategy/StorageUsageRecordAggregationStrategy.java @@ -1,10 +1,10 @@ /** * */ -package org.gcube.accounting.datamodel.aggregation.aggregationstrategy; +package org.gcube.accounting.aggregation.aggregationstrategy; +import org.gcube.accounting.aggregation.StorageUsageRecord; import org.gcube.accounting.datamodel.AggregationStrategy; -import org.gcube.accounting.datamodel.aggregation.StorageUsageRecord; import org.gcube.accounting.exception.NotAggregatableRecordsExceptions; /** diff --git a/src/main/java/org/gcube/accounting/datamodel/aggregation/scheduler/AggregationScheduler.java b/src/main/java/org/gcube/accounting/aggregation/scheduler/AggregationScheduler.java similarity index 95% rename from src/main/java/org/gcube/accounting/datamodel/aggregation/scheduler/AggregationScheduler.java rename to src/main/java/org/gcube/accounting/aggregation/scheduler/AggregationScheduler.java index bad7b19..3f9e042 100644 --- a/src/main/java/org/gcube/accounting/datamodel/aggregation/scheduler/AggregationScheduler.java +++ b/src/main/java/org/gcube/accounting/aggregation/scheduler/AggregationScheduler.java @@ -1,4 +1,4 @@ -package org.gcube.accounting.datamodel.aggregation.scheduler; +package org.gcube.accounting.aggregation.scheduler; import java.lang.reflect.Constructor; import java.util.ArrayList; @@ -52,7 +52,7 @@ public abstract class AggregationScheduler { Class clz; String aggregatedURFullyQualifiedName; try { - Package aggregatedPackage = org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord.class.getPackage(); + Package aggregatedPackage = org.gcube.accounting.aggregation.ServiceUsageRecord.class.getPackage(); aggregatedURFullyQualifiedName = String.format("%s.%s", aggregatedPackage.getName(), usageRecordName); clz = (Class) Class.forName(aggregatedURFullyQualifiedName); } catch (ClassNotFoundException e) { @@ -78,7 +78,7 @@ public abstract class AggregationScheduler { Class clz; String aggregationStrategyName; try { - Package aggregationStrategyPackage = org.gcube.accounting.datamodel.aggregation.aggregationstrategy.ServiceUsageRecordAggregationStrategy.class.getPackage(); + Package aggregationStrategyPackage = org.gcube.accounting.aggregation.aggregationstrategy.ServiceUsageRecordAggregationStrategy.class.getPackage(); aggregationStrategyName = String.format("%s.%s%s", aggregationStrategyPackage.getName(), usageRecordName, AggregationStrategy.class.getSimpleName()); clz = (Class) Class.forName(aggregationStrategyName); } catch (Exception e) { diff --git a/src/main/java/org/gcube/accounting/datamodel/aggregation/scheduler/BufferAggregationScheduler.java b/src/main/java/org/gcube/accounting/aggregation/scheduler/BufferAggregationScheduler.java similarity index 95% rename from src/main/java/org/gcube/accounting/datamodel/aggregation/scheduler/BufferAggregationScheduler.java rename to src/main/java/org/gcube/accounting/aggregation/scheduler/BufferAggregationScheduler.java index 54dbc84..692dfc9 100644 --- a/src/main/java/org/gcube/accounting/datamodel/aggregation/scheduler/BufferAggregationScheduler.java +++ b/src/main/java/org/gcube/accounting/aggregation/scheduler/BufferAggregationScheduler.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.accounting.datamodel.aggregation.scheduler; +package org.gcube.accounting.aggregation.scheduler; import java.util.Calendar; diff --git a/src/main/java/org/gcube/accounting/datamodel/BasicUsageRecord.java b/src/main/java/org/gcube/accounting/datamodel/BasicUsageRecord.java index 516d77e..8f40c03 100644 --- a/src/main/java/org/gcube/accounting/datamodel/BasicUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/BasicUsageRecord.java @@ -462,7 +462,7 @@ public abstract class BasicUsageRecord implements UsageRecord, Serializable { Class utilityClass = org.gcube.accounting.datamodel.implementations.JobUsageRecord.class; if(aggregated){ - utilityClass = org.gcube.accounting.datamodel.aggregation.JobUsageRecord.class; + utilityClass = org.gcube.accounting.aggregation.JobUsageRecord.class; } String classCanonicalName = utilityClass.getCanonicalName(); diff --git a/src/main/java/org/gcube/accounting/persistence/Persistence.java b/src/main/java/org/gcube/accounting/persistence/Persistence.java index 573de1b..7de397a 100644 --- a/src/main/java/org/gcube/accounting/persistence/Persistence.java +++ b/src/main/java/org/gcube/accounting/persistence/Persistence.java @@ -8,10 +8,10 @@ import java.util.ServiceLoader; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import org.gcube.accounting.aggregation.scheduler.AggregationScheduler; import org.gcube.accounting.datamodel.SingleUsageRecord; import org.gcube.accounting.datamodel.TestUsageRecord; import org.gcube.accounting.datamodel.UsageRecord; -import org.gcube.accounting.datamodel.aggregation.scheduler.AggregationScheduler; import org.gcube.accounting.exception.InvalidValueException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/test/java/org/gcube/accounting/datamodel/aggreagtion/aggregationstrategy/ServiceUsageRecordAggregationStrategyTest.java b/src/test/java/org/gcube/accounting/datamodel/aggreagtion/aggregationstrategy/ServiceUsageRecordAggregationStrategyTest.java index 34db672..9ed3c14 100644 --- a/src/test/java/org/gcube/accounting/datamodel/aggreagtion/aggregationstrategy/ServiceUsageRecordAggregationStrategyTest.java +++ b/src/test/java/org/gcube/accounting/datamodel/aggreagtion/aggregationstrategy/ServiceUsageRecordAggregationStrategyTest.java @@ -3,8 +3,8 @@ */ package org.gcube.accounting.datamodel.aggreagtion.aggregationstrategy; +import org.gcube.accounting.aggregation.aggregationstrategy.ServiceUsageRecordAggregationStrategy; import org.gcube.accounting.datamodel.TestUsageRecord; -import org.gcube.accounting.datamodel.aggregation.aggregationstrategy.ServiceUsageRecordAggregationStrategy; import org.gcube.accounting.datamodel.implementations.ServiceUsageRecord; import org.gcube.accounting.exception.InvalidValueException; import org.gcube.accounting.exception.NotAggregatableRecordsExceptions; @@ -29,8 +29,8 @@ public class ServiceUsageRecordAggregationStrategyTest { serviceUsageRecord.validate(); logger.debug("ServiceUsageRecord : {}", serviceUsageRecord); - org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord aggregated = - new org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord(serviceUsageRecord); + org.gcube.accounting.aggregation.ServiceUsageRecord aggregated = + new org.gcube.accounting.aggregation.ServiceUsageRecord(serviceUsageRecord); logger.debug("ServiceUsageRecord Converted to Aggregated: {}", aggregated); aggregated.validate(); @@ -67,16 +67,16 @@ public class ServiceUsageRecordAggregationStrategyTest { serviceUsageRecord.validate(); logger.debug("ServiceUsageRecord : {}", serviceUsageRecord); - org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord aggregated = - new org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord(serviceUsageRecord); + org.gcube.accounting.aggregation.ServiceUsageRecord aggregated = + new org.gcube.accounting.aggregation.ServiceUsageRecord(serviceUsageRecord); logger.debug("ServiceUsageRecord Converted to Aggregated: {}", aggregated); aggregated.validate(); ServiceUsageRecord serviceUsageRecord2 = TestUsageRecord.createTestServiceUsageRecord(); serviceUsageRecord2.validate(); logger.debug("ServiceUsageRecord 2 : {}", serviceUsageRecord2); - org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord converted = - new org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord(serviceUsageRecord2); + org.gcube.accounting.aggregation.ServiceUsageRecord converted = + new org.gcube.accounting.aggregation.ServiceUsageRecord(serviceUsageRecord2); logger.debug("ServiceUsageRecord 2 Converted to Aggregated: {}", converted); converted.validate(); @@ -108,8 +108,8 @@ public class ServiceUsageRecordAggregationStrategyTest { serviceUsageRecord.validate(); logger.debug("ServiceUsageRecord : {}", serviceUsageRecord); - org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord aggregated = - new org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord(serviceUsageRecord); + org.gcube.accounting.aggregation.ServiceUsageRecord aggregated = + new org.gcube.accounting.aggregation.ServiceUsageRecord(serviceUsageRecord); logger.debug("ServiceUsageRecord Converted to Aggregated: {}", aggregated); aggregated.validate(); diff --git a/src/test/java/org/gcube/accounting/datamodel/aggreagtion/aggregationstrategy/StorageUsageRecordAggregationStrategyTest.java b/src/test/java/org/gcube/accounting/datamodel/aggreagtion/aggregationstrategy/StorageUsageRecordAggregationStrategyTest.java index 32948bb..4a02b38 100644 --- a/src/test/java/org/gcube/accounting/datamodel/aggreagtion/aggregationstrategy/StorageUsageRecordAggregationStrategyTest.java +++ b/src/test/java/org/gcube/accounting/datamodel/aggreagtion/aggregationstrategy/StorageUsageRecordAggregationStrategyTest.java @@ -3,8 +3,8 @@ */ package org.gcube.accounting.datamodel.aggreagtion.aggregationstrategy; +import org.gcube.accounting.aggregation.aggregationstrategy.StorageUsageRecordAggregationStrategy; import org.gcube.accounting.datamodel.TestUsageRecord; -import org.gcube.accounting.datamodel.aggregation.aggregationstrategy.StorageUsageRecordAggregationStrategy; import org.gcube.accounting.datamodel.implementations.StorageUsageRecord; import org.gcube.accounting.exception.InvalidValueException; import org.gcube.accounting.exception.NotAggregatableRecordsExceptions; @@ -29,8 +29,8 @@ public class StorageUsageRecordAggregationStrategyTest { storageUsageRecord.validate(); logger.debug("StorageUsageRecord : {}", storageUsageRecord); - org.gcube.accounting.datamodel.aggregation.StorageUsageRecord aggregated = - new org.gcube.accounting.datamodel.aggregation.StorageUsageRecord(storageUsageRecord); + org.gcube.accounting.aggregation.StorageUsageRecord aggregated = + new org.gcube.accounting.aggregation.StorageUsageRecord(storageUsageRecord); logger.debug("StorageUsageRecord Converted to Aggregated: {}", aggregated); aggregated.validate(); @@ -58,16 +58,16 @@ public class StorageUsageRecordAggregationStrategyTest { storageUsageRecord.validate(); logger.debug("StorageUsageRecord : {}", storageUsageRecord); - org.gcube.accounting.datamodel.aggregation.StorageUsageRecord aggregated = - new org.gcube.accounting.datamodel.aggregation.StorageUsageRecord(storageUsageRecord); + org.gcube.accounting.aggregation.StorageUsageRecord aggregated = + new org.gcube.accounting.aggregation.StorageUsageRecord(storageUsageRecord); logger.debug("StorageUsageRecord Converted to Aggregated: {}", aggregated); aggregated.validate(); StorageUsageRecord storageUsageRecord2 = TestUsageRecord.createTestStorageUsageRecord(); storageUsageRecord2.validate(); logger.debug("StorageUsageRecord 2 : {}", storageUsageRecord2); - org.gcube.accounting.datamodel.aggregation.StorageUsageRecord converted = - new org.gcube.accounting.datamodel.aggregation.StorageUsageRecord(storageUsageRecord2); + org.gcube.accounting.aggregation.StorageUsageRecord converted = + new org.gcube.accounting.aggregation.StorageUsageRecord(storageUsageRecord2); logger.debug("StorageUsageRecord Converted to Aggregated: {}", converted); converted.validate(); @@ -93,8 +93,8 @@ public class StorageUsageRecordAggregationStrategyTest { storageUsageRecord.validate(); logger.debug("StorageUsageRecord : {}", storageUsageRecord); - org.gcube.accounting.datamodel.aggregation.StorageUsageRecord aggregated = - new org.gcube.accounting.datamodel.aggregation.StorageUsageRecord(storageUsageRecord); + org.gcube.accounting.aggregation.StorageUsageRecord aggregated = + new org.gcube.accounting.aggregation.StorageUsageRecord(storageUsageRecord); logger.debug("StorageUsageRecord Converted to Aggregated: {}", aggregated); aggregated.validate();