/*
 * JOnAS: Java(TM) Open Application Server
 * Copyright (C) 1999 Bull S.A.
 * Contact: jonas-team@objectweb.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id
 * --------------------------------------------------------------------------
 */
package org.objectweb.jonas.management;

// JMX import
import javax.management.Notification;

/**
 * Implements a notification class allowing to notify that an MBean attribute was mofified via the
 * add<i>AttribureName</i> method.
 */
public class AttributeAddNotification extends Notification {

    /**
     *
     */
    private static final long serialVersionUID = 1L;

    static String ATTRIBUTE_ADD = "jonas.management.attribute.add";

    String attributeName = null;
    String addedValue = null;

    /**
     * Constructs an AttributeAddNotification object. In addition to the information common to all notifications,
     * the caller must supply the name of the attribute that changed and the value of the added object.
     * @param source The notification producer, that is, the MBean the attribute belongs to.
     * @param sequenceNumber The notification sequence number within the source object.
     * @param timeStamp The date at which the notification is being sent.
     * @param message A String containing the message of this notification.
     * @param attributeName A String giving the name of the attribute.
     * @param addedValue A String giving the value added to the attribue's value
     */
    public AttributeAddNotification(Object source, long sequenceNumber, long timeStamp, String message, String attributeName, String addedValue) {
        super(ATTRIBUTE_ADD, source, sequenceNumber, timeStamp, message);
        this.attributeName = attributeName;
        this.addedValue = addedValue;
    }

    public String getAttributeName() {
        return attributeName;
    }

    public String getAddedValue() {
        return addedValue;
    }

    public String toString() {
        String res = super.toString();
        return res + "\n[ added resource: " + addedValue + " ]\n";
    }
}

