KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > orb > factory > SocketFactory


1 package org.jacorb.orb.factory;
2
3 /*
4  * Written for JacORB - a free Java ORB
5  *
6  * Copyright (C) 2000-2004 Nicolas Noffke, Gerald Brose.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */

22
23 /* We follow the design of socket factories in jsse (package javax.net and javax.net.ssl).
24  * Because this package don't the JDK yet, and not exported in Europe, we don't extend its classes.
25  * But we remain compatible, and could actualy use the jsse instead.
26  *
27  * The basic idea is to setup policies related to the sockets being constructed,
28  * in the factory: no special configuration is done in the code which asks for the sockets.
29  *
30  * We will use the polymorphism of both factories and sockets, to enable poeple
31  * to use different SSL implementations. The ORB will get different kinds of factories.
32  * The Factories will customize the special parameters used in socket construction.
33  * But the sockets returned to the application have to be subclasses of java.net.Socket,
34  * Which factory classes is used will be decide in org.jacorb.util.Environment as this is specific
35  * to the environment configuration.
36  * So the getDefault method could return null if no SSL support at all, or a factory that encapsulates
37  * a particular implementation and take care of initialising and pass specific parameters.
38  */

39
40 import java.net.*;
41 import java.io.IOException JavaDoc;
42
43 public interface SocketFactory
44 {
45     public Socket createSocket( String JavaDoc host,
46                                 int port )
47         throws IOException JavaDoc, UnknownHostException;
48
49     public boolean isSSL( Socket socket );
50 }
51
52
53
54
55
56
57
58
59
60
61
62
63
Popular Tags