2015-05-28 13:19:25 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
package org.gcube.accounting.datamodel.implementations;
|
|
|
|
|
2015-06-09 15:53:21 +02:00
|
|
|
import java.io.Serializable;
|
|
|
|
import java.util.Map;
|
|
|
|
|
2015-06-10 17:36:50 +02:00
|
|
|
import org.gcube.accounting.datamodel.BasicUsageRecord;
|
2015-06-05 14:43:04 +02:00
|
|
|
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
2015-06-08 17:30:08 +02:00
|
|
|
import org.gcube.accounting.datamodel.decorators.RequiredField;
|
2015-06-08 17:19:09 +02:00
|
|
|
import org.gcube.accounting.datamodel.validations.annotations.NotEmpty;
|
|
|
|
import org.gcube.accounting.datamodel.validations.annotations.ValidIP;
|
2015-06-18 16:30:42 +02:00
|
|
|
import org.gcube.accounting.datamodel.validations.annotations.ValidLong;
|
2015-05-29 16:08:21 +02:00
|
|
|
import org.gcube.accounting.exception.InvalidValueException;
|
2015-05-28 13:19:25 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
|
|
|
*
|
|
|
|
*/
|
2015-06-10 17:36:50 +02:00
|
|
|
public class ServiceUsageRecord extends BasicUsageRecord implements SingleUsageRecord {
|
2015-05-28 13:19:25 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Generated Serial Version UID
|
|
|
|
*/
|
|
|
|
private static final long serialVersionUID = -4214891294699473587L;
|
|
|
|
|
2015-06-25 17:41:56 +02:00
|
|
|
/**
|
2015-06-26 12:21:28 +02:00
|
|
|
* KEY for : IP address that originated the service call
|
2015-06-25 17:41:56 +02:00
|
|
|
*/
|
2015-05-29 17:39:24 +02:00
|
|
|
@ValidIP
|
2015-05-28 13:19:25 +02:00
|
|
|
public static final String CALLER_IP = "callerIP";
|
2015-06-26 12:21:28 +02:00
|
|
|
|
2015-06-25 17:41:56 +02:00
|
|
|
/**
|
2015-06-26 12:21:28 +02:00
|
|
|
* KEY for : hostname:port of the Hosting Node
|
2015-06-25 17:41:56 +02:00
|
|
|
*/
|
2015-06-08 17:30:08 +02:00
|
|
|
@RequiredField @NotEmpty
|
2015-05-28 13:19:25 +02:00
|
|
|
public static final String REF_HOST = "refHost";
|
2015-06-26 12:21:28 +02:00
|
|
|
|
2015-06-25 17:41:56 +02:00
|
|
|
/**
|
2015-06-26 12:21:28 +02:00
|
|
|
* KEY for : Hosting Node ID
|
2015-06-25 17:41:56 +02:00
|
|
|
*/
|
2015-06-08 17:30:08 +02:00
|
|
|
@RequiredField @NotEmpty
|
2015-05-28 13:19:25 +02:00
|
|
|
public static final String REF_VM = "refVM";
|
2015-06-26 12:21:28 +02:00
|
|
|
|
2015-06-25 17:41:56 +02:00
|
|
|
/**
|
2015-06-26 12:21:28 +02:00
|
|
|
* KEY for : Service Class
|
2015-06-25 17:41:56 +02:00
|
|
|
*/
|
2015-06-09 17:36:38 +02:00
|
|
|
@RequiredField @NotEmpty
|
2015-05-28 13:19:25 +02:00
|
|
|
public static final String SERVICE_CLASS = "serviceClass";
|
2015-06-26 12:21:28 +02:00
|
|
|
|
2015-06-25 17:41:56 +02:00
|
|
|
/**
|
2015-06-26 12:21:28 +02:00
|
|
|
* KEY for : Service Name
|
2015-06-25 17:41:56 +02:00
|
|
|
*/
|
2015-06-09 17:36:38 +02:00
|
|
|
@RequiredField @NotEmpty
|
2015-05-28 13:19:25 +02:00
|
|
|
public static final String SERVICE_NAME = "serviceName";
|
2015-06-26 12:21:28 +02:00
|
|
|
|
2015-06-25 17:41:56 +02:00
|
|
|
/**
|
2015-06-26 12:21:28 +02:00
|
|
|
* KEY for : Service Name
|
2015-06-25 17:41:56 +02:00
|
|
|
*/
|
2015-06-18 16:30:42 +02:00
|
|
|
@RequiredField @ValidLong
|
|
|
|
public static final String DURATION = "duration";
|
|
|
|
|
2015-05-28 13:19:25 +02:00
|
|
|
public ServiceUsageRecord(){
|
|
|
|
super();
|
|
|
|
}
|
2015-05-29 16:08:21 +02:00
|
|
|
|
2015-06-09 15:53:21 +02:00
|
|
|
public ServiceUsageRecord(Map<String, Serializable> properties) throws InvalidValueException {
|
|
|
|
super(properties);
|
|
|
|
}
|
|
|
|
|
2015-05-29 16:08:21 +02:00
|
|
|
public String getCallerIP() {
|
2015-06-09 14:54:14 +02:00
|
|
|
return (String) this.resourceProperties.get(CALLER_IP);
|
2015-05-29 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setCallerIP(String callerIP) throws InvalidValueException {
|
2015-06-09 14:54:14 +02:00
|
|
|
setResourceProperty(CALLER_IP, callerIP);
|
2015-05-29 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getRefHost() {
|
2015-06-09 14:54:14 +02:00
|
|
|
return (String) this.resourceProperties.get(REF_HOST);
|
2015-05-29 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setRefHost(String refHost) throws InvalidValueException {
|
2015-06-09 14:54:14 +02:00
|
|
|
setResourceProperty(REF_HOST, refHost);
|
2015-05-29 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getRefVM() {
|
2015-06-09 14:54:14 +02:00
|
|
|
return (String) this.resourceProperties.get(REF_VM);
|
2015-05-29 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setRefVM(String refVM) throws InvalidValueException {
|
2015-06-09 14:54:14 +02:00
|
|
|
setResourceProperty(REF_VM, refVM);
|
2015-05-29 16:08:21 +02:00
|
|
|
}
|
2015-06-18 16:30:42 +02:00
|
|
|
|
2015-05-29 16:08:21 +02:00
|
|
|
public String getServiceClass() {
|
2015-06-09 14:54:14 +02:00
|
|
|
return (String) this.resourceProperties.get(SERVICE_CLASS);
|
2015-05-29 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setServiceClass(String serviceClass) throws InvalidValueException {
|
2015-06-09 14:54:14 +02:00
|
|
|
setResourceProperty(SERVICE_CLASS, serviceClass);
|
2015-05-29 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getServiceName() {
|
2015-06-09 14:54:14 +02:00
|
|
|
return (String) this.resourceProperties.get(SERVICE_NAME);
|
2015-05-29 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setServiceName(String serviceName) throws InvalidValueException {
|
2015-06-09 14:54:14 +02:00
|
|
|
setResourceProperty(SERVICE_NAME, serviceName);
|
2015-05-29 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
2015-06-18 16:30:42 +02:00
|
|
|
public Long getDuration() {
|
|
|
|
return (Long) this.resourceProperties.get(DURATION);
|
|
|
|
}
|
|
|
|
|
2015-06-18 16:34:04 +02:00
|
|
|
public void setDuration(Long duration) throws InvalidValueException {
|
2015-06-18 16:30:42 +02:00
|
|
|
setResourceProperty(DURATION, duration);
|
|
|
|
}
|
2015-05-28 13:19:25 +02:00
|
|
|
}
|