return (String) this.obj;
}
public DataSource getDataSource(SourceResolver resolver, List sources)
throws IOException, MessagingException {
AbstractDataSource ds = null;
if (isURL) {
String url = (String) getObject();
Source src = resolver.resolveURI(url);
sources.add(src);
if (src.exists()) {
ds = new SourceDataSource(src, getType(), getName());
}
} else if (getObject() instanceof Part) {
Part part = (Part) getObject();
ds = new FilePartDataSource(part, getType(), getName());
} else if (getObject() instanceof InputStream) {
InputStream in = (InputStream) getObject();
ds = new InputStreamDataSource(in, getType(), getName());
} else if (getObject() instanceof byte[]) {
byte[] data = (byte[]) getObject();
ds = new InputStreamDataSource(data, getType(), getName());
} else {
// TODO: other classes?
throw new MessagingException("Not yet supported: " + getObject());
}
if (ds != null) {
ds.enableLogging(getMyLogger());
}
return ds;
}