配置运行成功,以备遗忘。
Spring 配置当中加入
<import resource="applicationFTP.xml"/> |
在Spring配置同级目录创建 applicationFTP.xml
<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="http://mina.apache.org/ftpserver/spring/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://mina.apache.org/ftpserver/spring/v1
http://mina.apache.org/ftpserver/ftpserver-1.0.xsd
http://www.springframework.org/schema/beans
"
id="ftpServers"
max-logins="500"
anon-enabled="false"
max-anon-logins="123"
max-login-failures="124"
login-failure-delay="125">
<listeners>
<nio-listener name="default" port="2121">
<ssl>
<keystore file="./res/ftpserver.jks" password="password" />
</ssl>
</nio-listener>
</listeners>
<db-user-manager>
<data-source>
<beans:bean class="org.apache.commons.dbcp.BasicDataSource">
<beans:property name="driverClassName" value="${dbcp_jdbc.driverClassName}" />
<beans:property name="url" value="${dbcp_jdbc.url}" />
<beans:property name="username" value="${dbcp_jdbc.username}" />
<beans:property name="password" value="${dbcp_jdbc.password}" />
<beans:property name="maxActive" value="${dbcp_cpool.maxActive}" />
<beans:property name="poolPreparedStatements" value="true" />
<beans:property name="minEvictableIdleTimeMillis" value="5" />
<beans:property name="minIdle" value="2" />
<beans:property name="initialSize" value="3" />
<beans:property name="testOnBorrow" value="true" />
<beans:property name="testWhileIdle" value="true" />
<beans:property name="testOnReturn" value="true" />
<beans:property name="removeAbandoned" value="true" />
<beans:property name="removeAbandonedTimeout" value="300" />
</beans:bean>
</data-source>
<insert-user>INSERT INTO FTP_USER (userid, userpassword,
homedirectory, enableflag, writepermission, idletime, uploadrate,
downloadrate) VALUES ('{userid}', '{userpassword}',
'{homedirectory}','{enableflag}',
'{writepermission}', {idletime}, {uploadrate},{downloadrate})</insert-user>
<update-user>UPDATE FTP_USER SET
userpassword='{userpassword}',homedirectory=
'{homedirectory}',enableflag={enableflag},writepermission={writepermission},idletime={idletime}
,uploadrate={uploadrate},downloadrate={downloadrate}
WHERE userid='{userid}'
</update-user>
<delete-user>DELETE FROM FTP_USER WHERE userid = '{userid}'</delete-user>
<select-user>SELECT userid, userpassword, homedirectory,
enableflag, writepermission, idletime, maxloginnumber,maxloginperip,uploadrate,
downloadrate
FROM FTP_USER WHERE userid = '{userid}'</select-user>
<select-all-users>SELECT userid FROM FTP_USER ORDER BY userid</select-all-users>
<is-admin>SELECT userid FROM FTP_USER WHERE userid='{userid}' AND
userid='admin'
</is-admin>
<authenticate>SELECT userpassword from FTP_USER WHERE
userid='{userid}'</authenticate>
</db-user-manager>
</server>