Welcome to Paul the Octopus – one of SAP HANA Cloud’s Community Samples! It will demonstrate how to use all the power and functionality of the Platform in one adorable web application. Do you remember Paul the Octopus from the FIFA World Cup 2010? He successfully predicted the winner of each of seven matches of the Germany national football team, as well as the champion of the final and this Community Sample is dedicated to him. Get ready! This app will not only show you the SAP HANA Cloud Platform’s Services, but will also amuse you. It’s not the usual rather boring “book-store” app – it’s an exciting game. There are plenty of matches every day and Paul is making his predictions for them. Here comes the cool thing – you can state your predictions as well. You can compete with Paul and try to beat him. So, take a deep breath and dive into the adventure with the SAP HANA Cloud Platform. In this blog you will get familiar with:
Overall picture
Before we get to play with this Community Sample, let’s see the overall picture. You have got a web application that you are going to deploy on the SAP HANA Cloud Platform. When you open your browser you see the user interface and start making requests to the server. The server sends responses to the browser and this whole communication process is handled via REST services.
Good, we got the communication between the server and the client. One more thing. Data for the fixtures (a synonym for a football match) is provided by a separate application that is called the data provider. But how does one app refer to another? It’s quite simple with the SAP HANA Cloud Connectivity Service (Internet Connectivity). What you do is to state the URL of the data provider application - https://octopuspaul.hana.ondemand.com/ptodata/ - in a new destination, named “opta” in the Connectivity tab of the server adapter.
To conclude: you have got the UI connected to the back end via restful services and the back end connected to the data provider via Connectivity Service.
First steps of using the SAP HANA Cloud Platform
Before we start, you need to sign up for a SAP HANA Cloud account, download the Eclipse IDE for EE Developers and set up the Eclipse tools for SAP HANA. More information on this topic can be found in the SAP HANA Cloud Documentation Center.
Importing the app as a project and running it
1. Importing
This Community Sample is a web application that makes use of Maven. Here is how to run it. You will need the m2e plugin for Eclipse and the m2e-wtp one (installable from the Eclipse Market). Download the project from https://github.com/SAP/cloud-paulpredicts. Open your HANA Cloud Eclipse IDE (with runtime environment SAP HANA Cloud already set up) and import the project as an Existing Maven project. Create a new server - either local or on the Cloud.
2. Running - here we split into 2 different scenarios - locally and on the Cloud
Common task for both scenarios is creating the Destination, required for consuming the Connectivity Service. Double-click on the server, Connectivity tab, create a new Destination named "opta" and paste the following URL to the URL field: https://octopuspaul.hana.ondemand.com/ptodata/ (see screenshot below)
2.1. Local scenario – if you have created a new local server, then:
-Dhttp.proxyHost=<yourproxyHost> -Dhttp.proxyPort=<yourProxyPort>
-Dhttps.proxyHost=<yourproxyHost> -Dhttps.proxyPort=<yourProxyPort>
and set your proxy hosts and ports:
Note: when running locally you will receive the mails on your local file system. In your local server's folder/work/mailservice/
2.2. Cloud scenario – if you have created a new server on the SAP HANA Cloud Platform, then:
Using the Web UI and its functions
When you open the app with your browser (e.g. http://localhost:8080/server in the local case) you will be prompted to fill in your username and password. Use the data you entered in the users tab above. After successful login you will see the following screen:
From the left – Paul and the percentage of his correct predictions and on the right – you and your correct predictions. You can change your profile picture if you wish. Just click the default one and a dialog like this will appear:
Select another image from your file system and that’s it. This feature makes use of SAP HANA Cloud’s Document Service.
The Fixtures tab is separated into 2 sub-tabs – one dedicated to the Future Fixtures and one to the Past Fixtures. In the Future Fixtures tab you can see all the matches you can make prediction for. When clicking on the left side of a row in the table you can see details about the teams that are going to compete right below the table. The ones which you already predicted are marked with orange labels:
You can make your prediction (or change a previous one) with the button in the last column of each row. A dialog (like the one below this paragraph) is going to pop up and prompts you to select a possible outcome.
In the Past Fixtures tab you can see whether your predictions had been right or not. The screen looks like this:
There is an admin UI. If you want to see it, you have to add “admin” right after the “… /server/” part of the URL. Please note that the admin UI is accessible only for Administrators, so you have to assign your user such a role. The admin UI contains monitoring tools (check out the users that use the app, a list of all the teams, fixtures and predictions) and some controlling – you can manually trigger importing fixtures from the data provider and trigger Paul to make his predictions. Here is how the admin UI looks like:
In the users tab you can see a list of all the users that are playing against Paul.
In the teams tab you can see all the teams that have already played or are going to play.
In the fixtures tab – probably you have already guessed – that’s right - all the fixtures are there.
In the predictions tab you can check out all the predictions made by all the users:
In the jobs tab you can manually trigger data importing and Paul making his predictions:
Enthusiastic already? Our follow-up blogs in which we get technical and explain how this app was created are now on the final straight.
Here is the first one: Paul Dissected Part 1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
10 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 |