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
This commit is contained in:
parent
1556c23629
commit
5de687d983
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.accounting.datamodel.aggregation;
|
package org.gcube.accounting.aggregation;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.accounting.datamodel.aggregation;
|
package org.gcube.accounting.aggregation;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.accounting.datamodel.aggregation;
|
package org.gcube.accounting.aggregation;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.accounting.datamodel.aggregation;
|
package org.gcube.accounting.aggregation;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
|
@ -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.AggregationStrategy;
|
||||||
import org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord;
|
|
||||||
import org.gcube.accounting.exception.NotAggregatableRecordsExceptions;
|
import org.gcube.accounting.exception.NotAggregatableRecordsExceptions;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -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.AggregationStrategy;
|
||||||
import org.gcube.accounting.datamodel.aggregation.StorageUsageRecord;
|
|
||||||
import org.gcube.accounting.exception.NotAggregatableRecordsExceptions;
|
import org.gcube.accounting.exception.NotAggregatableRecordsExceptions;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.accounting.datamodel.aggregation.scheduler;
|
package org.gcube.accounting.aggregation.scheduler;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -52,7 +52,7 @@ public abstract class AggregationScheduler {
|
||||||
Class<? extends AggregatedUsageRecord> clz;
|
Class<? extends AggregatedUsageRecord> clz;
|
||||||
String aggregatedURFullyQualifiedName;
|
String aggregatedURFullyQualifiedName;
|
||||||
try {
|
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);
|
aggregatedURFullyQualifiedName = String.format("%s.%s", aggregatedPackage.getName(), usageRecordName);
|
||||||
clz = (Class<? extends AggregatedUsageRecord>) Class.forName(aggregatedURFullyQualifiedName);
|
clz = (Class<? extends AggregatedUsageRecord>) Class.forName(aggregatedURFullyQualifiedName);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
|
@ -78,7 +78,7 @@ public abstract class AggregationScheduler {
|
||||||
Class<? extends AggregationStrategy> clz;
|
Class<? extends AggregationStrategy> clz;
|
||||||
String aggregationStrategyName;
|
String aggregationStrategyName;
|
||||||
try {
|
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());
|
aggregationStrategyName = String.format("%s.%s%s", aggregationStrategyPackage.getName(), usageRecordName, AggregationStrategy.class.getSimpleName());
|
||||||
clz = (Class<? extends AggregationStrategy>) Class.forName(aggregationStrategyName);
|
clz = (Class<? extends AggregationStrategy>) Class.forName(aggregationStrategyName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.accounting.datamodel.aggregation.scheduler;
|
package org.gcube.accounting.aggregation.scheduler;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
|
@ -462,7 +462,7 @@ public abstract class BasicUsageRecord implements UsageRecord, Serializable {
|
||||||
|
|
||||||
Class<? extends UsageRecord> utilityClass = org.gcube.accounting.datamodel.implementations.JobUsageRecord.class;
|
Class<? extends UsageRecord> utilityClass = org.gcube.accounting.datamodel.implementations.JobUsageRecord.class;
|
||||||
if(aggregated){
|
if(aggregated){
|
||||||
utilityClass = org.gcube.accounting.datamodel.aggregation.JobUsageRecord.class;
|
utilityClass = org.gcube.accounting.aggregation.JobUsageRecord.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
String classCanonicalName = utilityClass.getCanonicalName();
|
String classCanonicalName = utilityClass.getCanonicalName();
|
||||||
|
|
|
@ -8,10 +8,10 @@ import java.util.ServiceLoader;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
import org.gcube.accounting.aggregation.scheduler.AggregationScheduler;
|
||||||
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
||||||
import org.gcube.accounting.datamodel.TestUsageRecord;
|
import org.gcube.accounting.datamodel.TestUsageRecord;
|
||||||
import org.gcube.accounting.datamodel.UsageRecord;
|
import org.gcube.accounting.datamodel.UsageRecord;
|
||||||
import org.gcube.accounting.datamodel.aggregation.scheduler.AggregationScheduler;
|
|
||||||
import org.gcube.accounting.exception.InvalidValueException;
|
import org.gcube.accounting.exception.InvalidValueException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.accounting.datamodel.aggreagtion.aggregationstrategy;
|
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.TestUsageRecord;
|
||||||
import org.gcube.accounting.datamodel.aggregation.aggregationstrategy.ServiceUsageRecordAggregationStrategy;
|
|
||||||
import org.gcube.accounting.datamodel.implementations.ServiceUsageRecord;
|
import org.gcube.accounting.datamodel.implementations.ServiceUsageRecord;
|
||||||
import org.gcube.accounting.exception.InvalidValueException;
|
import org.gcube.accounting.exception.InvalidValueException;
|
||||||
import org.gcube.accounting.exception.NotAggregatableRecordsExceptions;
|
import org.gcube.accounting.exception.NotAggregatableRecordsExceptions;
|
||||||
|
@ -29,8 +29,8 @@ public class ServiceUsageRecordAggregationStrategyTest {
|
||||||
serviceUsageRecord.validate();
|
serviceUsageRecord.validate();
|
||||||
logger.debug("ServiceUsageRecord : {}", serviceUsageRecord);
|
logger.debug("ServiceUsageRecord : {}", serviceUsageRecord);
|
||||||
|
|
||||||
org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord aggregated =
|
org.gcube.accounting.aggregation.ServiceUsageRecord aggregated =
|
||||||
new org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord(serviceUsageRecord);
|
new org.gcube.accounting.aggregation.ServiceUsageRecord(serviceUsageRecord);
|
||||||
logger.debug("ServiceUsageRecord Converted to Aggregated: {}", aggregated);
|
logger.debug("ServiceUsageRecord Converted to Aggregated: {}", aggregated);
|
||||||
aggregated.validate();
|
aggregated.validate();
|
||||||
|
|
||||||
|
@ -67,16 +67,16 @@ public class ServiceUsageRecordAggregationStrategyTest {
|
||||||
serviceUsageRecord.validate();
|
serviceUsageRecord.validate();
|
||||||
logger.debug("ServiceUsageRecord : {}", serviceUsageRecord);
|
logger.debug("ServiceUsageRecord : {}", serviceUsageRecord);
|
||||||
|
|
||||||
org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord aggregated =
|
org.gcube.accounting.aggregation.ServiceUsageRecord aggregated =
|
||||||
new org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord(serviceUsageRecord);
|
new org.gcube.accounting.aggregation.ServiceUsageRecord(serviceUsageRecord);
|
||||||
logger.debug("ServiceUsageRecord Converted to Aggregated: {}", aggregated);
|
logger.debug("ServiceUsageRecord Converted to Aggregated: {}", aggregated);
|
||||||
aggregated.validate();
|
aggregated.validate();
|
||||||
|
|
||||||
ServiceUsageRecord serviceUsageRecord2 = TestUsageRecord.createTestServiceUsageRecord();
|
ServiceUsageRecord serviceUsageRecord2 = TestUsageRecord.createTestServiceUsageRecord();
|
||||||
serviceUsageRecord2.validate();
|
serviceUsageRecord2.validate();
|
||||||
logger.debug("ServiceUsageRecord 2 : {}", serviceUsageRecord2);
|
logger.debug("ServiceUsageRecord 2 : {}", serviceUsageRecord2);
|
||||||
org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord converted =
|
org.gcube.accounting.aggregation.ServiceUsageRecord converted =
|
||||||
new org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord(serviceUsageRecord2);
|
new org.gcube.accounting.aggregation.ServiceUsageRecord(serviceUsageRecord2);
|
||||||
logger.debug("ServiceUsageRecord 2 Converted to Aggregated: {}", converted);
|
logger.debug("ServiceUsageRecord 2 Converted to Aggregated: {}", converted);
|
||||||
converted.validate();
|
converted.validate();
|
||||||
|
|
||||||
|
@ -108,8 +108,8 @@ public class ServiceUsageRecordAggregationStrategyTest {
|
||||||
serviceUsageRecord.validate();
|
serviceUsageRecord.validate();
|
||||||
logger.debug("ServiceUsageRecord : {}", serviceUsageRecord);
|
logger.debug("ServiceUsageRecord : {}", serviceUsageRecord);
|
||||||
|
|
||||||
org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord aggregated =
|
org.gcube.accounting.aggregation.ServiceUsageRecord aggregated =
|
||||||
new org.gcube.accounting.datamodel.aggregation.ServiceUsageRecord(serviceUsageRecord);
|
new org.gcube.accounting.aggregation.ServiceUsageRecord(serviceUsageRecord);
|
||||||
logger.debug("ServiceUsageRecord Converted to Aggregated: {}", aggregated);
|
logger.debug("ServiceUsageRecord Converted to Aggregated: {}", aggregated);
|
||||||
aggregated.validate();
|
aggregated.validate();
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.accounting.datamodel.aggreagtion.aggregationstrategy;
|
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.TestUsageRecord;
|
||||||
import org.gcube.accounting.datamodel.aggregation.aggregationstrategy.StorageUsageRecordAggregationStrategy;
|
|
||||||
import org.gcube.accounting.datamodel.implementations.StorageUsageRecord;
|
import org.gcube.accounting.datamodel.implementations.StorageUsageRecord;
|
||||||
import org.gcube.accounting.exception.InvalidValueException;
|
import org.gcube.accounting.exception.InvalidValueException;
|
||||||
import org.gcube.accounting.exception.NotAggregatableRecordsExceptions;
|
import org.gcube.accounting.exception.NotAggregatableRecordsExceptions;
|
||||||
|
@ -29,8 +29,8 @@ public class StorageUsageRecordAggregationStrategyTest {
|
||||||
storageUsageRecord.validate();
|
storageUsageRecord.validate();
|
||||||
logger.debug("StorageUsageRecord : {}", storageUsageRecord);
|
logger.debug("StorageUsageRecord : {}", storageUsageRecord);
|
||||||
|
|
||||||
org.gcube.accounting.datamodel.aggregation.StorageUsageRecord aggregated =
|
org.gcube.accounting.aggregation.StorageUsageRecord aggregated =
|
||||||
new org.gcube.accounting.datamodel.aggregation.StorageUsageRecord(storageUsageRecord);
|
new org.gcube.accounting.aggregation.StorageUsageRecord(storageUsageRecord);
|
||||||
logger.debug("StorageUsageRecord Converted to Aggregated: {}", aggregated);
|
logger.debug("StorageUsageRecord Converted to Aggregated: {}", aggregated);
|
||||||
aggregated.validate();
|
aggregated.validate();
|
||||||
|
|
||||||
|
@ -58,16 +58,16 @@ public class StorageUsageRecordAggregationStrategyTest {
|
||||||
storageUsageRecord.validate();
|
storageUsageRecord.validate();
|
||||||
logger.debug("StorageUsageRecord : {}", storageUsageRecord);
|
logger.debug("StorageUsageRecord : {}", storageUsageRecord);
|
||||||
|
|
||||||
org.gcube.accounting.datamodel.aggregation.StorageUsageRecord aggregated =
|
org.gcube.accounting.aggregation.StorageUsageRecord aggregated =
|
||||||
new org.gcube.accounting.datamodel.aggregation.StorageUsageRecord(storageUsageRecord);
|
new org.gcube.accounting.aggregation.StorageUsageRecord(storageUsageRecord);
|
||||||
logger.debug("StorageUsageRecord Converted to Aggregated: {}", aggregated);
|
logger.debug("StorageUsageRecord Converted to Aggregated: {}", aggregated);
|
||||||
aggregated.validate();
|
aggregated.validate();
|
||||||
|
|
||||||
StorageUsageRecord storageUsageRecord2 = TestUsageRecord.createTestStorageUsageRecord();
|
StorageUsageRecord storageUsageRecord2 = TestUsageRecord.createTestStorageUsageRecord();
|
||||||
storageUsageRecord2.validate();
|
storageUsageRecord2.validate();
|
||||||
logger.debug("StorageUsageRecord 2 : {}", storageUsageRecord2);
|
logger.debug("StorageUsageRecord 2 : {}", storageUsageRecord2);
|
||||||
org.gcube.accounting.datamodel.aggregation.StorageUsageRecord converted =
|
org.gcube.accounting.aggregation.StorageUsageRecord converted =
|
||||||
new org.gcube.accounting.datamodel.aggregation.StorageUsageRecord(storageUsageRecord2);
|
new org.gcube.accounting.aggregation.StorageUsageRecord(storageUsageRecord2);
|
||||||
logger.debug("StorageUsageRecord Converted to Aggregated: {}", converted);
|
logger.debug("StorageUsageRecord Converted to Aggregated: {}", converted);
|
||||||
converted.validate();
|
converted.validate();
|
||||||
|
|
||||||
|
@ -93,8 +93,8 @@ public class StorageUsageRecordAggregationStrategyTest {
|
||||||
storageUsageRecord.validate();
|
storageUsageRecord.validate();
|
||||||
logger.debug("StorageUsageRecord : {}", storageUsageRecord);
|
logger.debug("StorageUsageRecord : {}", storageUsageRecord);
|
||||||
|
|
||||||
org.gcube.accounting.datamodel.aggregation.StorageUsageRecord aggregated =
|
org.gcube.accounting.aggregation.StorageUsageRecord aggregated =
|
||||||
new org.gcube.accounting.datamodel.aggregation.StorageUsageRecord(storageUsageRecord);
|
new org.gcube.accounting.aggregation.StorageUsageRecord(storageUsageRecord);
|
||||||
logger.debug("StorageUsageRecord Converted to Aggregated: {}", aggregated);
|
logger.debug("StorageUsageRecord Converted to Aggregated: {}", aggregated);
|
||||||
aggregated.validate();
|
aggregated.validate();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue