accounting-lib/src/main/java/org/gcube/accounting/messaging/ResourceAccounting.java

40 lines
1.0 KiB
Java

package org.gcube.accounting.messaging;
import org.gcube.accounting.datamodel.RawUsageRecord;
import org.gcube.accounting.exception.InvalidValueException;
import org.gcube.accounting.persistence.AccountingPersistence;
import org.gcube.accounting.persistence.AccountingPersistenceFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 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 {
private static final Logger logger = LoggerFactory.getLogger(ResourceAccounting.class);
@Deprecated
protected AccountingPersistence persistence;
@Deprecated
public ResourceAccounting() {
persistence = AccountingPersistenceFactory.getPersistence();
}
@Deprecated
public void sendAccountingMessage(RawUsageRecord message){
try {
persistence.account(message);
} catch (InvalidValueException e) {
logger.error("The Record you are going to account is not valid", e);
}
}
}