LogMessageTag.java :  » Portal » Open-Portal » com » sun » portal » desktop » taglib » providerContext » Java Open Source

Java Open Source » Portal » Open Portal 
Open Portal » com » sun » portal » desktop » taglib » providerContext » LogMessageTag.java
/*
 * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
 * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
 */
package com.sun.portal.desktop.taglib.providerContext;

import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;

import javax.servlet.jsp.JspException;

import com.sun.portal.log.common.PortalLogger;
import com.sun.portal.providers.context.ProviderContext;

import com.sun.portal.desktop.context.ContextException;
import com.sun.portal.desktop.taglib.DesktopTaglibException;

/**
 * This tag is deprecated.
 * @deprecated
 */

public class LogMessageTag
    extends BaseProviderContextTagSupport
{
    private Object m_value = null;
    private Throwable m_throwable = null;
    private static Logger logger = PortalLogger.getLogger(LogMessageTag.class);

    public void setValue( String value )
        throws DesktopTaglibException
    {
        m_value = resolveParameter( value );
    }

    public void setThrowable( String throwable )
        throws DesktopTaglibException
    {
        Object t = resolveParameter( throwable );
        if( t instanceof Throwable ) {
            m_throwable = (Throwable)t;
        } else {
            throw new DesktopTaglibException( DesktopTaglibException.INVALID_PARAMETER, throwable );
        }
    }

    public int doStartTag() throws JspException {
        if( m_throwable != null ) {
          if(logger.isLoggable(Level.FINER)) {
            LogRecord logRecord = new LogRecord(Level.FINER, m_value.toString());
            logRecord.setThrown(m_throwable);
          }
        } else {
            logger.finer(m_value.toString());
        }
        return SKIP_BODY;
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.