Home | History | Annotate | Download | only in ssl
      1 /*
      2  * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
      3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      4  *
      5  * This code is free software; you can redistribute it and/or modify it
      6  * under the terms of the GNU General Public License version 2 only, as
      7  * published by the Free Software Foundation.  Oracle designates this
      8  * particular file as subject to the "Classpath" exception as provided
      9  * by Oracle in the LICENSE file that accompanied this code.
     10  *
     11  * This code is distributed in the hope that it will be useful, but WITHOUT
     12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     14  * version 2 for more details (a copy is included in the LICENSE file that
     15  * accompanied this code).
     16  *
     17  * You should have received a copy of the GNU General Public License version
     18  * 2 along with this work; if not, write to the Free Software Foundation,
     19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     20  *
     21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     22  * or visit www.oracle.com if you need additional information or have any
     23  * questions.
     24  */
     25 
     26 
     27 package javax.net.ssl;
     28 
     29 import java.util.EventObject;
     30 
     31 
     32 /**
     33  * This event is propagated to a SSLSessionBindingListener.
     34  * When a listener object is bound or unbound to an SSLSession by
     35  * {@link SSLSession#putValue(String, Object)}
     36  * or {@link SSLSession#removeValue(String)}, objects which
     37  * implement the SSLSessionBindingListener will be receive an
     38  * event of this type.  The event's <code>name</code> field is the
     39  * key in which the listener is being bound or unbound.
     40  *
     41  * @see SSLSession
     42  * @see SSLSessionBindingListener
     43  *
     44  * @since 1.4
     45  * @author Nathan Abramson
     46  * @author David Brownell
     47  */
     48 public
     49 class SSLSessionBindingEvent
     50 extends EventObject
     51 {
     52     private static final long serialVersionUID = 3989172637106345L;
     53 
     54     /**
     55      * @serial The name to which the object is being bound or unbound
     56      */
     57     private String name;
     58 
     59     /**
     60      * Constructs a new SSLSessionBindingEvent.
     61      *
     62      * @param session the SSLSession acting as the source of the event
     63      * @param name the name to which the object is being bound or unbound
     64      * @exception  IllegalArgumentException  if <code>session</code> is null.
     65      */
     66     public SSLSessionBindingEvent(SSLSession session, String name)
     67     {
     68         super(session);
     69         this.name = name;
     70     }
     71 
     72     /**
     73      * Returns the name to which the object is being bound, or the name
     74      * from which the object is being unbound.
     75      *
     76      * @return the name to which the object is being bound or unbound
     77      */
     78     public String getName()
     79     {
     80         return name;
     81     }
     82 
     83     /**
     84      * Returns the SSLSession into which the listener is being bound or
     85      * from which the listener is being unbound.
     86      *
     87      * @return the <code>SSLSession</code>
     88      */
     89     public SSLSession getSession()
     90     {
     91         return (SSLSession) getSource();
     92     }
     93 }
     94