You are on page 1of 34

Week 3 Unit 1: Local Development

October, 2013

Local Development
How Do I Test My Application Locally?

Scenario: app developer wants to deploy & test persistence-enabled application locally application code should run both in the local dev environment & in the cloud

Deploy and test locally Eclipse IDE

Deploy in the cloud SAP HANA Cloud Platform DB DB

2013 SAP AG. All rights reserved.

Public

Local Development
Application Scenarios

Default
Application uses only one schema Application works only with default datasource binding Application uses no database-vendor-specific SQL statements/features

Multiple applications share one schema Application uses database-vendorspecific SQL statements/features One application uses multiple schemas

2013 SAP AG. All rights reserved.

Public

Local Development
Local Testing Default Support

Apache Derby
In-memory lightweight database Embedded in Java server runtime process

If only one schema is needed, no configuration changes are required Eclipse IDE
Choose Run As Run on Server Select Manually define a new server As the server type, select SAP SAP HANA Cloud local runtime

2013 SAP AG. All rights reserved.

Public

Local Development
Local Testing Support for Multiple Applications Sharing One Schema

Same as default support All applications deployed together on the local server always share the same schema on Derby

2013 SAP AG. All rights reserved.

Public

Local Development
Local Testing Support for Applications Using a Particular Database

Replace local database with


database system in the cloud via DB tunnel a customer installation of a database

Configuring the local server


Open
<server>/config_master/connection _data/ connection.properties

Replace with connection parameters for desired database system

*********

2013 SAP AG. All rights reserved.

Public

Local Development
Local Testing Support for Applications Using Multiple Schemas

To configure data sources as connection properties


Open
<server>/config_master/connection_ data/ connection.properties

************

For every data source used by the application


create a database configuration with a unique prefix to the property key add the property <prefix>com.sap.cloud.persistence .dsname=<data source name>

************

************

2013 SAP AG. All rights reserved.

Public

Local Development
What Youve Learned in This Unit

How to test your persistence-enabled application on a local server What Apache Derby is, and how it is used on SAP HANA Cloud Platform How to test your application locally but still use the data from your database in the cloud How to configure the applications data sources in the database connection properties

2013 SAP AG. All rights reserved.

Public

Week 3 Unit 2: Using SAP HANA Modeler


October, 2013

Using SAP HANA Modeler


Using SAP HANA Data Modeling and Analytics in the Cloud

Scenario: app developer wants to use SAP HANA data-persistence and analytic model artifacts Specifics of SAP HANA Cloud Platform Schemas on trial landscape: shared SAP HANA database systems Application isolation based on schema and package namespace Applications database user has restricted permissions

2013 SAP AG. All rights reserved.

Public

Using SAP HANA Modeler


Connect to Your Database in SAP HANA Cloud

Create schema of DB type HANA XS and name it opensap

2013 SAP AG. All rights reserved.

Public

Using SAP HANA Modeler


Connect to Your Database in SAP HANA Cloud

Open a database tunnel Connect SAP HANA studio to opensap schema In SAP HANA Systems View: Application schema Personal schema not used Application package EPM application sample data
EPM sample data EPM sample data

Application schema

Application package

2013 SAP AG. All rights reserved.

Public

Using SAP HANA Modeler


EPM Reference Application

Enterprise Procurement Model Reference Application Used for demo and testing purposes Pre-delivered data content for SAP HANA Cloud trial accounts Multiple tables available

Addresses Business partners Employees Products Sales orders

2013 SAP AG. All rights reserved.

Public

Using SAP HANA Modeler


Demo Scenario

Create calculation view on top of EPM data Create calculation view artifact Activate view Grant permissions to applications db user CALL "HCP"."HCP_GRANT_SELECT_ON_ACTIVATED_OBJECTS"

2013 SAP AG. All rights reserved.

Public

Using SAP HANA Modeler


Demo Scenario

Visualize View content in a Web application Consume calculation view in JDBC sample Declare data source jdbc/opensapDS in web.xml Select content in servlet
SELECT TOP 10 * FROM "_SYS_BIC"."<MyPackage>" "SO_CV" ORDER BY ...

Bind opensap schema to JDBC sample Deploy and start JDBC sample
2013 SAP AG. All rights reserved. Public 7

Using SAP HANA Modeler


What Youve Learned in This Unit

How to create a calculation view How to activate objects in SAP HANA studio How to grant permissions for your user to select data from activated objects How to consume calculation view content in a Java servlet

2013 SAP AG. All rights reserved.

Public

