01: /**
02: * Sequoia: Database clustering technology.
03: * Copyright (C) 2002-2004 French National Institute For Research In Computer
04: * Science And Control (INRIA).
05: * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
06: * Contact: sequoia@continuent.org
07: *
08: * Licensed under the Apache License, Version 2.0 (the "License");
09: * 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: */package org.continuent.sequoia.common.net;
23:
24: import java.io.IOException;
25: import java.io.Serializable;
26: import java.net.ServerSocket;
27: import java.rmi.server.RMIServerSocketFactory;
28:
29: import javax.net.ServerSocketFactory;
30: import javax.net.ssl.SSLServerSocket;
31:
32: /**
33: * This class defines a RMISSLServerSocketFactory
34: *
35: * @author <a href="mailto:marc.wick@monte-bre.ch">Marc Wick </a>
36: * @version 1.0
37: */
38: public class RMISSLServerSocketFactory implements
39: RMIServerSocketFactory, Serializable {
40: private static final long serialVersionUID = -1173753000488037655L;
41:
42: ServerSocketFactory factory;
43:
44: /**
45: * Creates a new <code>RMISSLServerSocketFactory.java</code> object
46: *
47: * @param socketFactory - the factory to be used
48: */
49: public RMISSLServerSocketFactory(ServerSocketFactory socketFactory) {
50: this .factory = socketFactory;
51: }
52:
53: /**
54: * @see java.rmi.server.RMIServerSocketFactory#createServerSocket(int)
55: */
56: public ServerSocket createServerSocket(int port) throws IOException {
57: SSLServerSocket socket = (SSLServerSocket) factory
58: .createServerSocket(port);
59: return socket;
60: }
61:
62: /**
63: * @see java.lang.Object#equals(java.lang.Object)
64: * <p>
65: * http://developer.java.sun.com/developer/bugParade/bugs/4492317.html
66: */
67: public boolean equals(Object obj) {
68: if (obj == null)
69: return false;
70: if (this == obj)
71: return true;
72: if (factory == null)
73: return false;
74: return (getClass() == obj.getClass() && factory.equals(factory));
75: }
76:
77: /**
78: * @see java.lang.Object#hashCode()
79: * <p>
80: * http://developer.java.sun.com/developer/bugParade/bugs/4492317.html
81: */
82: public int hashCode() {
83: return factory.hashCode();
84: }
85:
86: }
|