Niklas,

Thanks a lot for the response. This was a dumb question on my part. I knew it was my fault in using the configuration file as the namespaces were not right.

Anyway, I used beans as my default namespace and used "ftpserver" namespace for our ftpserver config:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xmlns:beans="http://www.springframework.org/schema/beans";
    xmlns:ftpserver="http://mina.apache.org/ftpserver/spring/v1";
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://mina.apache.org/ftpserver/spring/v1
        http://mina.apache.org/ftpserver/ftpserver-1.0.xsd";>

<ftpserver:server
        id="ftpServer"
        max-logins="200"
        anon-enabled="false"
        max-anon-logins="0"
        max-login-failures="3"
        login-failure-delay="500"
>

<ftpserver:listeners>
<ftpserver:nio-listener name="default" port="2222" implicit-ssl="false" idle-timeout="54000">
<ftpserver:data-connection idle-timeout="54000">
<active enabled="true" local-address="172.16.0.130" local-port="2323"
                        ip-check="true" />
<passive ports="123-125" address="172.16.0.130" external-address="172.16.0.130" />
</ftpserver:data-connection>
</ftpserver:nio-listener>
</ftpserver:listeners>

<ftpserver:user-manager>
<beans:bean id="userManager" class="dev.MyUserManager">
<beans:property name="maxLogin" value="20" />
<beans:property name="maxLoginPerIp" value="15" />
<beans:property name="directoryService" ref="cachingDirectoryService" />
</beans:bean>
</ftpserver:user-manager>

<!-- The file system -->
<ftpserver:native-filesystem case-insensitive="false" create-home="true" />

</ftpserver:server>

<bean class="dev.CachingDirectoryService" id="cachingDirectoryService">
<property name="servers" value="localhost:11211;localhost:11222" />
<property name="directoryService" ref="ldapDirectoryService" />
</bean>


<bean class="dev.LdapDirectoryService" id="ldapDirectoryService">
<property name="servers" value="localhost:389;localhost:1489"/>
</bean>

</beans>

Thanks a lot for your answer.

On 12/09/2010 01:18 AM, Niklas Gustavsson wrote:
Sorry for the late reply.

Not at all.

On Fri, Dec 3, 2010 at 2:59 AM, Manish Marathe<[email protected]>  wrote:
How can I add custom beans that I can reference from user-manager or any
other element?
If you need to do this, you can not use<server>  as the outer element,
instead you need to do something like:
<beans:beans
     xmlns="http://mina.apache.org/ftpserver/spring/v1";
     xmlns:beans="http://www.springframework.org/schema/beans";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="
     http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
     http://mina.apache.org/ftpserver/spring/v1
http://mina.apache.org/ftpserver/ftpserver-1.0.xsd
     "
     >
     <beans:bean class="mypackage.MyClass" id="myClass1" />

     <server
         id="myServer"
         max-logins="200"
         anon-enabled="false"
         max-anon-logins="0"
         max-login-failures="3"
         login-failure-delay="500"
         >

     <user-manager>
         <beans:bean class="mypackage.MyUserManager">
             <beans:property name="maxLogin" value="20" />
             <beans:property name="maxLoginPerIp" value="15" />
             <beans:property name="directoryService" ref="myClass1" />
         </beans:bean>
     </user-manager>

     </server>
</beans:beans>

/niklas


Reply via email to