refs #200: Create accouting-lib library
https://support.d4science.org/issues/200 Added getter and setter methos for standard fields git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@115152 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0539b770e5
commit
1022ab01c9
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,10 @@
|
|||
*/
|
||||
package org.gcube.accounting.datamodel.implementations;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.gcube.accounting.datamodel.RawUsageRecord;
|
||||
import org.gcube.accounting.exception.InvalidValueException;
|
||||
import org.gcube.common.validator.annotations.NotEmpty;
|
||||
|
||||
/**
|
||||
|
@ -24,9 +27,9 @@ public class JobUsageRecord extends RawUsageRecord {
|
|||
@NotEmpty
|
||||
public static final String JOB_NAME = "jobName";
|
||||
@NotEmpty
|
||||
public static final String JOB_START = "jobStart";
|
||||
public static final String JOB_START_TIME = "jobStartTime";
|
||||
@NotEmpty
|
||||
public static final String JOB_END = "jobEnd";
|
||||
public static final String JOB_END_TIME = "jobEndTime";
|
||||
@NotEmpty
|
||||
public static final String JOB_STATUS = "jobStatus";
|
||||
@NotEmpty
|
||||
|
@ -38,4 +41,80 @@ public class JobUsageRecord extends RawUsageRecord {
|
|||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Job Id
|
||||
*/
|
||||
public String getJobId() {
|
||||
return (String) this.resourceSpecificProperties.get(JOB_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jobId Job Id
|
||||
* @throws InvalidValueException if fails
|
||||
*/
|
||||
public void setJobId(String jobId) throws InvalidValueException {
|
||||
setResourceSpecificProperty(JOB_ID, jobId);
|
||||
}
|
||||
|
||||
public String getJobQualifier() {
|
||||
return (String) this.resourceSpecificProperties.get(JOB_QUALIFIER);
|
||||
}
|
||||
|
||||
public void setJobQualifier(String jobQualifier) throws InvalidValueException {
|
||||
setResourceSpecificProperty(JOB_QUALIFIER, jobQualifier);
|
||||
}
|
||||
|
||||
public String getJobName() {
|
||||
return (String) this.resourceSpecificProperties.get(JOB_NAME);
|
||||
}
|
||||
|
||||
public void setJobName(String jobName) throws InvalidValueException {
|
||||
setResourceSpecificProperty(JOB_NAME, jobName);
|
||||
}
|
||||
|
||||
public Calendar getJobStartTime() {
|
||||
long millis = (Long) this.resourceSpecificProperties.get(JOB_START_TIME);
|
||||
return timestampStringToCalendar(millis);
|
||||
}
|
||||
|
||||
public void setJobStartTime(Calendar jobStartTime) throws InvalidValueException {
|
||||
setResourceSpecificProperty(JOB_START_TIME, jobStartTime.getTimeInMillis());
|
||||
|
||||
}
|
||||
|
||||
public Calendar getJobEndTime() {
|
||||
long millis = (Long) this.resourceSpecificProperties.get(JOB_END_TIME);
|
||||
return timestampStringToCalendar(millis);
|
||||
}
|
||||
|
||||
public void setJobEndTime(Calendar jobEndTime) throws InvalidValueException {
|
||||
setResourceSpecificProperty(JOB_END_TIME, jobEndTime.getTimeInMillis());
|
||||
|
||||
}
|
||||
|
||||
public String getJobStatus() {
|
||||
return (String) this.resourceSpecificProperties.get(JOB_STATUS);
|
||||
}
|
||||
|
||||
public void setJobStatus(String jobStatus) throws InvalidValueException {
|
||||
setResourceSpecificProperty(JOB_STATUS, jobStatus);
|
||||
}
|
||||
|
||||
public int getVmsUsed() {
|
||||
return (Integer) this.resourceSpecificProperties.get(VMS_USED);
|
||||
}
|
||||
|
||||
public void setVmsUsed(int vmsUsed) throws InvalidValueException {
|
||||
setResourceSpecificProperty(VMS_USED, vmsUsed);
|
||||
}
|
||||
|
||||
public long getWallDuration() {
|
||||
return (Integer) this.resourceSpecificProperties.get(WALL_DURATION);
|
||||
}
|
||||
|
||||
public void setWallDuration(long wallDuration) throws InvalidValueException {
|
||||
setResourceSpecificProperty(WALL_DURATION, wallDuration);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
package org.gcube.accounting.datamodel.implementations;
|
||||
|
||||
import org.gcube.accounting.datamodel.RawUsageRecord;
|
||||
import org.gcube.accounting.exception.InvalidValueException;
|
||||
import org.gcube.common.validator.annotations.NotEmpty;
|
||||
|
||||
/**
|
||||
|
@ -18,7 +19,8 @@ public class PortletUsageRecord extends RawUsageRecord {
|
|||
private static final long serialVersionUID = 8339324883678974869L;
|
||||
|
||||
@NotEmpty
|
||||
public static final String USER = "user";
|
||||
public static final String USER_ID = "userId";
|
||||
|
||||
@NotEmpty
|
||||
public static final String OPERATION_ID = "operationId";
|
||||
|
||||
|
@ -26,4 +28,21 @@ public class PortletUsageRecord extends RawUsageRecord {
|
|||
super();
|
||||
}
|
||||
|
||||
|
||||
public String getUserId() {
|
||||
return (String) this.resourceSpecificProperties.get(USER_ID);
|
||||
}
|
||||
|
||||
public void setUserId(String userId) throws InvalidValueException {
|
||||
setResourceSpecificProperty(USER_ID, userId);
|
||||
}
|
||||
|
||||
public String getOperationId() {
|
||||
return (String) this.resourceSpecificProperties.get(OPERATION_ID);
|
||||
}
|
||||
|
||||
public void setOperationId(String operationId) throws InvalidValueException {
|
||||
setResourceSpecificProperty(OPERATION_ID, operationId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
package org.gcube.accounting.datamodel.implementations;
|
||||
|
||||
import org.gcube.accounting.datamodel.RawUsageRecord;
|
||||
import org.gcube.accounting.exception.InvalidValueException;
|
||||
import org.gcube.common.validator.annotations.NotEmpty;
|
||||
|
||||
/**
|
||||
|
@ -39,4 +40,77 @@ public class ServiceUsageRecord extends RawUsageRecord {
|
|||
public ServiceUsageRecord(){
|
||||
super();
|
||||
}
|
||||
|
||||
public String getCallerIP() {
|
||||
return (String) this.resourceSpecificProperties.get(CALLER_IP);
|
||||
}
|
||||
|
||||
public void setCallerIP(String callerIP) throws InvalidValueException {
|
||||
setResourceSpecificProperty(CALLER_IP, callerIP);
|
||||
}
|
||||
|
||||
public String getCallerScope() {
|
||||
return (String) this.resourceSpecificProperties.get(CALLER_SCOPE);
|
||||
}
|
||||
|
||||
public void setCallerScope(String callerScope) throws InvalidValueException {
|
||||
setResourceSpecificProperty(CALLER_SCOPE, callerScope);
|
||||
}
|
||||
|
||||
public String getRefHost() {
|
||||
return (String) this.resourceSpecificProperties.get(REF_HOST);
|
||||
}
|
||||
|
||||
public void setRefHost(String refHost) throws InvalidValueException {
|
||||
setResourceSpecificProperty(REF_HOST, refHost);
|
||||
}
|
||||
|
||||
public String getRefVM() {
|
||||
return (String) this.resourceSpecificProperties.get(REF_VM);
|
||||
}
|
||||
|
||||
public void setRefVM(String refVM) throws InvalidValueException {
|
||||
setResourceSpecificProperty(REF_VM, refVM);
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return (String) this.resourceSpecificProperties.get(DOMAIN);
|
||||
}
|
||||
|
||||
public void setDomain(String domain) throws InvalidValueException {
|
||||
setResourceSpecificProperty(DOMAIN, domain);
|
||||
}
|
||||
|
||||
public String getInvocationCount() {
|
||||
return (String) this.resourceSpecificProperties.get(INVOCATION_COUNT);
|
||||
}
|
||||
|
||||
public void setInvocationCount(String invocationCount) throws InvalidValueException {
|
||||
setResourceSpecificProperty(INVOCATION_COUNT, invocationCount);
|
||||
}
|
||||
|
||||
public String getAverageInvocationTime() {
|
||||
return (String) this.resourceSpecificProperties.get(AVERAGE_INVOCATION_COUNT);
|
||||
}
|
||||
|
||||
public void setAverageInvocationTime(String averageInvocationTime) throws InvalidValueException {
|
||||
setResourceSpecificProperty(AVERAGE_INVOCATION_COUNT, averageInvocationTime);
|
||||
}
|
||||
|
||||
public String getServiceClass() {
|
||||
return (String) this.resourceSpecificProperties.get(SERVICE_CLASS);
|
||||
}
|
||||
|
||||
public void setServiceClass(String serviceClass) throws InvalidValueException {
|
||||
setResourceSpecificProperty(SERVICE_CLASS, serviceClass);
|
||||
}
|
||||
|
||||
public String getServiceName() {
|
||||
return (String) this.resourceSpecificProperties.get(SERVICE_NAME);
|
||||
}
|
||||
|
||||
public void setServiceName(String serviceName) throws InvalidValueException {
|
||||
setResourceSpecificProperty(SERVICE_NAME, serviceName);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
package org.gcube.accounting.datamodel.implementations;
|
||||
|
||||
import org.gcube.accounting.datamodel.RawUsageRecord;
|
||||
import org.gcube.accounting.exception.InvalidValueException;
|
||||
import org.gcube.common.validator.annotations.NotEmpty;
|
||||
|
||||
/**
|
||||
|
@ -31,4 +32,45 @@ public class StorageStatusUsageRecord extends RawUsageRecord {
|
|||
public StorageStatusUsageRecord(){
|
||||
super();
|
||||
}
|
||||
|
||||
public String getProviderId() {
|
||||
return (String) this.resourceSpecificProperties.get(PROVIDER_ID);
|
||||
}
|
||||
|
||||
public void setProviderId(String providerId) throws InvalidValueException {
|
||||
setResourceSpecificProperty(PROVIDER_ID, providerId);
|
||||
}
|
||||
|
||||
public String getQualifier() {
|
||||
return (String) this.resourceSpecificProperties.get(QUALIFIER);
|
||||
}
|
||||
|
||||
public void setQualifier(String qualifier) throws InvalidValueException {
|
||||
setResourceSpecificProperty(QUALIFIER, qualifier);
|
||||
}
|
||||
|
||||
public String getDataType() {
|
||||
return (String) this.resourceSpecificProperties.get(DATA_TYPE);
|
||||
}
|
||||
|
||||
public void setDataType(String dataType) throws InvalidValueException {
|
||||
setResourceSpecificProperty(DATA_TYPE, dataType);
|
||||
}
|
||||
|
||||
public String getDataVolume() {
|
||||
return (String) this.resourceSpecificProperties.get(DATA_VOLUME);
|
||||
}
|
||||
|
||||
public void setDataVolume(String dataVolume) throws InvalidValueException {
|
||||
setResourceSpecificProperty(DATA_VOLUME, dataVolume);
|
||||
}
|
||||
|
||||
public String getDataCount() {
|
||||
return (String) this.resourceSpecificProperties.get(DATA_COUNT);
|
||||
}
|
||||
|
||||
public void setDataCount(String dataCount) throws InvalidValueException {
|
||||
setResourceSpecificProperty(DATA_COUNT, dataCount);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,39 +3,54 @@
|
|||
*/
|
||||
package org.gcube.accounting.datamodel.implementations;
|
||||
|
||||
import org.gcube.accounting.datamodel.RawUsageRecord;
|
||||
import org.gcube.accounting.exception.InvalidValueException;
|
||||
import org.gcube.common.validator.annotations.NotEmpty;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class StorageUsageRecord extends RawUsageRecord {
|
||||
public class StorageUsageRecord extends StorageStatusUsageRecord {
|
||||
|
||||
/**
|
||||
* Generated Serial Version UID
|
||||
*/
|
||||
private static final long serialVersionUID = 1381025822586583326L;
|
||||
|
||||
@NotEmpty
|
||||
public static final String PROVIDER_ID = "providerId";
|
||||
@NotEmpty
|
||||
public static final String OBJECT_URI = "objectURI";
|
||||
@NotEmpty
|
||||
public static final String OPERATION_TYPE = "operationType";
|
||||
@NotEmpty
|
||||
public static final String QUALIFIER = "qualifier";
|
||||
@NotEmpty
|
||||
public static final String DATA_TYPE = "dataType";
|
||||
@NotEmpty
|
||||
public static final String DATA_VOLUME = "dataVolume";
|
||||
@NotEmpty
|
||||
public static final String DATA_COUNT = "dataCount";
|
||||
@NotEmpty
|
||||
public static final String CALLER_IP = "callerIP";
|
||||
|
||||
|
||||
public StorageUsageRecord(){
|
||||
super();
|
||||
}
|
||||
|
||||
public String getObjectURI() {
|
||||
return (String) this.resourceSpecificProperties.get(OBJECT_URI);
|
||||
}
|
||||
|
||||
public void setObjectURI(String objectURI) throws InvalidValueException {
|
||||
setResourceSpecificProperty(OBJECT_URI, objectURI);
|
||||
}
|
||||
|
||||
public String getOperationType() {
|
||||
return (String) this.resourceSpecificProperties.get(OPERATION_TYPE);
|
||||
}
|
||||
|
||||
public void setOperationType(String operationType) throws InvalidValueException {
|
||||
setResourceSpecificProperty(OPERATION_TYPE, operationType);
|
||||
}
|
||||
|
||||
public String getCallerIP() {
|
||||
return (String) this.resourceSpecificProperties.get(CALLER_IP);
|
||||
}
|
||||
|
||||
public void setCallerIP(String callerIP) throws InvalidValueException {
|
||||
setResourceSpecificProperty(CALLER_IP, callerIP);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
*/
|
||||
package org.gcube.accounting.datamodel.implementations;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.gcube.accounting.datamodel.RawUsageRecord;
|
||||
import org.gcube.accounting.exception.InvalidValueException;
|
||||
import org.gcube.common.validator.annotations.NotEmpty;
|
||||
|
||||
/**
|
||||
|
@ -17,6 +20,10 @@ public class TaskUsageRecord extends RawUsageRecord {
|
|||
*/
|
||||
private static final long serialVersionUID = -2208425042550641240L;
|
||||
|
||||
public static enum USAGE_PHASE {
|
||||
completed, failed
|
||||
};
|
||||
|
||||
@NotEmpty
|
||||
public static final String JOB_ID = "jobId";
|
||||
@NotEmpty
|
||||
|
@ -26,9 +33,9 @@ public class TaskUsageRecord extends RawUsageRecord {
|
|||
@NotEmpty
|
||||
public static final String DOMAIN = "domain";
|
||||
@NotEmpty
|
||||
public static final String USAGE_START = "usageStart";
|
||||
public static final String USAGE_START_TIME = "usageStartTime";
|
||||
@NotEmpty
|
||||
public static final String USAGE_END = "usageEnd";
|
||||
public static final String USAGE_END_TIME = "usageEndTime";
|
||||
@NotEmpty
|
||||
public static final String USAGE_PHASE = "usagePhase";
|
||||
@NotEmpty
|
||||
|
@ -53,4 +60,135 @@ public class TaskUsageRecord extends RawUsageRecord {
|
|||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Job Id
|
||||
*/
|
||||
public String getJobId() {
|
||||
return (String) this.resourceSpecificProperties.get(JOB_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jobId Job Id
|
||||
* @throws InvalidValueException if fails
|
||||
*/
|
||||
public void setJobId(String jobId) throws InvalidValueException {
|
||||
setResourceSpecificProperty(JOB_ID, jobId);
|
||||
}
|
||||
|
||||
public String getRefHost() {
|
||||
return (String) this.resourceSpecificProperties.get(REF_HOST);
|
||||
}
|
||||
|
||||
public void setRefHost(String refHost) throws InvalidValueException {
|
||||
setResourceSpecificProperty(REF_HOST, refHost);
|
||||
}
|
||||
|
||||
public String getRefVM() {
|
||||
return (String) this.resourceSpecificProperties.get(REF_VM);
|
||||
}
|
||||
|
||||
public void setRefVM(String refVM) throws InvalidValueException {
|
||||
setResourceSpecificProperty(REF_VM, refVM);
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return (String) this.resourceSpecificProperties.get(DOMAIN);
|
||||
}
|
||||
|
||||
public void setDomain(String domain) throws InvalidValueException {
|
||||
setResourceSpecificProperty(DOMAIN, domain);
|
||||
}
|
||||
|
||||
public Calendar getUsageStartTime() {
|
||||
long millis = (Long) this.resourceSpecificProperties.get(USAGE_START_TIME);
|
||||
return timestampStringToCalendar(millis);
|
||||
}
|
||||
|
||||
public void setUsageStartTime(Calendar usageStartTime) throws InvalidValueException {
|
||||
setResourceSpecificProperty(USAGE_START_TIME, usageStartTime.getTimeInMillis());
|
||||
|
||||
}
|
||||
|
||||
public Calendar getUsageEndTime() {
|
||||
long millis = (Long) this.resourceSpecificProperties.get(USAGE_END_TIME);
|
||||
return timestampStringToCalendar(millis);
|
||||
}
|
||||
|
||||
public void setUsageEndTime(Calendar usageEndTime) throws InvalidValueException {
|
||||
setResourceSpecificProperty(USAGE_END_TIME, usageEndTime.getTimeInMillis());
|
||||
|
||||
}
|
||||
|
||||
public USAGE_PHASE getUsagePhase() {
|
||||
return (USAGE_PHASE) this.resourceSpecificProperties.get(USAGE_PHASE);
|
||||
}
|
||||
|
||||
public void setUsagePhase(USAGE_PHASE usagePhase) throws InvalidValueException {
|
||||
setResourceSpecificProperty(USAGE_PHASE, usagePhase);
|
||||
}
|
||||
|
||||
public int getInputFilesNumber() {
|
||||
return (Integer) this.resourceSpecificProperties.get(INPUT_FILES_NUMBER);
|
||||
}
|
||||
|
||||
public void setInputFilesNumber(int inputFilesNumber) throws InvalidValueException {
|
||||
setResourceSpecificProperty(INPUT_FILES_NUMBER, inputFilesNumber);
|
||||
}
|
||||
|
||||
public long getInputFilesSize() {
|
||||
return (Long) this.resourceSpecificProperties.get(INPUT_FILES_SIZE);
|
||||
}
|
||||
|
||||
public void setInputFilesSize(long inputFilesSize) throws InvalidValueException {
|
||||
setResourceSpecificProperty(INPUT_FILES_SIZE, inputFilesSize);
|
||||
}
|
||||
|
||||
public int getOutputFilesNumber() {
|
||||
return (Integer) this.resourceSpecificProperties.get(OUTPUT_FILES_NUMBER);
|
||||
}
|
||||
|
||||
public void setOutputFilesNumber(int outputFilesNumber) throws InvalidValueException {
|
||||
setResourceSpecificProperty(OUTPUT_FILES_NUMBER, outputFilesNumber);
|
||||
}
|
||||
|
||||
public long getOutputFilesSize() {
|
||||
return (Long) this.resourceSpecificProperties.get(OUTPUT_FILES_SIZE);
|
||||
}
|
||||
|
||||
public void setOutputFilesSize(long outputFilesSize) throws InvalidValueException {
|
||||
setResourceSpecificProperty(OUTPUT_FILES_SIZE, outputFilesSize);
|
||||
}
|
||||
|
||||
public long getOverallNetworkIn() {
|
||||
return (Long) this.resourceSpecificProperties.get(OVERALL_NETWORK_IN);
|
||||
}
|
||||
|
||||
public void setOverallNetworkIn(long overallNetworkIn) throws InvalidValueException {
|
||||
setResourceSpecificProperty(OVERALL_NETWORK_IN, overallNetworkIn);
|
||||
}
|
||||
|
||||
public long getOverallNetworkOut() {
|
||||
return (Long) this.resourceSpecificProperties.get(OVERALL_NETWORK_OUT);
|
||||
}
|
||||
|
||||
public void setOverallNetworkOut(long overallNetworkOut) throws InvalidValueException {
|
||||
setResourceSpecificProperty(OVERALL_NETWORK_OUT, overallNetworkOut);
|
||||
}
|
||||
|
||||
public int getCores() {
|
||||
return (Integer) this.resourceSpecificProperties.get(CORES);
|
||||
}
|
||||
|
||||
public void setCores(int cores) throws InvalidValueException {
|
||||
setResourceSpecificProperty(CORES, cores);
|
||||
}
|
||||
|
||||
public int getProcessors() {
|
||||
return (Integer) this.resourceSpecificProperties.get(PROCESSORS);
|
||||
}
|
||||
|
||||
public void setProcessors(int processors) throws InvalidValueException {
|
||||
setResourceSpecificProperty(PROCESSORS, processors);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue