Architecture & DesignJava Cloud Development: What Developers Need to Know

Java Cloud Development: What Developers Need to Know

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

If you are a Java developer and your organization is jumping on the cloud computing bandwagon, you have to change the way you build and deploy applications. In this article, I will examine what is in store for you with each cloud delivery model and with both public and private cloud scenarios.

Cloud Computing Delivery Models: IaaS, PaaS and SaaS

The delivery model for cloud infrastructure can be broadly categorized as Infrastructure as Service (Iaas), Platform as a Service (PaaS) or Software as a Service (SaaS).

Infrastructure as a Service (IaaS)

Cloud computing vendors provide infrastructure services such as computers, storage devices, and routers to deploy your application. This is a not a very new concept. Web hosting companies such as GoDaddy have been providing infrastructure to host websites to small and medium-sized companies for more than a decade. However, this is becoming mainstream for internal enterprise applications. Companies such as Amazon, Rackspace, Microsoft and others are leading providers for IaaS. When you sign up for IaaS (e.g. with Amazon EC2), the cloud vendor will allocate a virtual machine for your use.

If you use Infrastructure as a Service, you may have to deal with installation and configuration of the software platforms such as application servers, databases, and so on. The cloud vendors provide tools to manage the infrastructure and provide options for elastic computing.

Most software vendors are working with cloud providers such as Amazon, Rackspace and coming up with machine images or appliances with pre-configured software platforms. For example, you can use a pre-built Amazon Machine Image for JBoss application server or Oracle WebLogic Server. You do not have to incur upfront costs for purchasing software and you avoid the mundane tasks of installation/configuration of the software. The cloud provider will charge you a fee based on the real usage of resources such as CPU, bandwidth, number of users, and so on.

Platform as a Service (PaaS)

The cloud vendor provides the application platform such as middleware, database, messaging system, and so on. You have to use your development tool s remotely to leverage the services offered by the cloud vendor. This frees companies to worry about computing resources, tracking licenses, cost of installation and configuration/administration of software. This is gaining popularity and there are several vendors that provide Platform as Service (PaaS).

Some examples of PaaS are Salesforce.com’s Force.com platform, Google App Engine, VMForce (jointly launched by Salesforce.com and VMware) and Microsoft’s Windows Azure platform. This aspect of cloud computing is very disruptive in nature and is going to impact Java developers the most. I will examine this in detail later in this article.

Software as a Service (SaaS)

This is the most popular aspect of cloud computing and has been for more than a decade. A SaaS provider offers software/application hosted in the cloud. Some examples are Salesforce.com CRM, Workday HRMS, GoogleApps, and BMC’s RemedyForce. SaaS is primarily targeted to reduce total cost of ownership by avoiding expensive cost of development, deployment and maintenance, and so on. SaaS completely avoids having an internal IT infrastructure; the SaaS vendor takes the responsibility to ensure availability, scalability, security and performance of the applications. If SaaS is widely deployed and successful, then it will have great impact on the developer community. No IT organizations will require developers to build new applications–only the SaaS vendors!

Types of Cloud: Public vs. Private

Cloud infrastructure can be categorized based on the target user community. If the cloud infrastructure is open to everyone and is shared by a large number of customers, then it is referred to as a public cloud. The cloud infrastructure provided by Amazon, Google, Rackspace, Salesforce.com and Microsoft are examples of public clouds. Some IT organizations are adopting a cloud computing model inside their organization to serve their internal users. These kinds of clouds are being referred to as private clouds. A private cloud could be hosted inside an IT organization or a cloud vendor such as Rackspace can customize a part of their infrastructure for a specific company. A private cloud helps an IT organization to offer itself as a service to business users.

The concept of community cloud is gaining popularity. It is meant to service a known set of customers instead of being open to everyone. The community cloud will help share the cloud infrastructure between multiple companies and hence share the cost based on their usage.

The most interesting aspects of these will be the usage of the hybrid cloud. For example, you want to use a Java application deployed in a public cloud that accesses a database running on-premise or in a private cloud environment.

Using IaaS for Java Development

Using IaaS may not change your life drastically and may actually make it better. Most of us struggle to find computing resources in our IT organizations during development or testing. Cloud computing can make your life easier by providing a self-servicing model. If you sign up to use a public cloud, your cloud vendor provides tools to start and configure a virtual machine. For example, Microsoft Azure allows users to use remote desktops to connect to the virtual machine. You can choose to use your virtual machine however you want to.

Cloud management vendors such as VMware and BMC are providing infrastructure to manage, provision and configure virtual machine instances in a private cloud environment. They provide features such as a self-service portal to provision a new virtual machine instance.

