Tag: Java


Configuring SDK Download Behavior in the AWS Toolkit for Eclipse

The AWS Toolkit for Eclipse will automatically download new releases of the AWS SDK for Java, ensuring that you always have the most recent version of the service clients and productivity libraries. Some customers with slow network connections told us that the automatic downloads were sometimes triggered when they didn’t want to wait. In response, we made a couple of small changes to make this process more predictable and easier to manage.

First, we changed the directory where we download the SDKs. In previous releases of the Toolkit, the SDKs were stored in a directory specific to your eclipse workspace, so you would get a new SDK downloaded every time you started a new workspace. To eliminate this duplication, we consolidated all SDKs, for all workspaces, into one directory. It defaults to your home directory, but you can configure it to be wherever you want via a new preference page.

We also added a preference setting to not automatically check for and download new releases, so that customers adversely impacted by downloading every release of the SDK can opt out of this behavior. Even if you decide to manage your SDK releases manually, you can always update to the latest version using the Check for updates now button in the preferences.

As a final note, the same preferences can be configured for the AWS SDK for Android.

Android Support in the AWS Toolkit for Eclipse

We’ve launched a new feature in the AWS Toolkit for Eclipse to make it even easier to create AWS enabled Android applications.

The New AWS Android Project wizard creates an Android project preconfigured with the AWS SDK for Android in the classpath. The project can also optionally include a sample application demonstrating how to upload images to Amazon S3 and view them in a mobile browser.

For more information, see the full release notes.

Connecting to Amazon RDS Databases from Eclipse

When developing any application that uses a database, it’s incredibly important to have good tools at hand for working with the data in your database. Eclipse has great tools for working with relational data, and if you’re using the Amazon Relational Database Service (Amazon RDS) to manage your database, then configuring a connection to your database with the AWS Toolkit for Eclipse only takes a few clicks.

Before going any further, make sure you have the AWS Toolkit for Eclipse and the Eclipse Data Tools Platform (DTP) installed. The easiest way to ensure you have Eclipse DTP installed is to start with the Eclipse Java EE distribution. Once you’re running the Eclipse JEE distribution, you can install the AWS Toolkit for Eclipse through the Eclipse Marketplace, or by pointing the Eclipse Update Manager directly to the AWS Eclipse update site at http://aws.amazon.com/eclipse/ .

If you don’t have an Amazon RDS Database Instance running yet, you can launch one with just a few clicks in the AWS Management Console.

Once you’ve got a DB Instance running, open the AWS Explorer view in the AWS Toolkit for Eclipse. Make sure you’re using the correct account and AWS region, and you should see your DB Instance listed in the AWS Explorer view.

Once you find your DB Instance in the AWS Explorer view, right-click and select Connect....

From here, you need to specify the password to use when connecting to your database. You might also have to specify where the JDBC driver library is for your database type. The MySQL JDBC driver is distributed with the plug-in, but other databases have less permissive licenses and require you to download the JDBC driver from the vendor’s website and tell the plug-in where the jar is.

Once you’ve created the connection inside Eclipse to your DB Instance, you can use all the tools in Eclipse’s Data Tools Platform to work with your data. You can use the SQL Query Editor to run queries on your database, review your schema, and make changes using the DataSource Explorer, or just browse and edit your data in a spreadsheet editor.

AWS re:Invent Wrap Up

We’re all back in the office after a great week at re:Invent! We enjoyed meeting so many customers and hearing feedback from you on how you’re using the AWS services, SDKs, and tools.

If you weren’t able to attend AWS re:Invent this year, you can still check out lots of great video content online:

The technical sessions are being uploaded, too, including the sessions Zach and I presented:

There’s lots more, all available on the AmazonWebServices channel on YouTube.

What did you enjoy most about AWS re:Invent? You can find a survey for the whole conference, as well as individual surveys for each technical session you attended on the AWS re:Invent Sessions page. Surveys will be open until the end of the week (December 7th), so hurry and get your feedback in!

