com.google.gdata.client.appsforyourdomain.audit
Class AuditService

java.lang.Object
  extended by com.google.gdata.client.Service
      extended by com.google.gdata.client.GoogleService
          extended by com.google.gdata.client.appsforyourdomain.AppsForYourDomainService
              extended by com.google.gdata.client.appsforyourdomain.AppsPropertyService
                  extended by com.google.gdata.client.appsforyourdomain.audit.AuditService
All Implemented Interfaces:
AuthTokenFactory.TokenListener

public class AuditService
extends AppsPropertyService

AuditService allows Google Apps administrators to audit user's emails, email drafts, and archived chats.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gdata.client.GoogleService
GoogleService.AccountDeletedException, GoogleService.AccountDisabledException, GoogleService.CaptchaRequiredException, GoogleService.InvalidCredentialsException, GoogleService.NotVerifiedException, GoogleService.ServiceUnavailableException, GoogleService.SessionExpiredException, GoogleService.TermsNotAgreedException
 
Nested classes/interfaces inherited from class com.google.gdata.client.Service
Service.ClientInputProperties, Service.ClientOutputProperties, Service.ClientStreamProperties, Service.GDataRequest, Service.GDataRequestFactory, Service.Versions
 
Field Summary
static java.lang.String BASE_URL
           
 
Fields inherited from class com.google.gdata.client.appsforyourdomain.AppsForYourDomainService
APPS_SERVICE, DOMAIN_NAME, HTTPS_PROTOCOL
 
Fields inherited from class com.google.gdata.client.Service
connectTimeout, extProfile, metadataRegistry, requestFactory
 
Constructor Summary
AuditService(java.lang.String domain, java.lang.String applicationName)
          Parameterized constructor to setup a Service object which can be used to initialize the service without obtaining a token.
AuditService(java.lang.String adminEmail, java.lang.String adminPassword, java.lang.String domain, java.lang.String applicationName)
          Parameterized constructor for AuditService.
 
Method Summary
 GenericEntry createAccountInfoRequest(java.lang.String user)
          Creates a new Account Information request.
 GenericEntry createMailboxDumpRequest(MailBoxDumpRequest mailBoxDumpRequest)
          Creates a new request for obtaining a user mailbox dump.
 GenericEntry createMailMonitor(java.lang.String sourceUser, MailMonitor mailMonitor)
          Creates a new monitoring task to begin an audit.
 void deleteAccountInfoRequest(java.lang.String user, java.lang.String requestId)
          Deletes the account info request for the given user
 boolean deleteMailboxDumpRequest(java.lang.String user, java.lang.String id)
          Deletes the mailbox dump request for the given ID and user.
 void deleteMonitor(java.lang.String sourceUser, java.lang.String destUser)
          Removes the monitor configured for the given source and destination user.
 GenericEntry retrieveAccountInfoRequest(java.lang.String user, java.lang.String requestId)
          Retrieves a previously created account/services related information request for the given user.
 java.util.List<GenericEntry> retrieveAllAccountInfoRequests(java.util.Date fromDate)
          Retrieve all the Account info requests from the given start date.
 java.util.List<GenericEntry> retrieveAllMailboxDumpRequests(java.util.Date fromDate)
          Retrieves all mailbox dump requests from the given start date.
 GenericEntry retrieveMailboxDumpRequest(java.lang.String user, java.lang.String id)
          Retrieves the mailbox dump request for the given ID and user.
 GenericFeed retrieveMonitors(java.lang.String sourceUser)
          Retrieves all the monitors of a given user.
 GenericFeed retrieveNextPageOfAccountInfoRequests(Link next)
          Retrieves the next page of account info requests by following the atom next link.
 GenericFeed retrieveNextPageOfMailboxDumpRequests(Link next)
          Retrieves the next page of mailbox dump requests by following the atom next link.
 GenericFeed retrievePageOfAccountInfoRequests(java.util.Date fromDate)
          Retrieves a page of account info requests from the given optional start date.
 GenericFeed retrievePageOfMailboxDumpRequests(java.util.Date fromDate)
          Retrieves a page of mailbox dump requests from the given start date.
 GenericEntry uploadPublicKey(java.lang.String base64encodedKey)
          Upload a public key for signing mailbox dump archives.
 
