public SyncState getOrCreateSyncState(DataSource ds) throws ServiceException { synchronized (entries) { SyncState ss = entries.get(ds.getId()); if (ss == null) { ss = new SyncState(ds.getMailbox()); entries.put(ds.getId(), ss); } return ss; } }
private void setStatus(boolean success) throws ServiceException { Date now = new Date(); DataSource ds = getDataSource(); Map<String, Object> attrs = new HashMap<String, Object>(); String attr = success ? Provisioning.A_zimbraGalLastSuccessfulSyncTimestamp : Provisioning.A_zimbraGalLastFailedSyncTimestamp; attrs.put(attr, DateUtil.toGeneralizedTime(now)); Provisioning.getInstance().modifyDataSource(ds.getAccount(), ds.getId(), attrs); }
private Pop3Config newPop3Config(DataSource ds) { Pop3Config config = new Pop3Config(); config.setHost(ds.getHost()); config.setPort(ds.getPort()); config.setAuthenticationId(ds.getUsername()); config.setSecurity(getSecurity(ds.getConnectionType())); if (ds.isDebugTraceEnabled()) { config.setLogger(SyncUtil.getTraceLogger(ZimbraLog.pop_client, ds.getId())); } config.setSocketFactory(SocketFactories.defaultSocketFactory()); config.setSSLSocketFactory(SocketFactories.defaultSSLSocketFactory()); config.setConnectTimeout(ds.getConnectTimeout(LC.javamail_pop3_timeout.intValue())); config.setReadTimeout(ds.getReadTimeout(LC.javamail_pop3_timeout.intValue())); return config; }
public SyncState getSyncState(DataSource ds) { return entries.get(ds.getId()); }