IBM® WebSphere® Service Registry and Repository (hereafter called Service Registry) lets you invoke plug-ins that enable custom code to be executed in order to automate tasks or do additional processing of data based on actions taking place. Actions can include creating, updating, or deleting an object; transitioning an object from one life cycle state to another; making an object governable; or removing governance from an object. Based on the action, different plug-ins are called to perform validations, modifications, or notifications before or after the user's interaction with an object stored in Service Registry. There are three plug-in types:
- Modification plug-in
- Invoked after a user's interaction with an object, but before committing the changes to the Service Registry database, so that additional changes can be processed. If errors occur during the process of modification, the entire transaction is rolled back.
- Notification plug-in
- Invoked after changes are committed to the Service Registry database. These plug-ins are not used to change the content of the Service Registry, but to perform notification tasks or log variances.
- Validation plug-in
- Invoked before the actions are processed to ensure the validity of certain registry transactions and to enable modification of object attributes.
These three plug-in types come in two flavours, for objects set under governance, and objects not set under governance. In this article, you'll learn how to create, configure, and deploy plug-ins in Service Registry. This process will be explained using a sample modification plug-in, but the same principles also apply to Notification and Validation plug-ins.
Many customer implementations of Service Registry have to store objects of custom type, based on a custom metadata model consisting of objects, object attributes, and relationships among objects.
The scenario in this article focuses on a Service Registry object of a custom type with two custom properties named
During a search on two identically named artifacts within Service Registry, only the default properties are displayed, not the custom ones, so it is a good idea to fill default properties
with the values of custom properties in order to find the correct artifact. Therefore the values of the two properties
majorVersion should be concatenated and stored in the default property
In order to implement a modification plug-in that concatenates the two custom property values and stores the result in the default property
version, you need to develop
a custom Java™ class that implements the interface
com.ibm.serviceregistry.ServiceRegistryModifier, using Service Registry V6.2.0 or later.
ServiceRegistryModifier implements three methods:
Table 1. ServiceRegistryModifier methods
|create()||Invoked by creating an entity in Service Registry|
|update()||Invoked by modifying an entity already in Service Registry|
|delete()||Invoked by deleting an entity already in Service Registry|
Each method must return a status object named
ServiceRegistryStatus to indicate the completion of the action taking place in the method and describing the success of the
modification plug-in. In the sample scenario, the two methods create() and update() will be implemented. Here is a depiction of the solution:
- Start WebSphere Integration Developer and create a new Application Client Project.
- Configure the Java build path for the project.
- Create the plug-in implementation.
- Export the plug-in.
- Import the plug-in JAR file into Service Registry.
- Configure Service Registry to invoke the plug-in.
1. Start WebSphere Integration Developer and create a new Application Client Project
Develop the custom Java class to implement the modification plug-in:
- Start WebSphere Integration Developer.
- Select Window => Open perspective => Other => J2EE to switch to the J2EE perspective:
- Select New => Project to create a new J2EE application client project:
- Enter a name for the project and click Finish. In this example, the target runtime is WebSphere Process Server V6.1, but you can also use WebSphere Application Server V6.2.
2. Configure the Java Build Path for the project
As mentioned above, in order to develop a modification plug-in, the created class must implement the interface
com.ibm.serviceregistry.ServiceRegistryModifier with all of its methods.
In order to resolve all necessary imports and dependencies, you must configure the Java build path for the project. Therefore two JAR files named
ServiceRegistryClient.jar are delivered with Service Registry in the root directory of the Service Registry installation .
- Right-click the project Sample Modification Plug-in in the Project Explorer and select Build path => Configure build path.
- Select the Libraries tab and click Add external JARs:
- Select ServiceRegistryClient.jar and sdo-int.jar from the Service Registry installation root directory and click Open.
- Click OK to end the Build path configuration.
3. Create the plug-in implementation
- Right-click on the project Sample Modification Plug-in in the Project Explorer and select New => Class.
- Enter the appropriate information in the dialog:
- You can directly add the interface, which should be implemented by the class interfaces: Add => Type => ServiceRegistryModifier => Add => OK:
As you can see, all necessary methods are generated by the wizard. Now you can start inserting the custom code for the modification plug-in. In our example we only need to implement the methods create() and update(). Download the plug-in sample provided with the article for further information about the implementation and logic of the plug-in. The URIs in the code sample should match your Service Registry configuration, especially the business model.
4. Export the plug-in
After developing the necessary custom code for the plug-in, you need to export it into a JAR file, which you can then load into Service Registry and invoke:
- Right-click on the project in the Project Explorer and select Export => App Client JAR file.
- Browse the destination for the export and click Finish:
5. Import the plug-in JAR file into Service Registry
You can use the Web UI of Service Registry to import the plug-in's JAR file:
- Open a browser window and log in to Service Registry.
- Select the Configuration perspective and click Go.
- In the navigation tree, select Active Configuration Profile => Plug-ins => JARs:
- Click Load JAR Plug-in in the content pane.
- Click Browse and specify the path to your plug-ins JAR file. Enter a name for the plug-in and click OK:
You should receive a message saying
The upload was successful.
6. Configure Service Registry to invoke the plug-in
After loading the plug-in into your Service Registry configuration, you have to enable the plug-in so that Service Registry can invoke it when needed:
- In the navigation tree, click on Modification properties, since this is Modification plug-in:
- Open the Modification properties plug-in by clicking on the name.
- Find the line beginning with
- Enter the package name of the plug-in's Java class combined with the Java class name:
- Click Apply and then OK.
Service Registry is now configured to invoke the plug-in.
In this article, you've learned about the different types of Service Registry plug-ins, implemented a custom plug-in, and configured Service Registry to invoke it. You can now go on to develop different types of plug-ins yourself, and use the downloadable sample to invoke custom plug-ins for execution by Service Registry.
|Code sample||plug_in_sample.zip||11 KB|
- WebSphere Service Registry and Repository product page
Product descriptions, product news, training information, support information, and more.
- WebSphere Service Registry and Repository information center
A single Web portal to all WebSphere Service Registry and Repository documentation, with conceptual, task, and reference information to help you install, configure, and use the product.
- WebSphere Service Registry and Repository documentation library
WebSphere Service Registry and Repository announcement letters, demos, documentation, Redbooks, tutorials, Webcasts, and white papers.
- WebSphere Service Registry and Repository requirements
Hardware and software requirements for WebSphere Process Server.
- WebSphere Service Registry and Repository support
A searchable database of support problems and their solutions, plus downloads, fixes, problem tracking, and more.
- WebSphere Service Registry and Repository Handbook
This IBM Redbook discusses the architecture and functions of Service Registry, along with sample integration scenarios that you can use to implement Service Registry in an SOA.
- WebSphere SOA solutions developer resources page
Get technical resources for WebSphere SOA solutions.
- developerWorks SOA and Web services zone
Technical resources for evaluating, planning, designing, and implementing solutions that involve SOA and Web services.
- developerWorks WebSphere application connectivity zone
Access to WebSphere application connectivity (formerly WebSphere business integration) how-to articles, downloads, tutorials, education, product info, and more.
- developerWorks WebSphere business process management zone
Access to WebSphere BPM how-to articles, downloads, tutorials, education, product info, and other resources to help you model, assemble, deploy, and manage business processes.
- WebSphere business process management products page
For both business and technical users, a handy overview of all business process management products.
- WebSphere forums
Product-specific forums where you can get answers to your technical questions and share your expertise with other WebSphere users.
- Most popular WebSphere trial downloads
No-charge trial downloads for key WebSphere products.
- Technical books from IBM Press
Convenient online ordering through Barnes & Noble.
- developerWorks technical events and Webcasts
Free technical sessions by IBM experts that can accelerate your learning curve and help you succeed in your most difficult software projects. Sessions range from one-hour Webcasts to half-day and full-day live sessions in cities worldwide.
Dig deeper into WebSphere on developerWorks
Get samples, articles, product docs, and community resources to help build, deploy, and manage your cloud apps.
Experiment with new directions in software development.
Software development in the cloud. Register today to create a project.
Evaluate IBM software and solutions, and transform challenges into opportunities.