KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > appserv > management > client > HandshakeCompletedListenerImpl


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.appserv.management.client;
24
25 import java.security.cert.X509Certificate JavaDoc;
26 import java.security.cert.CertificateException JavaDoc;
27
28 import java.security.cert.Certificate JavaDoc;
29
30 import javax.net.ssl.HandshakeCompletedListener;
31 import javax.net.ssl.HandshakeCompletedEvent;
32 import javax.net.ssl.SSLPeerUnverifiedException;
33
34     
35 /**
36     A default HandshakeCompletedListener which remembers the
37     last HandshakeCompletedEvent that occured. Also supports
38     wrapping another HandshakeCompletedListener.
39  */

40 public class HandshakeCompletedListenerImpl implements HandshakeCompletedListener
41 {
42     private HandshakeCompletedListener mListener;
43     private HandshakeCompletedEvent mEvent;
44     
45         public
46     HandshakeCompletedListenerImpl()
47     {
48         this( null );
49     }
50     
51     /**
52         Create a new instance which chains to the specified
53         HandshakeCompletedListener when handshakeCompleted() is called.
54         @param listener
55      */

56         public
57     HandshakeCompletedListenerImpl( final HandshakeCompletedListener listener )
58     {
59         mListener = listener;
60         mEvent = null;
61     }
62     
63     /**
64         Remember the HandshakeCompletedEvent, then call the chained
65         listener (if any) with the same event.
66         
67         @param event
68      */

69         public synchronized void
70     handshakeCompleted( final HandshakeCompletedEvent event)
71     {
72         //trace( "handshakeCompleted: " + this + ":\n" +
73
//HandshakeCompletedEventStringifier.stringify( event ) );
74
mEvent = event;
75         
76         if ( mListener != null )
77         {
78             mListener.handshakeCompleted( event );
79         }
80     }
81     
82     /**
83         Get the last HandshakeCompletedEvent which occurred, possibly null.
84      */

85         public synchronized HandshakeCompletedEvent
86     getLastEvent()
87     {
88         return( mEvent );
89     }
90     
91         
92 }
93
94
95
96
97
98
99
100
Popular Tags