Following is a screenshot of BMC Software’s self-service portal for creating and managing virtual machine instances.

Java Cloud Development -- BMC Software Self-service

If you do not want to worry about installation and tracking licenses of your software while using a public cloud, then you can use a pre-configured virtual machine image or appliance provided by your vendor.

For the private cloud, your IT administrators have to create their own virtual image instance or use one provided by software vendors. For example, Oracle is providing virtual appliances for their software at that can be used with their private cloud infrastructure.

Here is an example of VMware’s vCloud Director Product, which provides self-service capability to start a pre-configured virtual machine with a specific software stack.

Java Cloud Development -- VMware vCloud Director

Some cloud management software such as BMC Software’s allows extending your virtual infrastructure with an application stack. For example, you can add LAMP or a Java stack to your virtual machine when you are trying to configure using a self-service portal.

Java Cloud Development -- BMC Software Self-service (2)

This private cloud greatly reduces the pain of acquiring hardware, installing of pre-requisites and the software each time you need an infrastructure for developing or testing an application.

Similar to the pay-per-usage concept, the private cloud management vendors are providing capabilities such as billing and charge-back to internal business units within an organization based on their usage.

Using PaaS for Java Development

PaaS is revolutionizing the way applications are built and deployed. You do not have to worry about the actual physical or virtual machine, application server/middleware platform and database or messaging system. You depend upon the platform provider for these services, similar to what you depend upon with an application server or a database in your on-premise environment.

When you start to build your application, you have to plan your target deployment platform because there is no standard similar to Java EE. If you are using PaaS then you have to use the API /SDK provided by the PaaS vendor. Next, I will examine PaaS offerings from a few popular vendors.

Google App Engine

Google App Engine provides the ability to develop and deploy applications in the cloud using Python or Java.

Google provides an Eclipse plugin to help you build Java-based Web applications and deploy them into their cloud platform. The following figure shows the Eclipse plugin that can be used for building and deploying applications to Google App Engine. As you can see, the deployment of the application requires credentials in Google App Engine.

Java Cloud Development -- Google App Engine

Google App Engine provides a Web container environment in the cloud. You can use Servlets, JSP, JPA or JDO and GWT to build Web-based applications. For persistence, you have to use Google Bigtable. Bigtable is a high-performance and proprietary database for storing structured data and is based on distributed file system.

Google App Engine supports Java Persistence API (JPA) with BigTable. However, JDBC is not allowed from Google App Engine and you cannot use any relational database on the cloud or an on-premise database on a hybrid cloud. This is a big limitation for any application that you want to build using an existing database. The Eclipse-based IDE allows you to deploy an app directly to Google App Engine.

Google App Engine is not Java EE compliant and does not support many features that you may be using with your Java Web application. You cannot move an existing Java Web application directly to Google App Engine without making source code changes.

If you are building an application that is oriented to external users and requires services such as BlobStore, Images, Mail Storage, XMPP, Map Reduce, etc., then you may consider Google App Engine. Google App Engine also allows integration with existing applications such as Oracle CRM using Web services.

Force.com

The Force.com platform allows developers to build applications on the cloud using Apex code and VisualForce, proprietary technologies developed by Salesforce.com. Apex code is a strongly-typed programming language that can be used to build server-side code such as business logic, database triggers, etc.–Java is not natively supported in the Force.com platform.

Following is an example of an Apex class. If you look carefully, it looks similar to Java.

 public interface ConfirmOrder {

Double getRebate();

}

public class OrderConfirmation implements ConfirmOrder {

static final double DEFAULT_REBATE = .10;

public Double getRebate() {

return DEFAULT_REBATE;

}

}

Salesforce.com provides an Eclipse plugin named Force.com IDE that you can use to build, test and deploy applications in the Force.com platform. Developers can also share their applications in the AppExchange, which is similar to the Apple AppStore. The following figure shows a screen shot of the Force.com IDE and type of components that you can build with it.

You can use VisualForce to build visualization for applications that are deployed on the Force.com platform. VisualForce provides an MVC paradigm to build user interfaces (UIs). You can use Force.com IDE to build VisualForce pages.

VMForce

The VMForce platform is a joint venture between Salesforce.com and VMware and is supposed to provide cloud application platform using SpringSource technologies. At the time of writing, this service was not available to the public. As per the marketing materials, you should be able to deploy standards compliant Web applications to VMForce. The VMForce platform will be built on SpringSource tcServer–a modified version of the popular Tomcat Web container. It is expected that it will provide better integration between JPA and the Force.com database. Hopefully, VMForce will also enable users to leverage their existing on-premise database by providing support for the hybrid cloud infrastructure.

Amazon Web Services

