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
Component:
name="socket-manager" lifestyle="singleton"
Service Export:
type="org.apache.avalon.cornerstone.services.sockets.SocketManager"

Field Summary
protected  Configuration m_configuration
           
protected  Context m_context
           
protected  HashMap m_serverSockets
           
protected  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)
           
protected  Object createFactory(String name, String className, Configuration configuration)
           
 ServerSocketFactory getServerSocketFactory(String name)
          Retrieve a server socket factory by name.
 SocketFactory getSocketFactory(String name)
          Retrieve a client socket factory by name.
 void initialize()
           
protected  void setupClientSocketFactory(String name, String className, Configuration configuration)
           
protected  void setupServerSocketFactory(String name, 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 HashMap m_serverSockets

m_sockets

protected final 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)
Specified by:
contextualize in interface Contextualizable
Context Entry:
key="urn:avalon:name" alias="block.name", key="urn:avalon:partition" alias="app.name", key="urn:avalon:home" type="java.io.File" alias="app.home"

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
Configuration Schema:
schema="http://relaxng.org/ns/structure/1.0"

initialize

public void initialize()
                throws Exception
Specified by:
initialize in interface Initializable
Throws:
Exception

setupServerSocketFactory

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

setupClientSocketFactory

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

createFactory

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

getServerSocketFactory

public ServerSocketFactory getServerSocketFactory(String name)
                                           throws 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:
Exception - if server socket factory is not available

getSocketFactory

public SocketFactory getSocketFactory(String name)
                               throws 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:
Exception - if socket factory is not available


Copyright © Apache Software Foundation. All Rights Reserved.