The AWS SDK for Java at re:Invent

The first ever AWS conference, re:Invent, has sold out! If you are one of the lucky people with a conference pass, we hope that you will come to hear Jason Fulghum and me speak about advanced features of the AWS SDK for Java and the AWS Toolkit for Eclipse. On Wednesday morning after the keynote, I’m giving a presentation and live demo of the AWS Toolkit for Eclipse’s features. It’s called Develop, Deploy, and Debug with Eclipse and the AWS SDK for Java:

The AWS SDK for Java and the AWS Toolkit for Eclipse enable developers to easily manage AWS resources, quickly build web scale Java applications that interact with AWS services, and deploy those applications to the AWS platform. In this session, learn what functionality the AWS SDK for Java and the AWS Toolkit for Eclipse provide, see common usage scenarios with the AWS SDK for Java, and discover how to use the management, deployment, and debugging capabilities in the AWS Toolkit for Eclipse.

Then on Thursday afternoon, Jason Fulghum will be sharing our best tips and tricks for getting the most out of the AWS SDK for Java in his presentation, Being Productive with the AWS SDK for Java:

The AWS SDK for Java includes several higher level APIs that make working with AWS simpler. Learn more about higher level APIs such as TransferManager, which allows you to easily manage asynchronous uploads and downloads from Amazon Simple Storage Service (Amazon S3); the AWS DynamoDB Object Persistence Layer, which allows you to annotate your Java classes to specify how the SDK should map them to AWS DynamoDB tables when they are saved and loaded; and other higher level APIs such as the Amazon Simple Email Service (Amazon SES) JavaMail provider.

We hope to see you at re:Invent! But if you can’t make it this year, don’t worry — we’ll be sharing the tips in our talks, and more, right here on the AWS Java Blog in the months to come.

Storing Java objects in Amazon DynamoDB tables

by zachmu | on | in Java | Permalink | Comments |  Share

The AWS SDK for Java makes it easy to store objects in Amazon DynamoDB and get them back out again, all without having to write the code to transform your objects into table items and vice versa. All you need to do is annotate your domain classes in a few places and the SDK will handle the work of getting objects into and out of the database. For example, here’s a minimal User class we want to store in DynamoDB:

@DynamoDBTable(tableName = "users")
public class User {
 
    private Integer id;
    private Set<String> friends;
    private String status;
 
    @DynamoDBHashKey
    public Integer getId() { return id; }
    public void setId(Integer id) { this.id = id; }
 
    @DynamoDBAttribute
    public Set<String> getFriends() { return friends; }
    public void setFriends(Set<String> friends) { this.friends = friends; }
 
    @DynamoDBAttribute
    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }
}

The DynamoDBMapper utility class makes it simple to store instances of this class in DynamoDB.

AmazonDynamoDB dynamo = new AmazonDynamoDBClient(awsCredentials);
DynamoDBMapper mapper = new DynamoDBMapper(dynamo);
 
// save a new item
mapper.save(newUser);
 
// update the item
newUser.setStatus("active");
newUser.getFriends().remove("Jeremy");
mapper.save(newUser);
 
// delete the item
mapper.delete(newUser);

DynamoDBMapper can also handle query and scan operations with automatic result pagination, optimistic locking, automatic hash key generation, custom marshaling logic, and much more. For more detail, see this article.

Welcome to the AWS SDKs and Tools Java blog

Welcome to the AWS SDKs and Tools Java blog. We’re glad to see you here!

This blog features information for AWS Java developers, including:

  • Demonstrations of new features in the AWS SDK for Java
  • Announcements of new features in the AWS Toolkit for Eclipse
  • Best practices for using the SDK
  • Important AWS product announcements for Java developers
  • Lots of code samples

You’ll see content from many of our team members, including developers from the SDKs and Tools team, as well as Java developers from service teams.

We hope you come back often to visit or subscribe to our blog using the RSS feed button at the top of the page. If you’d like us to cover any specific topics, please let us know and we’ll do our best.