Hi all, we are having problems at the time we are publishing a plenty of file in a transaction, with the CMS API. Our app is running in Cluster with Two fronts server (online)and another one behing (only offline). We are using OCEE module and cache in some files. We make a zip package with all content and then do an import of that zip. After that, we do a massive publish with the following class.
<br>As a result, some files after publishing, dissapear. But, if we make an touch over this files, these ones appears again. It is a hard task ! :S<br>Anyone have an answer ? <br><br>Below, our class.<br><br style="color: rgb(204, 0, 0); font-weight: bold;">
<span style="color: rgb(204, 0, 0); font-weight: bold;">public class AutoTouch {</span><br><br>    <span style="color: rgb(153, 0, 0);">public static StringBuffer autoTouch(CmsObject cms, String pakageFilename) throws Exception{
</span><br>        StringBuffer report = new StringBuffer();<br>        <br>       <span style="color: rgb(0, 153, 0);"> //read the manifiest.xml from the zip file</span><br>        List resourcePathList = ExportUtils.readFileListFromZip
(cms, pakageFilename);<br>        <span style="color: rgb(0, 153, 0);">//touch files</span><br>        touch(cms, resourcePathList, report);<br>        <span style="color: rgb(0, 153, 0);">//add needed resurces (sush as </span>
<br>        List resourceList = buildResourceList(cms, resourcePathList, report);<br>        <span style="color: rgb(0, 153, 0);">//unlock resources</span><br>        unlockResources(cms, resourceList, report);<br>       
<span style="color: rgb(0, 153, 0);"> //publish files</span><br>        publish(cms, resourceList, report);<br>        <br>        return report;<br>    }<br>    <br>  <span style="color: rgb(153, 0, 0);">  private static void touch(CmsObject cms, List resourcePathList, StringBuffer report) throws CmsException{
</span><br>        long now = (new Date()).getTime();        <br>        CmsResource    cmsResource;<br><br>        report.append("<strong>Touching Resources</strong><br>\n");    <br>        for(Iterator ite = 
resourcePathList.iterator(); ite.hasNext();){<br>            String resourcePath = "/" + (String)ite.next();<br>            <br>            if (!cms.existsResource(resourcePath)){<br>                report.append
(resourcePath + ": <strong>not found</strong><br>\n");<br>                ite.remove();<br>            }else{<br>                cmsResource = cms.readResource(resourcePath);<br>                if (
cmsResource.isFile()){<br>                    cms.lockResource(resourcePath);<br>                    cms.setDateLastModified(resourcePath, now, false);<br>                    report.append(resourcePath + ":  touched<br>\n");
<br>                }<br>            }<br>        }<br>        report.append("<strong>Resources Touched</strong><br>");<br>        report.append("<br>\n<br>\n");<br>    }<br>
    <br>    <span style="color: rgb(153, 0, 0);">private static List buildResourceList(CmsObject cms, List resourcePathList, StringBuffer report) throws CmsException{</span><br>        <br>        List resourceList = new LinkedList();
<br>        Iterator ite = resourcePathList.iterator();<br>        while(ite.hasNext()){<br>            CmsResource cmsResource = cms.readResource((String) ite.next());<br><br>            while(true){<br>                String parentPath = 
CmsResource.getParentFolder(cmsResource.getRootPath());<br>                if(parentPath==null) break;<br>                parentPath = cms.getRequestContext().removeSiteRoot(parentPath);<br>                CmsResource parentResource = 
cms.readResource(parentPath);<br>                if(parentResource.getState() != CmsResource.STATE_NEW) break;<br>                cmsResource = parentResource;<br>            }<br>            resourceList.add(cmsResource);
<br>        }<br>        return resourceList;<br>    }<br>    <br>    <span style="color: rgb(153, 0, 0);">private static void unlockResources(CmsObject cms, List resourceList, StringBuffer report) throws CmsException {</span>
<br><br>        for(Iterator ite = resourceList.iterator(); ite.hasNext();){<br>            CmsResource cmsResource = (CmsResource) ite.next();<br>            OpenCmsUtil.unlockResource(cms,cmsResource.getRootPath());<br>
        }<br>    }<br>    <br>    <span style="color: rgb(153, 0, 0);">private static void publish(CmsObject cms, List resourceList, StringBuffer report) throws CmsException {  </span><br style="color: rgb(153, 0, 0);"><span style="color: rgb(153, 0, 0);">
        </span><br>        CmsPublishList publishList = cms.getPublishList(resourceList, false, false, false);<br>        CmsStringBufferReport publishReport = new CmsStringBufferReport(new Locale("en"));<br>        
<br>        cms.publishProject(publishReport, publishList);<br>        report.append("<strong>File Publish Report</strong><br>\n");<br>        report.append(publishReport.toString().replaceAll("\n","<br>\n"));
<br>    }<br>}<br clear="all"><br>-- <br>Patricio.-