2015-05-28 13:19:25 +02:00
|
|
|
package org.gcube.accounting.messaging;
|
|
|
|
|
2015-06-15 15:43:15 +02:00
|
|
|
import org.gcube.accounting.datamodel.RawUsageRecord;
|
2015-06-25 14:30:50 +02:00
|
|
|
import org.gcube.accounting.exception.InvalidValueException;
|
2015-07-07 12:10:52 +02:00
|
|
|
import org.gcube.accounting.persistence.AccountingPersistence;
|
|
|
|
import org.gcube.accounting.persistence.AccountingPersistenceFactory;
|
2015-06-25 14:30:50 +02:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
2015-05-28 13:19:25 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This class has been created for backward compatibility.
|
|
|
|
* Use {@link #Persistence} class instead
|
|
|
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
public class ResourceAccounting {
|
|
|
|
|
2015-06-25 14:30:50 +02:00
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(ResourceAccounting.class);
|
|
|
|
|
|
|
|
@Deprecated
|
2015-07-07 12:10:52 +02:00
|
|
|
protected AccountingPersistence persistence;
|
2015-05-28 13:19:25 +02:00
|
|
|
|
|
|
|
@Deprecated
|
|
|
|
public ResourceAccounting() {
|
2015-07-07 12:10:52 +02:00
|
|
|
persistence = AccountingPersistenceFactory.getPersistence();
|
2015-05-28 13:19:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Deprecated
|
2015-06-15 15:43:15 +02:00
|
|
|
public void sendAccountingMessage(RawUsageRecord message){
|
2015-06-25 14:30:50 +02:00
|
|
|
try {
|
|
|
|
persistence.account(message);
|
|
|
|
} catch (InvalidValueException e) {
|
2015-07-22 17:28:30 +02:00
|
|
|
logger.error("The Record you are going to account is not valid", e);
|
2015-06-25 14:30:50 +02:00
|
|
|
}
|
2015-05-28 13:19:25 +02:00
|
|
|
}
|
|
|
|
|
2015-06-15 15:43:15 +02:00
|
|
|
|
2015-05-28 13:19:25 +02:00
|
|
|
}
|