Amazon Web Services (AWS) not only provides a complete application platform named Elastic BeanStalk (still in beta), where you can deploy your Java Web application, but it also provides some key services such as SimpleDB, Elastic MapReduce, and Simple Queue, which you can use from your application either when deploying to Amazon EC2 or your on-premise application. Amazon also has started Simple Relational Data Service, a fully-functional MySQL database, and plans to start Oracle database services.

You can build Java applications using the Amazon Web Services SDK, either in Java or several other programming languages. You can use Amazon Simple DB with JPA deployed in your application in your Tomcat or WebLogic instance.

Also, a community library is available that provides a Java API for using all Amazon Web services. Amazon provides an Eclipse plugin to build applications using AWS.

AWS Elastic Beanstalk

Elastic Beanstalk provides a Web container environment using Apache Tomcat where you can deploy Java Web applications. You just package your Web application into WAR packages and deploy into Beanstalk either using Eclipse, Amazon’s management console, command line tool or using Web services calls. If you use Tomcat or a standard Web application, then it will be much easier to migrate your on-premise application to Amazon Beanstalk. Amazon provides all the benefits of cloud computing such as load balancing and auto-scaling and provides Web interfaces to manage these features. You can use either relational databases such as Oracle or Amazon’s Simple DB Service for persisting data from your Web application.

It is apparent from above discussion that most of your existing Java applications will not work as is without requiring application changes. This is due to the fact that there are no standard APIs and you will have to learn the API based on the PaaS provider. If you are using advanced services such as JMS or EJB then you have to make changes to your application because none of the PaaS providers currently supports these API. I hope that a standard will evolve as the PaaS concept gains popularity in the developer community.

Building a Private PaaS for Java Development

Similar to building private IaaS, IT organizations may choose to build their private PaaS using the same characteristics of a public PaaS environment. You can leverage the tools and frameworks from a private cloud management vendor for managing a private PaaS. Your IT organization can provide services such as J2EE or Java EE servers, JMS servers, database, caching services, security, and so on. For example, an organization may build their PaaS environment with Oracle Fusion Middleware (WebLogic, Coherence and SOA) and a database and host these themselves.

As a developer, you build applications using services exposed by your private PaaS and deploy your application into the deployment environment made available to you. Most application server vendors such as Oracle, IBM and JBoss are working to provide infrastructure to help IT organizations provide private PaaS infrastructures. Microsoft’s Windows Azure Platform Appliance enables organizations to build their own PaaS environment using Microsoft technologies.

If your IT organization chooses to build its own Private PaaS, your development methodology probably does not have to change a whole lot, except you cannot choose your own versions of the API and libraries. You will be limited to the services provided by your private PaaS. The private PaaS will deliver several benefits, such as standardization across the organization, consistent upgrade and patching policies, optimal resource usage, and so on.

Using SaaS for Java Development

If your company is choosing SaaS, then end users directly use the application as a service and hence there is no IT infrastructure required on premise. For example, your customer may be using CRM from Salesforce.com, a HRMS system from Workday or a help desk system from BMC Software. When using SaaS, there may be some customization required to meet your organization’s needs and as a developer you may have to use the platform made available by the SaaS vendor. For example, you have to use Force.com, Apex and VisualForce to customize Salesforce.com’s CRM.

There may be several opportunities for developers to integrate new SaaS applications with existing systems based on the size of their businesses. You have to note that an enterprise cannot move their applications to SaaS or cloud-based solutions overnight. For example, an organization may adopt Salesforce.com CRM to replace their old CRM system, but they may have to integrate it with their existing applications such as Oracle eBusiness Suite. The SaaS vendors provide both SOAP- and REST-based Web services to help customers integrate with their existing applications. For example, you can use JAX-WS 2.1 to integrate your existing applications with Salesforce.com.

SaaS for Application Lifecycle Management

Another important aspect of SaaS is for Java developers to use application lifecycle management (ALM) tools such as source code control or continuous integration as services. Several companies such as CollabNet and VMware have started offering these services in the cloud. This frees you from worrying about building these software infrastructure elements in-house and mundane issues such as backup, recovery, availability, and so on.

Conclusion

Cloud computing is changing the way applications are built and deployed. In this article, I provided an introduction to cloud computing and provided some insights on different cloud platforms. Most importantly, you learned how cloud computing will impact your life as a Java developer.

About the Author

Debu Panda is a technologist with more than 18 years of experience. He is the lead author of the top-selling books EJB 3 In Action and Middleware Management. He is a regular contributor to leading technology magazines and a presenter at conferences such as JavaOne and Oracle OpenWorld. He blogs about middleware at http://debupanda.blogspot.com

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories