Download presentation
Presentation is loading. Please wait.
Published byJoseph Gibson Modified over 9 years ago
1
Google App Engine Google APIs OAuth Facebook Graph API
Twitter Bootstrap Google Developer Group Presentation & Albertian Institute of Science & Technology – 19th October 2013 Shashidhar Gurumurthy
2
Agenda Session Objectives App Engine Overview Environment Setup
App Engine Services OAuth Google APIs Facebook APIs References Play on shashi-demo.appspot.com
3
Session Objectives Describe App Engine & its offerings
Get you started on App Engine development using Java Usage of commonly used App Engine services OAuth Working with Google APIs Working with Facebook APIs Help you develop your first App Engine application and use few Google & Facebook APIs
4
Session Objectives – Prerequisites
Familiarity with Servlet development using a Servlet container such as Tomcat is assumed Some familiarity with Eclipse IDE That’s it… that’s all you need to get started on developing awesome apps with Google App Engine. Objectives
5
Session Objectives – What’s not covered
Google App Engine applications can be written in Python and Go programming languages as well. This session uses Java. All Services provided are not covered due to time constraints Objectives
6
So… what is Google App Engine
Overview Google App Engine lets you: Run web applications on Google’s infrastructure Easy to build, maintain and scale No servers to maintain – just upload your application Costs nothing to get started: All applications get a free limit on resources When billing is enabled for an application, free limits are raised but you still pay only for resource usage above free levels Applications run in a secure environment with limited access to underlying operating system Applications can only access other computers on the internet through provided URL Fetch and services Applications cannot write to the file systems Application code only runs in response to a web request, queued task or a scheduled task
7
The Java Runtime Environment
Overview Java runtime environment uses Java 6 (Java 7 support is experimental with SDK ) App Engine Java SDK supports Java 5 or 6 Java Servlet and JSPs The SDK provides implementations of Java Data Objects (JDO) & Java Persistence API (JPA) interfaces for interaction with App Engine Datastore JavaMail API can be used to send mail with App Engine Mail service java.net.HTTP APIs access the App Engine URL Fetch service
8
Development Workflow Overview App Engine SDK includes tools for local emulation of App Engine services SDK includes tools for uploading application to App Engine The App Engine admin console is the web-based interface for managing applications running on the App Engine. Use it to: Create new apps Configure domain names Change which version of application is live Examine logs Browse application datastore View Memcache App Engine Console
9
App Engine Information on web
Environment Setup Setup Install Java SDK (1.7 or 1.6) – 1.7 is experimental and available on App Engine SDK only If using Eclipse, install Google Plugin for Eclipse If not using Eclipse, download App Engine Java SDK In this case you will also need Apache Ant to enable you to interact with App Engine via command line interface – we will not cover this case. Setup details: App Engine Information on web
10
Services – Users Services App Engine applications can authenticate using one of three methods: Google Accounts Accounts on Google Apps Domains OpenID identifier – federated authentication Application can access a signed in user’s address (or OpenID identifier) The app can detect whether the current user is an administrator
11
Services – Datastore Services The App Engine Datastore is a schemaless object datastore The Datastore holds data objects known as entities Each entity is identified by its kind which categorizes the entity for the purpose of queries, and a key that uniquely identifies it within its kind The Datastore can execute multiple operations in a single transaction While the Datastore interface has similar features as traditional relational databases, it differs in the way it describes relationships between data objects Entities of the same kind can have different properties
12
Services – Java Datastore API
The App Engine Java SDK provides a low-level Datastore API with simple operations on entities The SDK also includes implementation of the Java Data Objects (JDO) and Java Persistence API (JPA) interfaces for modeling and persisting data App Engine Datastore service is a large area of study We will briefly review JDO for persisting and querying entities
13
Services – Scheduled Tasks
The App Engine Cron Service allows scheduling of tasks that operate at defined times or regular intervals A Cron job will invoke a URL using an HTTP GET request at a given time of day A cron.xml file in WEB-INF directory of the application controls cron The Admin Console allows you to view the state of your cron jobs The dev appserver does not automatically run the cron jobs
14
Services – Mail App Engine applications can send email messages
Apps can receive s at various addresses Apps send messages using the Mail service Apps receive messages in the form of HTTP requests initiated by App Engine and posted to the app The Mail service Java API supports the JavaMail interface for sending messages The development server does not send messages
15
Services – URL Fetch Services App Engine applications can fetch resources and communicate with other hosts over the internet using HTTP & HTTPS requests Apps use URL Fetch service to make requests The URL Fetch service uses Google’s network infrastructure for efficiency and scaling purposes Apps use java.net.URLConnection and related classes to make connections
16
Services – Task Queues Services Applications can perform work outside of a user request. The application adds tasks to task queues to be executed later Two types of queues: Push Queues function within App Engine environment. Configure a queue and add tasks to it. App Engine handles the rest. Pull Queues allows consumers inside or outside of App Engine environment to process tasks In this case application needs to scale workers based on processing volume
17
Services – Google Cloud Storage
The Google Cloud Storage offers another method for your application to store and serve data Similar to AWS S3 Access via a RESTful API as well as Cloud Storage Java API for Google App Engine
18
Services – Memcache Distributed in-memory data cache
Speed up common datastore queries If many requests make the same query with the same parameters, app can cache the results in memcache
19
Services – Multitenancy
Multitenancy refers to a software architecture whereby one instance of an application serves many client organization Namespaces API allows you to compartmentalize Google App Engine data App Engine supports Namespaces in the following APIs Datastore Memcache Task Queue
20
Services – Google Cloud Endpoints
Consists of tools, libraries and capabilities to generate endpoints and client libraries from an App Engine backend to simplify client access to that back end. Introduced in Feb 2013 with SDK 1.7.5
21
Services – Others App Identity
Identifying itself Asserting identity to Google APIs and other systems Blobstore: Datastore allows blobs of max 1M. For storing larger objects, use Blobstore Channel: Use to create persistent connection to send messages to Javascript client in real time. Images: Manipulate image data using dedicated image service Logs: Provides access to request and application logs OAuth: Use App Engine application as OAuth service provider Capabilities, Search, Prospective Search & XMPP (IM)
22
Google APIs & OAuth Google provides access to many of its services via APIs You can use these APIs within your applications Most of the APIs require authenticated access; OAuth provides the authentication mechanism OAuth also provides a mechanism to gain access to private data via scoped authorization Steps to use Google API: Define a project on Google API console Select the required services Create OAuth client id ( & secret) Use the OAuth flow to get access token Send Access token in request header of the HTTP call to Google API OAuth Playground Google APIs Console
23
Google OAuth Flow (for Web Server Applications)
24
Facebook API Usage Similar access mechanism as Google API
Uses OAuth for authorization Steps to use Facebook API: Define a Facebook App on developers.facebook.com This gives you App ID & App Secret Use the App ID & App Secret along with required permissions to get access token Send Access token as request parameter in the HTTP call to Facebook API Facebook Developers
25
What else do I need? Something to make the UI look better
Frameworks for responsive client Best ones to start with jQuery Twitter Bootstrap Some More Mustache Templates jQuery Mobile
26
Demo – Sample Starter Applications
Starter Apps which you can use to begin developing App Engine application using Google APIs or Facebook APIs Google API used – Calendar API to get Calendar list Facebook API used – Get logged in user’s profile How to use? To learn, copy/paste piece by piece into a new App Engine project OR Import whole project and enhance / modify
27
Environment Setup Create App Engine Project & Deploy Use Google and/or
Let’s Play Environment Setup Create App Engine Project & Deploy Use Google and/or Facebook API In Your Project
28
References Google App Engine Home: App Engine Java Home: App Engine Admin Console: Google APIs Console: Google OAuth documentation & flow: OAuth Playground: Facebook Developers: Demo Source Code: Google APIs starter project: ect.zip Google + Facebook APIs starter project: ookStartupProject.zip
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.