KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > common > net > RMISSLClientSocketFactory


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
6  * Contact: sequoia@continuent.org
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  * Initial developer(s): Marc Wick.
21  * Contributor(s): ______________________.
22  */

23
24 package org.continuent.sequoia.common.net;
25
26 import java.io.IOException JavaDoc;
27 import java.io.Serializable JavaDoc;
28 import java.net.Socket JavaDoc;
29 import java.rmi.server.RMIClientSocketFactory JavaDoc;
30
31 import javax.net.ssl.SSLSocket;
32 import javax.net.ssl.SSLSocketFactory;
33
34 /**
35  * This class defines a RMISSLClientSocketFactory
36  *
37  * @author <a HREF="mailto:marc.wick@monte-bre.ch">Marc Wick </a>
38  * @version 1.0
39  */

40 public class RMISSLClientSocketFactory
41     implements
42       RMIClientSocketFactory JavaDoc,
43       Serializable JavaDoc
44 {
45   private static final long serialVersionUID = -5994304413561755872L;
46
47   /**
48    * @see java.rmi.server.RMIClientSocketFactory#createSocket(java.lang.String,
49    * int)
50    */

51   public Socket JavaDoc createSocket(String JavaDoc host, int port) throws IOException JavaDoc
52   {
53     SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket(
54         host, port);
55     if (System.getProperty("javax.net.ssl.trustStore") != null)
56       socket.setNeedClientAuth(true);
57
58     return socket;
59   }
60
61   /**
62    * @see java.lang.Object#equals(java.lang.Object)
63    * <p>
64    * http://developer.java.sun.com/developer/bugParade/bugs/4492317.html
65    */

66   public boolean equals(Object JavaDoc obj)
67   {
68     if (obj == null)
69       return false;
70     if (this == obj)
71       return true;
72     return getClass() == obj.getClass();
73   }
74
75   /**
76    * @see java.lang.Object#hashCode()
77    * <p>
78    * http://developer.java.sun.com/developer/bugParade/bugs/4492317.html
79    */

80   public int hashCode()
81   {
82     return 13;
83   }
84 }
85
Popular Tags