Methods inherited from class com.google.gdata.client.appsforyourdomain.AppsForYourDomainService
delete, getAllPages, getEntry, getEntry, getFeed, getFeed, insert, query, update
 
Methods inherited from class com.google.gdata.client.GoogleService
addCookie, batch, createRequest, createRequest, delete, getAuthToken, getAuthTokenFactory, getCookieManager, getCookies, getEntry, getFeed, getFeed, getFeed, handleRedirectException, handlesCookies, handleSessionExpiredException, makePostRequest, setAuthSubToken, setAuthSubToken, setAuthTokenFactory, setCookieManager, setHandlesCookies, setOAuthCredentials, setUserCredentials, setUserCredentials, setUserCredentials, setUserCredentials, setUserToken, tokenChanged
 
Methods inherited from class com.google.gdata.client.Service
classOf, createBatchRequest, createDeleteRequest, createEntryRequest, createFeedRequest, createFeedRequest, createInsertRequest, createLinkQueryRequest, createPatchRequest, createUpdateRequest, delete, delete, endVersionScope, getAltRegistry, getContentType, getDefaultAltRegistry, getExtensionProfile, getFeed, getMetadataRegistry, getProtocolVersion, getRequestFactory, getSchema, getServiceVersion, getStreamFromLink, getStrictValidation, getVersion, initServiceVersion, introspect, parseResponseData, parseResponseData, patch, patch, query, query, setAcceptLanguage, setAltRegistry, setConnectTimeout, setContentType, setExtensionProfile, setHeader, setOAuthProxyHeaders, setPrivateHeader, setProtocolVersion, setReadTimeout, setRequestFactory, setStrictValidation, setTimeouts, startVersionScope, update, useSsl, writeRequestData, writeRequestData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE_URL

public static final java.lang.String BASE_URL
See Also:
Constant Field Values
Constructor Detail

AuditService

public AuditService(java.lang.String adminEmail,
                    java.lang.String adminPassword,
                    java.lang.String domain,
                    java.lang.String applicationName)
             throws AuthenticationException
Parameterized constructor for AuditService.

Parameters:
adminEmail - email id of the administrator
adminPassword - password for the administrator account
domain - the domain to be monitored
applicationName - application name for e.g audit-mycompany
Throws:
AuthenticationException - if an authentication related error occurs.

AuditService

public AuditService(java.lang.String domain,
                    java.lang.String applicationName)
             throws AuthenticationException
Parameterized constructor to setup a Service object which can be used to initialize the service without obtaining a token. The user should explicitly authorize the service by calling either setUserCredentials or setUserToken when using this constructor.

Parameters:
domain - Domain being configured
applicationName - Application name consuming the API
Throws:
AuthenticationException - If an authentication error occurs
Method Detail

createMailMonitor

public GenericEntry createMailMonitor(java.lang.String sourceUser,
                                      MailMonitor mailMonitor)
                               throws AppsForYourDomainException,
                                      java.net.MalformedURLException,
                                      java.io.IOException,
                                      ServiceException
Creates a new monitoring task to begin an audit. Note: The number of daily requests are limited per domain, and can include requests from several administrators during the day

Parameters:
sourceUser - is the user who receives or sends messages that are being audited.
mailMonitor - a POJO with details of the monitoring task
Returns:
a GenericEntry with details of the task created
Throws:
AppsForYourDomainException - If an Audit API error occurs
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

retrieveMonitors

public GenericFeed retrieveMonitors(java.lang.String sourceUser)
                             throws AppsForYourDomainException,
                                    java.net.MalformedURLException,
                                    java.io.IOException,
                                    ServiceException
