Thursday, January 20, 2011

Getting Started: Java with Google App Engine


Getting Started: Java with Google App Engine


Step1 Installing the Java SDK:

You develop and upload Java applications for Google App Engine using the App Engine Java software development kit (SDK).
The SDK includes software for a web server that you can run on your own computer to test your Java applications. The server simulates all of the App Engine services, including a local version of the data store, Google Accounts, and the ability to fetch URLs and send email from your computer using the App Engine APIs.
Google App Engine supports Java 5 and Java 6. When your Java application is running on App Engine, it runs using the Java 6 virtual machine (JVM) and standard libraries. Ideally, you should use Java 6 for compiling and testing your application to ensure that the local server behaves similarly to App Engine.
If necessary download and install the java SE Development Kit (JDK) and install for your platform from (http://www.oracle.com/technetwork/java/javase/downloads/index.html )

Step2 Using Eclipse and the Google plug-in for Eclipse:

If you are using the Eclipse development environment, the easiest way to develop, test and upload App Engine apps is to use the Google Plug-in for Eclipse. The plug-in includes everything you need to build, test and deploy your app, entirely within Eclipse.
The plug-in is available for Eclipse versions 3.3, 3.4, and 3.5. You can install the plug-in using the Software Update feature of Eclipse. The installation locations are as follows:


The following screenshots show how the installation progresses. 
Select Help àEclipse Marketplace


Type Google Plug-in for Eclipse in Find Field and Click on Go



Search Results Show You Google Plug-in Click on install button to install Plug-in    

Trying a Demo Application
Step 1: Create a new project by clicking the New Web Application Project button in the 

toolbar.





Step 2: Give the project name say HelloLogictreeit  as we are going to create a simple file Hello World application. Enter package name as com.hellologictreeit and uncheck “Use Google Web Toolkit,” and ensure “Use Google App Engine” is checked and click the finish button.


Step3: When you click the finish button you will get a sample HelloLogicTreeit application, which you can run going in the Run menu, select Run As > Web Application. By default application will run at port 8080, you can view the sample application at http://locahost:8080.


Console: In this project I am using port no 8888.By default it runs on 8080





Uploading Your Application

You create and manage applications in App Engine using the Administration Console. Once you have registered an application ID for your application, you upload it to App Engine using either the Eclipse plug-in, or a command-line tool in the SDK.

Registering the Application

You create and manage App Engine web applications from the App Engine Administration Console, at the following URL:https://appengine.google.com/ .Sign in to App Engine using your Google account. If you do not have a Google account, you can create a Google account with an email address and password. To create a new application, click the "Create an Application" button. Follow the instructions to register an application ID, a name unique to this application. If you elect to use the free appspot.com domain name, the full URL for the application will be http://application-id.appspot.com/. You can also purchase a top-level domain name for your app, or use one that you have already registered.

Uploading Your Application from Eclipse


Edit the appengine-web.xml file, and then change the value of the <application> element to be your registered application ID. (I registered my application name as quickbidslogic ) In (Google app engine my application)

The following screenshots show how to upload application from eclipse
Changes In appengine-web.xml (change application name. I registered my application name as quick bids logic)





Upload from Eclipse

You can upload your application code and files from within Eclipse using the Google Plug-in.
To upload your application from Eclipse, click the App Engine deploy button on the toolbar: 
Enter your Google account username (your email address) and password when prompted, then click the Upload button. Eclipse gets the application ID and version information from the appengine-web.xml file, and uploads the contents of the war/ directory.

 Click on Deploy







Accessing Your Application


You can now see your application running on App Engine. If you set up a free appspot.com domain name, the URL for your website begins with your application ID:


















Google App Engine Run your web apps on Google's infrastructure.

 What Is Google App Engine?


A Google App Engine enables you to build and host web apps on the same systems that power Google applications. App Engine offers fast development and deployment; simple administration, with no need to worry about hardware, patches or backups; and effortless scalability.
                    App Engine applications are easy to build, easy to maintain, and easy to scale as your traffic and data storage needs grow. With App Engine, there are no servers to maintain: You just upload your application, and it's ready to serve your users.

Google App Engine supports apps written in several programming languages.

ü  Java runtime environment
ü  other language using a JVM-based interpreter or compiler
ü  JavaScript
ü  Ruby
ü  Python runtime environment

Why developers are choosing App Engine?

Centralized administration: A new, company-focused administration console lets you manage all the applications in your domain.
Reliability and support: 99.9% uptime service level agreement, with premium developer support available.
Secure by default: Only users from your Google Apps domain can access applications by default.
Pricing that makes sense: Each application costs just $8 per user, per month up to a maximum of $1000 a month. Pay only for what you use.
Enterprise features: Coming later this year - hosted SQL databases, SSL on your company’s domain for secure communications, and access to advanced Google services.

Is Google App Engine Free?

             Every Google App Engine application will have enough CPU, bandwidth, and storage to serve around 5 million monthly page views for free. You can purchase additional resources at competitive prices when you need them and you'll pay only for what you use.

Will Java Play In Google App Engine?

While Google app does not support the entirety of the Java EE specification, many of its individual components are supported. These include:

Supported

ü  Java Data Objects (JDO)
ü  Java Persistence API (JPA)
ü  Java Server Faces (JSF) 1.1 - 2.0 
ü  Java Server Pages (JSP) + JSTL 
ü  Java Servlet  API 2.4
ü  JavaBeans™ Activation Framework (JAF)
ü  Java Architecture for XML Binding (JAXB)
ü  Java Mail
ü  XML processing APIs including DOM, SAX, and XSL

Not supported

ü  Enterprise Java Beans (EJB)
ü  JAX-RPC
ü  JAX-WS
ü  Java Database Connectivity (JDBC) 
ü  Java EE™ Connector Architecture (JCA)
ü  Java Management Extensions (JMX)
ü  Java Message Service (JMS)
ü  Java Naming and Directory Interface (JNDI)
ü  Remote Method Invocation (RMI)

Framework Supported

ü  Spring M.V.C
ü  Struts1 (Frame work)
ü  Struts2(Frame Work)
ü  Other JVM-based Languages
ü  J ruby
ü  PDF jet

Framework not supported

ü           Apache Poi
ü          Hibernate
ü          I text
ü           ICE faces