<beans>
聽聽聽 <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
聽聽<property name="driverClassName">
聽聽聽<value>${jdbc.driverClassName}</value>
聽聽</property>
聽聽<property name="url">
聽聽聽<value>${jdbc.url}</value>
聽聽</property>
聽聽<property name="username">
聽聽聽<value>${jdbc.username}</value>
聽聽</property>
聽聽<property name="password">
聽聽聽<value>${jdbc.password}</value>
聽聽</property>
聽</bean>
聽聽聽 <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
聽聽<property name="locations">
聽聽聽<list>
聽聽聽聽<value>classpath:/config/jdbc.properties</value>
聽聽聽聽<value>classpath:/config/customer.properties</value>
聽聽聽</list>
聽聽</property>
聽</bean>
聽
聽<bean id="ftpHandle" class="com.stt.dosp.datacollect.remote.FtpHandle"
聽聽abstract="false" singleton="true" lazy-init="default"
聽聽autowire="default" dependency-check="default">
聽聽<property name="server">
聽聽聽<value type="java.lang.String">${ftp.ip}</value>
聽聽</property>
聽聽<property name="user">
聽聽聽<value type="java.lang.String">${ftp.user}</value>
聽聽</property>
聽聽<property name="password">
聽聽聽<value type="java.lang.String">${ftp.password}</value>
聽聽</property>
聽聽<property name="remotePath">
聽聽聽<value type="java.lang.String">${ftp.remotePath}</value>
聽聽</property>
聽聽<property name="localPath">
聽聽聽<value type="java.lang.String">${ftp.localPath}</value>
聽聽</property>
聽聽<property name="temp">
聽聽聽<value type="java.lang.String">${ftp.temp}</value>
聽聽</property>
聽</bean>
聽
聽<bean id="fileHandle"
聽聽class="com.stt.dosp.datacollect.local.FileHandle" abstract="false"
聽聽singleton="true" lazy-init="default" autowire="default"
聽聽dependency-check="default">
聽聽<property name="ftpHandle">
聽聽聽<ref bean="ftpHandle" />
聽聽</property>
聽聽<property name="batchSize">
聽聽聽<value type="java.lang.Long">${local.batch}</value>
聽聽</property>
聽聽<property name="backupDir">
聽聽聽<value type="java.lang.String">${local.backup}</value>
聽聽</property>
聽聽<property name="doubleNameFix">
聽聽聽<value type="java.lang.String">
聽聽聽聽${local.double.name.fix}
聽聽聽</value>
聽聽</property>
聽聽<property name="insertSQL">
聽聽聽<value type="java.lang.String">${db.insert}</value>
聽聽</property>
聽</bean>
聽
聽<bean id="connectFtpServerTask"
聽聽class="com.stt.dosp.datacollect.schedule.ConnectFtpServerTask"
聽聽abstract="false" singleton="true" lazy-init="default"
聽聽autowire="default" dependency-check="default">
聽聽<property name="ftpHandle">
聽聽聽<ref bean="ftpHandle" />
聽聽</property>
聽</bean>
聽聽聽
聽聽聽 <bean id="collectLocalTask"
聽聽class="com.stt.dosp.datacollect.schedule.CollectLocalTask"
聽聽abstract="false" singleton="true" lazy-init="default"
聽聽autowire="default" dependency-check="default">
聽聽<property name="fileHandle">
聽聽聽<ref bean="fileHandle" />
聽聽</property>
聽</bean>
聽
聽<bean id="ftpConnectCheck" class="org.springframework.scheduling.timer.ScheduledTimerTask">
聽聽<property name="timerTask">
聽聽聽<ref bean="connectFtpServerTask" />
聽聽</property>
聽聽<property name="period">
聽聽聽<value>${ftp.task.period}</value>
聽聽</property>
聽聽<property name="delay">
聽聽聽<value>${ftp.task.delay}</value>
聽聽</property>
聽</bean>
聽
聽<bean id="localFileCheck" class="org.springframework.scheduling.timer.ScheduledTimerTask">
聽聽<property name="timerTask">
聽聽聽<ref bean="collectLocalTask" />
聽聽</property>
聽聽<property name="period">
聽聽聽<value>${local.task.period}</value>
聽聽</property>
聽聽<property name="delay">
聽聽聽<value>${local.task.delay}</value>
聽聽</property>
聽</bean>
聽
聽<bean id="timerBean" class="org.springframework.scheduling.timer.TimerFactoryBean">
聽聽<property name="scheduledTimerTasks">
聽聽聽<list>聽聽聽聽
聽聽聽聽<ref bean="ftpConnectCheck" />
聽聽聽聽<ref bean="localFileCheck" />
聽聽聽</list>
聽聽</property>
聽</bean>
聽
聽</beans>
--------->鍚姩綾誨弬鑰?
/**
聽* 鍚姩綾?br />聽* @author zhangjp
聽* @version 1.0
聽*/
public class StartMain {
聽/**
聽 * @param args
聽 */
聽聽public static void main(String[] args) {
聽聽 /*
聽 鍙渶瑕佸垵濮嬪寲涓涓猼askBean灝卞彲浠ュ姞杞絊cheduledTimerTask浠誨姟闃熷垪
聽聽 "<list>聽聽聽聽
聽聽聽聽聽 聽<ref bean="ftpConnectCheck" />
聽聽聽聽聽聽聽 <ref bean="localFileCheck" />
聽聽聽 聽聽</list>"
聽聽聽 閲岀殑鎵鏈変換鍔?br />聽 */
聽聽聽SpringBeanFactory.getBean("connectFtpServerTask");聽聽
聽聽聽do{
聽聽聽聽聽聽 聽聽try {
聽聽聽聽聽聽聽聽聽聽聽聽聽 聽聽Thread.sleep(1000);聽
聽 聽//鍥犱負main綾繪槸涓涓繘紼?鎵浠ヨ浣縨ain涓嶉鍑?鍔犱竴涓樆濉?br />聽聽 //(浣跨敤Thread.sleep(1000);聽鎴栬匱imer timer = new聽Timer();閮藉彲浠?
聽聽聽聽聽聽聽聽聽聽聽} catch (InterruptedException e) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽 聽// TODO Auto-generated catch block
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 e.printStackTrace();
聽聽聽聽聽聽聽聽聽 聽}
聽聽聽}while(true);
聽
聽}
}
---------->榪愯鍚姩綾?鍙互緙栧啓鍚勪釜騫沖彴鐨剆hell鑴氭湰,濡?".bat" ".sh"鏂囦歡)
.bat鑴氭湰鍙傝?windows):----->
@Echo Off
title dosp_collect
If %1.==CPGEN. GoTo :CPGEN
Rem ============= CLASSPATH ===================
Echo Generating classpath ...
Set CLASSPATH=
For %%X in (dospcollect-lib/*.jar) Do Call %0 CPGEN dospcollect-lib\%%X
For %%X in (common-lib/*.jar) Do Call %0 CPGEN common-lib\%%X
Rem ============= START DOSP COLLECT SERVER ===================
Echo Starting Dosp Collect Server ...
java聽 -Xms128m -Xmx256m聽 -classpath %CLASSPATH% com.stt.dosp.datacollect.startup.StartMain
GoTo :END
Rem ============= CLASSPATH HELP ===================
Rem This target is used to concatenate the classpath parts
:CPGEN
Set CLASSPATH=%CLASSPATH%;%2
Rem ============= END ===================
Rem Target needed to jump to the end of the file
:END
.sh鑴氭湰鍙傝?linux/unix)----->
#!/bin/bash
# don't run聽 DOSP COLLECT Server as root
if [ $UID -eq 0 ] ; then
聽echo
聽echo "For security reasons you should not run this script as root!"
聽echo
聽exit 1
fi聽
# go to current directory
cd `dirname $0`/..
# defining some variables
COMMON_LIB="common-lib"
DOSP_LIB="dospcollect-lib"
# generating the proper classpath
echo "Generating classpath ..."
CLASSPATH=""
for N in $COMMON_LIB/*.jar; do CLASSPATH="$CLASSPATH$N:"; done聽
for N in $DOSP_LIB/*.jar; do CLASSPATH="$CLASSPATH$N:"; done聽
# startup聽 DOSP COLLECT Server
echo "Starting聽 Dosp-Collect Server ..."
java聽 -Xms128m -Xmx256m -classpath $CLASSPATH com.stt.dosp.datacollect.startup.StartMain