Retrieves all the monitors of a given user.

Parameters:
sourceUser - user whose monitors are to be retrieved
Returns:
a GenericFeed object with details of monitors created.
Throws:
AppsForYourDomainException - If an Audit API error occurs
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

deleteMonitor

public void deleteMonitor(java.lang.String sourceUser,
                          java.lang.String destUser)
                   throws AppsForYourDomainException,
                          java.net.MalformedURLException,
                          java.io.IOException,
                          ServiceException
Removes the monitor configured for the given source and destination user. Note: The number of daily requests are limited per domain, and can include requests from several administrators during the day

Parameters:
sourceUser - the user who is being monitored
destUser - this user is the auditor who receives the audited email messages as blind carbon copies (Bcc).
Throws:
AppsForYourDomainException - If an Audit API error occurs
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

uploadPublicKey

public GenericEntry uploadPublicKey(java.lang.String base64encodedKey)
                             throws AppsForYourDomainException,
                                    java.net.MalformedURLException,
                                    java.io.IOException,
                                    ServiceException
Upload a public key for signing mailbox dump archives. This public encryption key should be a PGP format ascii-encoded RSA key. Before uploading the public key, convert the key to a base64 encoded string

Parameters:
base64encodedKey - a Base64 encoded, PGP format ASCII read RSA key
Returns:
a GenericEntry instance with the inserted entry.
Throws:
AppsForYourDomainException - If an Audit API error occurs
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

createMailboxDumpRequest

public GenericEntry createMailboxDumpRequest(MailBoxDumpRequest mailBoxDumpRequest)
                                      throws AppsForYourDomainException,
                                             java.net.MalformedURLException,
                                             java.io.IOException,
                                             ServiceException
Creates a new request for obtaining a user mailbox dump. The mailbox files are encrypted using the key uploaded uploadPublicKey and are available in mbox format

Parameters:
mailBoxDumpRequest - a POJO with request details.
Returns:
the inserted entry
Throws:
AppsForYourDomainException - If an Audit API error occurs
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

retrieveAllMailboxDumpRequests

public java.util.List<GenericEntry> retrieveAllMailboxDumpRequests(java.util.Date fromDate)
                                                            throws AppsForYourDomainException,
                                                                   java.net.MalformedURLException,
                                                                   java.io.IOException,
                                                                   ServiceException
Retrieves all mailbox dump requests from the given start date.

Parameters:
fromDate - optional date in the format 'yyyy-MM-dd hh:mm' in UTC. Pass null to retrieve without date filter.
Returns:
a List of all mailbox dump request entries for the domain
Throws:
AppsForYourDomainException - If an Audit API error occurs
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

retrievePageOfMailboxDumpRequests

public GenericFeed retrievePageOfMailboxDumpRequests(java.util.Date fromDate)
                                              throws AppsForYourDomainException,
                                                     java.net.MalformedURLException,
                                                     java.io.IOException,
                                                     ServiceException
Retrieves a page of mailbox dump requests from the given start date.

Parameters:
fromDate - optional date in the format 'yyyy-MM-dd hh:mm' in UTC. Pass null to retrieve without date filter
Returns:
a page of mailbox dump request entries for the domain
Throws:
AppsForYourDomainException - If an Audit API error occurs
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

retrieveNextPageOfMailboxDumpRequests

public GenericFeed retrieveNextPageOfMailboxDumpRequests(Link next)
                                                  throws AppsForYourDomainException,
                                                         java.net.MalformedURLException,
                                                         java.io.IOException,
                                                         ServiceException
Retrieves the next page of mailbox dump requests by following the atom next link.

Parameters:
next - The feed link for next page
Returns:
a page of mailbox dump request entries for the domain
Throws:
AppsForYourDomainException - If an Audit API error occurs
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

retrieveMailboxDumpRequest

