Friday, September 18, 2009

Get the dynamic UI for service adding in WSO2 Governance Registry 3.0.1

If you are using WSO2 Governance Registry 3.0.0 you can see that we are allowing users to create their services as resources by giving different kinds of information about the resource. If you go through the context sensitive documentation by clicking on the help button when you go the add service UI you'll get to know that you can configure the given UI by giving different values for the already provided UI by changing some XML files located int /governance/configurations directory.


Now we are allowing users to create their own fields in to govenance registry Service UI form so that you can have your own data in to service resources. This is a completely dynamic UI generation based on an XML. You just have to change an xml in the registry and change your Service UI dynamically. If you want to get this feature in you can do that by switching in to upcoming release of WSO2 Governance Registry 3.0.1 and download the patch here[1] and go through the readme on how to apply the patch to registry.

[1]http://builder.wso2.org/~carbon/service-ui-M2/patch.zip

Tuesday, July 7, 2009

Governance Registry Service Metadata

WSO2 Governance Registry is providing complete Service Metadata Management features with Release 3.0.0 to do a better governance in your SOA system. In the new left panel there are set of operations supported in order to manage service metadata efficiently.

We are providing two main operations to manage service metadata in order to do a better governance in users SOA(Service Oriented Architecture) system.

  • Importing required Service metadata as Registry resource
  • Managing imported Registry Resources
  • Users can add it's service details in different ways like importing complete set of service details, importing WSDL of set of services in the SOA system, importing Schema's or Policies of set of services in the SOA system. Importing service details can be done using the upper part of the metadata menu which contains the links Add->Service, Add-Policy, Add->WSDL, Add->Schema.

    Add Service

    This service import method is preferred when user doesn't have a proper description about the service with a WSDL but we provide a field to import WSDL in to Governance Registry. When user click on Add Service link user will be given a form to fill. Important thing in this form is user can simply reconfigure the default configuration.

    Configuring "Add Service" UI

    User can configure the set of drop down lists which suit to users SOA system. This can be done by changing the current configuration by editing the content of set of resources in /governance/configuration/. There are set of resources as displayed in Figure 3 which you can browse and edit the XML content of the resource.

    Ex: Default configuration have drop down list for Service states with the fields of Created Tested Deployed and Deprecated. If user wants to add a new Service in to this drop down list you have to add a new XML element like this in to the XML content of the resource /governance/configuration/states

    After adding new XML element save the content and to find the change, go to add service UI and see the states drop down. Likewise users can configure all the drop downs in the add service UI.Likewise users can configure all the drop downs in the add service UI.

    In Add Service UI there are set of fields to fill and service name and service Namespace are mandatory. Most of the fields are obvious service informations and if you want to add a WSDL URL you can add it but the information from the WSDL will not be display when you go to edit these information. So we prefer you to use add->WSDL if you have a WSDL in the given resource. And you can add any number of endpoints to the given service by clicking add endpoint link and if user try to add more and more endpoints without filling previously added endpoint new endpoint will not be displayed.

    After successfully adding a new Service user will be directed to newly added resource location which constructed based on the service Namespace which user shouldn't concern about. After direction user can see a resource with the given service name and if user give already exist service name service import operation will fail.

    Add Policy

    User can add Policy by traversing to the add Policy link. This form contains fields, policy URL and policy name. Governance Registry will automatically suggest a name for the policy once the URL is entered. Policy will be imported as a resource in to the Governance Registry. Successful import will redirect in to a page which list all the imported policies.


    Add WSDL

    If a WSDL URL is available and you need to import service information to the Governance Registry you can use the "Add WSDL" option provided with the Governance Registry. Once the URL is provided to the UI, a name is automatically suggested for the resource in Governance Registry. When we import the given WSDL we are extracting certain number of details like service name, service namespaces and service endpoints and import the given WSDL as a resource and import a service resource which is very similar to the resource we are creating when user add a service using add service UI. So user can go to that resource and edit the rest of the information user couldn't import through WSDL import operation, like Authentication Platform, Authentication Mechanism etc.

    Add Schema

    Like WSDL importing Governance Registry allow users to add Schema in to registry using add Schema UI. User have to give the schema location in to Schema URL and Schema name will be filling very similar in Add WSDL and Add Policy forms. Successful schema import will redirect in to currently available imported schema listing page.

    Validation

    Similar to WSDLs, WSO2 Governance Registry performs Schema validations on the wsdl provided once importing is done. The result is displayed under "properties" section of the imported Schema resource.


    Saturday, May 30, 2009

    My Elder brother Graduated in May 28th 2009

    This weekend is a very interesting one for all of my family members since My elder brother graduated last Thursday and one of my younger brother came home after nearly a month by finishing his first exam at faculty of medicine University of Peradeniya...
    My brothers convocation held in BMICH in colombo and parents were there to see their son's victory. This was my moms whole life since we were in our childhood. I always remember she was pointing to University of Ruhuna which is by the road of my fathers place and advising us to study hard...Yeah, she used to do that since I was in Grade 1...
    I'm thanking all of them who helped him to become a graduate..and wishing him all the success for his future endovours !!!! I think he's going to get another degree in couple of months and will be posting again on that !!!

    Monday, May 11, 2009

    Configuring Airtel HSDPA on Ubuntu

    Today I bought an Airtel Data bundle and tried to configure it on my Ubuntu 9.04.I have been accessing internet through my Mobitel connection for sometime and I thought it would be easy to configure it to Airtel.Yes it was easy but I had to do couple of things since the debian package did not had Airtel information in Sri Lankan service providers list. If you are a user willing to configure your Airtel HSDPA(Sri Lankan) connection on Ubuntu with your mobile this blog is for you.

    1.In the current mobile-broadband package which ships with Ubuntu 9.04 doesn't contain Airtel as service provider for Sri Lanka.So you have to get the latest update of the package. In order to do that,install subversion on your machine and get and svn check out from here :
    http://svn.gnome.org/svn/mobile-broadband-provider-info/trunk

    2.Copy serviceprovider.xml and serviceprovider.dtd file in to /usr/share/mobile-broadband-provider-info/

    3. You can see a computer at the panel which show the status of the network, right click it and select edit-Connections and select Mobile-Broadband tab.

    4. If you have already define one connectioin please remove it and add a new one. After copying that new file it will show you Airtel as a Sri Lankan Service Provider during the wizard.

    5. According to configuration now this should connect to the internet through Airtel Access point. But Unfortunately it didn't connect for me. The Access point on the latest trunk of the package is wrong and you have to double click on the newly added connection to reconfigure it and select the Access Point to

    AirtelLive (No Spelling mistakes and I'm don't have time to test the case sensitivity, just copy and paste this)

    6. Now you are done. Now when you click the icon which show the network status with a computer icon you can see the Airtel to select and click on it will connect to the internet if you have enough signal....:-)

    For me it work fine since I'm in galle right now and hopefully it'll work fine in Dehiwelle... (I used to stay there during week days)

    Sunday, May 10, 2009

    Problems with Jar files

    As a developer from a company which uses OSGi for most of their products I thought of discussing the problems we are having with typical jar files. Most of those issues are solved in OSGi Environment.Don't think twice OSGify your products to achieve real modularity for your software.
    First and major issue with simple jar files is not having a runtime concept, they are meaningful only during compile time. At runtime no changes could be done to a jar,it is just expose in to all the jar files in the environment which import it.Jar files doesn't contain any meta data about their dependencies and we do not have any control over the dependency management of jar files. All the classes in the jar is expose in to all the packages of the environment. In simple there's not information hiding between jar files in the Java runtime Environment. So I could say those words something like this. With OOP(Object Oriented Programming) we are achieving information hiding in class level but that's is, how nice if we could achieve that in modular level like exposing some of the packages(making public as we do in public methods and public variables in a class) and hide other packages of a particular jar file. And we can consider this as no communication mechanism between jar files in the horizontal direction, it just allow users to communication through the vertical direction by importing packages. No horizontal communication at all ....:-(

    With typical jar files if we have different versions of the same jar it will just pick the appropriate class from the classpath according to the order we are specifying the classpath, so we couldn't consider this as a proper versioning system.

    Next issue I would discuss is lack of dependency information in a single jar file. Most of the jar files are always depends on other third party jar, but we do not have any proper way of keeping that meta data describe the dependency for a given Jar file. This cause people to get a very popular Exception called ClassNotFoundException.

    Keeping only the dependency information in not enough, we should have a proper understanding about the versions of those dependencies otherwise we couldn't guarantee the behaviour since different versions could be having different behaviours. So with the dependency we should have the version information included on it.

    I have described couple of issues we are having with typical jar files and I will be blogging on how OSGi(Open System Gateway initiative) is going to solve almost all of the above issues and Lead Software Development in to new Modularity concept which will be an elegant feature of Java world.

    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.

    Saturday, May 2, 2009

    Object Passing between JSP's and Normal Java Classes

    Recently I was assigned to work with Java Web Component stuff and I was encountered a problem when I was developing new Web Services Component to WSO2 registry. Let me explain my problem....
    I have developed a web Service and generated the code for the client side. If you have a look on my JSP code it's calling the method getProfile by passing arguments path,data,session. My requirement in this method is calling the web service client and get the output of the Web service in to the variable data. When I debug the class GetProfileUtil I notice the expected behaviour of variable data but when the JSP runs it throws a Null Pointer Exception when call the get method of the data(Map>). So the modifications happen inside the method getProfile to the variable data is not visible to the JSP.

    String path =request.getParameter("path");
    Map defaultprofile = null;
    Map> data = null;

    try {
    GetProfileUtil.getProfile(path,data,config,session);
    defaultprofile = data.get(UserCoreConstants.DEFAULT_PROFILE);
    } catch (Exception e) {
    CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
    session.setAttribute(CarbonUIMessage.ID, uiMsg);
    }

    But when I modify my method like this to create the object inside the method and return it, it worked fine. I simply avoid passing the variabl in to the method getProfile but rather create a data variable and return it.

    String path =request.getParameter("path");
    Map defaultprofile = null;
    Map> data = null;

    try {
    data =GetProfileUtil.getProfile(path,config,session);
    defaultprofile = data.get(UserCoreConstants.DEFAULT_PROFILE);
    } catch (Exception e) {
    CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
    session.setAttribute(CarbonUIMessage.ID, uiMsg);
    }

    when I access the bean variable I got all the modifications happen inside the method.
    Is this the typical behaviour of JSP's and it's totally different from the way Java hadle object passing between classes and methods.
    As far as I understand only wrong thing I have done in my first case is pointing to a null value for data variable....Otherwise it should work...I don't know that approach might be a worst thing to do...