IPublishElement 发布相关对象。
其子类有IPublishContent(内容相关发布对象接口)、IPublishFolder(folder相关发布对象接口,有栏目、站点、分类法等具体的实现类)。
FileDistributeShip 文件分发相关类。
WCM的分发一般都是基于站点或栏目的,如:将某个文件拷贝到指定站点下,或指定栏目下,所以WCM的分发接口一般都会涉及到站点或栏目对象,也就是上面的IPublishFolder对象,IPublishFolder对象可以通过站点或栏目对象来构造,具体看后面的示例。
1、创建FileDistributeShip类 FileDistributeShip distribute = new FileDistributeShip(); // sLocalFilePathName需要分发的文件路径+名称 // publishElement 需要分发到ftp服务上的什么位置,是通过publishElement的存放位置获取的,需要构建一个publishElement对象。 IPublishFolder folder = (IPublishFolder) PublishElementFactory .makeElementFrom(_channel); //其中的_channel表示要分发到的目录栏目,如果是站点,需要换成对于的website对象 distributeShip.distributeFile(sLocalFilePathName,folder); // 分发文件到当前栏目所在的目录下 |