All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.jbi.management.ComponentMessageHolder Maven / Gradle / Ivy

The newest version!
/*
 * BEGIN_HEADER - DO NOT EDIT
 *
 * The contents of this file are subject to the terms
 * of the Common Development and Distribution License
 * (the "License").  You may not use this file except
 * in compliance with the License.
 *
 * You can obtain a copy of the license at
 * https://open-esb.dev.java.net/public/CDDLv1.0.html.
 * See the License for the specific language governing
 * permissions and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL
 * HEADER in each file and include the License file at
 * https://open-esb.dev.java.net/public/CDDLv1.0.html.
 * If applicable add the following below this CDDL HEADER,
 * with the fields enclosed by brackets "[]" replaced with
 * your own identifying information: Portions Copyright
 * [year] [name of copyright owner]
 */

/*
 * @(#)ComponentMessageHolder.java
 * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
 *
 * END_HEADER - DO NOT EDIT
 */
package com.sun.jbi.management;

import java.util.HashMap;

/**
 * This provides necessary methods for the components to 
 * pass the task result data to ManagemntMessageBuilder.
 * ManagementMessageBuilder constructs an XML document
 * based on this.
 *
 * @author Sun Microsystems, Inc.
 */

public class ComponentMessageHolder
{
    /** 
     * Type of message to build. Currently
     * it can either be 'Status' or 'Exception'
     */
    private String mMsgTypeToBuild = null;
    
    /** 
     * Cache for Localized Tokens
     */
    private HashMap mLocTokenCache = new HashMap();
    
    /** 
     * Cache for Localized Tokens
     */
    private HashMap mLocMessageCache = new HashMap();
    
    /** 
     * Cache for Localized Tokens 
     */
    private HashMap mLocParamCache = new HashMap();
    
    /** 
     * Exception Object
     */
    private Throwable mExceptionObject = null;
    
    /** 
     * task name
     */
    private String mTaskName = null;
    
    /** 
     * task result 
     */
    private String mTaskResult = null;
    
    /** 
     * status message type 
     */
    private String mStatusMsgType = null;
    
    /** 
     * exception message type
     */
    private String mExceptionMsgType = null;
    
    /** 
     * component name
     */
    private String mComponentName = null;
    
    
    
    /**
     * Creates a new instance of MessageContentHolder with a message type.
     * @param msgType String describing the message type to build.
     *
     */
    public ComponentMessageHolder(String msgType)
    {
        mMsgTypeToBuild = msgType;
    }
    
    /**
     * Set the name of the task executed by component. 
     * 
     * @param taskName - task executed by component. 
     * 
     */
    public void setTaskName(String taskName)
    {
        mTaskName = taskName;
    }
    
    /**
     * Set the name of the component that executed the task.
     * 
     * @param name - Name of the component.
     * 
     */
    public void setComponentName(String name)
    {
        mComponentName = name;
    }
    
    /**
     * Set the result of the task executed by component. 
     * 
     * @param taskResult - result of task executed by component. 
     * 
     */
    public void setTaskResult(String taskResult)
    {
        mTaskResult = taskResult;
    }
    
    /**
     * Set the exception object.  
     * 
     * @param exObj - exception object. 
     * 
     */
    public void setExceptionObject(Throwable exObj)
    {
        mExceptionObject = exObj;
    }
    
    /**
     * Set the message type being returned by the component.  
     * 
     * @param statMsgType - type of success message that is 
     *                      being returned by the component.
     * 
     */
    public void setStatusMessageType(String statMsgType)
    {
        mStatusMsgType = statMsgType;
    }
    
    
    /**
     * Set the exception message type being returned by the component.  
     * 
     * @param exMsgType - type of exception message that is 
     *                     being returned by the component.
     * 
     */
    public void setExceptionMessageType(String exMsgType)
    {
        mExceptionMsgType = exMsgType;
    }
    
    /**
     * Set the message token for the exception being
     * thrown by the component. 
     * 
     * @param nestingLevel - nesting level of the exception
     * @param locToken - message token. 
     * 
     */
    public void setLocToken(int nestingLevel, String locToken)
    {
        mLocTokenCache.put (String.valueOf(nestingLevel), locToken);
    }
    
    /**
     * Set the message for the exception being
     * thrown by the component. 
     * 
     * @param nestingLevel - nesting level of the exception.
     * @param locMessage - exception message. 
     * 
     */
    public void setLocMessage(int nestingLevel, String locMessage)
    {
        mLocMessageCache.put(String.valueOf(nestingLevel), locMessage);
    }
    
    /**
     * Set the message parameters for the exception being
     * thrown by the component. 
     * 
     * @param nestingLevel - nesting level of the exception.
     * @param locParam - exception message parameters. 
     * 
     */
    public void setLocParam(int nestingLevel, String[] locParam)
    {
        mLocParamCache.put(String.valueOf(nestingLevel), locParam);
    }
    
    /** Returns the message token.
     *  @param nestingLevel nesting level of the exception.
     *  @return message token at the given nesting level.
     *
     */
    public String getLocToken(int nestingLevel)
    {
        return (String) mLocTokenCache.get(String.valueOf(nestingLevel));
    }
    
    /** Returns the exception message.
     *  @param nestingLevel nesting level of the exception
     *  @return exception message at the given nesting level
     */
    public String getLocMessage(int nestingLevel)
    {
        return (String) mLocMessageCache.get(String.valueOf(nestingLevel));
    }
    
    /** Returns the exception message parameters.
     *  @param nestingLevel nesting level of the exception.
     *  @return exception message parameters at the given nesting level.
     *
     */
    public String[] getLocParam(int nestingLevel)
    {
        return (String[]) mLocParamCache.get(String.valueOf(nestingLevel));
    }
    
    /**
     * Get the exception object being thrown by this component.
     * @return Exception Object.
     *
     */
    public Throwable getExceptionObject()
    {
        return mExceptionObject;
    }
    
    /**
     * Get the name of the task executed by this component.
     * @return Task name.
     *
     */
    public String getTaskName()
    {
        return mTaskName;
    }
    
    /**
     * Get the result of the task executed by this component.
     * @return Task Result.
     *
     */
    public String getTaskResult()
    {
        return mTaskResult;
    }
    
    /**
     * Get the type(status, exception) of message to be built
     * for this component.
     * @return Task Result.
     *
     */
    public String getComponentMessageType()
    {
        return mMsgTypeToBuild;
    }
    
    /**
     * Get the status message type being returned by the component.
     * 
     * @return Status message type.
     *
     */
    public String getStatusMessageType()
    {
        return mStatusMsgType;
    }
    
    /**
     * Get the exception message type being returned by the component.
     * 
     * @return Status message type.
     *
     */
    public String getExceptionMessageType()
    {
        return mExceptionMsgType;
    }
    
    /**
     * Return the name of the component.
     * 
     * @return component name.
     *
     */
    public String getComponentName()
    {
        return mComponentName;
    }
    
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy