/** * */ 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; /** * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ * */ public class TaskUsageRecord extends RawUsageRecord { /** * Generated Serial Version UID */ private static final long serialVersionUID = -2208425042550641240L; public static enum USAGE_PHASE { completed, failed }; @NotEmpty public static final String JOB_ID = "jobId"; @NotEmpty public static final String REF_HOST = "refHost"; @NotEmpty public static final String REF_VM = "refVM"; @NotEmpty public static final String DOMAIN = "domain"; @NotEmpty public static final String USAGE_START_TIME = "usageStartTime"; @NotEmpty public static final String USAGE_END_TIME = "usageEndTime"; @NotEmpty public static final String USAGE_PHASE = "usagePhase"; @NotEmpty public static final String INPUT_FILES_NUMBER = "inputFilesNumber"; @NotEmpty public static final String INPUT_FILES_SIZE = "inputFilesSize"; @NotEmpty public static final String OUTPUT_FILES_NUMBER = "outputFilesNumber"; @NotEmpty public static final String OUTPUT_FILES_SIZE = "outputFilesSize"; @NotEmpty public static final String OVERALL_NETWORK_IN = "overallNetworkIn"; @NotEmpty public static final String OVERALL_NETWORK_OUT = "overallNetworkOut"; @NotEmpty public static final String CORES = "cores"; @NotEmpty public static final String PROCESSORS = "processors"; public TaskUsageRecord(){ 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); } }