sap inside track singapore 2014

28
Rapid Prototyping with Grails and HANA Cloud Platform Marc Lester Tan/SAP Mobility Innovation Center, APJ January 11, 2014

Upload: mharkus

Post on 10-May-2015

2.262 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: SAP Inside Track Singapore 2014

Rapid Prototyping with Grails and HANA Cloud Platform

Marc Lester Tan/SAP Mobility Innovation Center, APJJanuary 11, 2014

Page 2: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 2

Agenda

HANA Cloud Platform Overview of HANA Cloud Platform

Grails Overview of Grails Hello World

Demo

Page 3: SAP Inside Track Singapore 2014

HANA Cloud Platform

Page 4: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 4

HANA Cloud Platform

• Platform as a Service (PaaS)

• Runs on JVM

• HANA or MaxDB

• Integration with backend systems

• Development Tools for Eclipse

• Free for Developers

Page 5: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 5

Development Environment

• Platform SDK

• Platform Tools

• Console Client

Page 6: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 6

Development Environment

• Platform SDK

• Platform Tools

• Console Client

Page 7: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 7

Development Environment

• Platform SDK

• Platform Tools

• Console Client

Page 8: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 8

Platform Services and Utilities

• Authentication

• SAP UI5 – open-source @ sap.github.io/openui5/

• Persistence Service

• Connectivity Service

• Document Service

• Logging

• Cloud Environment Variables

Page 9: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 9

Platform Services and Utilities

• Authentication

• SAP UI5 – open-source @ sap.github.io/openui5/

• Persistence Service

• Connectivity Service

• Document Service

• Logging

• Cloud Environment Variables

Page 10: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 10

Platform Services and Utilities

• Authentication

• SAP UI5 – open-source @ sap.github.io/openui5/

• Persistence Service

• Connectivity Service

• Document Service

• Logging

• Cloud Environment Variables

Page 11: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 11

Platform Services and Utilities

• Authentication

• SAP UI5 – open-source @ sap.github.io/openui5/

• Persistence Service

• Connectivity Service

• Document Service

• Logging

• Cloud Environment Variables

Page 12: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 12

Platform Services and Utilities

• Authentication

• SAP UI5 – open-source @ sap.github.io/openui5/

• Persistence Service

• Connectivity Service

• Document Service

• Logging

• Cloud Environment Variables

Page 13: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 13

Platform Services and Utilities

• Authentication

• SAP UI5 – open-source @ sap.github.io/openui5/

• Persistence Service

• Connectivity Service

• Document Service

• Logging

• Cloud Environment Variables

Page 14: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 14

Platform Services and Utilities

• Authentication

• SAP UI5 – open-source @ sap.github.io/openui5/

• Persistence Service

• Connectivity Service

• Document Service

• Logging

• Cloud Environment Variables

Page 15: SAP Inside Track Singapore 2014

Grails

Page 16: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 16

What is Grails?

• Full stack web application framework

• Runs on JVM

• Open-source @ github.com/grails/grails-core/

• Uses Groovy programming language

• Follows Convention-over-Configuration paradigm

• Lots and lots of plugins!

Page 17: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 17

Key Features of Grails

• It includes easy to use ORM layer built on Hibernate

• Expressive view technology called GSP (Groovy Server Pages)

• Controller layer built on Spring MVC

• Scripting environment based on Groovy-based Gant

• Embedded Tomcat server configured for on-the-fly reloading

• DI provided by the built-in Spring container

Page 18: SAP Inside Track Singapore 2014

Hello World你好世界Hallo Weltहे�लो� वि�श्व

హలోవరల్డ్�

Page 19: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 19

Simple Web App

• Tool to manage Tech Events in Singapore

• Develop using Grails

• Deploy on Local and Remote HCP

• Use MaxDB

• Grails on HANA – coming soon! (https://hibernate.atlassian.net/browse/HHH-8228)

Page 20: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 20

Create the Web Application and Domain Class

$ grails create-app TechEvents

| Created Grails Application at /Users/i071571/Documents/sapinsidetrack/TechEvents

$ grails create-domain-class com.sap.techevents.Event

| Created file grails-app/domain/com/sap/techevents/Event.groovy

| Created file test/unit/com/sap/techevents/EventTests.groovy

Page 21: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 21

Modify the Domain Class

package com.sap.techevents

class Event {

String name

String description

Date eventDate

Date dateCreated

Date lastUpdated

static constraints = {

name blank: false

description blank: true

eventDate blank: false

}

}

Page 22: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 22

Build the Controllers, Views and Run the App

$ grails generate-controller com.sap.techevents.Event

| Packaging Grails application.....

| Finished generation for domain class com.sap.techevents.Event

$ grails generate-views com.sap.techevents.Event

| Compiling 1 source files....

| Finished generation for domain class com.sap.techevents.Event

$ grails run-app

| Server running. Browse to http://localhost:8080/TechEvents

Page 23: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 23

Local Testing and Deployment

• Add MANIFEST.MF that contains only Manifest-Version: 1.0

• Add _Events.groovy in scripts folder

• In _Events.groovy, copy the MANIFEST.MF to staging directory

• In _Events.groovy, modify web.xml generation to include JNDI bindings for database

• In grails-app/conf/DataSource.groovy, modify the production dataSource to:

dbCreate = "update"

jndiName = "java:comp/env/jdbc/DefaultDB"

dialect = "org.hibernate.dialect.SAPDBDialect"

Page 24: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 24

Local Testing and Deployment

• In grails-app/conf/DataSource.groovy, modify the development dataSource to:

dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''

//url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"

jndiName = "java:comp/env/jdbc/DefaultDB"

dialect = "org.hibernate.dialect.DerbyDialect"

• Copy com.sap.security.core.server.csi_1.0.1.jar from $HCP_SDK_HOME/repository/plugins to lib folder

• $ grails dev war

Page 25: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 25

Local Testing and Deployment

• Install HCP Local Server

$ neo.sh install-local

• Copy generated WAR file to HCP Local Server pickup folder

$ cp target/TechEvents-0.1.war /Applications/Dev/neo-java-web-sdk-1.43.20.3/server/pickup/

• Run HCP Local Server

$ neo.sh start-local

• Monitor log file to check if deployment is successful

$ tail -f /Applications/Dev/neo-java-web-sdk-1.43.20.3/server/log/ljs_trace.log

Page 26: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 26

Local Testing and Deployment

• Create a WAR file for Production Environment

$ grails prod war

• Deploy WAR File to HANA Cloud

$ neo.sh deploy -u SCN_USER –a ACCOUNT_NAME -b APP_NAME -h HOST_NAME -s target/TechEvents-0.1.war

• Start/Restart Application instance in HCP Cockpit

Page 27: SAP Inside Track Singapore 2014

© 2011 SAP AG. All rights reserved. 27

Resources

• HANA Cloud Portal

• HANA Cloud Platform Developer Resources

• HCP Content Overview

• OpenUI5

• Grails

• Groovy

• TechEvents Source Code

Page 28: SAP Inside Track Singapore 2014

Thank You!

Marc Lester Tanw: marctan.com