while (m_useTempDirs && itRules.hasNext()) { CmsStaticExportRfsRule rule = (CmsStaticExportRfsRule)itRules.next(); if (exportPath.equals(rule.getExportPathConfigured())) { m_useTempDirs = false; Integer backups = (exportBackups == null ? null : Integer.valueOf(exportBackups)); m_rfsRules.add(new CmsStaticExportRfsRule( name, description, backups, relativeLinks, m_rfsTmpRule.getRelatedSystemResources())); m_rfsTmpRule = new CmsStaticExportRfsRule("", "", "", "", "", "", null, null);
/** * Adds a regex of related system resources to the latest rfs-rule.<p> * * @param regex the regex to add */ public void addRfsRuleSystemRes(String regex) { m_rfsTmpRule.addRelatedSystemRes(regex); }
while (it.hasNext()) { CmsStaticExportRfsRule rule = (CmsStaticExportRfsRule)it.next(); if (rule.getSource().matcher(vfsName).matches()) { return rule.getExportPath();
/** * @see org.opencms.staticexport.CmsAfterPublishStaticExportHandler#getRelatedFilesToPurge(java.lang.String, java.lang.String) */ @Override protected List getRelatedFilesToPurge(String exportFileName, String vfsName) { CmsStaticExportManager manager = OpenCms.getStaticExportManager(); List result = new ArrayList(); if (m_rules == null) { // get the locale matching rules CmsLocaleManager locManager = OpenCms.getLocaleManager(); m_rules = new ArrayList(); Iterator itRules = manager.getRfsRules().iterator(); while (itRules.hasNext()) { CmsStaticExportRfsRule rule = (CmsStaticExportRfsRule)itRules.next(); Locale locale = CmsLocaleManager.getLocale(rule.getName()); if (locManager.getDefaultLocales().contains(locale)) { m_rules.add(rule); } } } // add paths for all possible locales Iterator it = m_rules.iterator(); while (it.hasNext()) { CmsStaticExportRfsRule rule = (CmsStaticExportRfsRule)it.next(); result.add(new File(rule.getLocalizedRfsName(exportFileName, File.separator))); } return result; } }
CmsStaticExportRfsRule rule = itRfsRules.next(); try { rule.setExportPath(normalizeExportPath(rule.getExportPathConfigured())); } catch (CmsIllegalArgumentException e) { CmsLog.INIT.warn(e.getMessageContainer()); rule.setExportPath(m_staticExportPath); rule.setExportWorkPath(normalizeExportPath(rule.getExportWorkPathConfigured())); } catch (CmsIllegalArgumentException e) { CmsLog.INIT.warn(e.getMessageContainer()); rule.setExportWorkPath(m_staticExportWorkPath); rule.setRfsPrefix(normalizeRfsPrefix(rule.getRfsPrefixConfigured())); Messages.get().getBundle().key( Messages.INIT_EXPORT_RFS_RULE_EXPORT_PATH_2, rfsRule.getSource(), rfsRule.getExportPath())); CmsLog.INIT.info( Messages.get().getBundle().key( Messages.INIT_EXPORT_RFS_RULE_RFS_PREFIX_2, rfsRule.getSource(), rfsRule.getRfsPrefix())); if (rfsRule.getUseRelativeLinks() != null) { if (rfsRule.getUseRelativeLinks().booleanValue()) { CmsLog.INIT.info( Messages.get().getBundle().key( Messages.INIT_EXPORT_RFS_RULE_RELATIVE_LINKS_1, rfsRule.getSource()));
rfsRuleElement.addElement(N_STATICEXPORT_NAME).addText(rule.getName()); rfsRuleElement.addElement(N_STATICEXPORT_DESCRIPTION).addText(rule.getDescription()); rfsRuleElement.addElement(N_STATICEXPORT_SOURCE).addText(rule.getSource().pattern()); rfsRuleElement.addElement(N_STATICEXPORT_RFS_PREFIX).addText(rule.getRfsPrefixConfigured()); rfsRuleElement.addElement(N_STATICEXPORT_EXPORTPATH).addText(rule.getExportPathConfigured()); if (rule.getExportWorkPathConfigured() != null) { rfsRuleElement.addElement(N_STATICEXPORT_EXPORTWORKPATH).addText(rule.getExportWorkPathConfigured()); if (rule.getExportBackups() != null) { rfsRuleElement.addElement(N_STATICEXPORT_EXPORTBACKUPS).addText( String.valueOf(rule.getExportBackups())); if (rule.getUseRelativeLinks() != null) { rfsRuleElement.addElement(N_STATICEXPORT_RELATIVELINKS).addText( rule.getUseRelativeLinks().toString()); Iterator itSystemRes = rule.getRelatedSystemResources().iterator(); while (itSystemRes.hasNext()) { Pattern sysRes = (Pattern)itSystemRes.next();
CmsStaticExportRfsRule rule = (CmsStaticExportRfsRule)it.next(); boolean export = rule.getSource().matcher(siteRoot + vfsName).matches(); matched |= export; export |= (vfsName.startsWith(CmsWorkplace.VFS_PATH_SYSTEM) && rule.match(vfsName)); if (export) { Locale locale = CmsLocaleManager.getLocale(rule.getName()); if (locales.contains(locale)) { String locRfsName = rfsName; if (locales.contains(locale)) { locRfsName = rule.getLocalizedRfsName(rfsName, "/"); writeResource(req, rule.getExportPath(), locRfsName, resource, content);
while (it.hasNext()) { CmsStaticExportRfsRule rule = (CmsStaticExportRfsRule)it.next(); File staticExportRule = new File(rule.getExportPath()); File staticExportWorkRule = new File(rule.getExportWorkPath()); rule.getExportPath(), rule.getExportBackups().intValue(), OpenCms.getResourceManager().getFileTranslator().translateResource(rule.getName())); staticExportWorkRule.renameTo(new File(rule.getExportPath()));
while (it.hasNext()) { CmsStaticExportRfsRule rule = (CmsStaticExportRfsRule)it.next(); if (rule.match(vfsName)) { exportFileName = CmsFileUtil.normalizePath(rule.getExportPath() + rfsName); exportFile = new File(exportFileName); if (dateLastModified > exportFile.lastModified()) {
/** * Returns the rfs export Path.<p> * * @return the rfs export Path */ public String getExportPath() { if (OpenCms.getStaticExportManager().isUseTempDir() && OpenCms.getStaticExportManager().isFullStaticExport()) { return getExportWorkPath(); } return m_exportPath; }
/** * Returns the rfs name for the given locale, only used for multi-language export.<p> * * @param rfsName the original rfs name * @param fileSeparator the file separator to use * * @return the rfs name for the given locale */ public String getLocalizedRfsName(String rfsName, String fileSeparator) { String locRfsName = null; // this might be too simple locRfsName = CmsStringUtil.substitute(rfsName, fileSeparator + CmsLocaleManager.getDefaultLocale().toString() + fileSeparator, fileSeparator + getName() + fileSeparator); return locRfsName; }
/** * Creates a new static export property object.<p> * */ public CmsStaticExportManager() { m_lockCmsEvent = new Object(); m_lockScrubExportFolders = new Object(); m_lockSetExportnames = new Object(); m_exportSuffixes = new ArrayList<String>(); m_exportFolders = new ArrayList<String>(); m_exportHeaders = new ArrayList<String>(); m_rfsRules = new ArrayList<CmsStaticExportRfsRule>(); m_exportRules = new ArrayList<CmsStaticExportExportRule>(); m_exportTmpRule = new CmsStaticExportExportRule("", ""); m_rfsTmpRule = new CmsStaticExportRfsRule("", "", "", "", "", "", null, null); m_fullStaticExport = false; }
while (it.hasNext()) { CmsStaticExportRfsRule rule = (CmsStaticExportRfsRule)it.next(); exportFolderName = CmsFileUtil.normalizePath(rule.getExportPath() + '/'); try { File exportFolder = new File(exportFolderName);
CmsStaticExportRfsRule rule = (CmsStaticExportRfsRule)itRfsRules.next(); try { rule.setExportPath(normalizeExportPath(rule.getExportPathConfigured())); } catch (CmsIllegalArgumentException e) { CmsLog.INIT.warn(e.getMessageContainer()); rule.setExportPath(m_staticExportPath); rule.setExportWorkPath(normalizeExportPath(rule.getExportWorkPathConfigured())); } catch (CmsIllegalArgumentException e) { CmsLog.INIT.warn(e.getMessageContainer()); rule.setExportWorkPath(m_staticExportWorkPath); rule.setRfsPrefix(normalizeRfsPrefix(rule.getRfsPrefixConfigured())); CmsLog.INIT.info(Messages.get().getBundle().key( Messages.INIT_EXPORT_RFS_RULE_EXPORT_PATH_2, rfsRule.getSource(), rfsRule.getExportPath())); CmsLog.INIT.info(Messages.get().getBundle().key( Messages.INIT_EXPORT_RFS_RULE_RFS_PREFIX_2, rfsRule.getSource(), rfsRule.getRfsPrefix())); if (rfsRule.getUseRelativeLinks() != null) { if (rfsRule.getUseRelativeLinks().booleanValue()) { CmsLog.INIT.info(Messages.get().getBundle().key( Messages.INIT_EXPORT_RFS_RULE_RELATIVE_LINKS_1, rfsRule.getSource())); } else { CmsLog.INIT.info(Messages.get().getBundle().key(
rfsRuleElement.addElement(N_STATICEXPORT_NAME).addText(rule.getName()); rfsRuleElement.addElement(N_STATICEXPORT_DESCRIPTION).addText(rule.getDescription()); rfsRuleElement.addElement(N_STATICEXPORT_SOURCE).addText(rule.getSource().pattern()); rfsRuleElement.addElement(N_STATICEXPORT_RFS_PREFIX).addText(rule.getRfsPrefixConfigured()); rfsRuleElement.addElement(N_STATICEXPORT_EXPORTPATH).addText(rule.getExportPathConfigured()); if (rule.getExportWorkPathConfigured() != null) { rfsRuleElement.addElement(N_STATICEXPORT_EXPORTWORKPATH).addText( rule.getExportWorkPathConfigured()); if (rule.getExportBackups() != null) { rfsRuleElement.addElement(N_STATICEXPORT_EXPORTBACKUPS).addText( String.valueOf(rule.getExportBackups())); if (rule.getUseRelativeLinks() != null) { rfsRuleElement.addElement(N_STATICEXPORT_RELATIVELINKS).addText( rule.getUseRelativeLinks().toString()); Iterator<Pattern> itSystemRes = rule.getRelatedSystemResources().iterator(); while (itSystemRes.hasNext()) { Pattern sysRes = itSystemRes.next();
CmsStaticExportRfsRule rule = it.next(); boolean export = rule.getSource().matcher(siteRoot + vfsName).matches(); matched |= export; export |= (vfsName.startsWith(CmsWorkplace.VFS_PATH_SYSTEM) && rule.match(vfsName)); if (export) { Locale locale = CmsLocaleManager.getLocale(rule.getName()); if (locales.contains(locale)) { String locRfsName = rfsName; if (locales.contains(locale)) { locRfsName = rule.getLocalizedRfsName(rfsName, "/"); writeResource(req, rule.getExportPath(), locRfsName, resource, content);
while (it.hasNext()) { CmsStaticExportRfsRule rule = it.next(); File staticExportRule = new File(rule.getExportPath()); File staticExportWorkRule = new File(rule.getExportWorkPath()); rule.getExportPath(), rule.getExportBackups().intValue(), OpenCms.getResourceManager().getFileTranslator().translateResource(rule.getName())); staticExportWorkRule.renameTo(new File(rule.getExportPath()));
/** * @see org.opencms.staticexport.CmsAfterPublishStaticExportHandler#getRelatedFilesToPurge(java.lang.String, java.lang.String) */ @Override protected List<File> getRelatedFilesToPurge(String exportFileName, String vfsName) { CmsStaticExportManager manager = OpenCms.getStaticExportManager(); List<File> result = new ArrayList<File>(); if (m_rules == null) { // get the locale matching rules CmsLocaleManager locManager = OpenCms.getLocaleManager(); m_rules = new ArrayList<CmsStaticExportRfsRule>(); Iterator<CmsStaticExportRfsRule> itRules = manager.getRfsRules().iterator(); while (itRules.hasNext()) { CmsStaticExportRfsRule rule = itRules.next(); Locale locale = CmsLocaleManager.getLocale(rule.getName()); if (locManager.getDefaultLocales().contains(locale)) { m_rules.add(rule); } } } // add paths for all possible locales Iterator<CmsStaticExportRfsRule> it = m_rules.iterator(); while (it.hasNext()) { CmsStaticExportRfsRule rule = it.next(); result.add(new File(rule.getLocalizedRfsName(exportFileName, File.separator))); } return result; } }
while (it.hasNext()) { CmsStaticExportRfsRule rule = it.next(); if (rule.match(vfsName)) { exportFileName = CmsFileUtil.normalizePath(rule.getExportPath() + rfsName); exportFile = new File(exportFileName); if (dateLastModified > exportFile.lastModified()) {
/** * Returns the rfs export Path.<p> * * @return the rfs export Path */ public String getExportPath() { if (OpenCms.getStaticExportManager().isUseTempDir() && OpenCms.getStaticExportManager().isFullStaticExport()) { return getExportWorkPath(); } return m_exportPath; }