Week 3 Unit 3: Introduction to the Document Service


October, 2013

Introduction to the Document Service


Overview

Stores files and folders in the cloud Open standards-based Easy to consume Usage-based pricing Scalable High availability setup Secure Multi-tenancy-enabled
Document Service Document Service API Internet SAP HANA Cloud Platform Apps

2013 SAP AG. All rights reserved.

Public

Introduction to the Document Service


CMIS

CMIS Standard at OASIS


CMIS defines semantics and protocols Major ECM companies on the committee SAP is an active contributor

Apache Chemistry
CMIS libraries for various languages Development tools: CMIS Workbench Technology Compatibility Kit (TCK) for CMIS SAP actively contributes and chairs this project

2013 SAP AG. All rights reserved.

Public

Introduction to the Document Service


Supported Features

CMIS features
Files & folders Metadata (types & properties) Queries via CMISQL Versioning Permission handling (ACL) Retention management

Additional features
AES encryption of content Virus scan on upload Multi-tenancy support Repository lifecycle Backups to multiple locations

2013 SAP AG. All rights reserved.

Public

Introduction to the Document Service


Demo: HelloWorld

Simple Web application Connects to Document service Creates a folder and a file Reads & prints the folders entries

2013 SAP AG. All rights reserved.

Public

Introduction to the Document Service


What Youve Learned in This Unit

How the Document service works The CMIS standard How to deploy the first demo application in combination with the Document service

2013 SAP AG. All rights reserved.

Public

Week 3 Unit 4: Consuming the Document Service with Ext. Tools


October, 2013

Consuming the Document Service with Ext. Tools


External Access to Document Repository

Documents in the cloud only accessible to apps deployed in the same account Proxy Bridge
Tunnels external CMIS requests to Document service Restricts access with roles or filters Access to repository via unique name + key
SAP HANA Cloud
Proxy Bridge

No direct access

Document Service

2013 SAP AG. All rights reserved.

Public

Consuming the Document Service with Ext. Tools


Demo: Proxy Bridge

Implement the Proxy Bridge by:


Subclassing AbstractCmisProxyServlet Declaring the servlet in web.xml Declaring roles to secure access Deploying to the cloud & assigning a role in the cockpit

Connecting to Proxy Bridge with CMIS Workbench allows you to:


Create folders & upload files View & edit metadata Execute any CMIS-defined operation

2013 SAP AG. All rights reserved.

Public

Consuming the Document Service with Ext. Tools


What Youve Learned in This Unit

How to access the document repository with external tools

2013 SAP AG. All rights reserved.

Public

Week 3 Unit 5: Document Service Metadata & Queries


October, 2013

Document Service Metadata & Queries


Metadata

Store properties alongside your documents to be able to query them later


CMIS defines a type system Predefined properties cmis:name, cmis:description, cmis:createdBy, cmis:modifiedBy, cmis:createdAt and cmis:modifiedAt SAP predefined properties such as sap:tags

2013 SAP AG. All rights reserved.

Public

Document Service Metadata & Queries


Metadata Coding Example

Setting properties
List<String> tags = Arrays.asList("Hello", "Tutorial"); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("sap:tags", tags); doc.updateProperties(properties);

Getting properties
// all properties List<Property<?>> properties = document.getProperties(); // single property Property<String> property = document.getProperty(cmis:name); String docName = property.getValue();

Querying properties
String query = "SELECT cmis:name, cmis:objectId, cmis:createdBy, sap:tags, sap:owner FROM cmis:document WHERE ANY sap:tags IN ('Hello')"; ItemIterable<QueryResult> results = session.query(query, false);

2013 SAP AG. All rights reserved.

Public

Document Service Metadata & Queries


Queries with the CMIS Workbench

2013 SAP AG. All rights reserved.

Public

Document Service Metadata & Queries


Advanced Features

Many more features waiting to be tried out:


Use ACLs and define read or write permissions on files/folders Create versions of files to track changes Use other external CMIS tools to access your data

2013 SAP AG. All rights reserved.

Public

Document Service Metadata & Queries


What Youve Learned in This Unit

How to attach properties to documents How to query properties in Java How to query with the CMIS Workbench Advanced features for the Document Service

2013 SAP AG. All rights reserved.

Public

Thank you

Contact information: open@sap.com

2013 SAP AG. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. National product specifications may vary. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries. Please see http://www.sap.com/corporate-en/legal/copyright/index.epx#trademark for additional trademark information and notices.

2013 SAP AG. All rights reserved.

Public