refs #200: Create accouting-lib library
https://support.d4science.org/issues/200 Implementing library git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@115258 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
32356675a0
commit
3661f051db
|
@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory;
|
|||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public abstract class RawUsageRecord implements UsageRecord, Serializable {
|
||||
public abstract class RawUsageRecord<T> implements UsageRecord, Serializable {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(RawUsageRecord.class);
|
||||
|
||||
|
@ -490,7 +490,7 @@ public abstract class RawUsageRecord implements UsageRecord, Serializable {
|
|||
return 1;
|
||||
}
|
||||
|
||||
public static List<UsageRecord> aggregate(List<UsageRecord> records){
|
||||
protected List<T> aggregate(List<T> records){
|
||||
// TODO implements
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
@ -506,8 +506,8 @@ public abstract class RawUsageRecord implements UsageRecord, Serializable {
|
|||
* @throws Exception if fails
|
||||
*/
|
||||
public static UsageRecord getUsageRecord(Map<String, Serializable> usageRecordMap) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
// TODO implements
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
package org.gcube.accounting.datamodel.implementations;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.accounting.datamodel.RawUsageRecord;
|
||||
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
||||
|
@ -19,7 +20,7 @@ import org.gcube.accounting.exception.InvalidValueException;
|
|||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class JobUsageRecord extends RawUsageRecord implements SingleUsageRecord {
|
||||
public class JobUsageRecord extends RawUsageRecord<JobUsageRecord> implements SingleUsageRecord {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
|
@ -142,4 +143,13 @@ public class JobUsageRecord extends RawUsageRecord implements SingleUsageRecord
|
|||
return wallDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<JobUsageRecord> aggregate(List<JobUsageRecord> records) {
|
||||
// TODO implements
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
package org.gcube.accounting.datamodel.implementations;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.accounting.datamodel.RawUsageRecord;
|
||||
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
||||
import org.gcube.accounting.datamodel.decorators.RequiredField;
|
||||
|
@ -15,7 +17,7 @@ import org.gcube.accounting.exception.InvalidValueException;
|
|||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class PortletUsageRecord extends RawUsageRecord implements SingleUsageRecord {
|
||||
public class PortletUsageRecord extends RawUsageRecord<PortletUsageRecord> implements SingleUsageRecord {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
|
@ -61,4 +63,13 @@ public class PortletUsageRecord extends RawUsageRecord implements SingleUsageRec
|
|||
setResourceSpecificProperty(OPERATION_ID, operationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<PortletUsageRecord> aggregate(List<PortletUsageRecord> records) {
|
||||
// TODO implements
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
package org.gcube.accounting.datamodel.implementations;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.accounting.datamodel.RawUsageRecord;
|
||||
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
||||
import org.gcube.accounting.datamodel.decorators.RequiredField;
|
||||
|
@ -16,7 +18,7 @@ import org.gcube.accounting.exception.InvalidValueException;
|
|||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class ServiceUsageRecord extends RawUsageRecord implements SingleUsageRecord {
|
||||
public class ServiceUsageRecord extends RawUsageRecord<ServiceUsageRecord> implements SingleUsageRecord {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
|
@ -118,4 +120,12 @@ public class ServiceUsageRecord extends RawUsageRecord implements SingleUsageRec
|
|||
setResourceSpecificProperty(SERVICE_NAME, serviceName);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<ServiceUsageRecord> aggregate(List<ServiceUsageRecord> records) {
|
||||
// TODO implements
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
package org.gcube.accounting.datamodel.implementations;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.accounting.datamodel.RawUsageRecord;
|
||||
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
||||
import org.gcube.accounting.datamodel.decorators.RequiredField;
|
||||
|
@ -17,7 +19,7 @@ import org.gcube.accounting.exception.InvalidValueException;
|
|||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class StorageUsageUsageRecord extends RawUsageRecord implements SingleUsageRecord {
|
||||
public class StorageUsageUsageRecord extends RawUsageRecord<StorageUsageUsageRecord> implements SingleUsageRecord {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
|
@ -124,5 +126,13 @@ public class StorageUsageUsageRecord extends RawUsageRecord implements SingleUsa
|
|||
public void setResourceOwner(String owner) throws InvalidValueException {
|
||||
setResourceSpecificProperty(RESOURCE_OWNER, owner);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<StorageUsageUsageRecord> aggregate(List<StorageUsageUsageRecord> records) {
|
||||
// TODO implements
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
package org.gcube.accounting.datamodel.implementations;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.accounting.datamodel.RawUsageRecord;
|
||||
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
||||
|
@ -19,7 +20,7 @@ import org.gcube.accounting.exception.InvalidValueException;
|
|||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class TaskUsageRecord extends RawUsageRecord implements SingleUsageRecord {
|
||||
public class TaskUsageRecord extends RawUsageRecord<TaskUsageRecord> implements SingleUsageRecord {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
|
@ -199,4 +200,12 @@ public class TaskUsageRecord extends RawUsageRecord implements SingleUsageRecord
|
|||
setResourceSpecificProperty(PROCESSORS, processors);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<TaskUsageRecord> aggregate(List<TaskUsageRecord> records) {
|
||||
// TODO implements
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class ResourceAccounting {
|
|||
}
|
||||
|
||||
@Deprecated
|
||||
public void sendAccountingMessage(RawUsageRecord message){
|
||||
public void sendAccountingMessage(@SuppressWarnings("rawtypes") RawUsageRecord message){
|
||||
persistence.account(message);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue