@Override protected void runInContext() { // Start the download! download(resume, downloadCompleteCallback); }
@Override public FormatInfo process(String templatePath, ImageFormat format, String templateName) { return process(templatePath, format, templateName, 0); }
@Override public String getDownloadLocalPath() { return getToFile(); }
public static void main(String[] args) { String url = "scp://root@sol10-2/root/alex/agent.zip?password=password"; TemplateDownloader td = new ScpTemplateDownloader(null, url, "/tmp/mysql", TemplateDownloader.DEFAULT_MAX_TEMPLATE_SIZE_IN_BYTES, null); long bytes = td.download(true, null); if (bytes > 0) { System.out.println("Downloaded (" + bytes + " bytes)" + " in " + td.getDownloadTime() / 1000 + " secs"); } else { System.out.println("Failed download"); } } }
public Processor buildQCOW2Processor(final StorageLayer storage) throws ConfigurationException { final Map<String, Object> params = new HashMap<String, Object>(); params.put(StorageLayer.InstanceConfigKey, storage); final Processor qcow2Processor = new QCOW2Processor(); qcow2Processor.configure("QCOW2 Processor", params); return qcow2Processor; }
public static void main(String[] args) { String url = "http:// dev.mysql.com/get/Downloads/MySQL-5.0/mysql-noinstall-5.0.77-win32.zip/from/http://mirror.services.wisc.edu/mysql/"; try { new java.net.URI(url); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } TemplateDownloader td = new HttpTemplateDownloader(null, url, "/tmp/mysql", null, TemplateDownloader.DEFAULT_MAX_TEMPLATE_SIZE_IN_BYTES, null, null, null, null); long bytes = td.download(true, null); if (bytes > 0) { System.out.println("Downloaded (" + bytes + " bytes)" + " in " + td.getDownloadTime() / 1000 + " secs"); } else { System.out.println("Failed download"); } }
public TemplateLocation buildTemplateLocation(final StorageLayer storage, final String templatePath) { final TemplateLocation location = new TemplateLocation(storage, templatePath); return location; }
@Override public FormatInfo process(String templatePath, ImageFormat format, String templateName) throws InternalErrorException { return process(templatePath, format, templateName, 0); }
@Override public FormatInfo process(String templatePath, ImageFormat format, String templateName) throws InternalErrorException { return process(templatePath, format, templateName, 0); }
@Override public FormatInfo process(String templatePath, ImageFormat format, String templateName) throws InternalErrorException { return process(templatePath, format, templateName, 0); }
@Override public FormatInfo process(String templatePath, ImageFormat format, String templateName) throws InternalErrorException { return process(templatePath, format, templateName, 0); }
@Override public FormatInfo process(String templatePath, ImageFormat format, String templateName) throws InternalErrorException { return process(templatePath, format, templateName, 0); }
@Override public FormatInfo process(String templatePath, ImageFormat format, String templateName) { return process(templatePath, format, templateName, 0); }
public void cleanup() { if (tu != null) { String upldPath = tu.getUploadLocalPath(); if (upldPath != null) { File f = new File(upldPath); f.delete(); } } }
@Override protected void runInContext() { try { download(_resume, _callback); } catch (Exception e) { s_logger.warn("Unable to complete download due to ", e); _errorString = "Failed to install: " + e.getMessage(); _status = TemplateDownloader.Status.UNRECOVERABLE_ERROR; } }
public void cleanup() { if (td != null) { String dnldPath = td.getDownloadLocalPath(); if (dnldPath != null) { File f = new File(dnldPath); File dir = f.getParentFile(); f.delete(); if (dir != null) { dir.delete(); } } } }
@Override public void run() { try { upload(completionCallback); } catch (Throwable t) { s_logger.warn("Caught exception during upload " + t.getMessage(), t); errorString = "Failed to install: " + t.getMessage(); status = TemplateUploader.Status.UNRECOVERABLE_ERROR; } }
@Override public String getDownloadError(String jobId) { DownloadJob dj = jobs.get(jobId); if (dj != null) { return dj.getTemplateDownloader().getDownloadError(); } return null; }
@Override public String getUploadError(String jobId) { UploadJob uj = jobs.get(jobId); if (uj != null) { return uj.getTemplateUploader().getUploadError(); } return null; }
@Override public int getUploadPct(String jobId) { UploadJob uj = jobs.get(jobId); if (uj != null) { return uj.getTemplateUploader().getUploadPercent(); } return 0; }