Skip to Content

MTA (Multi-Target-Application) is a model that manages life cycle of an application comprised of multiples modules created with different technologies,  and deployed to different target run-times. It encompasses and describes application modules, dependencies, and interfaces in an approach that facilitates validation, orchestration, maintenance, and automation of the application throughout its lifecycle.

In this tutorial, you will see how an MTA model and an MTA Archive Builder is used for staged development in Cloud Foundry environment within SAP Cloud platform.

You will be creating different  spaces in your organization- DEV for development where developers will develop solutions, QUAL for quality where quality engineer will test and PROD for production where IT Administrators will maintain and monitor the final solutions.

 

Application overview

It is a very simple application that allows the user to enter his first name and last name and by clicking on a “Create” button will insert the entered input to the table shown.

Architecture overview

The application has various components/layers as depicted in the snapshot below

 

Database

The employee data (first name and last name) is stored in the SAP HANA database using  an SAP Cloud Platform SAP HANA service.

Also you can share your HANA DB with all different spaces as explained here

Business Logic

The Business Logic defines the Java application which run on Cloud Foundry environment within SAP Cloud Platform.  It uses JPA (JAVA persistence API) for accessing, persisting, and managing data between Java objects / classes and a relational database.In this scenario, the Java application defines Employee class and map it to the Employee table in the SAP HANA database.

To implement Java Persistence API the Java application uses EclipseLink which is the open source Eclipse Persistence Services from the Eclipse Foundation.

It also uses Apache Olingo library to expose employee data as an OData Service to be consumed by the SAPUI application.

User Interface

The UI Logic is defined in an SAPUI5 application which also runs on Cloud Foundry environment within SAP Cloud Platform. It consumes the OData Service from the Java application to send and receive employee data from the SAP HANA database .

MTA model

As already mentioned MTA model application consist of multiple modules of different technologies. In current scenario, It consists of Java and SAPUI5 modules uses development descriptor (mta.yaml) to address their inter-dependencies and configuration data they expose, and the resource (SAP HANA database) they require to run.

The developer guide on how to develop and build MTA model can be found here.

Prerequisites:

You have JDK8 installed.

You have Node.js and npm installed.

You have Eclipse Neon with SAP CP tools/plugins installed.

You have downloaded and installed Cloud Foundry CLI and MTA Plugin of Cloud Foundry CLI.

You have downloaded and set up an MTA Archive Builder Tool.

You must have an enterprise account of SAP Cloud platform and provisioned SAP Cloud Platform HANA Service.

Note: This blog requires creation of multiples subaccounts and therefore can not be done with developer trial account.

 

Details:

Step1. Create subaccount , spaces (DEV, QUAL, PROD) and Database

Step2. Log on to the Cloud Foundry Instance

Step3. Clone the source code from the GitHub repository

Step4. Build the project

Step5. Deploy the project in various spaces 

 

Step1. Create a subaccount, spaces (DEV, QUAL, PROD) and database

  1. Log on to the enterprise account cockpit and select a region under Cloud Foundry environment where you have provision to create a subaccount. 

2. The global accounts available in this region are shown as tiles. Select a global account.

3. Navigate to ‘subaccounts’ Pane and choose a New Sub account.

4.Provide Display name as Test, Subdomain name as MTA.

 

5. Select a Test subaccount where you will create organization for your subaccount

6. Click on Create Organization where you will create different spaces to deploy your multi-target application.

Provide your organization name in the Create Cloud Foundry organization dialog

 

7. Navigate to the Spaces pane click on New Space by providing the space name as DEV and assign the space roles to your user.

8. Create a QUAL and PROD space in same way as explained above in the step number 7.

9. Create a Database on database management systems as explained here.

To share your database with different spaces (DEV,PROD, QUAL) please refer here.

Step2. Log on to the Cloud Foundry Instance:

log on to the your space (created in the previous step) on to Cloud Foundry Instance using the console client as described here.

Step 3. Clone the source code from the GitHub repository

Clone this Git repository and import the project  into the Eclipse workspace.

After successful import the project structure should look like this

Note: The pre-requisite for this step is that EGit Plugin must be installed in Eclipse.

Step4. Build the project

In order to build your project you need to download mta.jar and set up MTA archive builder as explained in the pre-requisites.

Navigate to the root folder of the Application and execute ‘java -jar [path to mta.jar] –build-target=CF build command

In case if you have downloaded the mta.jar file under the root folder of your project then execute the following command

After a successful build, the MultiTarget application archive file (cloud-employeeslistapp.mtar) would be generated.

Now the project structure will look as follows. This shows the deployable artifacts for java (target) and web (node_modules) and multi-target application archive file (cloud-employeeslistapp.mtar).

Step5. Deploy the project in various spaces 

Navigate to the root folder of the application where the cloud-employeeslistapp.mtar file is located.

Execute the cf deploy cloud-employeeslistapp.mtar command to deploy the multi-target application on the Cloud Foundry environment of the SAP Cloud Platform

 

On successful execution, application modules (Java and SAPUI5 ) will be uploaded and started on Cloud Foundry environment and same can be checked under the Applications section of DEV Space.

 

Also SAP HANA service would be created and bounded to the employeeslist-java application as shown below in the Service Binding section

 

In the same way, you can switch to the QUAL space, deploy the Multi-Target Applicationcount. Then you can finally switch to the PROD space, deploy the Multi-Target Application to it too.

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Christian Lechner

    Hi Anuj,

    the link to the MTA CF CLI Plugin is directing to a draft version of help.sap.com that is not accessible. The link to the  MTA archive builder tool is also directing to the help of HANA 2.0 SP02 that is not available yet. Can you tell when these resources will be officially available? Thanks.

    Best regards

    Christian

    (0) 
    1. Anuj Mehta Post author

      Hi Christian,

      Thanks a lot for pointing this out! These resources are already available.I have updated both the links. I hope you will able to access these.

      Best Regards,

      Anuj

       

       

      (1) 

Leave a Reply