public class ZimbraConnector extends AbstractMessagingConnector implements Disposable
| Modifier and Type | Class and Description |
|---|---|
private class |
ZimbraConnector.ZimbraEvent |
MessagingConnector.AttendeeInformation, MessagingConnector.FreeBusyStatus, MessagingConnector.ResponseType| Modifier and Type | Field and Description |
|---|---|
protected RequestConfig |
_connectionConfig
The shared configuration for request (for timeout purposes)
|
protected ConnectionKeepAliveStrategy |
_connectionKeepAliveStrategy
The keep-alive stragegy to optimize http clients
|
protected PoolingHttpClientConnectionManager |
_connectionManager
Request to the remote app will be ppoled for perfs purposes
|
protected String |
_domainPreauthSecretKey
Preauth secret key
|
protected static int |
_DROP_KEPTALIVE_CONNECTION_AFTER
The number of seconds after what kept alive connections are dropt
|
protected JSONUtils |
_jsonUtils
The JSON Utils
|
protected UserManager |
_usersManager
The user manager
|
protected String |
_zimbraUrl
Url to zimbra
|
_cryptoHelper, _currentUserProvider, _userPopulationDAO, _userPrefROLE| Constructor and Description |
|---|
ZimbraConnector() |
| Modifier and Type | Method and Description |
|---|---|
private String |
_computeQueryString(User user,
String targetApp) |
protected String |
_doPreauthRequest(User user)
Zimbra preauth request to log the current user into zimbra and retrieve the ZM_AUTH_TOKEN
|
protected List<Map<String,Object>> |
_extractCalendarProperties(Calendar calendar,
int dayInterval,
int maxEvents)
Extract interesting properties for the calendar.
|
protected Map<String,Object> |
_extractCalendarProperties(ZimbraConnector.ZimbraEvent zimbraEvent)
Extract interesting properties for the event.
|
protected Calendar |
_getCalendar(User user,
String zmAuthToken,
String dayInterval)
Retrieves a calendar through a query via the Zimbra REST API.
|
protected String |
_getComputedPreauth(String zimbraUser,
String timestamp,
String secretKey)
Compute the preauth key.
|
protected Map<String,Object> |
_getEmailInfo(User user,
String zmAuthToken)
Retrieves some mail info through a query via the Zimbra REST API.
|
protected CloseableHttpClient |
_getHttpClient()
Get a new pooled http client.
|
protected String |
_sanitizeEventLocation(Location location)
Extract the interesting part of the raw event location.
|
void |
dispose() |
void |
initialize() |
protected List<EmailMessage> |
internalGetEmails(UserIdentity userIdentity,
int maxEmails)
Get emails (no caching)
|
protected int |
internalGetEmailsCount(UserIdentity userIdentity)
Get emails count (no caching)
|
protected List<CalendarEvent> |
internalGetEvents(UserIdentity userIdentity,
int maxDays,
int maxEvents)
Get upcoming events (no caching)
|
protected int |
internalGetEventsCount(UserIdentity userIdentity,
int maxDays)
Get upcoming events count (no caching)
|
void |
redirect(Redirector redirector,
String targetApp)
Preauth user and redirect to the zimbra application
|
void |
service(ServiceManager smanager) |
createEvent, deleteEvent, getAllowedPopulationIds, getAttendees, getEvents, getEventsCount, getFreeBusy, getUnreadEmailCount, getUnreadEmails, getUserCryptedPassword, getUserPassword, internalCreateEvent, internalDeleteEvent, internalGetAttendees, internalGetFreeBusy, internalIsEventExist, internalSetAttendees, internalUpdateEvent, isAllowed, isEventExist, isUserExist, setAttendees, setUserPassword, supportInvitation, supportUserCredential, updateEvent, userCredentialNeededgetLogger, setLoggerprotected static final int _DROP_KEPTALIVE_CONNECTION_AFTER
protected UserManager _usersManager
protected JSONUtils _jsonUtils
protected String _zimbraUrl
protected String _domainPreauthSecretKey
protected PoolingHttpClientConnectionManager _connectionManager
protected ConnectionKeepAliveStrategy _connectionKeepAliveStrategy
protected RequestConfig _connectionConfig
public ZimbraConnector()
public void service(ServiceManager smanager) throws ServiceException
service in interface Serviceableservice in class AbstractMessagingConnectorServiceExceptionpublic void initialize()
initialize in interface Initializableinitialize in class AbstractMessagingConnectorpublic void dispose()
dispose in interface Disposableprotected CloseableHttpClient _getHttpClient()
public void redirect(Redirector redirector, String targetApp) throws ProcessingException, IOException
redirector - The redirectortargetApp - The zimbra application (ex: mail)ProcessingException - if failed to redirectIOException - if failed to redirectprotected Map<String,Object> _getEmailInfo(User user, String zmAuthToken)
user - The userzmAuthToken - The auth token corresponding to a currenlty logged
user in zimbra.protected Calendar _getCalendar(User user, String zmAuthToken, String dayInterval)
user - The userzmAuthToken - The auth token corresponding to a currenlty logged
user in zimbra.dayInterval - Interval of day to search for the next eventprotected List<Map<String,Object>> _extractCalendarProperties(Calendar calendar, int dayInterval, int maxEvents)
calendar - The calendardayInterval - Interval of day to search for the next eventmaxEvents - The maximum number of eventsprotected Map<String,Object> _extractCalendarProperties(ZimbraConnector.ZimbraEvent zimbraEvent)
zimbraEvent - The eventprotected String _sanitizeEventLocation(Location location)
location - The iCal4j location object.protected String _doPreauthRequest(User user)
user - The user for which the preauth request will be done.null if user is null or has no email.MessagingConnectorException - if failed to get zimbra token for userprivate String _computeQueryString(User user, String targetApp)
protected String _getComputedPreauth(String zimbraUser, String timestamp, String secretKey) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException
zimbraUser - The Zimbra Usertimestamp - The timestampsecretKey - The secret keyNoSuchAlgorithmException - if no Provider supports a MacSpi
implementation for the specified algorithm (HmacSHA1).InvalidKeyException - if the given key is inappropriate for
initializing the MACUnsupportedEncodingException - If the named charset (UTF-8) is not
supportedprotected List<CalendarEvent> internalGetEvents(UserIdentity userIdentity, int maxDays, int maxEvents) throws MessagingConnectorException
AbstractMessagingConnectorinternalGetEvents in class AbstractMessagingConnectoruserIdentity - The user identitymaxDays - The maximum number of days to search formaxEvents - The maximum number of events to retrieveMessagingConnectorException - if failed to get events from serverprotected int internalGetEventsCount(UserIdentity userIdentity, int maxDays) throws MessagingConnectorException
AbstractMessagingConnectorinternalGetEventsCount in class AbstractMessagingConnectoruserIdentity - The user identitymaxDays - The maximum number of days to search forMessagingConnectorException - if failed to get events from serverprotected List<EmailMessage> internalGetEmails(UserIdentity userIdentity, int maxEmails) throws MessagingConnectorException
AbstractMessagingConnectorinternalGetEmails in class AbstractMessagingConnectoruserIdentity - The user identitymaxEmails - The maximum number of emails to retrieveMessagingConnectorException - if failed to get events from serverprotected int internalGetEmailsCount(UserIdentity userIdentity) throws MessagingConnectorException
AbstractMessagingConnectorinternalGetEmailsCount in class AbstractMessagingConnectoruserIdentity - The user identityMessagingConnectorException - if failed to get events from server