Cloud 9 is an online IDE which is used to develop applications on the go. It provides the setup that you need, instantly. The main advantage of Cloud 9 is that you can access your code anywhere, using any web browser. Also you can share your environment with other developers for code review without the environment being set up on the developer's machine. If you want to ease your Java application development, then go for this Learning Path.
In this Learning Path, you will learn to set up Cloud 9 with various other processes such as configuration of Cloud 9, build Java programs, and work with many more features. You will also learn how to install Google’s app engine to design and build apps for Google Cloud that can scale without limits.
By the end of this Learning Path, you will have gained skills to efficiently develop and deploy your Java applications on Cloud 9.
About the Author
Brett Hooper is a well-seasoned software engineer, entrepreneur, teacher, and all-around techno-surfer. His decades of experience have taken him from years of IT consulting for Fortune 100 behemoths, to a number of entrepreneurial start-up efforts, to the U.S. Dept of Defense in defining their way forward in mobile and web-related technologies. Brett’s excitement in learning, implementing, and teaching new, interesting development frameworks, stacks, and services is never waning and keeps him heads-down more than not. He develops new teaching content from his AlohaCodeWorks headquarters in beautiful Maui, HI.
Review the section description (from the outline). Iterate the section video titles and provide a bit of detail for each.
Cloud9 IDE is a development environment in the Cloud. It runs in the browser, but still provides the power and features to compare with even the best hard installed IDEs such as Eclipse or Visual Studio. How can an app in the browser possibly do what we're accustomed to on our local IDEs?
It may still seem a stretch to have an IDE running in a browser as compared to a locally installed system. You may be wondering how workspaces function and how the IDE actually works. We can look a little closer at these things and address some of the concerns that may still be outstanding.
Cloud9 requires that a user establish an account to access services. There are different options available on different account types to provide the appropriate features and performance for different types of users of the service. We should have an understanding of the different account types before setting up a new account.
What are Servlets and JSPs and why are they used? Think of them as Java classes that can extend the capabilities of an application server. Servlets and JSPs have the capability to respond to any type of request and serve dynamic web content from a container within a web server. They are primarily used with the HTTP protocol.
Servlets and JSPs provide many appealing qualities in a mature and extensible platform for application development. Let's look at how common use-cases sit within this environment in both the contexts of the client and the server-side.
Developing with Servlets and JSPs requires a few specific things—Java, the Servlet and JSP libraries, and an application server with a Servlet container. Let's take a look at these requirements individually and understand what each does individually and collectively.
We can begin fine tuning our Cloud9 workspace for Java development and then get a project scaffolded for a Java Web application. What do we have here that looks familiar?
As we continue to get our Workspace tuned and a Java Web application project scaffolded, we will start to see some differences in how things are done. Let’s setup our app server and test it out.
With our Workspace and project setup and ready to roll, let's examine our active environment and some of its parameters that we should be aware of as we code and test on Cloud9.
Because our environment is running in a VM in the cloud and our interface is the browser, we no longer have local access to anything. So, certain things, like developing database components, are handled bit differently.
Even though we’re working in the Cloud and we’re discovering it’s differences from a local environment, we’ll still find many of the development resources we depend upon readily available, like Git.
In the Cloud, there are certain things that just cannot happen as they would if we were set up on a local machine. In a case like this, there’s usually a surrogate, but it may require a totally different approach and a different way of thinking.
We’ve completed the process of readying a Workspace and project for Java Web app development and are ready to code up the world’s next best thing. Let’s review each of the steps we’ve taken and think about their significance.
Get a project off the ground first requires a workspace in Cloud9. Using the Workspace Wizard is the way to get one going. There are options, let’s check them out.
In getting our project set up for code, we now can take the next step, which is getting Tomcat installed. This includes a list of things that have to happen, in order, for the installation to be successful.
As we progress with our workspace and project definition, we are nearly ready to begin coding. We do need to have a database installed and there is a procedure we can follow to get this done.
The final step in readying our dev environment and project for coding is to get Git configured and connected to an outside repo. We know this is easily done on Cloud9, but let’s review the steps
Get an initial servlet working in our project will prove that everything works and we can continue with development. We can create a servlet to output some html, a jndi implementation for database access, and a build script to build and deploy it all.
With a Servlet defined and running successfully in our app, including the use of a data access class and a Quote bean class, we can focus now on implementing a JSP as well. Let’s use best practices and replace our Servlet’s Quotes page creation functionality with a new JSP.
With a JSP replacing what we had working originally in a Servlet, we can now re-purpose the Servlet to provide a JSON output of our Quotes data. The servlet is already wired up and working, so changing the output code within the Servlet is where we need to modify things.
Google’s App Engine for Java is an amazing platform for developing web applications and services and hosting them in the Cloud. With a full SDK and progressive hosting options, it is a one stop shop in the cloud for Java web enthusiasts.
Let’s dive deeper into what App Engine is in terms of Java, what features it provides for application functionality from a design perspective, and how App Engine is an excellent option in the Cloud Computing marketplace.
Building apps for App Engine provides many advantages. Running App Engine applications on Google’s world-class, fully managed infrastructure removes numerous layers of overhead and headaches from an application’s life cycle and makes our lives so much easier. Let’s look at some of the specific reasons for using App Engine.
To develop applications for GAE, we’ll want to use an IDE to help us along. Here, we’ll use the amazing Cloud 9 Online IDE a browser-based, zero-install IDE. What is Cloud 9? It’s a development environment in the Cloud that runs in the browser. It provides the power and features that compare with even the best hard installed IDE’s such as Eclipse or Visual Studio.
With a new Cloud 9 account established and ready to go, we can learn to create a new workspace where an App Engine project can live, grow, and deploy. Connecting a C9 workspace to GCP so App Engine utilities and deployment just works, is the trick here.
We need to be aware of all of the benefits the Cloud9 service provides, including how and when managing design, coding, and testing within a virtual workspace, many of the typical overheads we need to pay are just removed from the start. Then, when introducing GCP and the App Engine specific API’s and services, the development process is streamlined even further by removing even more variable aspects of the design, coding, testing, deployment, and maintenance processes.
Cloud 9 and App Engine together provide a complete Java Application development, deployment, and maintenance solution, all accessible in the Cloud. This gives us flexibility to address development or deployment concerns from anywhere, on any device, and at any time. The physical confines of a development environment, which normally wrap the physical machine and local network, and their containing facility, are broken down and provide freedoms not normally found in traditional means.
When developing applications for Google App Engine, all of the resources necessary are provided in the GCP and App Engine SDK. With Cloud 9 and App Engine, a natural, uniform, consistent development and deployment workflow is put in place for developers, like us, to leverage. Let’s look into the steps provided in this pathway to Java applications in the Cloud.
We can now take a closer look at the final stage of a Cloud application’s life cycle, its deployed instance or instances, running in the cloud, and how we can approach monitoring and maintaining app instances deployed in a live environment.
App Engine sits within the whole of the Google Cloud Platform, which we know is a deep and broad array of Cloud products and services. Many of these other GCP products and services are integrated, either directly or indirectly with the App Engine product, to expand the App Engine feature set and provide features and functionality to meet the needs of any application’s design specifications.
Scaling an app on App Engine for minimal or maximal traffic is easy to configure and deploy. There are considerations when formulating a scaling strategy that should be entertained at the design time so an app can behave as expected in the Cloud.
App Engine provides a great “allowance” of resources for no charge that let us deploy an application to the cloud and run it in the Cloud, along with many different features, without incurring any charges. An efficient, lower-traffic app can run almost indefinitely without incurring any charges. Let’s see what fees are applied when an app is more than a little popular though, and how to mitigate charges through design.
In a typical App Engine app, we’ll use a standard set of features provided by the platform. A datastore is one of these features, as is Memcache, Task Queues, and authentication. Let’s look at how these all work together to form the basis of a typical App Engine app.
Let’s get an app going and do the first logical thing in the process—configure the instance behavior of our app. We’ll first get a GCP project, a C9 workspace, and an App Engine app all ready to go, and then work with the deployment file to configure instance lifecycle options.
Integrating the services and resources we need to create our app’s functional foundation is our next step. Let’s get our datastore and caching setup and the app ready to implement Task Queues, and then consider authentication options.
Google Cloud Datastore is a NoSQL document database built for automatic scaling, high performance, and ease of application development. We can leverage this service to provide a robust, easy to work with backend for most Web applications. Let’s get familiar with the service and the supporting library we’ll use with it, and then enable Cloud Datastore in our project.
Google Cloud Endpoints, which is integrated in App Engine, can generate a single api for data access and also generate clients for the Web and many different devices. For us, this feature will provide a REST-like API and a client bundle that we can use in our app.
We’re starting from square one, so we need a new GCP project for our app, and then we need a new Cloud 9 workspace to build it within. These need to be integrated, so we’ll do that as we create our new workspace. We’ll then clone a new starter API project into our workspace.
With a GCP Java App Engine in the Cloud 9 environment, we use Maven and GCloud utilities to configure, build, and deploy our app. Let’s finish the configuration of our application and get it ready for coding.
We need to get data into our project’s Datastore and be able to access it through our app’ API methods. We can write code for handling data in our app, load the Datastore with Star Wars data, and then be able to write within queries in our API classes.
With all of our supporting classes, including data creation, persistence, and retrieval classes, we now need to update our API class, Echo.java, so it exposes an interface to our new data and its associated functionality. We can add the proper methods to our Echo.java API class to have this happen magically through the Cloud Endpoints magic.
The Task Queue API lets applications perform work, called tasks, asynchronously outside of a user request. If an app needs to execute work in the background, it adds tasks to task queues. The tasks are executed later, by scalable App Engine worker services in your application.
Applications built for the Google Cloud Platform (including App Engine) can easily implement Authentication by using one of a number of different services. Included options are OAuth 2.0/OpenID Connect, the Google sign in service, Firebase Authentication, and App Engine’s very own Users API service. Let’s look at all of these and implement an Authentication scheme in our app.
As we’ve seen, deploying our app to App Engine can be done with a single, simple maven or gcloud command. However, working with versions of our app in the cloud needs to be discussed and understood so when deployed, an app is configured correctly to do as we intend in the cloud. We need to understand how instances of our app work on App Engine and then how versions of our app are configured into the mix and how they are manipulated for testing and live requests.
We’ve completed all of the instructional videos in this course. Congratulations for completing the sequence and arriving at this point. We’ve learned all we need to begin developing Java web applications in the cloud with Cloud 9 and GAE/J. For the sake of retention and deepening our understanding of the material presented in this course, let’s quickly review everything we’ve learned from start to finish.
Packt has been committed to developer learning since 2004. A lot has changed in software since then - but Packt has remained responsive to these changes, continuing to look forward at the trends and tools defining the way we work and live. And how to put them to work.
With an extensive library of content - more than 4000 books and video courses -Packt's mission is to help developers stay relevant in a rapidly changing world. From new web frameworks and programming languages, to cutting edge data analytics, and DevOps, Packt takes software professionals in every field to what's important to them now.
From skills that will help you to develop and future proof your career to immediate solutions to every day tech challenges, Packt is a go-to resource to make you a better, smarter developer.
Packt Udemy courses continue this tradition, bringing you comprehensive yet concise video courses straight from the experts.