日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

Mule3.x中對Ftp協(xié)議的支持

 嶗山道哥 2011-01-12
1.    前言
一直都聽說 Mule 對 Ftp 和 Http 協(xié)議的支持很好,于是就關(guān)注了一下。
Mule 通過一系列的配置文件的配置就可以完成對 Ftp 服務(wù)器的下載和上傳 ,這個還是很神奇的。
但是可惜的是, Mule 本身并不支持 FtpS 協(xié)議,只支持 SFTP ,這樣對于工業(yè)級的使用上,未免有點不方便 。
 
2.    Mule 3.x 的基本知識
Mule 是一個開源的 ESB 軟件,基本概念如下:
 
Mule 3.X 中對 Ftp 的支持是通過 < ftp:connector> 等標(biāo)簽實現(xiàn)的,具體的官方信息如下:
 
在 Mule 3.x 中,運行 config.xml 的方法如下:
a.       在 app 目錄下新建一個目錄,比如 test-ftp
b.       將寫好的 config.xml 拷貝到 test-ftp 下,并且取名為 mule-config.xml
c.       在 bin 目錄下,運行 CMD 如下
Mule –app test-ftp
 
 
3.    Mule 3.x 中 ftp 支持的方法
a.       從 ftp 服務(wù)器上下載文件的方法
<? xml version = "1.0" encoding = "UTF-8" ?>
      xmlns:xsi = "http://www./2001/XMLSchema-instance"
      xmlns:spring = "http://www./schema/beans"
      xmlns:http = "http://www./schema/mule/http"
      xmlns:vm = "http://www./schema/mule/vm"
      xmlns:ftp = "http://www./schema/mule/ftp"
      xmlns:file = "http://www./schema/mule/file"
      xsi:schemaLocation = "
 
<!--
連接 FTP 服務(wù)器的連接器
-->
    < ftp:connector name = "ftpConnector" binary = "true"
       validateConnections = "true" />
 
 
    < model name = "ftp-model" >
       < service name = "ftp-reader" >
       <!--
     連接 FTP 服務(wù)器的入口節(jié)點,在這里配置 ftp 的 ip ,賬戶和密碼
     利用 file:filename-wildcard -filter 確認(rèn)只下載 xml 文件
     -->
           < inbound >
              < ftp:inbound-endpoint user = "zhany" binary = "true" path = ""
                  password = "zhany" host = "192.168.120.33" port = "21"
                  pollingFrequency = "10000" connector-ref = "ftpConnector"  
                  >
                  < file:filename-wildcard-filter
                     pattern = "*.xml" />
              </ ftp:inbound-endpoint >
           </ inbound >
    <!--
     連接 FTP 服務(wù)器的出口節(jié)點,在這里配置地址,將文件下載到 e:/out 目錄下
     同時利用 outputPattern ,定義下載的文件和源文件同名同類型
     -->
           < outbound >
              < pass-through-router >
                  < file:outbound-endpoint path = "/e:/out" outputPattern = "[header:originalFilename]" />
              </ pass-through-router >
           </ outbound >
 
       </ service >
    </ model >
 
</ mule >
 
 
 
b.       上傳文件到 ftp 服務(wù)器上的辦法
<? xml version = "1.0" encoding = "UTF-8" ?>
      xmlns:xsi = "http://www./2001/XMLSchema-instance"
      xmlns:spring = "http://www./schema/beans"
      xmlns:http = "http://www./schema/mule/http"
      xmlns:vm = "http://www./schema/mule/vm"
      xmlns:ftp = "http://www./schema/mule/ftp"
      xmlns:file = "http://www./schema/mule/file"
      xsi:schemaLocation = "
<!--
傳輸文件的連接器
-->
    < file:connector name = "fileConnector" pollingFrequency = "6000" />
<!--
連接 ftp 服務(wù)器的連接器
-->
    < ftp:connector name = "ftpConnector" />
   
    < model name = "model" >
       < service name = "service" >
           < inbound >
           <!--
        利用 fileConnector 讀取 e:/tmp 下的文件
       -->
              < file:inbound-endpoint path = "/e:/tmp"
                  connector-ref = "fileConnector" >
              </ file:inbound-endpoint >
           </ inbound >
           < outbound >
              <!--
        利用 ftpConnector 將文件傳輸?shù)?ftp 服務(wù)器上,這里配置了服務(wù)器的 ip 和賬戶密碼
       -->
              < pass-through-router >
                  < ftp:outbound-endpoint host = "192.168.120.33"
                     port = "21" user = "zhany" password = "zhany" path = "" connector-ref = "ftpConnector" />
              </ pass-through-router >
           </ outbound >
       </ service >
    </ model >
</ mule >
 
 

本文來自CSDN博客,轉(zhuǎn)載請標(biāo)明出處:http://blog.csdn.net/nanjingjiangbiao/archive/2010/10/11/5933923.aspx

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多