org.apache.avalon.cornerstone.blocks.sockets
Class TLSServerSocketFactory

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.avalon.cornerstone.blocks.sockets.AbstractTLSSocketFactory
          extended byorg.apache.avalon.cornerstone.blocks.sockets.TLSServerSocketFactory
All Implemented Interfaces:
Configurable, Contextualizable, Initializable, LogEnabled, ServerSocketFactory

public class TLSServerSocketFactory
extends AbstractTLSSocketFactory
implements ServerSocketFactory

Manufactures TLS server sockets. Configuration element inside a SocketManager would look like:

  <factory name="secure"
            class="org.apache.avalon.cornerstone.blocks.sockets.TLSServerSocketFactory" >
   <ssl-factory /> <!-- see SSLFactoryBuilder -->
   <timeout> 0 </timeout>
   <!-- With this option set to a non-zero timeout, a call to
     accept() for this ServerSocket will block for only this amount of
     time. If the timeout expires, a java.io.InterruptedIOException is
     raised, though the ServerSocket is still valid. Default value is 0. -->
   <authenticate-client>false</authenticate-client>
   <!-- Whether or not the client must present a certificate to
      confirm its identity. Defaults to false. -->
 </factory>
 

Author:
Peter Donald, Federico Barbieri, Charles Benett, Harish Prabandham, Costin Manolache, Craig McClanahan, Andrei Ivanov, Greg Steuck

Field Summary
protected  boolean m_keyStoreAuthenticateClients
           
 
Fields inherited from class org.apache.avalon.cornerstone.blocks.sockets.AbstractTLSSocketFactory
m_socketTimeOut
 
Constructor Summary
TLSServerSocketFactory()
           
 
Method Summary
 void configure(Configuration configuration)
          Configures the factory.
 java.net.ServerSocket createServerSocket(int port)
          Creates a socket on specified port.
 java.net.ServerSocket createServerSocket(int port, int backLog)
          Creates a socket on specified port with a specified backLog.
 java.net.ServerSocket createServerSocket(int port, int backLog, java.net.InetAddress bindAddress)
          Creates a socket on a particular network interface on specified port with a specified backLog.
protected  void initServerSocket(java.net.ServerSocket serverSocket)
           
protected  void visitBuilder(SSLFactoryBuilder builder)
          The child factories have to use an instance of SSLFactoryBuilder to obtain their factories.
 
Methods inherited from class org.apache.avalon.cornerstone.blocks.sockets.AbstractTLSSocketFactory
contextualize, initialize
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_keyStoreAuthenticateClients

protected boolean m_keyStoreAuthenticateClients
Constructor Detail

TLSServerSocketFactory

public TLSServerSocketFactory()
Method Detail

configure

public void configure(Configuration configuration)
               throws ConfigurationException
Configures the factory.

Specified by:
configure in interface Configurable
Overrides:
configure in class AbstractTLSSocketFactory
Parameters:
configuration - the Configuration
Throws:
ConfigurationException - if an error occurs

visitBuilder

protected void visitBuilder(SSLFactoryBuilder builder)
Description copied from class: AbstractTLSSocketFactory
The child factories have to use an instance of SSLFactoryBuilder to obtain their factories. So they are given an instance when it's ready. Another alternative was to have the SSLFactoryBuilder export buildContext method, but that would mean SSLContext which is deep in Sun guts will be aired in 3-4 classes instead of 1.

Specified by:
visitBuilder in class AbstractTLSSocketFactory

createServerSocket

public java.net.ServerSocket createServerSocket(int port)
                                         throws java.io.IOException
Creates a socket on specified port.

Specified by:
createServerSocket in interface ServerSocketFactory
Parameters:
port - the port
Returns:
the created ServerSocket
Throws:
java.io.IOException - if an error occurs

createServerSocket

public java.net.ServerSocket createServerSocket(int port,
                                                int backLog)
                                         throws java.io.IOException
Creates a socket on specified port with a specified backLog.

Specified by:
createServerSocket in interface ServerSocketFactory
Parameters:
port - the port
backLog - the backLog
Returns:
the created ServerSocket
Throws:
java.io.IOException - if an error occurs

createServerSocket

public java.net.ServerSocket createServerSocket(int port,
                                                int backLog,
                                                java.net.InetAddress bindAddress)
                                         throws java.io.IOException
Creates a socket on a particular network interface on specified port with a specified backLog.

Specified by:
createServerSocket in interface ServerSocketFactory
Parameters:
port - the port
backLog - the backLog
bindAddress - the network interface to bind to.
Returns:
the created ServerSocket
Throws:
java.io.IOException - if an error occurs

initServerSocket

protected void initServerSocket(java.net.ServerSocket serverSocket)
                         throws java.io.IOException
Throws:
java.io.IOException


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.