Saturday, May 9, 2009

WSO2 Registry Initialization

Since I was assigned to work with Registry team at WSO2 I had a look in to the Registry Core source code which ships as a separate bundle with Carbon. I read the code from the Declarative Service level code and thought of blog about the Registry Initialization.
Since this is a bundle of Carbon Environment it calls most of the methods of OSGI(Open Services Gateway Initiative) but other than calling them all the initialization happens inside the start method of the bundle itself.
At the very first stage it will create the class RegistryConfiguration which mainly go through the carbon.xml and find what type of initialization is configured. It could be a Remote Registry or an Embedded Registry(Default Initialization). If it's a Remote Registry users have to give the values for following parameters like URL,UserName and Password in the carbon.xml.After reading carbon.xml it simply validate the configuration and create the RegistryContext object by reading registry.xml and passing RegistryRealm object in to RegistryContext. Almost all the initialization happed during the time of creation of RegistryContext. Major tasks are reading registry.xml and registering Handlers and configurating most of the database configurations in programmatical stage.

After initializing the registry service based on the carbon.xml it add it to carbon environment by calling addCarbonRootCollection method and now RegistryCore is up and running in Carbon Environment. In the latest trunk all the bundle initializations are done using Declarative Service and you won't be able to find Tracker Classes or Activators any more in Carbon platform.

I will be writing more about the structure of the Registry-Core in near future since it could be useful to understand the internal implementation for who ever is going to implement their own repository management system.

No comments :