As a developer with the customer, I may want to be able to build server extensions based on sample code I receive from SAP. This code must run out of the box w/o any dependencies on SAP internal build infrastructure, here you go how to use SMP3 sample code.

1. Download sample source code

    Latest source code address: SAP/sap_mobile_platform_extend_functionality · GitHub

    Download it and unzip it to you work folder, e.g. c:/sample.

2. Prerequisites

  2.1 maven/maven repository, customer should have their own repositories.

        For example in my test, I mapped central Repository http://central.maven.org/maven2/, SMP3 use spring framework bundles, it’s required too, for example, Spring OSGI Bundle Repository Sample

http://repository.opencastproject.org/nexus/content/repositories/public/

        P2 unzip repository used for build p2 artifacts, e.g. http://download.eclipse.org/virgo/updatesite/3.6.2.RELEASE/, see repository.javaweb property in submodule sample.parent.

  It’s used when building p2 features/repository. see featuren pom or repository pom.

  2.2 SMP3 installed/Upload dependencies to reporisotory from SMP3

        There is an utility in SMP3 installation folder named com.sybase365.mobiliser.dist.tools-5.4.1.RC1.jar which can uploaded dependencies to their repository incase missing maven artifacts.

            Usage: java -jar bundles/com.sybase365.mobiliser.dist.tools.jar

            <DEPENDENCY META INFORMATION FILE>, e.g. ./dependencies.properties

            <DIST DIRECTORY>, e.g. ../

            <NEXUS URL>, e.g. http://localhost/nexus

            <REPOSITORY NAME>, e.g. repo

            <USERNAME>, e.g. admin

            <PASSWORD>, e.g. password

            <put|rest> for using the PUT or REST Nexus interface, defaults to REST (which auto-generates POM files too)

            e.g. I have local nexus http://usphlwssc247.amer.global.corp.sap:8081/nexus, smp3_customer is one repository. admin/admin123 is user/password. After unzip the sample code to c:/sample, the file c:/sample/dependencies.properties is there, suppose SMP3 install in folder C:\smp3, open command line, go to C:\smp3\extras\dependencies, run below command to upload dependencies to smp3_customer repository.

        java -jar com.sybase365.mobiliser.dist.tools-5.4.1.RC1.jar c:\sample\dependencies.properties C:\smp3\plugins http://usphlwssc247.amer.global.corp.sap:8081/nexus smp3_customer admin admin123

3. Customize and build samples source code

    3.1 Build sample code

        The submodule sample.parent need to build first first, then build each samples separately, customer can customize the code as need.

    3.2 Build p2 repository

        P2 update-site include features and repository, Open command line, go to update-site folder, run maven command mvn clean install build it, the p2 repository will be generated in folder repository/target/repository.

  If some of features are not required, customer can comment it.   

4. Install features/repository in Admin UI

    4.1 Go to SMP ADMIN UI->SETTINGS -> REPOSITORIES, add new repository.

        e.g. Unzip the code to c:/sample, then generate p2 repository to c:/sample/update-site/repository/target/repository, input file:/c:/sample/update-site/repository/target/repository to text box in adminUI, save it.

    4.2 Go to SMP ADMIN UI->SETTINGS -> FEATURES&COMPONENTS, enable features added in previous step.

5. Verify if it is take effect or not

  5.1 JPA

        Visit URL http://localhost:8080/com.sap.mobile.platform.server.sample.customization.persistence.jpa.wab
        Output in browser, more actions can be done by below API

Usage:

  …?action=getAllEmployees

  …?action=getDepartmentEmployees&deptName=

  …?action=addDepartment&deptName=

  …?action=addEmployee&deptName=&firstName=&lastName=

  5.2 Properties

      Output in console:

      The full URL is: https://www.yahoo.com:443/altsearch

  5.3 Servlet

      http://localhost:8080/NoSlash

      Output in browser:

      Service processed by NoSlash at URL http://localhost:8080/NoSlash

  5.4 Filters

      If you open url http://localhost:8080/public/abc in browser, output in SMP console:

      noauthfilter forwarding /public/abc to /abc



To report this post you need to login first.

2 Comments

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

  1. Martin English

    None of the *.sap..* links resolve. The implication is that they are SAP intranet links.

    How is this of ANY use at all to someone who does not work for SAP ?

    (0) 
    1. Bing-yan Zhang Post author

      I attached the zip file, it need remove .txt suffix then unzip to local.

      I’m requesting OSS approval, after that, I can upload it to github.

      Thanks

      (0) 

Leave a Reply