KickJava   Java API By Example, From Geeks To Geeks.

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


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.ServerSocket JavaDoc;
29 import java.rmi.server.RMIServerSocketFactory JavaDoc;
30
31 import javax.net.ServerSocketFactory;
32 import javax.net.ssl.SSLServerSocket;
33
34 /**
35  * This class defines a RMISSLServerSocketFactory
36  *
37  * @author <a HREF="mailto:marc.wick@monte-bre.ch">Marc Wick </a>
38  * @version 1.0
39  */

40 public class RMISSLServerSocketFactory
41     implements
42       RMIServerSocketFactory JavaDoc,
43       Serializable JavaDoc
44 {
45   private static final long serialVersionUID = -1173753000488037655L;
46
47   ServerSocketFactory JavaDoc factory;
48
49   /**
50    * Creates a new <code>RMISSLServerSocketFactory.java</code> object
51    *
52    * @param socketFactory - the factory to be used
53    */

54   public RMISSLServerSocketFactory(ServerSocketFactory JavaDoc socketFactory)
55   {
56     this.factory = socketFactory;
57   }
58
59   /**
60    * @see java.rmi.server.RMIServerSocketFactory#createServerSocket(int)
61    */

62   public ServerSocket JavaDoc createServerSocket(int port) throws IOException JavaDoc
63   {
64     SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(port);
65     return socket;
66   }
67
68   /**
69    * @see java.lang.Object#equals(java.lang.Object)
70    * <p>
71    * http://developer.java.sun.com/developer/bugParade/bugs/4492317.html
72    */

73   public boolean equals(Object JavaDoc obj)
74   {
75     if (obj == null)
76       return false;
77     if (this == obj)
78       return true;
79     if (factory == null)
80       return false;
81     return (getClass() == obj.getClass() && factory.equals(factory));
82   }
83
84   /**
85    * @see java.lang.Object#hashCode()
86    * <p>
87    * http://developer.java.sun.com/developer/bugParade/bugs/4492317.html
88    */

89   public int hashCode()
90   {
91     return factory.hashCode();
92   }
93
94 }
95
Popular Tags