Sample: Creating a virtual application with the patterntypetest.hello plug-in

You can use the patterntypetest.hello plug-in to create an application that is deployed to the cloud.

Before you begin

Set up your development environment and import the sample pattern type.

Procedure

  1. Click Patterns > Virtual Application Patterns. The Virtual Application Patterns pane displays. Ensure that the patterntypetest.hello 2.0 is selected.
  2. Select patterntypetest.hello 2.0 from the patterns list.
  3. Click the New on the toolbar. The Create Application dialog box displays.
  4. Click Start Building. The Pattern Builder displays in a new window.
  5. In the Other Components section in the component list, drag the Hello and HelloCenter components into the middle section of the canvas. Name the application in the Virtual Application pane.
  6. Select the List View tab, next to the Diagram tab.
  7. Create the sample_userlist.json file with the following content ["Mike","Alice","Joe"].
  8. Click the HelloCenter component. In the right attributes view, type sample in the Hello Center Name attribute field. Upload the created sample_userlist.json file in the Registered User List.
  9. In the Diagram tab, click the Hello component.
    In the right attributes view, type one of the following names: "Mike","Alice","Joe".
  10. Link Hello to HelloCenter.
    Click the link and type any name in the receiver of greeting message attribute field.
  11. To review all of the settings that you configured in the previous steps, click the List View tab on the left pane.
  12. Click Save and return to the Virtual Application Patterns page.
  13. Refresh the Virtual Application Patterns page to display the new application.

    The application displays in the list that is on the left.

  14. Select the application and click the Deploy icon in the upper right pane.

    The Deploy Virtual Application window displays. Specify the IP type and the target for the deployment, and then click OK.

    When the deployment is complete, the status icon turns green.

  15. Click Patterns > Virtual Application Instances to view the deployed virtual application instance.
  16. Select the virtual application instance.
  17. In the details pane, find the virtual machine with the HCenter client in the list of virtual machines. It has the name Hello_Plugin-HVM-XXXX, where XXXX is a set of digits. Click the Log link next to the virtual machine to open the file viewer in a new window.
  18. In the file viewer, select IWD Agent and then choose ../logs/Hello_Plugin-HVM.XXXX.hello and then console.log.
    The log includes messages that are sent by users.
    [2011-06-30 04:10:49,592] Hello/HCenter/changed.py 47121262922944 pid=16205 
    INFO Send the request to get a greeting message from Mike to Alice
    [2011-06-30 04:10:49,859] Hello/HCenter/changed.py 47121262922944 pid=16205 
    INFO Receive the message from hello center: Mike, a kind greeting message from Alice has been sent out
  19. From Patterns > Virtual Application Instances, select the application, and click the Manage button.
  20. Change to the new tab in your browser, which shows the Instance Console.
  21. Choose the Operations tab.
  22. Select Hello role. Use the operation to send a message to the HelloCenter and get a response back.
  23. Select HelloCenter role. Use the operation to edit the list of registered users, which affects response messages.