Hey Java Devs, Here's How to Get Started on Windows Azure
The Cloud Zone is brought to you in partnership with Mendix. Better understand the aPaaS landscape and how the right platform can accelerate your software delivery cadence and capacity with the Gartner 2015 Magic Quadrant for Enterprise Application Platform as a Service.
The content of the following article was originall written by Kris Raigh over at The Silver Lining Blog.
Getting Started with Windows Azure for Java
Hello, my name is Kris, and I work on Windows Azure alongside Larry and Brian. I specifically manage some of our documentation and community efforts for Java support on Windows Azure. In this blog post, I’ll talk about how to get started with Java on Windows Azure and provide links and additional information on the wealth of resources already available to start developing Java apps for Windows Azure.
The Windows Azure SDK for Java provides client libraries and tools to allow Java developers to quickly and easily create applications that run on Windows Azure or leverage Windows Azure services such as Windows Azure Storage or Service Bus.
Downloading and Installing the Windows Azure SDK
To get started with Java on Windows Azure, you need two major components:
- Windows Azure Emulator and Eclipse Tooling
- Windows Azure Client Libraries for Java
You can install the Windows Azure Emulator and Eclipse Tooling directly from Eclipse. You can download the Windows Azure Client Libraries for Java either manually or via Apache Maven. The instructions on how to do this are available here.
In the rest of this blog post, I’ll discuss some key features and supported scenarios of Java in Windows Azure, and highlight additional resources where one can learn further.
Windows Azure Service Runtime with Java
The Windows Azure Service Runtime library provides functionality that allows your application to interact with the Windows Azure environment. It also allows your application to determine information about the roles, role instances, and role environment. Examples of where you would use the Service Runtime include:
- Determining configuration settings, local resources, and role-related information.
- Responding to role environment changes, for example a change to a configuration setting.
- Requesting a recycle of a role instance.
The RoleEnvironment, RoleInstance, and Role classes are the main classes in the Service Runtime. They are described conceptually in greater detail here and described from an API perspective at the Javadocs.
SQL Azure with Java
This topic on SQL Azure and Java describes in great detail the common scenarios that you may wish tackle with SQL Azure and Java. It is helpful to also understand how to use the JDBC driver for SQL Azure and SQL Server, and conceptually overview SQL Azure itself, should you not be fluent in it. Remember that to attempt these scenarios, your environment must meet the following pre-requisites:
- A Java Developer Kit (JDK), v 1.6 or later.
- A Windows Azure subscription
- If you are using Eclipse:
- Eclipse IDE for Java EE Developers, Helios or later
- The Windows Azure Plugin for Eclipse with Java. During installation of this plugin, ensure that Microsoft SQL Server JDBC Driver 3.0 is included
- If you are not using Eclipse:
Understanding and Using the Windows Azure Plugin for Java
The Windows Azure Plugin for Eclipse with Java provides templates and functionality that allow you to easily create, develop, test, and deploy Windows Azure applications using the Eclipse development environment. The Windows Azure Plugin for Eclipse with Java is developed by Persistent Systems Ltd, and is sponsored and designed by Microsoft. It is an Open Source project, whose source code is available under the Apache License 2.0 from the project’s site at http://sourceforge.net/projects/waplugin4ej/.
The following topics provide information about the Windows Azure Plugin for Eclipse with Java.
- What's New in the Windows Azure Plugin for Eclipse with Java
- Installing the Windows Azure Plugin for Eclipse with Java
- Creating a Hello World Application Using the Windows Azure Plugin for Eclipse with Java
- Using the Windows Azure Service Runtime Library in JSP
- Enabling Remote Access in Windows Azure Using Eclipse
- Debugging in Windows Azure Using Eclipse
- Miscellaneous Role Configuration Settings
- Session Affinity
- How to Maintain Session Data with Session Affinity
- Displaying Javadoc content in Eclipse for the Windows Azure Libraries for Java
Tutorials and How-to Guides on Windows Azure + Java
In addition to the resources above that describe how to exploit the Windows Azure plug-in for Eclipse, the following select collection of existing tutorials and how-to guides will also be useful.
This example shows you how you can use Windows Azure storage to store images in Windows Azure. The code is for a console application that uploads an image to Windows Azure, and then creates an HTML file that displays the image in your browser.
This guide shows you how to perform common scenarios using the Windows Azure Blob storage service and the Windows Azure SDK for Java. The scenarios covered include uploading, listing, downloading, and deleting blobs.
This guide shows you how to perform common scenarios using the Windows Azure Queue storage service and the Windows Azure SDK for Java. The scenarios covered include inserting, peeking, getting, and deleting queue messages, as well as creating and deleting queues.
This guide will show you how to perform common scenarios using the Windows Azure Table storage service and Windows Azure SDK for Java. The scenarios covered include creating and deleting a table, inserting and querying entities in a table.
This guide demonstrates how to perform common programming tasks with the SendGrid email service on Windows Azure and Windows Azure SDK for Java. The scenarios covered include constructing email, sending email, adding attachments, using filters, and updating properties
This guide shows you how to use Service Bus queues and use the Windows Azure SDK for Java. The scenarios covered include creating queues, sending and receiving messages, and deleting queues.
This guide shows you how to use Service Bus topics and subscriptions and use the Windows Azure SDK for Java. The scenarios covered include creating topics and subscriptions, creating subscription filters, sending messages to a topic, receiving messages from a subscription, and deleting topics and subscriptions.