Google Data APIs Client Library (1.41.1)



com.google.gdata.client.appsforyourdomain.migration
Class MailItemService

java.lang.Object
  extended by com.google.gdata.client.Service
      extended by com.google.gdata.client.GoogleService
          extended by com.google.gdata.client.media.MediaService
              extended by com.google.gdata.client.appsforyourdomain.migration.MailItemService
All Implemented Interfaces:
AuthTokenFactory.TokenListener

public class MailItemService
extends MediaService

The MailItemService class is a MediaService that can upload mail to the Google Apps Email Migration API.

The recommended way to perform mail migration is to issue multipart POST requests, where the first part contains an Atom entry specifying the message properties and labels, and the second part contains the complete RFC822 message as UTF-8 text.


Nested Class Summary
static class MailItemService.Versions
           
 
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
 
Field Summary
static java.lang.String APPS_APIS_DOMAIN
          Domain for sending API requests.
static Version DEFAULT_VERSION
          Version 1 is the current default version for MailItemService.
static java.lang.String URL_PREFIX
          URL prefix for accessing migration feeds.
static java.lang.String URL_SUFFIX
          URL suffix for the mail item batch feed.
 
Fields inherited from class com.google.gdata.client.media.MediaService
DEFAULT_CHUNKED_BUFFER_SIZE, NO_CHUNKED_MEDIA_REQUEST
 
Fields inherited from class com.google.gdata.client.Service
connectTimeout, extProfile, metadataRegistry, requestFactory
 
Constructor Summary
MailItemService(java.lang.String applicationName)
          Constructs a MailItemService instance for an application with the name applicationName.
MailItemService(java.lang.String applicationName, java.lang.String protocol, java.lang.String domainName)
          Constructs a MailItemService instance connecting to the service with name serviceName for an application with the name applicationName.
 
Method Summary
 MailItemFeed batch(java.lang.String domain, java.lang.String userName, MailItemFeed feed)
          Inserts one or more MailItem entries in a single batch operation.
 
Methods inherited from class com.google.gdata.client.media.MediaService
getDefaultAltRegistry, getMedia, getMedia, insert, insert, setChunkedMediaUpload, update, updateMedia, updateMedia
 
Methods inherited from class com.google.gdata.client.GoogleService
addCookie, batch, createRequest, createRequest, delete, delete, getAuthToken, getAuthTokenFactory, getCookieManager, getCookies, getEntry, getEntry, getFeed, 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, getEntry, getExtensionProfile, getFeed, getFeed, getMetadataRegistry, getProtocolVersion, getRequestFactory, getSchema, getServiceVersion, getStreamFromLink, getVersion, initServiceVersion, introspect, parseResponseData, parseResponseData, patch, patch, query, query, query, setAcceptLanguage, setAltRegistry, setConnectTimeout, setContentType, setExtensionProfile, setHeader, setOAuthProxyHeaders, setPrivateHeader, setProtocolVersion, setReadTimeout, setRequestFactory, 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

DEFAULT_VERSION

public static final Version DEFAULT_VERSION
Version 1 is the current default version for MailItemService.


APPS_APIS_DOMAIN

public static final java.lang.String APPS_APIS_DOMAIN
Domain for sending API requests.

See Also:
Constant Field Values

URL_PREFIX

public static final java.lang.String URL_PREFIX
URL prefix for accessing migration feeds.

See Also:
Constant Field Values

URL_SUFFIX

public static final java.lang.String URL_SUFFIX
URL suffix for the mail item batch feed.

See Also:
Constant Field Values
Constructor Detail

MailItemService

public MailItemService(java.lang.String applicationName)
Constructs a MailItemService instance for an application with the name applicationName.

Parameters:
applicationName - the name of the client application accessing the service. Application names should preferably have the format [company-id]-[app-name]-[app-version]. The name will be used by the Google servers to monitor the source of authentication.

MailItemService

public MailItemService(java.lang.String applicationName,
                       java.lang.String protocol,
                       java.lang.String domainName)
Constructs a MailItemService instance connecting to the service with name serviceName for an application with the name applicationName. The service will authenticate at the provided domainName.

Parameters:
applicationName - the name of the client application accessing the service. Application names should preferably have the format [company-id]-[app-name]-[app-version]. The name will be used by the Google servers to monitor the source of authentication.
protocol - name of protocol to use for authentication ("http"/"https")
domainName - the name of the domain hosting the login handler
Method Detail

batch

public MailItemFeed batch(java.lang.String domain,
                          java.lang.String userName,
                          MailItemFeed feed)
                   throws BatchInterruptedException,
                          java.io.IOException,
                          java.net.MalformedURLException,
                          ServiceException
Inserts one or more MailItem entries in a single batch operation. Using batch instead of repeated calls to insert is helpful in reducing HTTP overhead.

Parameters:
domain - the domain into which mail is being migrated
feed - a feed containing one or more MailItemEntry objects, each of which has been tagged with BatchUtils#setBatchId(com.google.gdata.data.BaseEntry, String). The batch operation type of each entry must be BatchOperationType.INSERT; however, there should be no need to call BatchUtils.setBatchOperationType on each entry, as this operation is already the default.
Returns:
a feed with the result of each operation in a separate MailItemEntry object.
Throws:
java.io.IOException - if an error occurs while communicating with the GData service.
java.net.MalformedURLException - if the batch feed URL cannot be constructed.
ServiceException - if the insert request failed due to system error.
BatchInterruptedException - if an irrecoverable error was detected by the server while parsing the request, like invalid XML data. Some operations might have succeeded when this exception is thrown. Check BatchInterruptedException.getFeed().