As explained in the
previous blog, the multi-tenant application will be deployed and run in the provider account (see section below highlighted in red).
Robert from ITeLo Consulting is the administrator of this account so he will perform the following steps in order to setup the application in the ITeLO Consulting (Provider) account.
Step 1: Create an application archive that contains all the application artifacts
Step 2: Deploy the application archive into the ITeLO Consulting (Provider) account
Step 3: Create subscriptions from consumers ABC PetroCorp and XYZ EnergyCorp to the applications run...
Let’s look at these steps in detail.
Pre-requisites:
- You have Java 8 installed.
- You have Eclipse Neon with SAP CP tools/plugins installed.
- You have the latest version of SAP CP Java Web Tomcat 8 SDK downloaded and unzipped.
- You have downloaded and set up an MTA Archive Builder Tool.
- Note that this series requires creation of multiple SAP CP accounts and therefore cannot be done using the developer trial account.
- You have an SAP CP account which has a database assigned to it. For this blog series, we expect the display name of the SAP CP account to be ITeLO Consulting (Provider).
- The ITeLO Consulting (Provider) account has at least one unused Java Compute Unit assigned to itself from the quota.
Note: You could refer to the
Getting Started with SAP CP tutorials for more information.
Note: In this blog, we make use of the feature called Solutions deployment.
As an alternative, you could also just do a deployment of individual applications instead of using the Solutions feature.
Step 1: Create an application archive that contains all the application artifacts
For this blog series, the source code for the Pollution Monitoring application has been shared in GitHub. We will first clone the application source code and then create the application archive from the source code.
Clone the source code from GitHub repository
Step |
Screenshot |
---|
a) Clone this Git repository and import the project into the Eclipse workspace.
Note: The pre-requisite for this step is that EGit Plugin must be installed in Eclipse. |
|
b) After a successful import, the Project Structure should look like this |
|
A real world application comprises of multiple modules developed using different technologies. The modules would also need to be deployed to different target runtimes (e.g. Java, HTML5). Instead of creating, deploying and managing these modules individually, SAP CP supports creation of a single
Multi-Target Application that packages all these heterogeneous modules into a single archive.
As explained in the architecture overview from the
previous blog , the business logic is defined in the Java application and UI logic is defined in an HTML5 application. In this step, Robert will build a multi-target application (MTA) Archive file in order to package the application into a deployable format.
Create (multi-target) application archive
In order to create multi-target application archive you need to download mta.jar and set up MTA archive builder as explained in the pre-requisites.
Step |
Screenshot |
---|
a) Modules of the multi-target application are described in the MTA development descriptor fie (mta.yaml). Open this yaml file that is present under root folder of project. |
|
b) The yaml file contains information about the Java and HTML5 modules that should be created. (We’ll provide more details in the MTAR Explanation section at the end of the blog).For now, bind the database (using the database ID) to the Java application.
Here, the id is the DB identifier (ID) of the database assigned to the provider account.
Refer to the DB ID under the Persistence -> Databases Systems tab in the ITeLO Consulting (Provider) account. |
|
c) Navigate to the root folder of the Application and execute ‘java -jar [path to mta.jar] –build-target=NEO build command. |
|
d) After a successful build, the Multi-Target application archive file (pollutionmonitoring.mtar) would be generated under the target folder as shown the snapshot. |
|
g) The pollutionmonitoring.mtar (MTA Archive) file would be generated under the target folder as shown the snapshot. |
|
Step 2: Deploy the application archive into the ITeLO Consulting (Provider) account
The next step is to deploy the pollutionmonitoring.mtar MTA Archive file into the ITeLO Consulting (Provider) account. This is done using the
Solutions feature shown in the SAP CP Cockpit as described
here.
Step |
Screenshot |
---|
a) Click on the Solutions tab in the SAP CP cockpit
b) Click on the Deploy button. |
|
c) In the Browse button of the Deploy dialog, select the MTAR file location that was generated from the Maven build.
d) Choose Deploy. |
|
e) Once the MTA archive file is successfully deployed, you can observe the following in the SAP CP cockpit.
- A Java application ‘pollutionmonitoring’ would be deployed and running under the Java application pane
- A data source binding would be created under Data Source Bindings pane of Java application
- An HTML5 application ‘pollutionmonitoringui’ would run under HTML5 pane of the provider account.
|
|
Step 3: Create subscriptions from consumers ABC PetroCorp and XYZ EnergyCorp to the applications running in the provider account
In this step, Robert would
create 2 consumer accounts – by name
ABC Petro Corp (Consumer) and
XYZ Energy Corp (Consumer).
Create consumer accounts
Step |
Screenshot |
---|
a) Navigate to the Overview tab of the SAP CP account.
b) Click on the ‘New Account’ button as shown in the screenshot. |
|
c) Create an account by the name “ABC Petro Corp (Consumer)”
d) Click on Save.
e) Similarly, create the account “XYZ Energy Corp (Consumer)”. |
|
f) From the overview pane for the global account, there would be 3 accounts shown |
|
As the next step, Robert will subscribe these consumer accounts to the Java and HTML5 applications running on the provider account.
Create subscriptions to the applications running in the provider account
Step |
Screenshot |
---|
Note:A prerequisite for executing neo commands is setting up the console client.
a) Using the neo console client, a subscription is created from the ABC Petro Corp (Consumer) account to the pollutionmonitoring Java application running in the ITeLO Consulting (Provider) account.
neo subscribe --account <<ABC_PetroCorp_consumer_account_id>> -application <<ITeLO_consulting_provider_account_id>>:pollutionmonitoring -user <<your_user_id>> -host <<your_landscape_host>>
|
|
b) Similarly a subscription has to be created to the pollutionmonitoringui HTML5 application in the ITeLO Consulting (Provider).
Click on the Subscriptions tab, then select “New Subscription” |
|
c) Select the provider account and application as shown in the screenshot.
d) Then click on Save.
e) This would create a subscription to the HTML5 application. |
|
f) In the Subscriptions tab of ABC PetroCorp(Consumer) account, you would see the following subscriptions. |
|
g) Similarly, subscriptions have to be created for XYZ Energy Corp (Consumer) as summarized in the table. |
Subscriber |
Provider application |
ABC Petro Corp (Consumer) |
ITeLO Consulting (Provider) : pollutionmonitoring
{Java app} |
ABC Petro Corp (Consumer) |
ITeLO Consulting (Provider) : pollutionmonitoringui
{HTML5 app} |
XYZ Energy Corp (Consumer) |
ITeLO Consulting (Provider) : pollutionmonitoring
{Java app} |
XYZ Energy Corp (Consumer) |
ITeLO Consulting (Provider) : pollutionmonitoringui
{HTML5 app} |
|
MTAR Explanation
Now let’s understand how the MTAR was created in Step 2. The required configuration was specified in the file – the MTA Development descriptor file (mta.yaml)
.
MTA Development Descriptor file: Modules of the multi-target application are described in the
MTA deployment descriptor file (mta.yaml).
- HTML5 module is defined below by specifying the module name, type and dependency (to the Java application that contains the business logic).
- Java module is defined below by specifying the module name, type and dependency (to the database service that will persist data generated by the Java application).
- SAP CP persistence service is configured with the ID of the database that is assigned to the SAP CP account.