This sample explains how to create a query processor that can be used to run custom queries on WSO2 Governance Registry in few easy steps. We will be reusing the code of the Handler Sample and the WS-API Sample in this example. This sample requires Apache Maven and Apache Ant. See Installation Prerequisites for links on how to install it.
1. Navigate to
samples/handler/src to find the source code of the Handler Sample.
2. Add a new Java Class named
GREG_HOME/samples/handler/src/src/main/java/org/wso2/carbon/registry/samples/task/SampleQueryProcessor.java with the following source:
3. Compile the source code by running the following command inside
mvn clean install will trigger an Apache Maven Build in your command line. This requires you having installed Apache Maven. See Installation Prerequisites for links on how to install it.
A successful run of Apache Maven will generate a report similar to the following:
4. Copy the
5. Edit the
registry.xml file which is in
GREG_HOME/repository/conf folder and add the following XML snippet.
See also Configuration for Query Processors.
7. Start the WSO2 Governance Registry server. See Running the Product for more information.
8. After the server has successfully started, navigate to
samples/ws-client to find the source code of the WS-API Sample.
9. Replace the main method of the class in
GREG_HOME/samples/ws-client/src/org/wso2/carbon/registry/ws/client/sample/SampleWSRegistryClient.java with the following source:
10. Compile the source code by running the following command inside
ant run will trigger an Apache Ant Build in your command line. This requires you having installed Apache Ant. See Installation Prerequisites for links on how to install it.
A successful run of Apache Ant will generate a report similar to the following:
11. Now observe the command prompt of the WSO2 Governance Registry Server. You should find a line similar to the following printed on your command prompt, which indicates that you query has successfully executed.