Showing posts from 2014

Configurable Governance Artifacts - CURD Operation

Please refer my previous post which explain about Configurable Governance Artifacts in WSO2 Governance Registry.

Once you have added an RXT, it will generate HTML based List and Add view. Also it will be deployed as an Axis2 based service with CRUD operations. For example, when you upload contact.rxt, there will be a Contact Service exposed with CRUD operations. Using provided CRUD operations, external client applications(php, .net,etc) can perform registry operations.

Below is an example CRUD operations provided for Contact RXT which we created in my previous post(RXT Source).
addContact - create an artifact in the type Contact .getContact - retrieve an artifact in the type Contact .updateContact - update an artifact in the type Contact .deleteContact - delete an artifact in the type Contact . getContactArtifactIDs - get all the artifact ID s of artifacts in the type Contact .

To retrieve WSDL of the above service, we need to disable "HideAdminServiceWSDLs" in "carbon.xml…

WSO2 Governance Registry - Configurable Governance Artifacts

Configurable Governance Artifacts is one of many well-defined extension points supported by the WSO2 Governance Registry. This is also known as Registry Extensions Types. This allows you to define own metadata models other than the default metadata model which is shipped with the product. This will support modeling any type of asset according to the user requirements.

When deploying Configurable Governance Artifacts in WSO@ Governance Registry, it creates a web service which supports CURD (Create, Update, Retrieve, Delete) operations. So using external web services, client application users can consume them.

Below are the main elements in RXT configuration.

artifactType elementartifactKey elementstoragePath elementnameAttribute elementnamespaceAttribute elementmenu elementui elementrelationships element Using above basic model, you can create/modify RXTs based on your requirement. Let’s go through a sample RXT file and understand requirements of each element one by one. For an exampl…

Maven excludes all transitive dependencies

"Transitive dependencies are a new feature in Maven 2.0. This allows you to avoid needing to discover and specify the libraries that your own dependencies require, and including them automatically."

I had a problem, where some dependencies were available in the run time, but they weren't available in the public nexus repositories. For an example, Hibernate depends on the Sun JTA API JAR and it is not available in the central Maven repository because it cannot be freely redistributed. So when building the project, it was trying to download transitive dependencies and got failed.

So I looked  a way to ignore all the transitive dependencies, and found that we can ignore all the associated dependencies of a given dependency. There we can exclude all transitive dependencies without specifying groupId and artifactId of the dependencies. So need to use astric(*) character as groupid and artifactid of the dependency.
<dependency> <groupId>sample.ProjectA</grou…

Customizing Header and Footer of WSO2 API Manager Store

If you want to customize the header and footer of WSO2 API Manager Store application, this blog post will be explaining how to do that by adding a subtheme. 
Adding a Subtheme
1). Navigate to "\repository\deployment\server\jaggeryapps\store\site\themes\fancy\subthemes" directory. 2). Create a directory with the name of your subtheme. Here I am going to create a subtheme called "test" 3). Edit "repository\deployment\server\jaggeryapps\store\site\conf\site.json" file as below. This makes your sub theme as the default theme.
"theme" : {         "base" : "fancy",   "subtheme" : "test"     }, Customize Header:
As an example, Here I am going to remove theme selection menu item from store header (theme selection will be appearing after user login into the store).
1). Create a directory called "templates" inside your subtheme directory. 2). Copy "template.jag" located in "\repository\deploy…

Host name verification failed for

Are you getting a " Host name verification failed for host" exception as below while trying to connect with a different host? 

TID: [0] [AM] [2014-08-28 14:41:51,936] ERROR {org.apache.synapse.transport.passthru.TargetHandler} - I/O error: Host name verification failed for host : {org.apache.synapse.transport.passthru.TargetHandler} Host name verification failed for host : at org.apache.synapse.transport.http.conn.ClientSSLSetupHandler.verify(
at org.apache.http.nio.reactor.ssl.SSLIOSession.doHandshake(
at org.apache.http.nio.reactor.ssl.SSLIOSession.isAppInputReady(
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(
at org.apache.http.i…

WSO2 Governance Registry - Monitor database operations using log4jdbc

LOG4JDBC is a Java based database driver that can be used to log SQL and/or JDBC calls. So here I am going to show how to monitor JDBC operations on Governance Registry using log4jdbc.

Here I believe you have already configured Governance Registry instance with MySQL. If not, please follow the instruction available in the Governance Registry documentation.

1). Download the log4jdbc driver

 You can download log4jdbc driver from below location:

2). Add log4jdbc driver

 Copy log4jdbc driver into CARBON_HOME/repository/components/lib directory.

3). Configure file.

Navigate to file located in CARBON_HOME/repository/conf/ directory and add below entry in to file.

# Log all JDBC calls except for ResultSet calls

# Log only JDBC calls to ResultSet objects

# Log only the SQL t…

WSO2 G-Reg Modify Subject of the Email Notification

WSO2 Governance Registry generates notifications for events triggered by various operations performed on resources and collections stored in the repository. Notifications can be consumed in a variety of formats including E-mail. The sample "E-mail NotificationCustomization" shows how we can modify the content of emails. It describes how to edit email body and restrict email notification to some email addresses.

Here I am going to extend that sample to modify Subject of the email.

private void editSubject(MessageContext msgContext, String newSubject) { ((Map) msgContext.getOptions().getProperty( MessageContext.TRANSPORT_HEADERS)).put(MailConstants.MAIL_HEADER_SUBJECT, newSubject); }

You will have to import "org.apache.axis2.transport.mail.MailConstants;" class and other related Java util classes as well.

When you are building the sample code, please follow the instructions available in the Governance Registry Sample Documentation.

WSO2 Governance Registry - Apply Tags using Handler

There can be scenarios, where users want to apply tags into their resources, while resource is inserted. I am writing this post based on my answer provided to this Stack Overflow question.

Question was on how to apply a tag into a service in WSO2 Governance Registry at the time of the service creation. We can use Registry Handler for achieving this requirement. Handlers are the well-known extension points in WSO2 Governance Registry.

"Handlers are pluggable components, that contain custom processing logic for handling resources. All handlers extend an abstract class named Handler, which provides default implementations for resource handling methods as well as a few utilities useful for concrete handler implementations."[WSO2 Governance Registry Docs]

I have modified handler sample, which is shipped with Governance Registry pack. Using above link please download the G-Reg pack and handler sample is located at GREG_HOME/samples/handler.

public void put(RequestContext requestC…