About the AWS SDK for Java
The AWS SDK for Java is a single, downloadable package that includes the AWS Java library, code samples, and documentation. Previously, AWS offered a collection of individual Java libraries for many infrastructure services, but not Amazon S3. Now, you can get started in minutes with a single package that includes the AWS Java library, code samples, and documentation. Additionally, Eclipse Java IDE users can get started with the SDK using the AWS Toolkit for Eclipse.
Learn more about the AWS SDK for Java at http://aws.amazon.com/sdkforjava.
What's New in the AWS SDK for Java Library?
There are a number of differences between the previous Java libraries from AWS and the new AWS SDK for Java. In addition to grouping the libraries into a single package along with documentation and code samples, the AWS SDK for Java makes it easier to use multiple AWS products.
Here are some highlights of new features in the AWS SDK for Java library:
- Support for Amazon S3 We now provide an officially-supported Java API for working with Amazon S3.
- Improved exception handling - The AWS Java SDK uses runtime (or unchecked) exceptions for catching service-level and client-level issues. See AWS SDK for Java Tips and Tricks for more information.
- Easier access to data returned from operations No more
- Documentation More detailed and comprehensive JavaDocs.
- Minor improvements to service interfaces Minor changes include renaming RunningInstance to just Instance, and correcting unpluralized list properties.
We recommend switching to the new AWS SDK for Java, where you'll continue to get new feature updates and bug fixes.
Overview of API Changes
The following section lists the API differences between the previous Java libraries and the new AWS SDK for Java.
Changes for All Services
The changes that affect all services include:
- Methods that return lists are now pluralized.
- Constructors with parameters have changed.
- The old
<OperationName>Responsetypes which encapsulate
<OperationName>Resultobjects have gone away, operations just return the
<OperationName>Resultdirectly now. This changes the type and removes the need to perform the
.setEndpoint()method has moved from
ClientConfigurationto the client directly; more broadly this is because the purpose of
ClientConfigurationhas changed from storing client-specific settings to a set of configurations that apply across multiple clients.
- Dates are represented as
java.util.Dateobjects, instead of strings.
- Operations whose parameters are all optional have an additional method form that doesn't require a request object.
- Exceptions are now runtime exceptions (see AWS SDK for Java Tips and Tricks for more information on handling exceptions).
- More specific exception subclasses are available to help developers detect specific error conditions (for example:
NumberDomainBytesExceededExceptionfor Amazon SimpleDB).
- The client mock implementations have been removed. Instead, developers are encouraged to use more flexible and full featured mock libraries, such as:
- Java package names have changed so that the old client classes (for example:
com.amazonaws.ec2) don't conflict with the new SDK classes (for example:
- toJSONFragment and toXMLFragment methods have been removed from Model objects. Developers who need this functionality are encouraged to use a more standard third-party Java serialization library.
unset<Type>methods have been removed. If you need to empty out a list member in a request object, just pass in null to the setter or fluent setter.
ObjectFactoryclasses have been removed to simplify using the libraries.
- AWS request IDs are available through all Exception objects and through request/response logs.
- Enums are available for common string values passed in service requests (for example: Amazon EC2's
InstanceTypeenum lists the available EC2 instance types).
The additional changes of interest by service are:
Amazon Elastic MapReduce
Some additional resources to help you build your application include: