KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > remoting > security > SSLServerSocketFactoryService


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.remoting.security;
8
9 import java.io.IOException JavaDoc;
10 import java.net.InetAddress JavaDoc;
11 import java.net.ServerSocket JavaDoc;
12 import javax.net.ServerSocketFactory;
13
14 /**
15  * This is a basic wrapper around the SSLSocketBuilder which is needed
16  * because it extneds the javax.net.ServerSocketFactory class and
17  * implements the SSLServerSocketFactoryServiceMBean. It has no other function.
18  *
19  * @author <a HREF="mailto:tom.elrod@jboss.com">Tom Elrod</a>
20  */

21 public class SSLServerSocketFactoryService extends ServerSocketFactory implements SSLServerSocketFactoryServiceMBean
22 {
23    private SSLSocketBuilderMBean sslSocketBuilder = null;
24    private ServerSocketFactory serverSocketFactory = null;
25
26    public void setSSLSocketBuilder(SSLSocketBuilderMBean sslSocketBuilder)
27    {
28       this.sslSocketBuilder = sslSocketBuilder;
29    }
30
31    public ServerSocket JavaDoc createServerSocket() throws IOException JavaDoc
32    {
33       return super.createServerSocket();
34    }
35
36    public ServerSocket JavaDoc createServerSocket(int i) throws IOException JavaDoc
37    {
38       return serverSocketFactory.createServerSocket(i);
39    }
40
41    public ServerSocket JavaDoc createServerSocket(int i, int i1) throws IOException JavaDoc
42    {
43       return serverSocketFactory.createServerSocket(i, i1);
44    }
45
46    public ServerSocket JavaDoc createServerSocket(int i, int i1, InetAddress JavaDoc inetAddress) throws IOException JavaDoc
47    {
48       return serverSocketFactory.createServerSocket(i, i1, inetAddress);
49    }
50
51    /**
52     * start the service, create is already called
53     */

54    public void start() throws Exception JavaDoc
55    {
56       if(sslSocketBuilder != null)
57       {
58          serverSocketFactory = sslSocketBuilder.createSSLServerSocketFactory();
59       }
60       else
61       {
62          throw new Exception JavaDoc("Can not create server socket factory due to the SSLSocketBuilder not being set.");
63       }
64    }
65
66    /**
67     * create the service, do expensive operations etc
68     */

69    public void create() throws Exception JavaDoc
70    {
71       //NOOP
72
}
73
74    /**
75     * stop the service
76     */

77    public void stop()
78    {
79       //NOOP
80
}
81
82    /**
83     * destroy the service, tear down
84     */

85    public void destroy()
86    {
87       //NOOP
88
}
89 }
Popular Tags