List of usage examples for javax.activation DataSource equals
public boolean equals(Object obj)
From source file:immf.MyHtmlEmail.java
/** * Embeds the specified <code>DataSource</code> in the HTML using a * randomly generated Content-ID. Returns the generated Content-ID string. * * @param dataSource the <code>DataSource</code> to embed * @param name the name that will be set in the filename header field * @return the generated Content-ID for this <code>DataSource</code> * @throws EmailException if the embedding fails or if <code>name</code> is * null or empty/*w w w.ja v a2 s . c o m*/ * @see #embed(DataSource, String, String) * @since 1.1 */ public String embed(DataSource dataSource, String name) throws EmailException { // check if the DataSource has already been attached; // if so, return the cached CID value. if (inlineEmbeds.containsKey(name)) { InlineImage ii = (InlineImage) inlineEmbeds.get(name); // make sure the supplied URL points to the same thing // as the one already associated with this name. if (dataSource.equals(ii.getDataSource())) { return ii.getCid(); } else { throw new EmailException("embedded DataSource '" + name + "' is already bound to name " + ii.getDataSource().toString() + "; existing names cannot be rebound"); } } String cid = randomAlphabetic(HtmlEmail.CID_LENGTH).toLowerCase(); return embed(dataSource, name, cid); }