use of com.zimbra.soap.type.DataSource in project zm-mailbox by Zimbra.
the class ZMailbox method testDataSource.
/**
* Tests a data source.
*
* @return <tt>null</tt> on success, or the error string on failure
*/
public String testDataSource(ZDataSource source) throws ServiceException {
TestDataSourceRequest req = new TestDataSourceRequest();
DataSource jaxbObj = source.toJaxb();
req.setDataSource(jaxbObj);
TestDataSourceResponse resp = (TestDataSourceResponse) invokeJaxb(req);
List<TestDataSource> dataSources = resp.getDataSources();
int success = 0;
if (dataSources.size() > 0 && dataSources.get(0) != null) {
TestDataSource ds = dataSources.get(0);
success = ds.getSuccess();
if (success < 1) {
return ds.getError();
} else {
return null;
}
}
return null;
}
use of com.zimbra.soap.type.DataSource in project zm-mailbox by Zimbra.
the class ZMailbox method getAllDataSources.
public List<ZDataSource> getAllDataSources() throws ServiceException {
GetDataSourcesResponse res = invokeJaxb(new GetDataSourcesRequest());
List<ZDataSource> result = new ArrayList<ZDataSource>();
for (DataSource ds : res.getDataSources()) {
if (ds instanceof Pop3DataSource) {
result.add(new ZPop3DataSource((Pop3DataSource) ds));
} else if (ds instanceof ImapDataSource) {
result.add(new ZImapDataSource((ImapDataSource) ds));
} else if (ds instanceof CalDataSource) {
result.add(new ZCalDataSource((CalDataSource) ds));
} else if (ds instanceof RssDataSource) {
result.add(new ZRssDataSource((RssDataSource) ds));
} else {
result.add(new ZDataSource(ds));
}
}
return result;
}
Aggregations