Deployment - Sales Dashboard using AppFabric SDK for Java

Prerequisites
Demo Installation Guide

  1. If you haven't already done so, Download and configure the AppFabric SDK for Java Developers.

  2.       
  3. Download and extract jdotnetservices-v1.0-sample-source.zip. This will create three folders
    1. SalesOrderService
    2. PollingService
    3. SalesOrderServiceClientApp
          
  4. The Demo requires a service namespace, management key, issuer key, policy key and claims to be created on azure. The following steps explain how to create a service namespace, keys and claims on azure:
    1. Login to AppFabric Devloper Portal using your live ID.
    2. Create a project by specifying a name e.g. JavaAppFabric.
    3. Once the project is created, Click on the project name to navigate to the project information Page.


    4. Project_information
    5. Click on 'Add Service Namespace' to create a new service namespace, give name e.g. appfabricsdkjava

    6. service_namespace_creation
    7. Once the service namespace is created, click on the 'Service Namespace' name to navigate to the service namespace information page.
    8. In this page you can see information such as Management key, service bus and access control end points.

    9. service_namepapce_info
    10. To create issuer key and policy key, download and install Windows Azure platform AppFabric SDK.
    11. Go to C:\Program Files\Windows Azure platform AppFabric SDK\V1.0\Tools, Update the Acm.exe.config file,with service namespace and management key.


    12. acm.exe.config
    13. Copy and paste SetUpSalesDashBoard.cmd to C:\Program Files\Windows Azure platform AppFabric SDK\V1.0\Samples \AccessControl\GettingStarted\ASPNETStringReverser
    14. From the command prompt run SetUpSalesDashBoard.cmd, this script will ask for your service namespace name and management key
    15. SetUpSalesDashBoard

      This script will create and display the issuer key and policy key, notedown these keys. This script also creates required claims for the SalesDashBoard application.
  5. Install the prerequisites.
  6. Follow the instructions listed below to configure the RESTful Sales Order Service (Creating SalesOrderService.war)
    1. Run the salesdashboard.sql file to create the database used by Sales Order Service.
    2. Open and edit the configuration file as below: SalesOrderService/src/com/persistent/appfabric/sample/salesdataservice/config/configuration.properties.
      1. Define the database constants for current deployment
        • MySQL server name as DB_HOST. e.g. DB_HOST = localhost
        • MySQL port number as DB_PORT. e.g. DB_PORT = 3306
        • MySQL user name as DB_USER. e.g. DB_USER = root
        • MySQL password as DB_PASSWORD. e.g. DB_PASSWORD = password
        • MySQL database name as DB_DATABASE_NAME. e.g. DB_DATABASE_NAME = javasalesdashboard
        • MySQL database as DATABASE. E.g. DATABASE = mysql
        • MySQL database driver as DB_DRIVER. e.g. DB_DRIVER = com.mysql.jdbc.Driver

      2. Define the AppFabric settings as described below:
        • Use the value of Issuer key (from step 3.j) as SIGNING_KEY. The Signing key will be used by Sales Order Service for token and claim validations.
        • Define SERVICE_NAME as SalesOrderService
        • Define APPLIES_TO as http://localhost/SalesDashboard/
        Now your configuration.properties file will look like this:
        SalesDashBoardService_Config
    3. Open the command prompt, change current directory to SalesOrderService project path and run "ant" command
    4. Ant Script will generate SalesOrderService.war file in dist/lib directory

  7. Follow the instructions listed below to configure the Polling Service (creating polling.jar)
    1. Open eclipse.
    2. Select new->Java Project.

    3. polling1
    4. Select "Create project from existing source" [shown in image].
    5. Direct the path to "Polling service" root of demo source code and click finish.
    6. Make sure that eclipse project is using jdk1.6.
      1. Right click on the project and select properties
      2. If the JDK compliance is not 1.6 pl. refer to Eclipse documentation to change it. It will be safe to point to JDK 1.6
        polling2
      3. Place the jdotnetservices-v1.0-sdk.jar and commons-codec-1.4.jar files in lib folder under PollingService folder.
    7. Provide the jar file references to project class-path.
      1. Right-click project and select properties
      2. Click on "Java Build Path" and select "Libraries" tag
      3. Click "Add Jars…" and select above two jars (step 6.e.iii) from lib folder
      4. Select OK
        Polling3
    8. Edit PollingService\src\com\persistent\appfabric\config\configuration.properties.
      1. Set "ISSUER_NAME=owner" in the configuration.properties file.
      2. Set management key as ISSUER_SECRET
      3. Your configuration file will look like this
        Polling3
    9. Provide MANIFEST.MF file for dependencies.
      1. If such file is not present in the Polling java Project [parallel to "src" folder], create one with the same name and contents as shown below.
        Polling4
    10. Export project to polling.jar file.
      1. Right click the project and select "Export…" option
      2. Expand "Java" and select "jar", "Click Next>"
        Polling5
      3. Uncheck .classpath, .project, and other such files
      4. Provide jar file name and path.
      5. Click "Next"
      6. Click again "Next"
      7. Select "Use existing Manifest file from workspace"
      8. And browse to the MANIFEST.MF file
      9. Click Finish
        Polling6

  8. Follow the instructions listed below to configure the Sales Order Client Application (creating ‘SalesOrderServiceClientApp.war’ file)
    1. Place the jdotnetservices-v1.0-sdk.jar, krysalis-jCharts-1.0.0-alpha-1.jar and commons-codec-1.4.jar files in lib folder under SalesOrderServiceClientApp folder.
    2. Open and edit SalesOrderServiceClientApp/src/com/persistent/appfabric/sample/salesdataclient/config/ACS.properties as follows:
      client_config1
    3. Update the proxy settings present in proxySettings.properties file placed under SalesOrderServiceClientApp\src\com\persistent\appfabric\sample\salesdataclient\config folder as per your configuration.
    4. Open the command prompt and change current directory to SalesOrderServiceClientApp folder and run command "ant createwar".
    5. This will create SalesOrderServiceClientApp.war file in SalesOrderServiceClientApp/dist/lib folder.
  9. Follow the instructions listed below to Deploy the SalesOrderService.war and SalesOrderServiceClientApp.war on tomcat server
    1. Locate the root folder of tomcat installation. [Generally it will be C:\apache-tomcat-6.x.x]
    2. Copy the "SalesOrderService.war" and "SalesOrderServiceClientApp.war" files to < tomcat root folder > \webapps
    3. Start the tomcat server as a service or by running < tomcat root folder >/bin/startup.bat dependeing upon installation of tomcat
  10. Follow the instructions listed below to start the polling service from command prompt
    1. Change the current directory to the path where polling.jar resides
    2. Run following command:

      java -jar polling.jar < message_buffer_name > start

      where message_buffer_name is the Message Buffer that will be used by the polling service
      To stop the polling service from command prompt:

      Run the command:

      java -jar polling.jar < message_buffer_name > stop
  11. Run the client as

    http://localhost:8080/SalesOrderServiceClientApp/pages/

    [replace 8080 by port if tomcat uses different port than 8080]