public boolean addAll(Collection<? extends Attachment> c) { boolean b = false; for (Iterator<? extends Attachment> it = c.iterator(); it.hasNext();) { Attachment o = it.next(); if (!attachments.containsKey(o.getId())) { b = true; attachments.put(o.getId(), o.getDataHandler()); cache.put(o.getId(), o); } } return b; }
public boolean add(Attachment e) { if (!attachments.containsKey(e.getId())) { attachments.put(e.getId(), e.getDataHandler()); cache.put(e.getId(), e); return true; } return false; }
if (writingHeaders) { writingHeaders = false; current = att.getDataHandler().getInputStream(); } else if (atts.hasNext()) { att = atts.next();
DataHandler dh = a.getDataHandler(); String ct = dh.getContentType(); Object o = null;
if (atts != null) { for (Attachment a : atts) { if (a.getDataHandler().getDataSource() instanceof AttachmentDataSource) { try { ((AttachmentDataSource)a.getDataHandler().getDataSource()).cache(inMessage); } catch (IOException e) { throw new Fault(e);
public boolean containsValue(Object value) { Iterator<Attachment> it = collection.iterator(); while (it.hasNext()) { Attachment at = it.next(); if (value.equals(at.getDataHandler())) { return true; } } return false; }
public boolean containsValue(Object value) { Iterator<Attachment> it = collection.iterator(); while (it.hasNext()) { Attachment at = it.next(); if (value.equals(at.getDataHandler())) { return true; } } return false; }
public boolean containsValue(Object value) { Iterator<Attachment> it = collection.iterator(); while (it.hasNext()) { Attachment at = it.next(); if (value.equals(at.getDataHandler())) { return true; } } return false; }
@Override protected Object readAttachment(Attachment att, Context context) throws IOException { DataHandler handler = att.getDataHandler(); InputStream is = handler.getInputStream(); // try // { ByteArrayOutputStream out = new ByteArrayOutputStream(); copy(is, out); is.close(); return out.toByteArray(); }
public DataHandler get(Object key) { Iterator<Attachment> it = collection.iterator(); while (it.hasNext()) { Attachment at = it.next(); if (key.equals(at.getId())) { return at.getDataHandler(); } } return null; }
public DataHandler get(Object key) { Iterator<Attachment> it = collection.iterator(); while (it.hasNext()) { Attachment at = it.next(); if (key.equals(at.getId())) { return at.getDataHandler(); } } return null; }
public DataHandler get(Object key) { Iterator<Attachment> it = collection.iterator(); while (it.hasNext()) { Attachment at = it.next(); if (key.equals(at.getId())) { return at.getDataHandler(); } } return null; }
@Override protected Object readAttachment(Attachment att, Context context) throws IOException { DataHandler handler = att.getDataHandler(); InputStream is = handler.getInputStream(); // try // { ByteArrayOutputStream out = new ByteArrayOutputStream(); copy(is, out); is.close(); return out.toByteArray(); }
public boolean addAll(Collection<? extends Attachment> c) { boolean b = false; for (Iterator<? extends Attachment> it = c.iterator(); it.hasNext();) { Attachment o = it.next(); if (!attachments.containsKey(o.getId())) { b = true; attachments.put(o.getId(), o.getDataHandler()); cache.put(o.getId(), o); } } return b; }
public DataHandler remove(Object key) { Iterator<Attachment> it = collection.iterator(); while (it.hasNext()) { Attachment at = it.next(); if (key.equals(at.getId())) { collection.remove(at); return at.getDataHandler(); } } return null; } public DataHandler put(String key, DataHandler value) {
public boolean add(Attachment e) { if (!attachments.containsKey(e.getId())) { attachments.put(e.getId(), e.getDataHandler()); cache.put(e.getId(), e); return true; } return false; }
public DataHandler remove(Object key) { Iterator<Attachment> it = collection.iterator(); while (it.hasNext()) { Attachment at = it.next(); if (key.equals(at.getId())) { collection.remove(at); return at.getDataHandler(); } } return null; } public DataHandler put(String key, DataHandler value) {
public DataHandler remove(Object key) { Iterator<Attachment> it = collection.iterator(); while (it.hasNext()) { Attachment at = it.next(); if (key.equals(at.getId())) { collection.remove(at); return at.getDataHandler(); } } return null; } public DataHandler put(String key, DataHandler value) {
private DefaultAttachment createCamelAttachment(Attachment attachment) { DefaultAttachment camelAttachment = new DefaultAttachment(attachment.getDataHandler()); Iterator<String> headers = attachment.getHeaderNames(); while (headers.hasNext()) { String name = headers.next(); camelAttachment.addHeader(name, attachment.getHeader(name)); } return camelAttachment; }
public void handleMessage(Message message) throws Fault { Assert.assertEquals("check attachment count", 1, message.getAttachments().size()); Attachment att = message.getAttachments().iterator().next(); Assert.assertNotNull("Attachment is null", att); Assert.assertNotNull("Attachment content-type is null", att.getDataHandler().getDataSource() .getContentType()); }