Let’s imagine you would like to manage a pool of resources, each resource are not sharable and thus a pattern can request a resource at deployment time and return the resource during its deletion.
To reach that goal, you can create, what we call, a shared service. The shared service will manage the pool of resources and provide basic functionality such as ‘get a resource’, ‘return a resource’. This article is based on the example provided in the PDK (downloadable from the SCAWS console or look at installation guide here) and the developerworks article: Navigate a shared services workload in PureApplication System
This is a quite long blog but I hope you will enjoye this step by step shared service development procedure.
A shared service is implemented as a plugin for the IBM SmartCloud Application Workload Service and has more or less the same structure as a plugin.
To develop the shared service we will use the PDK in our Eclipse environment.
In our exercise, we will call our shared service ‘Pool Manager’ and implement the server side. The client side (code to call the service) is described in a separate blog here meanwhile you can look at the shared service example provided in the PDK package.
Here are the steps, I will split them in multiple chapters:
0) Creation of the plugin.
1) Presentation: This is about creating the needed files for the UI
1.1) Define the application model.
1.2) Specify our config.json file.
1.3) Define the shared service application model.
1.4) PresentationTest
2) Deployment: Here we will add the necessary element to be able to deploy the shared service.
2.1) Create the part/role
2.2) Define the package
2.3) Define the OSGI files for the topology provider
2.4) Update the topology template
2.5) Test the deployment
3) Define and implement the service
3.1) Define the OSGI files for the service provider
3.2) Declare the service in the topology.
3.3) Implement the java class for the service.
3.4) Create the API methods.
4) Final Test