FileDocCategorySizeDatePackage
Util.javaAPI DocGlassfish v2 API4847Fri May 04 22:30:28 BST 2007com.sun.enterprise.jbi.serviceengine.util

Util

public final class Util extends Object
This utility class provides method to build management message.
author
bhavanishankar@dev.java.net.
see
com.sun.enterprise.jbi.serviceengine.core.JavaEEServiceEngineSUManager

Fields Summary
Constructors Summary
private Util()
Creates a new instance of Util. The constructor has been declared private to prevent instantiation.

    
Methods Summary
public static java.lang.StringbuildManagementMessage(java.lang.String messageType, java.lang.String taskName, java.lang.String taskResult, java.lang.String locToken, java.lang.String locParam, java.lang.String locMessage, java.lang.Throwable expObj)
Helper method to build a management message for soap binding component.

param
messageType component message holder type
param
taskName task name
param
taskResult task result indicating success or failure
param
locToken token indicating the location of error.
param
locParam parameters for error message.
param
locMessage error message.
param
expObj exceptino object
return
management message for the component.

        String componentName = JavaEEServiceEngineContext.getInstance()
                .getJBIContext()
                .getComponentName();
        ComponentMessageHolder messageHolder =
                new ComponentMessageHolder(messageType);
        messageHolder.setComponentName(componentName);
        messageHolder.setTaskName(taskName);
        messageHolder.setTaskResult(taskResult);

        if (locToken != null) {
            messageHolder.setLocToken(1, locToken);
        }

        if (locParam != null) {
            String[] locParams = new String[1];
            locParams[0] = locParam;
            messageHolder.setLocParam(1, locParams);
        }

        if (locMessage != null) {
            messageHolder.setLocMessage(1, locMessage);
        }

        if (expObj != null) {
            messageHolder.setExceptionObject(expObj);
        }

        String retMsg = null;

        try {
            ManagementMessageBuilder managementMessageBuilder =
                    new ManagementMessageBuilder();
            retMsg =
                    managementMessageBuilder.buildComponentMessage(messageHolder);
        }
        catch (Exception exp) {
            retMsg = null;
        }

        return retMsg;