Refiner Overview
Refiner is a Transformer Service blade that you can use to filter and sort large lists of data. It enables you to set the filtering and sorting criteria that are relevant to you.
For example, you could filter a container so that only the following results are returned:
-
All the bonds that mature in the forthcoming 2 year period.
-
All the bonds with a coupon greater than a particular value.
-
All the bonds with a rating greater than a particular value.
As well as filtering the results, you can also sort them into the most convenient order - in descending order of the bonds' coupon, for example. Filtering and sorting can be done in the same request.
To find out more about how to deploy Refiner and use it to filter and sort requests, see How can I… Deploy the Refiner Service Module.
Refiner Service Architecture
Refiner sits within Transformer in the Caplin Platform.
A basic Refiner setup involves a client application, which connects to Liberator using RTTP, a Transformer, which is connected to Liberator, and an Integration Adapter, which is connected to Transformer.
![Transformer in Caplin Platform, showing Refiner Module](../../../images/cp-detail-transformer-focus1_Refiner_Highlighted_2.png)
In Transformer, data transformation services are implemented in Transformer Modules. The Transformer provides an interface for Transformer Modules to register as providers for objects in a specific namespace. When client applications request an object whose subject matches the namespace for a particular Module, the Transformer requests that object from the Module, which then returns the object.
Transformer Modules can be written in Java, Lua or C. Refiner is a Java Transformer Module; it’s supplied as a Service blade that’s deployed in the Caplin Platform Deployment Framework. When Refiner receives a request for a filtered or sorted container, it requests the base container (sometimes referred to as the "underlying container") from the relevant Integration Adapter. When the base container and constituent records arrive from the Adapter, Refiner applies the filter and/or sort criteria specified by the client and sends back the results.
How container filtering works
The following diagram illustrates how container filtering works. It shows the Caplin Platform components involved in filtering the contents of a container, and the flow of subscriptions and data through the system. The actual filtering and sorting of the container is performed by the Transformer’s Caplin Refiner module, which is deployed as a Transformer Service blade.
In this example, the client application has already subscribed to the container /CTR/FI/ALL
, and the instruments referred to in the container are displayed to the end-user in a grid (see the beige-coloured box at the top left of the diagram). Subsequently the end-user sets up a filter that restricts the instruments displayed in the container to those where the Coupon (CpnRate
field) is greater than 6
. For simplicity, the container is not windowed.
![How container filtering works](../../../images/ContainerFilteringOperation.png)
-
Caplin Trader calls the StreamLink Container Filtering API to add the filter (CpnRate>6) to the subscription for the container
/CTR/FI/ALL
. Liberator receives the filter as a request for the subject/FILTER/CTR/FI/ALL?(CpnRate>6).
-
Liberator passes the container filter subscription request on to Transformer, where it is retained by Caplin Refiner, which sets up the filter. (If the base container – in this case
/CTR/FI/ALL
– is not in the Transformer’s cache, Transformer requests it from the relevant Integration Adapter.) -
At the same time, the Integration Adapter that handles the subscriptions to the instruments in the container passes back to Transformer a new container element, referring to a new instrument
FI/US/C.
-
In Transformer, Caplin Refiner applies the filter to the container according to the latest set of instruments. In this example, the value of the CpnRate field for
/FI/EU/A
and/FI/EU/C i
s less than6
, so these instruments no longer meet the filter criteria, and must be removed from the filtered container. The new instrument/FI/US/C,
with itsCpnRate
of10.62
, matches the filter, so it is retained in the filtered container. Transformer sends a container structure change message to Liberator, specifying that the subject names/FI/EU/A
and/FI/EU/C
be removed from the container, and the subject name/FI/US/C
be added to the container. -
Liberator makes the changes to the container and passes the corresponding container structure change messages on to StreamLink. StreamLink then informs the client about the change to the filtered container so that it can remove the instruments
/FI/EU/A
and/FI/EU/C
from the filtered grid on the display, and add/FI/US/C.
Any updates to the instruments/FI/EU/B
, and the image for the new instrument/FI/US/C
, are also fed back to the client via Liberator and StreamLink. The client updates the instruments in the filtered grid – see the grey box at the top right of the diagram.
Using Refiner
To use Caplin Refiner, a client application subscribes to (requests) a subject, where the subject name indicates to the Transformer that a container is to be filtered and/or sorted. The Transformer passes the subscription request to its Caplin Refiner module, which then parses information from the subject in order to perform its functions.
The client doesn’t create such subscription requests directly, but instead calls dedicated API methods to construct filter and sort directives, which are then passed on to Caplin Refiner.
-
To use Caplin Refiner from a Caplin Trader application, call the Caplin Trader API methods on particular display components (such as grids) that allow you to filter and sort the data displayed. For details, see the Caplin Trader JavaScript Libraries API Documentation. The main classes are
FieldFilterExpression
andLogicalFilterExpression
. Also see How can I… Configure sorting and filtering (in Caplin Trader 4 grids). -
To use Caplin Refiner from a client that isn’t a Caplin Trader application, call the API methods provided in the StreamLink library that your application uses. These methods allow you to build up the request in an object oriented way, and the request string itself is then generated by the StreamLink library. For a detailed example of how to do this, see How can I… Access Refiner through StreamLink.
Requirements
To use Refiner, you need to have the following installed
-
Caplin Trader (v2.2.3 or above)
-
Liberator (v5.0.2 or above)
-
Transformer 32 bit (v5.0.5 or above) OR Transformer 64 bit (v5.1.1 or above)
-
Java (v6 or above)
Internationalisation (I18n)
I18n support is built into Refiner and includes the following:
-
International characters in Filtering.
-
Custom sorting using Java
compareTo
. You can write a class that implementsjava.util.Comparator
and provide any sort order. -
Locale-Independent Comparisons. There’s more information about this on the Oracle Performing Locale-Independent Comparisons page.
See also:
-
How can I… Deploy the Refiner Service Module
-
How can I… Filter and Sort in Refiner
-
How can I… Implement custom sorting and filtering in Refiner
-
How can I… Access Refiner through StreamLink
-
How can I… Configure Refiner
-
How can I… Configure sorting and filtering (in Caplin Trader 4 grids).
-
How can I… Set Refiner user permissions and subject mappings
-
Reference: Refiner configuration properties