FileDocCategorySizeDatePackage
LogQueryEntryImpl.javaAPI DocGlassfish v2 API8729Fri May 04 22:30:50 BST 2007com.sun.appserv.management.ext.logging

LogQueryEntryImpl

public final class LogQueryEntryImpl extends Object implements LogQueryEntry
INTERNAL USE ONLY--not part of the API
since
AS 9.0

Fields Summary
private transient Map
mNameValuePairsMap
final long
mRecordNumber
final Date
mDate
final String
mLevel
final String
mProductName
final String
mMessage
final String
mMessageID
final String
mModule
final String
mNameValuePairs
private static final String
NVP_PAIRS_DELIM
delimiter between name/value pairs
private static final String
PAIR_DELIM
delimiter between name and value
Constructors Summary
public LogQueryEntryImpl(long recordNumber, Date date, String level, String productName, String message, String messageID, String module, String nameValuePairs)

        if ( date == null || level == null || message == null ||
            module == null || nameValuePairs == null )
        {
            throw new IllegalArgumentException();
        }
        
        mRecordNumber   = recordNumber;
        mDate           = date;
        mLevel          = Level.parse( level ).toString();
        mProductName    = productName;
        mModule         = module;
        mMessage        = message;
        mMessageID      = messageID;
        mNameValuePairs = nameValuePairs;
    
public LogQueryEntryImpl(Object[] values)

        if ( values.length != NUM_FIELDS )
        {
            throw new IllegalArgumentException( "wrong number of fields: " + values.length);
        }
   
        mRecordNumber   = (Long)values[ RECORD_NUMBER_INDEX ];
        mDate           = (Date)values[ DATE_INDEX ];
        mLevel          = Level.parse( (String)values[ LEVEL_INDEX ] ).toString();
        mProductName    = (String)values[ PRODUCT_NAME_INDEX ];
        mMessageID      = (String)values[ MESSAGE_ID_INDEX ];
        mModule         = (String)values[ MODULE_INDEX ];
        mMessage        = (String)values[ MESSAGE_INDEX ];
        mNameValuePairs = (String)values[ NAME_VALUE_PAIRS_INDEX ];
    
Methods Summary
public booleanequals(java.lang.Object rhs)

        boolean  equal   = false;
        
        if ( this == rhs )
        {
            equal   = true;
        }
        else if ( rhs instanceof LogQueryEntry )
        {
           final LogQueryEntry e   = (LogQueryEntry)rhs;
           
           equal    = ArrayUtil.arraysEqual( getFields(), e.getFields() );
        }

        return equal;
    
public java.util.DategetDate()

        return mDate;
    
public java.lang.Object[]getFields()

        final Object[]  fields  = new Object[ NUM_FIELDS ];
        
        fields[ RECORD_NUMBER_INDEX ]  = mRecordNumber;
        fields[ DATE_INDEX ]           = mDate;
        fields[ LEVEL_INDEX ]          = mLevel;
        fields[ PRODUCT_NAME_INDEX ]   = mProductName;
        fields[ MESSAGE_ID_INDEX ]     = mMessageID;
        fields[ MODULE_INDEX ]         = mModule;
        fields[ MESSAGE_INDEX ]        = mMessage;
        fields[ NAME_VALUE_PAIRS_INDEX ]= mNameValuePairs;
        
        return fields;
	
public java.lang.StringgetLevel()

        return mLevel;
    
public java.lang.StringgetMessage()

        return mMessage;
    
public java.lang.StringgetMessageID()

        return mMessageID;
    
public java.lang.StringgetModule()

        return mModule;
    
public java.lang.StringgetNameValuePairs()

        return mNameValuePairs;
    
public java.util.MapgetNameValuePairsMap()

        if ( mNameValuePairsMap == null )
        {
            mNameValuePairsMap  = parseNameValuePairs();
        }
        
        return mNameValuePairsMap;
    
public java.lang.StringgetObjectName()

        return getNameValuePairsMap().get( OBJECTNAME_KEY );
    
public java.lang.StringgetProductName()

        return mProductName;
    
public longgetRecordNumber()

        return mRecordNumber;
    
public java.lang.StringgetThreadID()

        return getNameValuePairsMap().get( THREAD_ID_KEY );
    
public inthashCode()

 	    return ObjectUtil.hashCode( mDate, mLevel,
 	        mProductName, mMessage, mMessageID, mModule, mNameValuePairs) ^
 	        ObjectUtil.hashCode( mRecordNumber );
 	
private java.util.MapparseNameValuePairs()

    
         
    
    
        final String src    = getNameValuePairs();
        final Map<String,String> m   = new HashMap<String,String>();
        
        final String[]  pairs   = src.split( NVP_PAIRS_DELIM );
        
        for( String pair : pairs )
        {
            final int   idx = pair.indexOf( PAIR_DELIM );
            if ( idx < 0 )
            {
                throw new IllegalArgumentException( src );
            }
            final String    name    = pair.substring( 0, idx ).trim();
            final String    value   = pair.substring( idx + 1, pair.length() ).trim();
            
            m.put( name, value );
        }
        
        return m;
    
public java.lang.StringtoString()

        final String D = "|";
        
        //  [#|DATE|LEVEL|PRODUCT_NAME|MODULE|NAME_VALUE_PAIRS|MESSAGE|#]
        return "[#" +
            getRecordNumber() + D +
            getDate() + D +
            getLevel() + D +
            getProductName() + D +
            getModule() + D +
            getNameValuePairs() + D +
            getMessage() + D +
            getMessageID() + D +
            "]";