tridion - 如何制作自定义部署程序将数据写入 MS SQL 数据库?

标签 tridion tridion2009 tridion-content-delivery

我在 config/cd_deployer_conf.xml 的默认处理器中添加了一个自定义模块:

<Processor Action="Deploy" Class="com.tridion.deployer.Processor">
            ...
            <Module Type="MyCustomModuleDeploy" Class="com.tridion.new.extensions.MyCustomModule">
            </Module>
</Processor>

该模块的代码如下所示:

public class MyCustomModule extends com.tridion.deployer.modules.PageDeploy {

     static Logger logger = Logger.getLogger("customDeployerFirst");

    public MyCustomModule(Configuration config, Processor processor)
            throws ConfigurationException {
        super(config, processor);
        // TODO Auto-generated constructor stub
    }

    public void processPage(Page page, File pageFile) throws ProcessingException {
        // TODO Auto-generated method stub
            Date d = new Date();
        log.info("WORKING");
        log.info("Page ID: " + page.getId().toString());
        log.info("Publication date: "+ d.toString());
    }

}

每次发布​​页面时,我都会在日志文件中获取所需的信息。

接下来我要做的是将页面 ID 和发布日期写入我之前创建的表中的 Microsoft SQL 数据库。我怎样才能做到这一点?如何从 MyCustomModule 访问数据库表?

谢谢

最佳答案

不确定您的要求,但您已经选择了部署者扩展模型与存储扩展。通过存储扩展,Tridion 将提供有关如何扩展存储的模型(例如可以扩展的 JPAFramework 和 Base DAOEntities)。如果您要采用部署程序扩展路线,正如 Quirin 和 Nuno 提到的那样,这就像像任何其他应用程序一样编写标准 JDBC 代码。

但是,我建议您也查看存储扩展模型,看看它是否符合您的要求。一个非常好的起点是查看以下文章:http://www.sdltridionworld.com/articles/sdltridion2011/tutorials/extending-content-delivery-storage-sdltridion-2011-1.aspx

关于tridion - 如何制作自定义部署程序将数据写入 MS SQL 数据库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11361594/

相关文章:

tridion - OE/AM同步

tridion - 将包中的项目作为 Dreamweaver 模板执行

没有确切元数据字段的组件的 Tridion 查询

jsp - 我正在研究 tridion。每次单击链接(菜单)时,它都会创建一个新 session 。后端我们使用tomcat

tridion - 快速检查 Tridion 链路传播

tridion - 富文本字段中的符号

tridion - 如何最好地将 Tridion Broker 用作多个网站的单一内容来源?

tridion - 如何在自定义页面部署器中访问转换后的 html 页面?

tridion - 在复合模板中使用 C# 进行渲染时出现问题

tridion-2011 - 在负载均衡场景中使用代理数据库的 Tridion 部署程序配置