Extending the WSO2 Governance Registry with Handlers and Filters


Published on

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Extending the WSO2 Governance Registry with Handlers and Filters

  1. 1. Extending the WSO2 GovernanceRegistry with Handlers and Filters Isuru Wimalasundera Software Engineer WSO2
  2. 2. Objectives• An introduction to Handlers and Filters• A brief description over normal processing of resources in registry.• The extension of resource processing by Handlers.• The role of a filter• A simple demo on the use of handlers and filters• Other important aspects
  3. 3. Why need Handlers ?• Handlers is a Java archive file which is used in extending functionality of registry.• Registry is not only a resources store, it inherits additional capabilities and makes resources suitable for enterprise deployment.• But Organizations or a deployment can have the requirement of customizing the standard behavior of resources.
  4. 4. The normal resource processing
  5. 5. The normal resource processing (contd.)• Registry API provides all the resources related operations.• The Repository interacts with the data access layer and do low- level database operations.• Registry invokes the Version Repository if the resource requires versioning.• Registry directly interacts with data access layer to do non resource related operations. E.g. – tagging, commenting, etc.
  6. 6. Handlers in to action• Handler is a pluggable component.• Every handler is extended from an abstract class called Handler.• The Handler implementation allows to provide alternative behaviors for basic resource related operations.• The handler implements a corresponding operation for resource handling methods of the Registry API.
  7. 7. Handlers in to action (contd.)• As event invocations happens the corresponding handler methods will get triggered by registry.  get – Retrieve a resource.  put - Adding a new resource , updating an existing resource.  importResource - Adding or updating a resource by importing its content from a URL.  delete - Deleting a resource.  putChild - Adding a child resource to a collection.  importChild - Importing a child resource to a collection.
  8. 8. Handlers in to action (contd.)• All the handler methods contains a single parameter of type RequestContext.• An instance of RequestContext holds all details about current request. • resourcePath – a unique path referred to the resource • resource - holds the actual Resource instance • sourceURL - URL to import resource content (only for import operations) • parentPath – path to the parent resource • parentCollection - collection implementation of the parent resource • properties - to store handler specific information • processingComplete – must set to true to terminate the processing after the handler is invoked.
  9. 9. The role of a Filter• Every handler has an associated Filter.• Filters provide criteria for engaging handlers.• Registry always evaluates the associated filter before invoking a handler.• If the filter evaluates to true, it will invoke its associated handler.• A filter extends from the Abstract class Filter.
  10. 10. The role of a Filter (contd.)
  11. 11. The role of a Filter (contd.)• The registry contains two built in filter implementations for common filtering scenarios• MediaTypeMatcher • Filter by the media type of resource.• URLMatcher • Filter by the URL criteria defined .• Customized filters can be implement according to the organization and deployment requirements.
  12. 12. The Handler Architecture
  13. 13. Handler Manager Phases• At registration handlers get categorized in to phases as given below.• Pre-Commit Handlers: • System Phase (all built-in handlers and handlers defined on registry.xml) • Tenant System Phase (tenant-specific system handlers) • User Defined Handler Phase (handlers uploaded and configured through Management Console) • Reporting Phase (the eventing, statistics, and simulation handlers)• Post-Commit Handlers • Commit Phase (if the commit succeeded these are executed) • Rollback Phase (if the commit failed these are executed)
  14. 14. The demo• Implementation of a Handler• Implementation of a Filter• How to deploy a handler• Handler registration to the handler chain• Functionality of the Handler• Functionality of the Filter
  15. 15. Thank You
  16. 16. WSO2• Founded in 2005 by acknowledged leaders in XML, Web Services Technologies & Standards and Open Source• Producing entire middleware platform 100% open source under Apache license• Business model is to sell comprehensive support & maintenance for our products• Venture funded by Intel Capital• Global corporation with offices in USA, UK & Sri Lanka• 100+ employees and growing
  17. 17. Selected Customers
  18. 18. WSO2 engagement model• QuickStart• Development Support• Development Services• Production Support• Turnkey Solutions • WSO2 Mobile Services Solution • WSO2 FIX Gateway Solution • WSO2 SAP Gateway Solution