GeodesySeries
- * object.
- *
- * @return A summary of the values of this object's fields
- */
- @Override
- public String toString() {
- return super.toString() +
- ",id=" + id +
- ",user=\"" + user + "\"" +
- ",name=\"" + name + "\"" +
- ",description=\"" + description + "\"";
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/auscope/portal/server/vegl/VGLDataPurchase.java b/src/main/java/org/auscope/portal/server/vegl/VGLDataPurchase.java
deleted file mode 100644
index 7721c235f..000000000
--- a/src/main/java/org/auscope/portal/server/vegl/VGLDataPurchase.java
+++ /dev/null
@@ -1,244 +0,0 @@
-package org.auscope.portal.server.vegl;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.FetchType;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.GenerationType;
-import jakarta.persistence.Id;
-import jakarta.persistence.JoinColumn;
-import jakarta.persistence.ManyToOne;
-import jakarta.persistence.Table;
-
-import org.auscope.portal.server.web.security.PortalUser;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * Simple class that stores user data purchase information
- * @author rob508
- *
- */
-@Entity
-@Table(name = "data_purchases")
-public class VGLDataPurchase implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Integer id;
-
- @Column(nullable=false)
- private Date date;
-
- @Column(nullable=false)
- private Float amount;
-
- @Column(nullable=false)
- private String downloadUrl;
-
- @Column(nullable=false)
- private String cswRecord;
-
- @Column(nullable=false)
- private String onlineResourceType;
-
- @Column(nullable=false)
- private String url;
-
- @Column(nullable=false)
- private String localPath;
-
- @Column(nullable=false)
- private String name;
-
- @Column(nullable=false)
- private String description;
-
- @Column(nullable=false)
- private Double northBoundLatitude;
-
- @Column(nullable=false)
- private Double southBoundLatitude;
-
- @Column(nullable=false)
- private Double eastBoundLongitude;
-
- @Column(nullable=false)
- private Double westBoundLongitude;
-
- @Column(nullable=false)
- private String paymentRecord;
-
- /** The user who made the purchase */
- @JsonIgnore
- @ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "userId")
- private PortalUser parent;
-
- public VGLDataPurchase() {
- super();
- }
-
- public VGLDataPurchase(Date date, Float amount, String downloadUrl, String cswRecord, String onlineResourceType, String url, String localPath, String name, String description,
- Double northBoundLatitude, Double southBoundLatitude, Double eastBoundLongitude, Double westBoundLongitude, String paymentRecord,
- PortalUser user) {
- super();
- this.date = date;
- this.amount = amount;
- this.downloadUrl = downloadUrl;
- this.cswRecord = cswRecord;
- this.onlineResourceType = onlineResourceType;
- this.url = url;
- this.localPath = localPath;
- this.name = name;
- this.description = description;
- this.northBoundLatitude = northBoundLatitude;
- this.southBoundLatitude = southBoundLatitude;
- this.eastBoundLongitude = eastBoundLongitude;
- this.westBoundLongitude = westBoundLongitude;
- this.paymentRecord = paymentRecord;
- this.parent = user;
- }
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public Date getDate() {
- return date;
- }
-
- public void setDate(Date date) {
- this.date = date;
- }
-
- public String getDownloadUrl() {
- return downloadUrl;
- }
-
- public void setDownloadUrl(String downloadUrl) {
- this.downloadUrl = downloadUrl;
- }
-
- public Float getAmount() {
- return amount;
- }
-
- public void setAmount(Float amount) {
- this.amount = amount;
- }
-
- public String getCswRecord() {
- return cswRecord;
- }
-
- public void setCswRecord(String cswRecord) {
- this.cswRecord = cswRecord;
- }
-
- public String getOnlineResourceType() {
- return onlineResourceType;
- }
-
- public void setOnlineResourceType(String onlineResourceType) {
- this.onlineResourceType = onlineResourceType;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getLocalPath() {
- return localPath;
- }
-
- public void setLocalPath(String localPath) {
- this.localPath = localPath;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Double getNorthBoundLatitude() {
- return northBoundLatitude;
- }
-
- public void setNorthBoundLatitude(Double northBoundLatitude) {
- this.northBoundLatitude = northBoundLatitude;
- }
-
- public Double getSouthBoundLatitude() {
- return southBoundLatitude;
- }
-
- public void setSouthBoundLatitude(Double southBoundLatitude) {
- this.southBoundLatitude = southBoundLatitude;
- }
-
- public Double getEastBoundLongitude() {
- return eastBoundLongitude;
- }
-
- public void setEastBoundLongitude(Double eastBoundLongitude) {
- this.eastBoundLongitude = eastBoundLongitude;
- }
-
- public Double getWestBoundLongitude() {
- return westBoundLongitude;
- }
-
- public void setWestBoundLongitude(Double westBoundLongitude) {
- this.westBoundLongitude = westBoundLongitude;
- }
-
- public String getPaymentRecord() {
- return this.paymentRecord;
- }
-
- public void setPaymentRecord(String paymentRecord) {
- this.paymentRecord = paymentRecord;
- }
-
- /**
- * User that made the purchases
- * @return
- */
- public PortalUser getParent() {
- return parent;
- }
-
- /**
- * User that made the purchases
- * @param parent
- */
- public void setParent(PortalUser parent) {
- this.parent = parent;
- }
-
-}
diff --git a/src/main/java/org/auscope/portal/server/vegl/VGLJobAuditLog.java b/src/main/java/org/auscope/portal/server/vegl/VGLJobAuditLog.java
deleted file mode 100644
index ba930a5b3..000000000
--- a/src/main/java/org/auscope/portal/server/vegl/VGLJobAuditLog.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.auscope.portal.server.vegl;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import jakarta.persistence.Entity;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.GenerationType;
-import jakarta.persistence.Id;
-import jakarta.persistence.Table;
-
-/**
- * A simple POJO class that stores a job life cycle transition
- * information for auditing purposes.
- *
- * @author Richard Goh
- */
-@Entity
-@Table(name = "jobs_audit_log")
-public class VGLJobAuditLog implements Serializable {
-
- /**
- * Generated on 2012-09-24
- */
- private static final long serialVersionUID = -1762982566490775865L;
-
- /** The primary key for this parameter*/
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Integer id;
- /** The id of the job that owns this parameter*/
- private Integer jobId;
- /** The descriptive status of the job before its status change */
- private String fromStatus;
- /** The descriptive status of the job after its status change */
- private String toStatus;
- /** The date & time when this job changed its status*/
- private Date transitionDate;
- /** An optional job transition audit log */
- private String message;
-
-
- /**
- * Default constructor.
- */
- public VGLJobAuditLog() {
- }
-
- /**
- * @return the id
- */
- public Integer getId() {
- return id;
- }
-
- /**
- * @param id the id to set
- */
- public void setId(Integer id) {
- this.id = id;
- }
-
- /**
- * @return the jobId
- */
- public Integer getJobId() {
- return jobId;
- }
-
- /**
- * @param jobId the jobId to set
- */
- public void setJobId(Integer jobId) {
- this.jobId = jobId;
- }
-
- /**
- * @return the fromStatus
- */
- public String getFromStatus() {
- return fromStatus;
- }
-
- /**
- * @param fromStatus the fromStatus to set
- */
- public void setFromStatus(String fromStatus) {
- this.fromStatus = fromStatus;
- }
-
- /**
- * @return the toStatus
- */
- public String getToStatus() {
- return toStatus;
- }
-
- /**
- * @param toStatus the toStatus to set
- */
- public void setToStatus(String toStatus) {
- this.toStatus = toStatus;
- }
-
- /**
- * @return the transitionDate
- */
- public Date getTransitionDate() {
- return transitionDate;
- }
-
- /**
- * @param transitionDate the transitionDate to set
- */
- public void setTransitionDate(Date transitionDate) {
- this.transitionDate = transitionDate;
- }
-
- /**
- * @return the message
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * @param message the message to set
- */
- public void setMessage(String message) {
- this.message = message;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/auscope/portal/server/vegl/VGLJobPurchase.java b/src/main/java/org/auscope/portal/server/vegl/VGLJobPurchase.java
deleted file mode 100644
index dc6a46734..000000000
--- a/src/main/java/org/auscope/portal/server/vegl/VGLJobPurchase.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package org.auscope.portal.server.vegl;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.FetchType;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.GenerationType;
-import jakarta.persistence.Id;
-import jakarta.persistence.JoinColumn;
-import jakarta.persistence.ManyToOne;
-import jakarta.persistence.Table;
-
-import org.auscope.portal.server.web.security.PortalUser;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * Simple class that stores user job purchase information
- * @author rob508
- *
- */
-@Entity
-@Table(name = "job_purchases")
-public class VGLJobPurchase implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Integer id;
-
- @Column(nullable=false)
- private Date date;
-
- @Column(nullable=false)
- private Float amount;
-
- @Column(nullable=false)
- private Integer jobId;
-
- @Column(nullable=false)
- private String jobName;
-
- @Column(nullable=false)
- private String paymentRecord;
-
- /** The user who made the purchase */
- @JsonIgnore
- @ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "userId")
- private PortalUser parent;
-
- public VGLJobPurchase() {
- super();
- }
-
- public VGLJobPurchase(Date date, Float amount, Integer jobId, String jobName,
- String paymentRecord, PortalUser user) {
- super();
- this.date = date;
- this.amount = amount;
- this.jobId = jobId;
- this.jobName = jobName;
- this.paymentRecord = paymentRecord;
- this.parent = user;
- }
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public Date getDate() {
- return date;
- }
-
- public void setDate(Date date) {
- this.date = date;
- }
-
- public Float getAmount() {
- return amount;
- }
-
- public void setAmount(Float amount) {
- this.amount = amount;
- }
-
- public Integer getJobId() {
- return jobId;
- }
-
- public void setJobId(Integer jobId) {
- this.jobId = jobId;
- }
-
- public String getJobName() {
- return jobName;
- }
-
- public void setJobName(String jobName) {
- this.jobName = jobName;
- }
-
- public String getPaymentRecord() {
- return this.paymentRecord;
- }
-
- public void setPaymentRecord(String paymentRecord) {
- this.paymentRecord = paymentRecord;
- }
-
- /**
- * User that made the purchases
- * @return
- */
- public PortalUser getParent() {
- return parent;
- }
-
- /**
- * User that made the purchases
- * @param parent
- */
- public void setParent(PortalUser parent) {
- this.parent = parent;
- }
-
-}
diff --git a/src/main/java/org/auscope/portal/server/vegl/VGLJobStatusAndLogReader.java b/src/main/java/org/auscope/portal/server/vegl/VGLJobStatusAndLogReader.java
deleted file mode 100644
index 02257f315..000000000
--- a/src/main/java/org/auscope/portal/server/vegl/VGLJobStatusAndLogReader.java
+++ /dev/null
@@ -1,296 +0,0 @@
-package org.auscope.portal.server.vegl;
-
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
-import java.util.Date;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.io.IOUtils;
-import org.auscope.portal.core.cloud.CloudFileInformation;
-import org.auscope.portal.core.cloud.CloudJob;
-import org.auscope.portal.core.services.PortalServiceException;
-import org.auscope.portal.core.services.cloud.CloudComputeService;
-import org.auscope.portal.core.services.cloud.CloudStorageService;
-import org.auscope.portal.core.services.cloud.monitor.JobStatusReader;
-import org.auscope.portal.core.util.FileIOUtil;
-import org.auscope.portal.server.web.controllers.BaseCloudController;
-import org.auscope.portal.server.web.controllers.JobBuilderController;
-import org.auscope.portal.server.web.controllers.JobListController;
-import org.auscope.portal.server.web.security.NCIDetails;
-import org.auscope.portal.server.web.service.CloudSubmissionService;
-import org.springframework.ui.ModelMap;
-
-public class VGLJobStatusAndLogReader extends BaseCloudController implements JobStatusReader {
-
-
- private CloudSubmissionService cloudSubmissionService;
-
- public VGLJobStatusAndLogReader() {
- super(null, null, null);
- }
-
- public VGLJobStatusAndLogReader(VEGLJobManager jobManager,
- CloudStorageService[] cloudStorageServices,
- CloudComputeService[] cloudComputeServices) {
- super(cloudStorageServices, cloudComputeServices, jobManager);
- }
-
- public CloudSubmissionService getCloudSubmissionService() {
- return cloudSubmissionService;
- }
-
- public void setCloudSubmissionService(CloudSubmissionService cloudSubmissionService) {
- this.cloudSubmissionService = cloudSubmissionService;
- }
-
- /**
- * Gets a pre parsed version of the internal logs. The resulting object will
- * contain the logs sectioned into 'named sections' e.g.: Section for python code,
- * section for environment etc.
- *
- * Will always contain a single section called "Full" containing the un-sectioned
- * original log.
- *
- * @param job
- * @return
- */
- public ModelMap getSectionedLogs(VEGLJob job) throws PortalServiceException {
- return getSectionedLogs(job, JobListController.VL_LOG_FILE);
- }
-
- /**
- * Gets a pre parsed version of the specified log file. The resulting object will
- * contain the logs sectioned into 'named sections' e.g.: Section for python code,
- * section for environment etc.
- *
- * Will always contain a single section called "Full" containing the un-sectioned
- * original log.
- *
- * @param job
- * @return
- */
- public ModelMap getSectionedLogs(VEGLJob job, String logFile) throws PortalServiceException {
- CloudStorageService cloudStorageService = getStorageService(job);
- if (cloudStorageService == null) {
- throw new PortalServiceException(
- "The specified job doesn't have a storage service.",
- "Please ensure you have chosen a storage provider for the job.");
- }
-
- //Download the logs from cloud storage
- String logContents = null;
- InputStream is = null;
- try {
- is = cloudStorageService.getJobFile(job, logFile);
- logContents = IOUtils.toString(is, StandardCharsets.UTF_8);
- } catch (Exception ex) {
- log.debug(String.format("The job %1$s hasn't uploaded %2$s yet", job.getId(), logFile));
- } finally {
- FileIOUtil.closeQuietly(is);
- }
-
- //If we fail at that, download direct from the running instance
- if (logContents == null) {
- CloudComputeService compute = getComputeService(job);
- if (compute == null) {
- throw new PortalServiceException(
- "The specified job doesn't have a compute service.",
- "Please ensure you have chosen a compute provider for the job.");
- }
-
- logContents = compute.getConsoleLog(job);
- if (logContents == null) {
- throw new PortalServiceException("The specified job hasn't uploaded any logs yet");
- }
- }
-
- ModelMap namedSections = new ModelMap();
- namedSections.put("Full", logContents); //always include the full log
-
- //Iterate through looking for start/end matches. All text between a start/end
- //tag will be snipped out and used in their own region/section
- Pattern p = Pattern.compile("^#### (.*) (.+) ####$[\\n\\r]*", Pattern.MULTILINE);
- Matcher m = p.matcher(logContents);
- int start = 0;
- String currentSectionName = null;
- while (m.find()) {
- String sectionName = m.group(1);
- String delimiter = m.group(2);
-
- //On a new match - record the location and name
- if (delimiter.equals("start")) {
- start = m.end();
- currentSectionName = sectionName;
- } else if (delimiter.equals("end")) {
- //On a closing pattern - ensure we are closing the current region (we don't support nesting)
- //Take the snippet of text and store it in our result map
- if (sectionName.equals(currentSectionName)) {
- String regionText = logContents.substring(start, m.start());
- namedSections.put(sectionName, regionText);
- currentSectionName = null;
- start = 0;
- }
- }
- }
-
- //We have an unfinished section... let's include it anyway
- if (currentSectionName != null) {
- String regionText = logContents.substring(start);
- namedSections.put(currentSectionName, regionText);
- }
-
- return namedSections;
- }
-
- /**
- *
- * @param job
- * @param sectionName
- * @return null if it doesn't have any log
- */
- public String getSectionedLog(VEGLJob job, String sectionName) {
- try {
- ModelMap sectLogs = getSectionedLogs(job);
- return (String)sectLogs.get(sectionName);
- } catch (PortalServiceException ex) {
- log.debug(ex.getMessage());
- return null;
- }
- }
-
- /**
- * Using the services internal to the class, determine the current status of this job. Service failure
- * will return the underlying job status
- */
- @Override
- public String getJobStatus(CloudJob cloudJob) {
-
- String stsArn = cloudJob.getProperty(CloudJob.PROPERTY_STS_ARN);
- String clientSecret = cloudJob.getProperty(CloudJob.PROPERTY_CLIENT_SECRET);
- String s3Role = cloudJob.getProperty(CloudJob.PROPERTY_S3_ROLE);
- String nciUser = cloudJob.getProperty(NCIDetails.PROPERTY_NCI_USER);
- String nciProj = cloudJob.getProperty(NCIDetails.PROPERTY_NCI_PROJECT);
- String nciKey = cloudJob.getProperty(NCIDetails.PROPERTY_NCI_KEY);
-
-
- //The service hangs onto the underlying job Object but the DB is the point of truth
- //Make sure we get an updated job object first!
- VEGLJob job = jobManager.getJobById(cloudJob.getId(), stsArn, clientSecret, s3Role, cloudJob.getEmailAddress(), nciUser, nciProj, nciKey);
- if (job == null) {
- return null;
- }
-
- CloudComputeService cloudComputeService = getComputeService(job);
- if (cloudComputeService == null) {
- if( ! "Saved".equalsIgnoreCase(job.getStatus())) {
- log.warn(String.format("No cloud storage service with id '%1$s' for job '%2$s'. cannot update job status", job.getComputeServiceId(), job.getId()));
- }
- return job.getStatus();
- }
-
- //If we are provisioning BUT the cloudSubmissionService has no record of the provisioning then we may have problems
- if (job.getStatus().equals(JobBuilderController.STATUS_PROVISION) &&
- !cloudSubmissionService.isSubmitting(job, cloudComputeService)) {
-
- //Just to rule out a possible race condition - get the latest copy of the job from the DB to rule out the possibility
- //of a state transition occuring since the last refresh (no state transition can occur once isSubmitting returns false)
- job = jobManager.getJobById(cloudJob.getId(), stsArn, clientSecret, s3Role, cloudJob.getEmailAddress(), nciUser, nciProj, nciKey);
- if (job.getStatus().equals(JobBuilderController.STATUS_PROVISION)) {
- //if after all that we are confident that provisioning has failed AND the status still says provisioning, update to ERROR
- return JobBuilderController.STATUS_ERROR;
- }
- }
-
- //Some states are terminated states, do absolutely nothing
- //Other states are managed by the JobBuilder
- if (job.getStatus().equals(JobBuilderController.STATUS_DONE) ||
- job.getStatus().equals(JobBuilderController.STATUS_UNSUBMITTED) ||
- job.getStatus().equals(JobBuilderController.STATUS_INQUEUE) ||
- job.getStatus().equals(JobBuilderController.STATUS_ERROR)||
- job.getStatus().equals(JobBuilderController.STATUS_WALLTIME_EXCEEDED) ||
- job.getStatus().equals(JobBuilderController.STATUS_PROVISION) ||
- job.getStatus().equals(JobBuilderController.STATUS_INQUEUE)) {
- return job.getStatus();
- }
-
- //Get the output files for this job
- CloudStorageService cloudStorageService = getStorageService(job);
- if (cloudStorageService == null) {
- log.warn(String.format("No cloud storage service with id '%1$s' for job '%2$s'. cannot update job status", job.getStorageServiceId(), job.getId()));
- return job.getStatus();
- }
- CloudFileInformation[] results = null;
- try {
- results = cloudStorageService.listJobFiles(job);
- } catch (Exception e) {
- log.error("Error listing job files for job " + job.getId() + ":" + e.getMessage());
- log.debug("Exception:", e);
- return job.getStatus();
- }
-
- boolean jobStarted = containsFile(results, "workflow-version.txt");
- boolean jobFinished = containsFile(results, JobListController.VL_TERMINATION_FILE);
- // VM side walltime exceeded
- boolean jobWalltimeExceeded = containsFile(results, "walltime-exceeded.txt");
-
- String expectedStatus = JobBuilderController.STATUS_PENDING;
- if (jobFinished) {
- expectedStatus = JobBuilderController.STATUS_DONE;
- } else if (jobStarted) {
- expectedStatus = JobBuilderController.STATUS_ACTIVE;
- } else if(jobWalltimeExceeded) {
- expectedStatus = JobBuilderController.STATUS_WALLTIME_EXCEEDED;
- }
-
- // If the walltime has exceeded and the VM side walltime check has
- // failed to shut the instance down, shut it down
- if(jobStarted && !jobFinished && job.isWalltimeSet()) {
- if(job.getSubmitDate().getTime() + (job.getWalltime()*60*1000) < new Date().getTime()) {
- try {
- cloudComputeService.terminateJob(job);
- return JobBuilderController.STATUS_WALLTIME_EXCEEDED;
- } catch(Exception e) {
- log.warn("Exception shutting down terminal: " + job.toString(), e);
- return JobBuilderController.STATUS_WALLTIME_EXCEEDED;
- }
- }
- }
-
- //There is also a possibility that the cloud has had issues booting the VM... lets see what we can dig up
- try {
- switch (cloudComputeService.getJobStatus(job)) {
- case Missing:
- if (jobFinished) {
- return JobBuilderController.STATUS_DONE;
- } else if (jobWalltimeExceeded) {
- return JobBuilderController.STATUS_WALLTIME_EXCEEDED;
- } else {
- return JobBuilderController.STATUS_ERROR;
- }
- case Pending:
- case Running:
- return expectedStatus;
- }
- } catch (Exception ex) {
- log.warn("Exception looking up job VM status:" + job.toString(), ex);
- return job.getStatus();
- }
-
- return expectedStatus;
- }
-
- private static boolean containsFile(CloudFileInformation[] files, String fileName) {
- if (files == null) {
- return false;
- }
-
- for (CloudFileInformation file : files) {
- if (file.getName().endsWith(fileName) && file.getSize() > 0) {
- return true;
- }
- }
-
- return false;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/auscope/portal/server/vegl/VLScmSnapshot.java b/src/main/java/org/auscope/portal/server/vegl/VLScmSnapshot.java
deleted file mode 100644
index ac6acdda7..000000000
--- a/src/main/java/org/auscope/portal/server/vegl/VLScmSnapshot.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.auscope.portal.server.vegl;
-
-import java.io.Serializable;
-
-import jakarta.persistence.Entity;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.GenerationType;
-import jakarta.persistence.Id;
-
-@Entity
-//@Table() No table currently - legacy
-public class VLScmSnapshot implements Serializable {
-
- private static final long serialVersionUID = -6638880820028925202L;
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Integer id;
-
- private String scmEntryId;
- private String computeVmId;
- private String computeServiceId;
-
- protected VLScmSnapshot() {
- }
-
- public VLScmSnapshot(Integer id) {
- this.id = id;
- }
-
- public Integer getId() {
- return id;
- }
-
- protected void setId(Integer id) {
- this.id = id;
- }
-
- public String getScmEntryId() {
- return scmEntryId;
- }
-
- public void setScmEntryId(String scmEntryId) {
- this.scmEntryId = scmEntryId;
- }
-
- public String getComputeVmId() {
- return computeVmId;
- }
-
- public void setComputeVmId(String computeVmId) {
- this.computeVmId = computeVmId;
- }
-
- public String getComputeServiceId() {
- return computeServiceId;
- }
-
- public void setComputeServiceId(String computeServiceId) {
- this.computeServiceId = computeServiceId;
- }
-}
diff --git a/src/main/java/org/auscope/portal/server/vegl/VglDownload.java b/src/main/java/org/auscope/portal/server/vegl/VglDownload.java
deleted file mode 100644
index faa35e071..000000000
--- a/src/main/java/org/auscope/portal/server/vegl/VglDownload.java
+++ /dev/null
@@ -1,296 +0,0 @@
-package org.auscope.portal.server.vegl;
-
-import java.io.Serializable;
-
-import jakarta.persistence.Entity;
-import jakarta.persistence.FetchType;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.GenerationType;
-import jakarta.persistence.Id;
-import jakarta.persistence.JoinColumn;
-import jakarta.persistence.ManyToOne;
-import jakarta.persistence.Table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * Represents a remote file download step that occurs during a VL job startup
- * @author Josh Vote
- *
- */
-@Entity
-@Table(name="downloads")
-public class VglDownload implements Serializable, Cloneable {
- private static final long serialVersionUID = 5436097345907506395L;
-
- /** The primary key for this download*/
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Integer id;
- /** The descriptive name of this download*/
- private String name;
- /** The long description for this download*/
- private String description;
- /** The actual URL that when accessed with a GET request will download data*/
- private String url;
- /** Where the downloaded data (on the job VM) will be downloaded to*/
- private String localPath;
- /** If this download is for a spatial region this will represent the most northern bounds of the region in WGS:84*/
- private Double northBoundLatitude;
- /** If this download is for a spatial region this will represent the most southern bounds of the region in WGS:84*/
- private Double southBoundLatitude;
- /** If this download is for a spatial region this will represent the most eastern bounds of the region in WGS:84*/
- private Double eastBoundLongitude;
- /** If this download is for a spatial region this will represent the most western bounds of the region in WGS:84*/
- private Double westBoundLongitude;
- /** The job that owns this download*/
- @JsonIgnore
- @ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "jobId")
- private VEGLJob parent;
-
- /*
- * Removing these as can't see they're used and not defined in database,
- * also affects JobDownloadController, TestJobDownloadController
- */
- /** Organisation or person responsible for this data set */
- //private String owner;
- /** Url of the data this is a subset of (if applicable) */
- //private String parentUrl;
- /** Name of the data this is a subset of (if applicable) */
- //private String parentName;
-
-
- /**
- * Default constructor
- */
- public VglDownload() {
- this(null);
- }
-
- /**
- *
- * @param id The primary key for this download
- */
- public VglDownload(Integer id) {
- super();
- this.id = id;
- }
-
- /**
- * The primary key for this download
- * @return
- */
- public Integer getId() {
- return id;
- }
-
- /**
- * The primary key for this download
- * @param id
- */
- public void setId(Integer id) {
- this.id = id;
- }
-
- /**
- * The descriptive name of this download
- * @return
- */
- public String getName() {
- return name;
- }
-
- /**
- * The descriptive name of this download
- * @param name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * The long description for this download
- * @return
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * The long description for this download
- * @param description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * The actual URL that when accessed with a GET request will download data
- * @return
- */
- public String getUrl() {
- return url;
- }
-
- /**
- * The actual URL that when accessed with a GET request will download data
- * @param url
- */
- public void setUrl(String url) {
- this.url = url;
- }
-
- /**
- * Where the downloaded data (on the job VM) will be downloaded to
- * @return
- */
- public String getLocalPath() {
- return localPath;
- }
-
- /**
- * Where the downloaded data (on the job VM) will be downloaded to
- * @param localPath
- */
- public void setLocalPath(String localPath) {
- this.localPath = localPath;
- }
-
- /**
- * If this download is for a spatial region this will represent the most northern bounds of the region in WGS:84
- * @return
- */
- public Double getNorthBoundLatitude() {
- return northBoundLatitude;
- }
-
- /**
- * If this download is for a spatial region this will represent the most northern bounds of the region in WGS:84
- * @param northBoundLatitude
- */
- public void setNorthBoundLatitude(Double northBoundLatitude) {
- this.northBoundLatitude = northBoundLatitude;
- }
-
- /**
- * If this download is for a spatial region this will represent the most southern bounds of the region in WGS:84
- * @return
- */
- public Double getSouthBoundLatitude() {
- return southBoundLatitude;
- }
-
- /**
- * If this download is for a spatial region this will represent the most southern bounds of the region in WGS:84
- * @param southBoundLatitude
- */
- public void setSouthBoundLatitude(Double southBoundLatitude) {
- this.southBoundLatitude = southBoundLatitude;
- }
-
- /**
- * If this download is for a spatial region this will represent the most eastern bounds of the region in WGS:84
- * @return
- */
- public Double getEastBoundLongitude() {
- return eastBoundLongitude;
- }
-
- /**
- * If this download is for a spatial region this will represent the most eastern bounds of the region in WGS:84
- * @param eastBoundLongitude
- */
- public void setEastBoundLongitude(Double eastBoundLongitude) {
- this.eastBoundLongitude = eastBoundLongitude;
- }
-
- /**
- * If this download is for a spatial region this will represent the most western bounds of the region in WGS:84
- * @return
- */
- public Double getWestBoundLongitude() {
- return westBoundLongitude;
- }
-
- /**
- * If this download is for a spatial region this will represent the most western bounds of the region in WGS:84
- * @param westBoundLongitude
- */
- public void setWestBoundLongitude(Double westBoundLongitude) {
- this.westBoundLongitude = westBoundLongitude;
- }
-
- /*
- public String getOwner() {
- return owner;
- }
-
- public void setOwner(String owner) {
- this.owner = owner;
- }
-
- public String getParentUrl() {
- return parentUrl;
- }
-
- public void setParentUrl(String parentUrl) {
- this.parentUrl = parentUrl;
- }
-
- public String getParentName() {
- return parentName;
- }
-
- public void setParentName(String parentName) {
- this.parentName = parentName;
- }
- */
-
- /**
- * The job that owns this download
- * @return
- */
- public VEGLJob getParent() {
- return parent;
- }
-
- /**
- * The job that owns this download
- * @param parent
- */
- public void setParent(VEGLJob parent) {
- this.parent = parent;
- }
-
- @Override
- public Object clone() {
- try {
- return super.clone();
- } catch (CloneNotSupportedException e) {
- return null;
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null) {
- return false;
- }
-
- if (!(obj instanceof VglDownload)) {
- return false;
- }
-
- return this.id.equals(((VglDownload)obj).id);
- }
-
- @Override
- public int hashCode() {
- return this.id.hashCode();
- }
-}
diff --git a/src/main/java/org/auscope/portal/server/vegl/VglMachineImage.java b/src/main/java/org/auscope/portal/server/vegl/VglMachineImage.java
deleted file mode 100644
index 2efd6fa71..000000000
--- a/src/main/java/org/auscope/portal/server/vegl/VglMachineImage.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.auscope.portal.server.vegl;
-
-import org.auscope.portal.core.cloud.MachineImage;
-
-/**
- * Represents a single virtual machine image that can be used for spawning worker instances.
- *
- * Extends the original concept to include security permissions
- * @author Josh Vote
- *
- */
-public class VglMachineImage extends MachineImage {
-
- private static final long serialVersionUID = 2136324684785829825L;
-
- /** List of roles that have been given the permission to use this image */
- private String[] permissions;
-
- /**
- * Creates a new VglMachineImage object
- * @param imageId
- */
- public VglMachineImage(String imageId) {
- super(imageId);
- }
-
- /**
- * List of roles that have been given the permission to use this image
- * @return
- */
- public String[] getPermissions() {
- return permissions;
- }
-
- /**
- * List of roles that have been given the permission to use this image
- * @param permissions
- */
- public void setPermissions(String[] permissions) {
- this.permissions = permissions;
- }
-}
diff --git a/src/main/java/org/auscope/portal/server/vegl/VglParameter.java b/src/main/java/org/auscope/portal/server/vegl/VglParameter.java
deleted file mode 100644
index 5bd55bfd7..000000000
--- a/src/main/java/org/auscope/portal/server/vegl/VglParameter.java
+++ /dev/null
@@ -1,204 +0,0 @@
-package org.auscope.portal.server.vegl;
-
-import java.io.Serializable;
-
-import jakarta.persistence.Entity;
-import jakarta.persistence.FetchType;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.GenerationType;
-import jakarta.persistence.Id;
-import jakarta.persistence.JoinColumn;
-import jakarta.persistence.ManyToOne;
-import jakarta.persistence.Table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-
-
-/**
- * A Job Parameter is a single 'typed' (very loosely) key/value pairing.
- *
- * A typical Job will have one or more parameter values created as the job is constructed. The parameter
- * set is made available to any job scripts that get run
- *
- * @author Josh Vote
- *
- */
-@Entity
-@Table(name="parameters")
-public class VglParameter implements Serializable, Cloneable {
-
- private static final long serialVersionUID = -7474027234400180238L;
-
- /**
- * The different types of parameter types
- * @author Josh Vote
- */
- public enum ParameterType {
- string,
- number
- }
-
- /** The primary key for this parameter*/
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Integer id;
-
- /** The name of this parameter*/
- private String name;
-
- /** The value (as a string) of this parameter*/
- private String value;
-
- /** The 'type' of this parameter. Can be 'number' or 'string'*/
- private String type;
- /** The job that owns this parameter*/
-
- @JsonIgnore
- @ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "jobId")
- private VEGLJob parent;
-
-
- /**
- * Default constructor
- */
- public VglParameter() {
- this(null, null);
- }
-
- /**
- * Default constructor
- */
- public VglParameter(Integer id, String name) {
- this(id, name, null, null);
- }
-
- /**
- * Construct a fully populated instance
- */
- public VglParameter(Integer id, String name, String value, String type) {
- this(id, name, value, type, null);
- }
-
- /**
- * Construct a fully populated instance
- */
- public VglParameter(Integer id, String name, String value, String type, VEGLJob parent) {
- super();
- this.id = id;
- this.name = name;
- this.type = type;
- this.value = value;
- this.parent = parent;
- }
-
- /**
- * The primary key for this parameter
- * @return
- */
- public Integer getId() {
- return id;
- }
-
- /**
- * The primary key for this parameter
- * @param id
- */
- public void setId(Integer id) {
- this.id = id;
- }
-
- /**
- * The name of this parameter
- * @return
- */
- public String getName() {
- return name;
- }
-
- /**
- * The name of this parameter
- * @param name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * The value (as a string) of this parameter
- * @return
- */
- public String getValue() {
- return value;
- }
-
- /**
- * The value (as a string) of this parameter
- * @param value
- */
- public void setValue(String value) {
- this.value = value;
- }
-
- /**
- * The 'type' of this parameter. Can be 'number' or 'string'
- * @return
- */
- public String getType() {
- return type;
- }
-
- /**
- * The 'type' of this parameter. Can be 'number' or 'string'
- * @param type
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * The job that owns this parameter
- * @return
- */
- public VEGLJob getParent() {
- return parent;
- }
-
- /**
- * The job that owns this parameter
- * @param parent
- */
- public void setParent(VEGLJob parent) {
- this.parent = parent;
- }
-
- /**
- * Tests two VglJobParameter objects for equality based on job id and name
- */
- @Override
- public boolean equals(Object o) {
- if (o instanceof VglParameter) {
- return this.parent.getId().equals(((VglParameter) o).parent.getId()) && this.name.equals(((VglParameter) o).name);
- }
-
- return false;
- }
-
- /**
- * Gets a hashcode based of the job id and name parameters;
- */
- @Override
- public int hashCode() {
- return name.hashCode() ^ parent.getId().hashCode();
- }
-
- @Override
- public Object clone() {
- try {
- return super.clone();
- } catch (CloneNotSupportedException e) {
- return null;
- }
- }
-}
diff --git a/src/main/java/org/auscope/portal/server/vegl/mail/JobCompletionMailSender.java b/src/main/java/org/auscope/portal/server/vegl/mail/JobCompletionMailSender.java
deleted file mode 100644
index 022e8fb93..000000000
--- a/src/main/java/org/auscope/portal/server/vegl/mail/JobCompletionMailSender.java
+++ /dev/null
@@ -1,293 +0,0 @@
-package org.auscope.portal.server.vegl.mail;
-
-import java.io.StringWriter;
-import java.util.Date;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.VelocityEngine;
-import org.auscope.portal.core.util.DateUtil;
-import org.auscope.portal.core.util.TextUtil;
-import org.auscope.portal.server.vegl.VEGLJob;
-import org.auscope.portal.server.vegl.VEGLJobManager;
-import org.auscope.portal.server.vegl.VEGLSeries;
-import org.auscope.portal.server.vegl.VGLJobStatusAndLogReader;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.mail.MailSender;
-import org.springframework.mail.SimpleMailMessage;
-
-/**
- * A concrete implementation of JobMailServer interface
- * that responsible for constructing and sending out
- * job completion notification.
- *
- * @author Richard Goh
- */
-public class JobCompletionMailSender implements JobMailSender {
- private final Log LOG = LogFactory.getLog(getClass());
-
- //Properties that get injected thru constructor
- private VEGLJobManager jobManager;
- private VGLJobStatusAndLogReader jobStatLogReader;
- private MailSender mailSender;
- private VelocityEngine velocityEngine;
-
- //Properties that get injected thru setter methods
- private String template;
- private String dateFormat;
- private int maxLengthForSeriesNameInSubject;
- private int maxLengthForJobNameInSubject;
- private int maxLinesForTail;
- private String emailSender;
- private String emailSubject;
-
- private String portalUrl=null;
-
- /**
- * @return the portalUrl
- */
- public String getPortalUrl() {
- return portalUrl;
- }
-
- /**
- * @param portalUrl the portalUrl to set
- */
- public void setPortalUrl(String portalUrl) {
- this.portalUrl = portalUrl;
- }
-
- @Autowired
- public JobCompletionMailSender(VEGLJobManager jobManager,
- VGLJobStatusAndLogReader jobStatLogReader, MailSender mailSender,
- VelocityEngine velocityEngine) {
- this.jobManager = jobManager;
- this.jobStatLogReader = jobStatLogReader;
- this.mailSender = mailSender;
- this.velocityEngine = velocityEngine;
- }
-
- /**
- * Sets the job completion notification template file including
- * its location on the class path.
- *
- * @param template
- */
- public void setTemplate(String template) {
- this.template = template;
- }
-
- /**
- * Gets the job completion notification template file path.
- *
- * @return
- */
- public String getTemplate() {
- return template;
- }
-
- /**
- * Sets the date format to be used in the email text.
- *
- * @param dateFormat The pattern describing the date and time format.
- */
- public void setDateFormat(String dateFormat) {
- this.dateFormat = dateFormat;
- }
-
- /**
- * Gets the date format used in the email text.
- *
- * @return the pattern describing the date and time format.
- */
- public String getDateFormat() {
- return dateFormat;
- }
-
- /**
- * Sets the maximum length for series name to be
- * displayed in email subject.
- *
- * @param maxLengthForSeriesNameInSubject
- */
- public void setMaxLengthForSeriesNameInSubject(int maxLengthForSeriesNameInSubject) {
- this.maxLengthForSeriesNameInSubject = maxLengthForSeriesNameInSubject;
- }
-
- /**
- * Gets the maximum length of series name in the
- * email subject.
- *
- * @return
- */
- public int getMaxLengthForSeriesNameInSubject() {
- return maxLengthForSeriesNameInSubject;
- }
-
- /**
- * Sets the maximum length for job name to be
- * displayed on email subject.
- *
- * @param maxLengthForJobNameInSubject
- */
- public void setMaxLengthForJobNameInSubject(int maxLengthForJobNameInSubject) {
- this.maxLengthForJobNameInSubject = maxLengthForJobNameInSubject;
- }
-
- /**
- * Gets the maximum length of job name in the
- * email subject.
- *
- * @return
- */
- public int getMaxLengthForJobNameInSubject() {
- return maxLengthForJobNameInSubject;
- }
-
- /**
- * Sets the maximum number of lines (N - counting from
- * the bottom) to be used for getting the last N lines
- * of text from the job execution log.
- *
- * @param maxLinesForTail
- */
- public void setMaxLinesForTail(int maxLinesForTail) {
- this.maxLinesForTail = maxLinesForTail;
- }
-
- /**
- * Get the maximum number of lines for tailing the
- * job execution log.
- *
- * @return
- */
- public int getMaxLinesForTail() {
- return maxLinesForTail;
- }
-
- /**
- * Sets the email sender.
- *
- * @param emailSender
- */
- public void setEmailSender(String emailSender) {
- this.emailSender = emailSender;
- }
-
- /**
- * Gets the email sender.
- *
- * @return
- */
- public String getEmailSender() {
- return emailSender;
- }
-
- /**
- * Sets the email subject.
- *
- * @param emailSubject
- */
- public void setEmailSubject(String emailSubject) {
- this.emailSubject = emailSubject;
- }
-
- /**
- * Get the email subject.
- *
- * @return
- */
- public String getEmailSubject() {
- return emailSubject;
- }
-
- /**
- * Constructs job completion notification email content.
- * @param seriesName
- */
- @Override
- public String constructMailContent(String seriesName, VEGLJob job) {
-
- Date submitDate, processDate, executeDate;
- if(job.getSubmitDate()!=null){
- submitDate=job.getSubmitDate();
- }else{
- submitDate=new Date();
- }
-
- if(job.getProcessDate()!=null){
- processDate=job.getProcessDate();
- }else{
- processDate=new Date();
- }
-
- // If execution date failed to set revert to submission date
- if(job.getExecuteDate()!=null){
- executeDate=job.getExecuteDate();
- }else{
- executeDate= job.getSubmitDate();
- }
-
- long[] diff = DateUtil.getTimeDifference(executeDate, processDate);
- String timeElapsed = diff[0] + " day(s) " + diff[1] + " hour(s) "
- + diff[2] + " minute(s) " + diff[3] + " second(s)";
-
- VelocityContext velocityContext = new VelocityContext();
- velocityContext.put("userName", job.getUser().substring(0,job.getUser().indexOf("@")));
- velocityContext.put("status", job.getStatus());
- velocityContext.put("jobId", job.getId().toString());
- velocityContext.put("seriesName", seriesName);
- velocityContext.put("jobName", job.getName());
- velocityContext.put("jobDescription", job.getDescription());
- velocityContext.put("dateSubmitted", DateUtil.formatDate(submitDate, dateFormat));
- velocityContext.put("dateExecuted", DateUtil.formatDate(executeDate, dateFormat));
- velocityContext.put("dateProcessed", DateUtil.formatDate(processDate, dateFormat));
- velocityContext.put("timeElapsed", timeElapsed);
- velocityContext.put("jobExecLogSnippet", TextUtil.tail(jobStatLogReader.getSectionedLog(job, "Python"), maxLinesForTail));
- velocityContext.put("emailSender", getEmailSender());
- velocityContext.put("portalUrl", getPortalUrl());
- StringWriter stringWriter = new StringWriter();
- velocityEngine.mergeTemplate(template, "UTF-8", velocityContext, stringWriter);
- return stringWriter.toString();
- }
-
- /**
- * Sends job completion notification email with Spring
- * framework's MailSender.
- */
- @Override
- public void sendMail(VEGLJob job) {
- String jobName = job.getName();
- String seriesName = "";
-
- if (job.getSeriesId() != null && job.getSeriesId() != 0) {
- VEGLSeries jobSeries = jobManager.getSeriesById(job.getSeriesId(), job.getEmailAddress());
- if (jobSeries != null) {
- seriesName = jobSeries.getName();
-
- if (seriesName.length() > maxLengthForSeriesNameInSubject) {
- seriesName = seriesName.substring(0, maxLengthForJobNameInSubject);
- }
- }
- }
-
- if (jobName.length() > maxLengthForJobNameInSubject) {
- jobName = jobName.substring(0, maxLengthForJobNameInSubject);
- }
-
- String subject = String.format(this.emailSubject, jobName);
-
- SimpleMailMessage msg = new SimpleMailMessage();
- msg.setFrom(this.emailSender);
- msg.setTo(job.getEmailAddress());
- msg.setSubject(subject);
- msg.setText(constructMailContent(seriesName, job));
-
- try {
- this.mailSender.send(msg);
- } catch (Exception ex) {
- LOG.error("Sending of email notification failed for job id [" + job.getId() + "].", ex);
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/auscope/portal/server/vegl/mail/JobMailSender.java b/src/main/java/org/auscope/portal/server/vegl/mail/JobMailSender.java
deleted file mode 100644
index 7901845f6..000000000
--- a/src/main/java/org/auscope/portal/server/vegl/mail/JobMailSender.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.auscope.portal.server.vegl.mail;
-
-import org.auscope.portal.server.vegl.VEGLJob;
-
-/**
- * An interface with common methods for any beans that
- * need to implement send mail functionality.
- *
- * @author Richard Goh
- */
-public interface JobMailSender {
- /**
- * Constructs job notification email content.
- *
- * @param seriesName The series name
- * @param job The VEGLJob object
- * @return
- */
- public String constructMailContent(String seriesName, VEGLJob job);
-
- /**
- * Sends email with SMTP protocol.
- *
- * @param job
- */
- public void sendMail(VEGLJob job);
-
-}
\ No newline at end of file
diff --git a/src/main/java/org/auscope/portal/server/web/controllers/BaseCloudController.java b/src/main/java/org/auscope/portal/server/web/controllers/BaseCloudController.java
deleted file mode 100644
index d30ce967a..000000000
--- a/src/main/java/org/auscope/portal/server/web/controllers/BaseCloudController.java
+++ /dev/null
@@ -1,234 +0,0 @@
-package org.auscope.portal.server.web.controllers;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.auscope.portal.core.cloud.CloudJob;
-import org.auscope.portal.core.services.PortalServiceException;
-import org.auscope.portal.core.services.cloud.CloudComputeService;
-import org.auscope.portal.core.services.cloud.CloudStorageService;
-import org.auscope.portal.core.services.cloud.CloudStorageServiceJClouds;
-import org.auscope.portal.core.util.TextUtil;
-import org.auscope.portal.server.vegl.VEGLJob;
-import org.auscope.portal.server.vegl.VEGLJobManager;
-import org.auscope.portal.server.web.security.PortalUser;
-import org.auscope.portal.server.web.security.NCIDetails;
-import org.auscope.portal.server.web.service.NCIDetailsService;
-import org.springframework.beans.factory.annotation.Value;
-
-/**
- * Methods and variables common to any controller wishing to access
- * the cloud
- *
- * @author Josh Vote
- *
- */
-public abstract class BaseCloudController extends BaseModelController {
- /** All cloud storage services that are available to this controller */
- protected CloudStorageService[] cloudStorageServices;
- /** All cloud compute services that are available to this controller */
- protected CloudComputeService[] cloudComputeServices;
- private String vmSh, vmShutdownSh;
-
-
- /**
- * @param cloudStorageServices All cloud storage services that are available to this controller
- * @param cloudComputeServices All cloud compute services that are available to this controller
- */
- public BaseCloudController(CloudStorageService[] cloudStorageServices, CloudComputeService[] cloudComputeServices, VEGLJobManager jobManager) {
- this(cloudStorageServices,cloudComputeServices, jobManager,null,null);
- }
-
- public BaseCloudController(CloudStorageService[] cloudStorageServices, CloudComputeService[] cloudComputeServices, VEGLJobManager jobManager,
- @Value("${cloud.vm.sh}") String vmSh, @Value("${cloud.vm-shutdown.sh}") String vmShutdownSh) {
- super(jobManager);
- this.cloudComputeServices = cloudComputeServices;
- this.cloudStorageServices = cloudStorageServices;
- this.vmSh=vmSh;
- this.vmShutdownSh=vmShutdownSh;
- }
-
-
- /**
- * Lookup a cloud storage service by ID. Returns null if the service DNE
- * @param id The name of the service to lookup
- * @return
- */
- protected CloudStorageService getStorageService(String id) {
- for (CloudStorageService s : cloudStorageServices) {
- if (s.getId().equals(id)) {
- return s;
- }
- }
-
- log.warn(String.format("CloudStorageService with ID '%1$s' doesn't exist", id));
- return null;
- }
-
- /**
- * Lookup a cloud storage service by ID (as configured in job). Returns null if the service DNE
- * @param id The job whose storage service id will be used in the lookup
- * @return
- */
- protected CloudStorageService getStorageService(VEGLJob job) {
- return getStorageService(job.getStorageServiceId());
- }
-
- /**
- * Lookup a cloud compute service by ID. Returns null if the service DNE
- * @param id The name of the service to lookup
- * @return
- */
- protected CloudComputeService getComputeService(String id) {
- if(TextUtil.isNullOrEmpty(id))
- return null;
-
- for (CloudComputeService s : cloudComputeServices) {
- if (s.getId().equals(id)) {
- return s;
- }
- }
-
- log.warn(String.format("CloudComputeService with ID '%1$s' doesn't exist", id));
- return null;
- }
-
- /**
- * Gets the subset of cloudComputeServices that the specified user has successfully configured in their setup page.
- * @param user
- * @param nciDetailsService
- * @return
- * @throws PortalServiceException
- */
- protected ListVEGLJob
objects.
- * @throws PortalServiceException
- */
- @RequestMapping("/secure/listJobs.do")
- public ModelAndView listJobs(HttpServletRequest request,
- HttpServletResponse response,
- @RequestParam("seriesId") Integer seriesId,
- @RequestParam(required=false, value="forceStatusRefresh", defaultValue="false") boolean forceStatusRefresh) throws PortalServiceException {
- PortalUser user = userService.getLoggedInUser();
- VEGLSeries series = attemptGetSeries(seriesId, user);
- if (series == null) {
- return generateJSONResponseMAV(false, null, "Unable to lookup job series.");
- }
-
- ListVEGLJob
objects.
- * @throws PortalServiceException
- */
- @SuppressWarnings("unchecked")
- @RequestMapping("/secure/treeJobs.do")
- public ModelAndView treeJobs(HttpServletRequest request,
- HttpServletResponse response,
- @RequestParam(required=false, value="forceStatusRefresh", defaultValue="false") boolean forceStatusRefresh) throws PortalServiceException {
- PortalUser user = userService.getLoggedInUser();
- if (user == null) {
- return generateJSONResponseMAV(false);
- }
-
- Listsc-name | Name of the scientific code |
source | Map of source parameters |
source.type | Source repository type ("git", "svn") |
source.url | Source repository URL |
source.checkout | Checkout target for source repository |
source.exec | Shell command to execute after source checkout. |
system_packages | List of system packages |
python_packages | List of python packages |
python_requirements | Path to a pip requirements.txt file in the source |