[Download] | [Documentation Home] | [Release Note]

Gadget Sample

Introduction

This sample demostrate how data services are invoked inside a gadget using REST calls. Following sample provides database operations such as insert, update, delete and retreive data; further, it provides a mechanism to analyze data in a barchart format.

Prerequisites

The sample data services should be deployed as per the instructions mentioned in Deploying Samples section.

Database Definition

The scenario is based on a possible database used in a small company to handle its internal affairs. Such information about the products that are produced in the company.

Service Definition

There are seperate queries/resources written for specific operations; resources are defined inorder to access data through REST calls. The resources implemented in the service are listed as follows.

The above first four resources uses the same resource path http://localhost:9763/services/ResourcesSample.HTTPEndpoint/product , the REST calls are identified by the HTTP request method. The last resource is used to retrieve all the products, therefore seperate resource path is used.

Manage Product Gadget

Manage product gadget provides the functionality to add, edit, delete and view a product and access the database directly.





Figure 1: Manage Products



Product Analysis Gadget

The product analysis gadget calculate number of products for a product line and create a bar chart according to the result. Whenever a product is modified/inserted the barchart is refreshed accordingly. This functionality is provided using the WSO2 Gadget Server inter gadget comunication feature.





Figure 2: Products Chart





Product Infomation Gadget



The product information gadget retreive all products and displays product infomation in a table format and refresh data according to data management.





Figure 3: Products Information