School Supply System on Google App Engine
Download
Report
Transcript School Supply System on Google App Engine
By: Devesh Sharma
Why Cloud Computing?
◦ Traditional Business Applications
Expensive
Complicated
Difficult to manage
Idea behind Cloud Computing
◦ Instead of organizations running their business
applications by themselves in-house, run them on
shared data centers.
1. Ease of use
2. Lower costs
3. Unlimited storage capacity
4. Highly automated
5. Allows IT to shift focus
6. Scalability
Actors: Parents and Teacher
Features:
◦ Application and database hosted on Google App
Engine
◦ Developed Front End using Servlets and JSP’s
◦ Developed Back End using Google App Engine (non
relational) datastore
Demo
Advantages:
◦ Easy to get started
◦ Automatic Scalability
◦ Reliability, performance and security of Google’s
infrastructure
◦ Cost efficient hosting
◦ Risk free trial period
The Mail Java API
The Users Java API
Other services:
◦ App Engine applications can send and receive email
messages
◦ The Mail Service Java API supports the JavaMail interface
for sending email messages
◦ Example
◦ App Engine applications can authenticate users who
have Google Accounts
◦ Example
◦ Image manipulation, URL fetch, OAuth, etc
Not a relational database, Object Oriented
database instead
Datastore stores and performs queries over
data objects, known as entities
An entity has one or more properties
App Engine Java SDK includes
implementations of the Java Data Objects
(JDO) and Java Persistence API (JPA) interfaces
Interaction with the datastore using a
PersistenceManager object, obtained from
PersistenceManagerFactory object
Setting up a PersistenceManagerFactory instance
takes time to initialize. Therefore, an app should
reuse a single instance.
An easy way: wrap it in singleton class, PMF.java
Demo – PMF.java on Eclipse
Defining Data classes
◦ Annotations:
@PersistenceCapable
@Persistent
◦ Relationships:
One to One
One to Many
◦ Show Users.java data class in Eclipse
Creating data/Making Objects Persistent
◦ Example:
PersistenceManager pm =
PMF.get().getPersistenceManager();
Users user = new Users(“Devesh”, “Sharma”,..);
try{
pm.makePersistent(user);
}finally{
pm.close();
}
Queries in App Engine:
◦ JDO includes a query language (JDOQL) for retrieving objects that meet a
set of criteria.
◦
Query query = pm.newQuery(Users.class);
query.setFilter("lastName == lastNameParam");
query.declareParameters("String lastNameParam");
try {
List<Users> results = (List<Users>) query.execute(“Sharma");
if (results.iterator().hasNext()) {
for (Users u : results) {
// ...
}
} else {
// ... no results ...
}
} finally {
query.closeAll();
}
Updating an Object
◦ Users u = pm.getObjectByID(Users.class, key);
U.setFirstName(newFirstName);
Deleting an object
◦ pm.deletePersistent(user);
Use admin console to:
Create a new application
Add other people as developers
View error logs and analyze traffic
Blacklist IP addresses or subnets – DoS protection
service
◦ Browse your application’s datastore and manage
indexes
◦ Test new versions of your application, and switch
the version that users see
◦
◦
◦
◦
My Admin Console
http://code.google.com/appengine/
http://code.google.com/appengine/docs/jav
a/overview.html
What is Cloud computing?. (n.d.). Retrieved
from
http://www.salesforce.com/cloudcomputing/