Monday, August 19, 2013

Issues while executiing the WLST script to customize the OSB

Issues while executiing the WLST script to customize the OSB

You may be receiving some of the below issues while executing the WLST script to customize the OSB projects.

ImportError: no module named wli: Make sure $OSBHOME/lib/sb-kernel-api.jar is added into the CLASSPATH.

ImportError: no module named customization: Make sure $OSBHOME/modules /com.bea.common.configfwk_1.5.0.0.jar added into the CLASSPATH.

java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.bea.wli.sb.management.configuration.DelegatedSessionManagementMBean: Make sure $OSBHOME/lib/sb-kernel-impl.jar added into the CLASSPATH.

 CLASSPATH=$CLASSPATH:$OSBHOME/modules/com.bea.common.configfwk_1.5.0.0.jar:$OSBHOME/lib/sb-kernel-api.jar:$OSBHOME/lib/sb-kernel-impl.jar;export CLASSPATH



Customizing the OSB Service through WLST script

Customizing the OSB Service through WLST script

This post will explain how to Customize the OSB Service through WLST script

The below WLST script will help us to run the OSB customization file.

import sys
from java.io import FileInputStream
from com.bea.wli.config.customization import Customization
from com.bea.wli.sb.management.importexport import ALSBImportOperation
from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
from com.bea.wli.sb.management.configuration import SessionManagementMBean

def customizeOSBService(customizationFile):
    SessionMBean = None
    try:
        connect('weblogic', 'welcome1', 't3://localhost:8000')
        domainRuntime()
        sessionName = String("Customization"+Long(System.currentTimeMillis()).toString())
        SessionMBean = findService("SessionManagement", "com.bea.wli.sb.management.configuration.SessionManagementMBean")
        SessionMBean.createSession(sessionName)
        OSBConfigurationMBean = findService(String("ALSBConfiguration.").concat(sessionName), "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")
        print 'Loading customization File', customizationFile
        iStream = FileInputStream(customizationFile)
        customizationList = Customization.fromXML(iStream)       
        OSBConfigurationMBean.customize(customizationList)
        SessionMBean.activateSession(sessionName, "Complete customization using wlst")
        disconnect()

    except:
        print "Unexpected error:", sys.exc_info()[0]
        if SessionMBean != None:
            SessionMBean.discardSession(sessionName)
        raise

def main():
       
        customizeOSBService('D:\Albin\ALSBCustomizationFile.xml')           
        print 'Successfully Completed customization'   
main()

Customization File:

Customization file will help us to modify the environment specific values for a OSB project.
The previous post can be referred for more details on customization file.

Modify the  environment specific values in the customization file.

Running the Script:

Login to the server and copy the wlst script and the Customization file to some location.
Execute the below two commands

CLASSPATH=$CLASSPATH:$OSBHOME/modules/com.bea.common.configfwk_1.5.0.0.jar:$OSBHOME/lib/sb-kernel-api.jar:$OSBHOME/lib/sb-kernel-impl.jar;export CLASSPATH

wlst.sh /home/eaiapp/Albin/OSBCustomization.wlst

Before executing the first command change the com.bea.common.configfwk_1.5.0.0.jar file version according to your environment.

After successful execution verify the service from OSB Console

  DOWNLOAD OSBCustomization.wlst


Saturday, August 17, 2013

OSB Service customization through console

OSB Service customization through console

This post will explain how to perform OSB customization through console


OSB customization will help us to change the environment specific properties for OSB resources.
There are multiple options to customize the OSB resources.

 Find & Replace:

Find And Replace option help us to find and replace the environment specific values. For example replacing the service URI of the service.
Login to OSB console (http ://<< host name>> :<< port>>/sbconsole) and Create the session
Click on System Administration and Find & Replace under Customization


Enter the find value also provide Find in variable type, Located in project if required and click on Find button. This will display the find results in the bottom.

Enter the value to be replaced and click on Replace All.



Monday, August 12, 2013

Removing the default rowselector column from DOJO Enhanced Grid

Removing the default rowselector column from DOJO Enhanced Grid:

Make sure the value for rowSelector is set as 0px or remove rowSelector property from the grid definition.

var grid = new dojox.grid.EnhancedGrid({
        id : gridObjectName,
        structure : layout,
        rowSelector : '0px',
        sortFields: [{attribute: defaultsort, ascending: true}],
        noDataMessage:"<span class=\"dojoxGridNoData\">No Matching Rows Found!!</span>",
        plugins : {
            indirectSelection:selection,
            pagination : {
                pageSizes : [ "25", "50", "100" ],
                description : true,
                sizeSwitch : true,
                pageStepper : true,
                gotoButton : true,
                /* page step to be displayed */
                maxPageStep : 4,
                /* position of the pagination bar */
                position : "bottom"
            }
        }
    }






Programmatically Uncheck/Check DOJO Checkboxs

Programmatically Uncheck/Check DOJO Checkboxs

The below lines of code will help us to check /uncheck set of dojo checkboxes from javascript.

dojo.forEach (dojo.query("input[type=checkbox]"), function(item){
var widget = dijit.getEnclosingWidget(item);
alert(widget)
widget.set('checked', false);
})

We can change the dojo.query parameter accordingly to fetch the checkboxes.


Saturday, August 10, 2013

Testing the Spring Service layer through JUnit

Testing the Spring Service layer through JUnit

Steps to enable Junit test for spring service layer

This post will explains the steps required to test the spring service layer through JUnit without deploying to the server.

Right Click on the service class for which the test class needs to be created and click on New and select JUnit Test Case


Click on Next and provide the Test Class Name and the package to which the test class has to be created.


Click on Next and select the methods for which the test methods needs to be created and click on finish.



Thursday, August 8, 2013

Fetch Type vs Fetch Mode in Hibernate

Fetch Type vs Fetch Mode in Hibernate

Fetch type (lazy/eager) tells when Hibernate fetches the association, whether in advance when it fetches the entity (eager), or whether it waits for the code to ask for the association (lazy).

Fetch mode (select/join) refers to how Hibernate will fetch the association, i.e. does it use an extra SELECT statement, or does it use a join.

Some combinations of these make no sense, e.g. lazy+join. If you use lazy fetching, then SELECT fetch mode is the only one that you can do.If you use eager fetch, then you can choose to use either fetch mode.