2012-05-20 65 views

回答

5

部署者只能使用Java擴展,因爲您已經找到。如果你想完全使用.NET自定義一些東西,最好的辦法是用FTP發佈文件(或者在沒有正在進行部署的情況下使用HTTP),並創建一個帶有文件系統監視的.NET應用程序來處理這些文件。

也許您可以分享更多關於您嘗試實現的內容以及您的SDL Tridion版本,以便有人提供更多建議。

+0

嗨克里斯感謝您的投入,我相信我們不能自定義使用.NET感謝確認,其實我試圖執行谷歌標記HTML,請參閱此問題(http://stackoverflow.com/questions/10674431/server-performance-going-down-while-we-trying-to-get-some-data -from-tridion-2009)..請看看並建議! –

5

顯而易見的答案是NO。部署者是Content Delivery的一個相當低級別的部分,其擴展性點僅適用於Java。

但是,有很多方法來剝皮這隻貓,這一切都取決於你想要達到的目標。例如,你可以創建一個.NET的Web服務,它可以完成擴展的所有功能,並編寫一個調用此Web服務的簡單的部署器模塊(使用Java),將所有必需的參數傳遞給它。

在將包傳遞到部署者正在偵聽的實際位置之前,您可以通過發佈到.NET方法將被調用的位置來預處理Transport包。

如果您更喜歡後處理,您可以配置您的部署者以保持成功的事務並監視部署者存儲這些位置的位置(「傳入文件夾」+「\ Success」)。

這一切都取決於你想達到什麼。推薦的方法是使用Java,但如果您不熟悉該語言,則可以創造性並通過最少的Java編碼實現相同的最終結果。下面是通過循環項目已發佈並記錄有關對象的信息「空」模塊的例子:

import java.util.Iterator; 

import com.tridion.configuration.Configuration; 
import com.tridion.configuration.ConfigurationException; 
import com.tridion.deployer.Module; 
import com.tridion.deployer.ProcessingException; 
import com.tridion.deployer.Processor; 

import com.tridion.transport.transportpackage.Binary; 
import com.tridion.transport.transportpackage.BinaryKey; 
import com.tridion.transport.transportpackage.Component; 
import com.tridion.transport.transportpackage.ComponentKey; 
import com.tridion.transport.transportpackage.MetaData; 
import com.tridion.transport.transportpackage.MetaDataFile; 
import com.tridion.transport.transportpackage.Page; 
import com.tridion.transport.transportpackage.PageKey; 
import com.tridion.transport.transportpackage.ProcessorInstructions; 
import com.tridion.transport.transportpackage.Section; 
import com.tridion.transport.transportpackage.TransportPackage; 

import org.slf4j.LoggerFactory; 
import org.slf4j.Logger; 


public class CustomCacheNotificationDeploy extends Module { 

    String action = null; 
    Logger log = null; 
    MetaDataFile pageMeta = null; 
    MetaDataFile componentMeta = null; 
    MetaDataFile binaryMeta = null; 
    public CustomCacheNotificationDeploy(Configuration config, Processor processor) 
      throws ConfigurationException { 
     super(config, processor); 
     log = LoggerFactory.getLogger(getClass()); 
     // TODO Auto-generated constructor stub 
    } 

    @SuppressWarnings("deprecation") 
    public void process(TransportPackage data) throws ProcessingException{ 
     ProcessorInstructions instructions = data.getProcessorInstructions(); 
     action = instructions.getAction(); 
     MetaData pageMetaInfo = instructions.getMetaData("Pages"); 
     MetaData componentMetaInfo = instructions.getMetaData("Components"); 
     MetaData binaryMetaInfo = instructions.getMetaData("Binaries"); 
     pageMeta = data.getMetaData("Pages", pageMetaInfo.getName()); 
     componentMeta = data.getMetaData("Components", componentMetaInfo.getName()); 
     binaryMeta = data.getMetaData("Binaries", binaryMetaInfo.getName()); 

     log.debug("Action " + action + " started for publication " + instructions.getPublicationId()); 

     Section section = null; 
     Iterator<Section> Sections = instructions.getSections(); 
     for(; Sections.hasNext(); processSection(section)) 
     { 
      section = Sections.next(); 
     } 

    } 

    protected void processSection(Section section) 
    { 
     log.debug("Processing Section " + section.getName()); 
     Iterator iterator = section.getFileItems(); 
     Object item; 
     for(; iterator.hasNext(); processItem(item, section)) 
     { 
      item = iterator.next(); 
     } 
     Section subSection; 
     for(Iterator i$ = section.getSubSections().iterator(); i$.hasNext(); processSection(subSection)) 
      subSection = (Section)i$.next(); 
    } 

    protected void processItem(Object obj, Section section) 
    { 
     if(obj instanceof PageKey) 
     { 
      log.debug("Object is Page"); 
      PageKey key = (PageKey) obj; 
      Page page = (Page)pageMeta.getMetaData(key); 
      log.debug("Page being deployed is " + page.getId() + " with URL " + page.getURLPath()); 
     } 
     if(obj instanceof ComponentKey) 
     { 
      log.debug("Object is Component"); 
      ComponentKey key = (ComponentKey) obj; 
      Component component = (Component)componentMeta.getMetaData(key); 
      log.debug("Component being deployed is " + component.getId()); 
     } 
     if(obj instanceof BinaryKey) 
     { 
      log.debug("Object is Binary"); 
      BinaryKey key = (BinaryKey) obj; 
      Binary binary = (Binary)binaryMeta.getMetaData(key); 
      log.debug("Binary being deployed is " + binary.getId() + " with URL " + binary.getURLPath()); 
     } 
    } 
} 
+0

嗨Nuno,感謝您的回覆是上面的實施將幫助我這個實現(http://stackoverflow.com/questions/10674431/server-performance-going-down-while-we-trying-to-get-一些數據,從-的tridion-2009) –

相關問題