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

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

public class DefaultSocketManager
extends AbstractLogEnabled
implements SocketManager, Contextualizable, Configurable, Initializable

Implementation of SocketManager.

Author:
Avalon Development Team

Field Summary
protected  Configuration m_configuration
           
protected  Context m_context
           
protected  java.util.HashMap m_serverSockets
           
protected  java.util.HashMap m_sockets
           
 
Fields inherited from interface org.apache.avalon.cornerstone.services.sockets.SocketManager
ROLE
 
Constructor Summary
DefaultSocketManager()
           
 
Method Summary
 void configure(Configuration configuration)
          Configure the SocketManager.
 void contextualize(Context context)
          Pass the Context to the component.
protected  java.lang.Object createFactory(java.lang.String name, java.lang.String className, Configuration configuration)
           
 ServerSocketFactory getServerSocketFactory(java.lang.String name)
          Retrieve a server socket factory by name.
 SocketFactory getSocketFactory(java.lang.String name)
          Retrieve a client socket factory by name.
 void initialize()
          Initialize the component.
protected  void setupClientSocketFactory(java.lang.String name, java.lang.String className, Configuration configuration)
           
protected  void setupServerSocketFactory(java.lang.String name, java.lang.String className, Configuration configuration)
           
 
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_serverSockets

protected final java.util.HashMap m_serverSockets

m_sockets

protected final java.util.HashMap m_sockets

m_context

protected Context m_context

m_configuration

protected Configuration m_configuration
Constructor Detail

DefaultSocketManager

public DefaultSocketManager()
Method Detail

contextualize

public void contextualize(Context context)
Description copied from interface: Contextualizable
Pass the Context to the component. This method is called after the LogEnabled.enableLogging( Logger ) (if present) method and before any other method.

Specified by:
contextualize in interface Contextualizable
Parameters:
context - the context. Must not be null.

configure

public void configure(Configuration configuration)
               throws ConfigurationException
Configure the SocketManager.

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

initialize

public void initialize()
                throws java.lang.Exception
Description copied from interface: Initializable
Initialize the component. Initialization includes allocating any resources required throughout the component's lifecycle.

Specified by:
initialize in interface Initializable
Throws:
java.lang.Exception - if an error occurs

setupServerSocketFactory

protected void setupServerSocketFactory(java.lang.String name,
                                        java.lang.String className,
                                        Configuration configuration)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

setupClientSocketFactory

protected void setupClientSocketFactory(java.lang.String name,
                                        java.lang.String className,
                                        Configuration configuration)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

createFactory

protected java.lang.Object createFactory(java.lang.String name,
                                         java.lang.String className,
                                         Configuration configuration)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

getServerSocketFactory

public ServerSocketFactory getServerSocketFactory(java.lang.String name)
                                           throws java.lang.Exception
Retrieve a server socket factory by name.

Specified by:
getServerSocketFactory in interface SocketManager
Parameters:
name - the name of server socket factory
Returns:
the ServerSocketFactory
Throws:
java.lang.Exception - if server socket factory is not available

getSocketFactory

public SocketFactory getSocketFactory(java.lang.String name)
                               throws java.lang.Exception
Retrieve a client socket factory by name.

Specified by:
getSocketFactory in interface SocketManager
Parameters:
name - the name of client socket factory
Returns:
the SocketFactory
Throws:
java.lang.Exception - if socket factory is not available


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