public GenericEntry retrieveMailboxDumpRequest(java.lang.String user,
                                               java.lang.String id)
                                        throws AppsForYourDomainException,
                                               java.net.MalformedURLException,
                                               java.io.IOException,
                                               ServiceException
Retrieves the mailbox dump request for the given ID and user.

Parameters:
user - the user whose dump requests need to be retrieved
id - the requestId of the mailbox dump request
Returns:
a GenericEntry instance of the requested dump request
Throws:
AppsForYourDomainException - If an Audit API error occurs
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

deleteMailboxDumpRequest

public boolean deleteMailboxDumpRequest(java.lang.String user,
                                        java.lang.String id)
                                 throws AppsForYourDomainException,
                                        java.net.MalformedURLException,
                                        java.io.IOException,
                                        ServiceException
Deletes the mailbox dump request for the given ID and user.

Parameters:
user - the user whose dump requests need to be deleted.
id - the requestId of the mailbox dump request.
Returns:
true, if delete succeeds.
Throws:
AppsForYourDomainException - If an Audit API error occurs
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

createAccountInfoRequest

public GenericEntry createAccountInfoRequest(java.lang.String user)
                                      throws AppsForYourDomainException,
                                             java.io.IOException,
                                             ServiceException
Creates a new Account Information request. When completed, the account info is available for download.

Parameters:
user - the domain user whose account information is to be audited
Returns:
GenericEntry with request details.
Throws:
AppsForYourDomainException - If an Audit API error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

retrieveAccountInfoRequest

public GenericEntry retrieveAccountInfoRequest(java.lang.String user,
                                               java.lang.String requestId)
                                        throws AppsForYourDomainException,
                                               java.io.IOException,
                                               ServiceException
Retrieves a previously created account/services related information request for the given user.

Parameters:
user - the user whose account info is being retrieved
requestId - the unique requestId identifying the request
Returns:
a GenericEntry instance with request details
Throws:
AppsForYourDomainException - If an Audit API error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

retrieveAllAccountInfoRequests

public java.util.List<GenericEntry> retrieveAllAccountInfoRequests(java.util.Date fromDate)
                                                            throws AppsForYourDomainException,
                                                                   java.io.IOException,
                                                                   ServiceException
Retrieve all the Account info requests from the given start date.

Parameters:
fromDate - optional date in the format 'yyyy-MM-dd hh:mm' in UTC. Pass null to retrieve without date filter.
Returns:
Entries created starting the requested date
Throws:
AppsForYourDomainException - If an Audit API error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

retrievePageOfAccountInfoRequests

public GenericFeed retrievePageOfAccountInfoRequests(java.util.Date fromDate)
                                              throws AppsForYourDomainException,
                                                     java.net.MalformedURLException,
                                                     java.io.IOException,
                                                     ServiceException
Retrieves a page of account info requests from the given optional start date. Pass null for date to retrieve requests without date filter.

Parameters:
fromDate - optional date in the format 'yyyy-MM-dd hh:mm' in UTC. Pass null to retrieve without date filter
Returns:
a page of account info request entries for the domain
Throws:
AppsForYourDomainException - If an Audit API error occurs
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

retrieveNextPageOfAccountInfoRequests

public GenericFeed retrieveNextPageOfAccountInfoRequests(Link next)
                                                  throws AppsForYourDomainException,
                                                         java.net.MalformedURLException,
                                                         java.io.IOException,
                                                         ServiceException
Retrieves the next page of account info requests by following the atom next link.

Parameters:
next - The feed link for next page
Returns:
a page of account info request entries for the domain
Throws:
AppsForYourDomainException - If an Audit API error occurs
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

deleteAccountInfoRequest

public void deleteAccountInfoRequest(java.lang.String user,
                                     java.lang.String requestId)
                              throws AppsForYourDomainException,
                                     java.io.IOException,
                                     ServiceException
Deletes the account info request for the given user

Parameters:
user - the user whose request is to be deleted
requestId - the unique id of the request
Throws:
AppsForYourDomainException - If an Audit API error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails