Sunday, 22 March 2015

How to Setup Google Glass Quick Start Demo on HANA

At the end of the operations we will deploy demo to Hana Cloud Platform. Then users will authorize via created url on cloud platform. After successful login, current timestamp, name and location of user are saved to Hana Database and a timelinecard is posted with the last logged in users data.

Deploy Quick Start Demo:

There is two major task to deploy demo

Creating a Google APIs Console project:

Google has a detail tutorial to create a console project. You can follow the instructions.
The created client ID and client secret for my project:

Importing project to hana studioCapture1.JPG
Download attached .war file and import project into Hana studio. (If you want to try Quick start demo independently from Hana studio, please download .zip file, import it as archieve project into eclipse)
import.jpg
If everything is OK Then;
  • Open “oauth.properties” file under “com.google.glassware” package and copy your client_id & client_secret values that were created in Google Api Console project.
  • Set Context Root to “/” from project->properties->”Web Project settings” (after login, google redirect you to project root, i don’t want to change original project so leave like this)
  • If needed, change java version from project->properties->”Project Facets” (application is running smoothly with java 1.6 or 1.7)
  • if you using eclipse instead of Hana Studio install m2e in eclipse and be sure Maven library is setted from project->properties->”Deployment Assembly”
import.jpg
The modifications & new developments over original demo project;
  • For new developed classes, com.hana package was created
  • UserInfo class was created, to get&keep user login info
  • HanaMirrorClient class was created, to post timelinecard on glass
  • UserDAO class was created, to manage Hana database operations (jdbc was used)
  • Append Hana Log” button was added into index.jsp file
  • to get user info, UserInfo instance was created in index.jsp file
  • To post a new timelinecard as soon as user login, NewUserBootstrapper class was modified

After all the last operation is deploying project. To deploy on Sap Hana Cloud, in hana studio go to servers section, add a new Hana Cloud Portal Server and run your project on hana server.

Ps:If you run project in eclipse, Download Tomcat(version is very important I tried with Tomcat7.0.52), add it as a new server in eclipse and run your project on Tomcat Server.

Test Your Project:

Open Hana Cloud cockpit and go to your deployed application details. There is a url to run your application. You can run my application via https://hanaonglass1p104935trial.hanatrial.ondemand.com to post yourself a timelinecard.

Capture5.JPG
Capture2.JPG
If you wonder how timelinecard will look on google glass device, you can use google playground application via https://developers.google.com/glass/tools-downloads/playground . In order to use the Playground with the Google Mirror API, you need to insert your project's client ID. To test my application paste "236007231554.apps.googleusercontent.com" to textbox and click authorize.

Capture4.JPG
Capture3.JPG


I’m living in Turkey and Google Glass hasn’t sold here yet. So i should say that i couldn’t try application on device. If someone who has glass maybe try application on device, and we will be very glad with feedbacks.


GGlass-demo-994_x.jpg
GGlass-demo-665_x.jpg
GGlass-demo-576_x.jpg
Files:

No comments:

Post a Comment