001/*
002 * JPPF.
003 * Copyright (C) 2005-2016 JPPF Team.
004 * http://www.jppf.org
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.jppf.client.event;
020
021import java.util.EventObject;
022
023import org.jppf.client.JPPFClientConnectionStatus;
024
025/**
026 * Event sent to notify of a status change for a client connection.
027 * @author Laurent Cohen
028 */
029public class ClientConnectionStatusEvent extends EventObject
030{
031  /**
032   * The connection status before the change.
033   */
034  private JPPFClientConnectionStatus oldStatus = null;
035
036  /**
037   * Initialize this event with a client connection as source.
038   * @param source the event source.
039   * @param oldStatus the connection status before the change.
040   */
041  public ClientConnectionStatusEvent(final ClientConnectionStatusHandler source, final JPPFClientConnectionStatus oldStatus)
042  {
043    super(source);
044    this.oldStatus = oldStatus;
045  }
046
047  /**
048   * Get the source of this event.
049   * @return the event source as a <code>ClientConnectionStatusHandler</code> instance.
050   */
051  public ClientConnectionStatusHandler getClientConnectionStatusHandler()
052  {
053    return (ClientConnectionStatusHandler) getSource();
054  }
055
056  /**
057   * Get the connection status before the change.
058   * @return a {@link JPPFClientConnectionStatus} enum value.
059   */
060  public JPPFClientConnectionStatus getOldStatus()
061  {
062    return oldStatus;
063  }
064}