org.apache.mina.integration.spring
Class IoAcceptorFactoryBean

java.lang.Object
  extended by org.apache.mina.integration.spring.IoAcceptorFactoryBean

public class IoAcceptorFactoryBean
extends Object

Spring FactoryBean which enables the bindings of an IoAcceptor to be configured using Spring. Example of usage:

   <!-- This makes it possible to specify java.net.SocketAddress values 
        (e.g. :80 below) as Strings.
        They will be converted into java.net.InetSocketAddress objects by Spring.  -->
   <bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
     <property name="customEditors">
       <map>
         <entry key="java.net.SocketAddress">
           <bean class="org.apache.mina.integration.spring.InetSocketAddressEditor"/>
         </entry>
       </map>
     </property>
   </bean>
 
   <!-- The IoHandler implementation -->
   <bean id="httpHandler" class="com.example.MyHttpHandler">
     ...
   </bean>
     
   <bean id="filterChainBuilder" 
         class="org.apache.mina.integration.spring.DefaultIoFilterChainBuilderFactoryBean">
     <property name="filters">
       <list>
         <bean class="org.apache.mina.filter.ThreadPoolFilter">
           <!-- Threads will be named IoWorker-1, IoWorker-2, etc -->
           <constructor-arg value="IoWorker"/>
           <property name="maximumPoolSize" value="10"/>
         </bean>
         <bean class="org.apache.mina.filter.LoggingFilter"/>
       </list>
     </property>
   </bean>

   <bean id="ioAcceptor" class="org.apache.mina.integration.spring.IoAcceptorFactoryBean">
     <property name="target">
       <bean class="org.apache.mina.transport.socket.nio.SocketAcceptor"/>
     </property>
     <property name="bindings">
       <list>
         <bean class="org.apache.mina.integration.spring.Binding">
           <property name="address" value=":80"/>
           <property name="handler" ref="httpHandler"/>
           <property name="serviceConfig">
             <bean class="org.apache.mina.transport.socket.nio.SocketAcceptorConfig">
               <property name="filterChainBuilder" ref="filterChainBuilder"/>
               <property name="reuseAddress" value="true"/>
             </bean>
           </property>
         </bean>
       </list>
     </property>
   </bean>
 

Version:
$Rev: 391231 $, $Date: 2006-04-04 15:21:55 +0900 (Tue, 04 Apr 2006) $
Author:
The Apache Directory Project (mina-dev@directory.apache.org)

Constructor Summary
IoAcceptorFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
 Object getObject()
           
 Class getObjectType()
           
 boolean isSingleton()
           
 void setBindings(Binding[] bindings)
          Sets the bindings to be used by the IoAcceptor configured by this factory bean.
 void setTarget(IoAcceptor target)
          Sets the IoAcceptor to be configured using this factory bean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IoAcceptorFactoryBean

public IoAcceptorFactoryBean()
Method Detail

setTarget

public void setTarget(IoAcceptor target)
Sets the IoAcceptor to be configured using this factory bean.

Parameters:
target - the target IoAcceptor.

setBindings

public void setBindings(Binding[] bindings)
Sets the bindings to be used by the IoAcceptor configured by this factory bean.

Parameters:
bindings - the bindings.
Throws:
IllegalArgumentException - if the specified value is null.
See Also:
IoAcceptor.bind(SocketAddress, IoHandler), IoAcceptor.bind(SocketAddress, IoHandler, IoServiceConfig), Binding

getObject

public Object getObject()
                 throws Exception
Throws:
Exception

getObjectType

public Class getObjectType()

isSingleton

public boolean isSingleton()

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Throws:
Exception

destroy

public void destroy()
             throws Exception
Throws:
Exception