/** * Returns the download strategy depending on the information from the * uploadURL. Currently supportet HTTP and FTP * * @return */ protected BlobDownloadStrategy createDownloadStrategy() { BlobDownloadStrategy strategy; try { URL url = new URL(getUploadUrl()); if(url.getProtocol().equalsIgnoreCase("FTP")) { strategy = new FTPBlobDownloadStrategy(this); } else if (url.getProtocol().equalsIgnoreCase("FILE")) { strategy = new FileSystemBlobStrategy(this); } else { strategy = new DefaultBlobDownloadStrategy(this); } } catch (MalformedURLException e) { strategy = new DefaultBlobDownloadStrategy(this); } catch (URISyntaxException e) { strategy = new DefaultBlobDownloadStrategy(this); } return strategy; }
public InputStream getInputStream(ActiveMQBlobMessage message) throws IOException, JMSException { url = message.getURL(); final FTPClient ftp = createFTP(); String path = url.getPath(); String workingDir = path.substring(0, path.lastIndexOf("/")); String file = path.substring(path.lastIndexOf("/") + 1); ftp.changeWorkingDirectory(workingDir); ftp.setFileType(FTPClient.BINARY_FILE_TYPE); InputStream input = new FilterInputStream(ftp.retrieveFileStream(file)) { public void close() throws IOException { in.close(); ftp.quit(); ftp.disconnect(); } }; return input; }
public void deleteFile(ActiveMQBlobMessage message) throws IOException, JMSException { url = message.getURL(); final FTPClient ftp = createFTP(); String path = url.getPath(); try { if (!ftp.deleteFile(path)) { throw new JMSException("Delete file failed: " + ftp.getReplyString()); } } finally { ftp.quit(); ftp.disconnect(); } }
/** * Returns the download strategy depending on the information from the * uploadURL. Currently supportet HTTP and FTP * * @return */ protected BlobDownloadStrategy createDownloadStrategy() { BlobDownloadStrategy strategy; try { URL url = new URL(getUploadUrl()); if(url.getProtocol().equalsIgnoreCase("FTP")) { strategy = new FTPBlobDownloadStrategy(this); } else if (url.getProtocol().equalsIgnoreCase("FILE")) { strategy = new FileSystemBlobStrategy(this); } else { strategy = new DefaultBlobDownloadStrategy(this); } } catch (MalformedURLException e) { strategy = new DefaultBlobDownloadStrategy(this); } catch (URISyntaxException e) { strategy = new DefaultBlobDownloadStrategy(this); } return strategy; }
public InputStream getInputStream(ActiveMQBlobMessage message) throws IOException, JMSException { url = message.getURL(); final FTPClient ftp = createFTP(); String path = url.getPath(); String workingDir = path.substring(0, path.lastIndexOf("/")); String file = path.substring(path.lastIndexOf("/") + 1); ftp.changeWorkingDirectory(workingDir); ftp.setFileType(FTPClient.BINARY_FILE_TYPE); InputStream input = new FilterInputStream(ftp.retrieveFileStream(file)) { public void close() throws IOException { in.close(); ftp.quit(); ftp.disconnect(); } }; return input; }
/** * Returns the download strategy depending on the information from the * uploadURL. Currently supportet HTTP and FTP * * @return */ protected BlobDownloadStrategy createDownloadStrategy() { BlobDownloadStrategy strategy; try { URL url = new URL(getUploadUrl()); if(url.getProtocol().equalsIgnoreCase("FTP")) { strategy = new FTPBlobDownloadStrategy(this); } else if (url.getProtocol().equalsIgnoreCase("FILE")) { strategy = new FileSystemBlobStrategy(this); } else { strategy = new DefaultBlobDownloadStrategy(this); } } catch (MalformedURLException e) { strategy = new DefaultBlobDownloadStrategy(this); } catch (URISyntaxException e) { strategy = new DefaultBlobDownloadStrategy(this); } return strategy; }
public InputStream getInputStream(ActiveMQBlobMessage message) throws IOException, JMSException { url = message.getURL(); final FTPClient ftp = createFTP(); String path = url.getPath(); String workingDir = path.substring(0, path.lastIndexOf("/")); String file = path.substring(path.lastIndexOf("/") + 1); ftp.changeWorkingDirectory(workingDir); ftp.setFileType(FTPClient.BINARY_FILE_TYPE); InputStream input = new FilterInputStream(ftp.retrieveFileStream(file)) { public void close() throws IOException { in.close(); ftp.quit(); ftp.disconnect(); } }; return input; }
/** * Returns the download strategy depending on the information from the * uploadURL. Currently supportet HTTP and FTP * * @return */ protected BlobDownloadStrategy createDownloadStrategy() { BlobDownloadStrategy strategy; try { URL url = new URL(getUploadUrl()); if(url.getProtocol().equalsIgnoreCase("FTP")) { strategy = new FTPBlobDownloadStrategy(this); } else if (url.getProtocol().equalsIgnoreCase("FILE")) { strategy = new FileSystemBlobStrategy(this); } else { strategy = new DefaultBlobDownloadStrategy(this); } } catch (MalformedURLException e) { strategy = new DefaultBlobDownloadStrategy(this); } catch (URISyntaxException e) { strategy = new DefaultBlobDownloadStrategy(this); } return strategy; }
public InputStream getInputStream(ActiveMQBlobMessage message) throws IOException, JMSException { url = message.getURL(); final FTPClient ftp = createFTP(); String path = url.getPath(); String workingDir = path.substring(0, path.lastIndexOf("/")); String file = path.substring(path.lastIndexOf("/") + 1); ftp.changeWorkingDirectory(workingDir); ftp.setFileType(FTPClient.BINARY_FILE_TYPE); InputStream input = new FilterInputStream(ftp.retrieveFileStream(file)) { public void close() throws IOException { in.close(); ftp.quit(); ftp.disconnect(); } }; return input; }
/** * Returns the download strategy depending on the information from the * uploadURL. Currently supportet HTTP and FTP * * @return */ protected BlobDownloadStrategy createDownloadStrategy() { BlobDownloadStrategy strategy; try { URL url = new URL(getUploadUrl()); if(url.getProtocol().equalsIgnoreCase("FTP")) { strategy = new FTPBlobDownloadStrategy(this); } else if (url.getProtocol().equalsIgnoreCase("FILE")) { strategy = new FileSystemBlobStrategy(this); } else { strategy = new DefaultBlobDownloadStrategy(this); } } catch (MalformedURLException e) { strategy = new DefaultBlobDownloadStrategy(this); } catch (URISyntaxException e) { strategy = new DefaultBlobDownloadStrategy(this); } return strategy; }
public InputStream getInputStream(ActiveMQBlobMessage message) throws IOException, JMSException { url = message.getURL(); final FTPClient ftp = createFTP(); String path = url.getPath(); String workingDir = path.substring(0, path.lastIndexOf("/")); String file = path.substring(path.lastIndexOf("/") + 1); ftp.changeWorkingDirectory(workingDir); ftp.setFileType(FTPClient.BINARY_FILE_TYPE); InputStream input = new FilterInputStream(ftp.retrieveFileStream(file)) { public void close() throws IOException { in.close(); ftp.quit(); ftp.disconnect(); } }; return input; }
public void deleteFile(ActiveMQBlobMessage message) throws IOException, JMSException { url = message.getURL(); final FTPClient ftp = createFTP(); String path = url.getPath(); try { if (!ftp.deleteFile(path)) { throw new JMSException("Delete file failed: " + ftp.getReplyString()); } } finally { ftp.quit(); ftp.disconnect(); } }
public void deleteFile(ActiveMQBlobMessage message) throws IOException, JMSException { url = message.getURL(); final FTPClient ftp = createFTP(); String path = url.getPath(); try { if (!ftp.deleteFile(path)) { throw new JMSException("Delete file failed: " + ftp.getReplyString()); } } finally { ftp.quit(); ftp.disconnect(); } }
public void deleteFile(ActiveMQBlobMessage message) throws IOException, JMSException { url = message.getURL(); final FTPClient ftp = createFTP(); String path = url.getPath(); try { if (!ftp.deleteFile(path)) { throw new JMSException("Delete file failed: " + ftp.getReplyString()); } } finally { ftp.quit(); ftp.disconnect(); } }
public void deleteFile(ActiveMQBlobMessage message) throws IOException, JMSException { url = message.getURL(); final FTPClient ftp = createFTP(); String path = url.getPath(); try { if (!ftp.deleteFile(path)) { throw new JMSException("Delete file failed: " + ftp.getReplyString()); } } finally { ftp.quit(); ftp.disconnect(); } }