public InputStream getInputStream(ActiveMQBlobMessage message) throws IOException, JMSException { URL value = message.getURL(); if (value == null) { return null; } return value.openStream(); }
@Override public Map<String, Object> getFields(Object o) throws OpenDataException { ActiveMQBlobMessage m = (ActiveMQBlobMessage)o; Map<String, Object> rc = super.getFields(o); try { rc.put(CompositeDataConstants.MESSAGE_URL, "" + m.getURL().toString()); } catch (JMSException e) { rc.put(CompositeDataConstants.MESSAGE_URL, ""); } return rc; } }
/** * Return the {@link File} for the {@link ActiveMQBlobMessage}. * * @param message * @return file * @throws JMSException * @throws IOException */ protected File getFile(ActiveMQBlobMessage message) throws JMSException, IOException { if (message.getURL() != null) { try { return new File(message.getURL().toURI()); } catch (URISyntaxException e) { IOException ioe = new IOException("Unable to open file for message " + message); ioe.initCause(e); } } //replace all : with _ to make windows more happy String fileName = message.getJMSMessageID().replaceAll(":", "_"); return new File(rootFile, fileName); } }
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 InputStream getInputStream(ActiveMQBlobMessage message) throws IOException, JMSException { URL value = message.getURL(); if (value == null) { return null; } return value.openStream(); }
public InputStream getInputStream(ActiveMQBlobMessage message) throws IOException, JMSException { URL value = message.getURL(); if (value == null) { return null; } return value.openStream(); }
public InputStream getInputStream(ActiveMQBlobMessage message) throws IOException, JMSException { URL value = message.getURL(); if (value == null) { return null; } return value.openStream(); }
public InputStream getInputStream(ActiveMQBlobMessage message) throws IOException, JMSException { URL value = message.getURL(); if (value == null) { return null; } return value.openStream(); }
@Override public Map<String, Object> getFields(Object o) throws OpenDataException { ActiveMQBlobMessage m = (ActiveMQBlobMessage)o; Map<String, Object> rc = super.getFields(o); try { rc.put(CompositeDataConstants.MESSAGE_URL, "" + m.getURL().toString()); } catch (JMSException e) { rc.put(CompositeDataConstants.MESSAGE_URL, ""); } return rc; } }
@Override public Map<String, Object> getFields(Object o) throws OpenDataException { ActiveMQBlobMessage m = (ActiveMQBlobMessage)o; Map<String, Object> rc = super.getFields(o); try { rc.put(CompositeDataConstants.MESSAGE_URL, "" + m.getURL().toString()); } catch (JMSException e) { rc.put(CompositeDataConstants.MESSAGE_URL, ""); } return rc; } }
@Override public Map<String, Object> getFields(Object o) throws OpenDataException { ActiveMQBlobMessage m = (ActiveMQBlobMessage)o; Map<String, Object> rc = super.getFields(o); try { rc.put(CompositeDataConstants.MESSAGE_URL, "" + m.getURL().toString()); } catch (JMSException e) { rc.put(CompositeDataConstants.MESSAGE_URL, ""); } return rc; } }
@Override public Map<String, Object> getFields(Object o) throws OpenDataException { ActiveMQBlobMessage m = (ActiveMQBlobMessage)o; Map<String, Object> rc = super.getFields(o); try { rc.put(CompositeDataConstants.MESSAGE_URL, "" + m.getURL().toString()); } catch (JMSException e) { rc.put(CompositeDataConstants.MESSAGE_URL, ""); } return rc; } }
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 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(); } }
@Override protected Message copy(Session session, Message m) throws JMSException { if (m instanceof ActiveMQBlobMessage) { ActiveMQBlobMessage b = (ActiveMQBlobMessage) m; ActiveMQBlobMessage copy = (ActiveMQBlobMessage) getAMQSession(session).createBlobMessage(b.getURL()); try { copy.setProperties(b.getProperties()); } catch (IOException e) { throw JMSExceptionSupport.create("Unable to copy message " + m, e); } return copy; } else { return super.copy(session, m); } }