private String computeModuleHash(CmsModule module, CmsProject project) throws CmsException {

        LOG.info("Getting module hash for " + module.getName());
        // This method may be called very frequently during a short time, but it is unlikely
        // that a module changes multiple times in a few seconds, so we use a timed cache here
        String cachedValue = m_newModuleHashCache.get(module);
        if (cachedValue != null) {
            LOG.info("Using cached value for module hash of " + module.getName());
            return cachedValue;
        }

        CmsObject cms = OpenCms.initCmsObject(m_adminCms);
        if (!CmsStringUtil.isEmptyOrWhitespaceOnly(module.getSite())) {
            cms.getRequestContext().setSiteRoot(module.getSite());
        }
        cms.getRequestContext().setCurrentProject(project);

        // We compute a hash code from the paths of all resources belonging to the module and their respective modification dates.
        List<String> entries = Lists.newArrayList();
        for (String path : module.getResources()) {
            try {
                Set<CmsResource> resources = Sets.newHashSet();
                CmsResource moduleRes = cms.readResource(path, CmsResourceFilter.IGNORE_EXPIRATION);
                resources.add(moduleRes);
                if (moduleRes.isFolder()) {
                    resources.addAll(cms.readResources(path, CmsResourceFilter.IGNORE_EXPIRATION, true));
                }
                for (CmsResource res : resources) {
                    entries.add(res.getRootPath() + ":" + res.getDateLastModified());
                }
            } catch (CmsVfsResourceNotFoundException e) {
                entries.add(path + ":null");
            }
        }
        Collections.sort(entries);
        String inputString = CmsStringUtil.listAsString(entries, "\n") + "\nMETA:" + module.getObjectCreateTime();
        LOG.debug("Computing module hash from base string:\n" + inputString);
        return "" + inputString.hashCode();
    }
private String computeModuleHash ( CmsModule module , CmsProject project ) throws CmsException { LOG . info ( "Getting module hash for " + module . getName ( ) ) ; String cachedValue = m_newModuleHashCache . get ( module ) ; if ( cachedValue != null ) { LOG . info ( "Using cached value for module hash of " + module . getName ( ) ) ; return cachedValue ; } CmsObject cms = OpenCms . initCmsObject ( m_adminCms ) ; if ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( module . getSite ( ) ) ) { cms . getRequestContext ( ) . setSiteRoot ( module . getSite ( ) ) ; } cms . getRequestContext ( ) . setCurrentProject ( project ) ; List < String > entries = Lists . newArrayList ( ) ; for ( String path : module . getResources ( ) ) { try { Set < CmsResource > resources = Sets . newHashSet ( ) ; CmsResource moduleRes = cms . readResource ( path , CmsResourceFilter . IGNORE_EXPIRATION ) ; resources . add ( moduleRes ) ; if ( moduleRes . isFolder ( ) ) { resources . addAll ( cms . readResources ( path , CmsResourceFilter . IGNORE_EXPIRATION , true ) ) ; } for ( CmsResource res : resources ) { entries . add ( res . getRootPath ( ) + ":" + res . getDateLastModified ( ) ) ; } } catch ( CmsVfsResourceNotFoundException e ) { entries . add ( path + ":null" ) ; } } Collections . sort ( entries ) ; String inputString = CmsStringUtil . listAsString ( entries , "\n" ) + "\nMETA:" + module . getObjectCreateTime ( ) ; LOG . debug ( "Computing module hash from base string:\n" + inputString ) ; return "" + inputString . hashCode ( ) ; }
Computes a module hash, which should change when a module changes and stay the same when the module doesn't change.<p>

We only use the modification time of the module resources and their descendants and the modification time of the metadata
for computing it.

@param module the module for which to compute the module signature
@param project the project in which to compute the module hash
@return the module signature
@throws CmsException if something goes wrong