/** * Returns <code>true</code> if the synchonization is enabled.<p> * * The synchonization is enabled if both source and destination * path is set, and also the enabled flag is true.<p> * * @return <code>true</code> if the synchonization is enabled */ public boolean isSyncEnabled() { return isEnabled() && (m_sourceListInVfs != null) && (m_destinationPathInRfs != null); }
/** * @see org.opencms.main.CmsException#createException(org.opencms.i18n.CmsMessageContainer, java.lang.Throwable) */ @Override public CmsException createException(CmsMessageContainer container, Throwable cause) { return new CmsSynchronizeException(container, cause); } }
/** * Sets the source path list of the synchronization in the OpenCms VFS.<p> * * The objects in the list must be of type <code>{@link String}</code>. * * @param sourceListInVfs the source path list of the synchronization in the OpenCms VFS to set */ public void setSourceListInVfs(List<String> sourceListInVfs) { if (sourceListInVfs == null) { m_sourceListInVfs = new ArrayList<String>(); } else { m_sourceListInVfs = optimizeSourceList(sourceListInVfs); } }
if (m_syncList.containsKey(translate(resourcename))) { CmsSynchronizeList sync = m_syncList.get(translate(resourcename)); fsFile = getFileInRfs(sync.getResName()); if (res.getDateLastModified() > sync.getModifiedVfs()) { if ((fsFile.lastModified() > sync.getModifiedFs()) && (fsFile.lastModified() > res.getDateLastModified())) { action = UPDATE_VFS; } else { if (fsFile.lastModified() > sync.getModifiedFs()) { action = UPDATE_VFS;
long modifiedVfs = new Long(tok.nextToken()).longValue(); long modifiedFs = new Long(tok.nextToken()).longValue(); CmsSynchronizeList sync = new CmsSynchronizeList(resName, tranResName, modifiedVfs, modifiedFs); syncList.put(translate(resName), sync); throw new CmsSynchronizeException(Messages.get().container(Messages.ERR_READ_SYNC_LIST_0), e); } finally {
if (isEnabled() && (m_destinationPathInRfs == null)) { throw new CmsSynchronizeException(Messages.get().container(Messages.ERR_NO_RFS_DESTINATION_0)); if (isEnabled() && ((m_sourceListInVfs == null) || (m_sourceListInVfs.size() == 0))) { throw new CmsSynchronizeException(Messages.get().container(Messages.ERR_NO_VFS_SOURCE_0));
/** * Returns true if the user has enabled synchronization.<p> * * @return true if the user has enabled synchronization */ public boolean isSyncEnabled() { CmsSynchronizeSettings syncSettings = getSettings().getUserSettings().getSynchronizeSettings(); return (syncSettings != null) && syncSettings.isSyncEnabled(); }
/** * Updates the synchronization lists if a resource is not used during the * synchronization process.<p> * * @param res the resource whose entry must be updated */ private void skipResource(CmsResource res) { // add the file to the new sync list... String resname = m_cms.getSitePath(res); CmsSynchronizeList syncList = m_syncList.get(translate(resname)); m_newSyncList.put(translate(resname), syncList); // .. and remove it from the old one m_syncList.remove(translate(resname)); // update the report m_report.print(org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_SUCCESSION_1, String.valueOf(m_count++)), I_CmsReport.FORMAT_NOTE); m_report.print(Messages.get().container(Messages.RPT_SKIPPING_0), I_CmsReport.FORMAT_NOTE); m_report.println( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_ARGUMENT_1, resname)); }
throw new CmsSynchronizeException(Messages.get().container(Messages.ERR_EXISTENT_FILE_1, newFile.getPath())); fOut = new FileOutputStream(newFile); } else { throw new CmsSynchronizeException( Messages.get().container(Messages.ERR_CREATE_DIR_1, newFile.getPath())); throw new CmsSynchronizeException(Messages.get().container( Messages.ERR_CREATE_FILE_1, this.getClass().getName(),
/** * Initializes the synchronize settings object for this dialog.<p> */ protected void initSynchronizeSettingsObject() { Object o = getDialogObject(); if ((o == null) || !(o instanceof CmsSynchronizeSettings)) { CmsUserSettings userSettings = new CmsUserSettings(getCms()); o = userSettings.getSynchronizeSettings(); } if (o != null) { m_synchronizeSettings = (CmsSynchronizeSettings)o; } else { m_synchronizeSettings = new CmsSynchronizeSettings(); } }
/** * @see java.lang.Runnable#run() */ @Override public void run() { I_CmsReport report = getReport(); report.println(Messages.get().container(Messages.RPT_SYNCHRONIZE_BEGIN_0), I_CmsReport.FORMAT_HEADLINE); try { new CmsSynchronize(getCms(), m_settings, getReport()); } catch (Throwable e) { m_error = e; report.println(e); } report.println(Messages.get().container(Messages.RPT_SYNCHRONIZE_END_0), I_CmsReport.FORMAT_HEADLINE); } }
long modifiedVfs = new Long(tok.nextToken()).longValue(); long modifiedFs = new Long(tok.nextToken()).longValue(); CmsSynchronizeList sync = new CmsSynchronizeList(resName, tranResName, modifiedVfs, modifiedFs); syncList.put(translate(resName), sync); throw new CmsSynchronizeException(Messages.get().container(Messages.ERR_READ_SYNC_LIST_0), e); } finally {
if (isEnabled() && (m_destinationPathInRfs == null)) { throw new CmsSynchronizeException(Messages.get().container(Messages.ERR_NO_RFS_DESTINATION_0)); if (isEnabled() && ((m_sourceListInVfs == null) || (m_sourceListInVfs.size() == 0))) { throw new CmsSynchronizeException(Messages.get().container(Messages.ERR_NO_VFS_SOURCE_0));
/** * Returns true if the user has enabled synchronization.<p> * * @return true if the user has enabled synchronization */ public boolean isSyncEnabled() { CmsSynchronizeSettings syncSettings = getSettings().getUserSettings().getSynchronizeSettings(); return (syncSettings != null) && syncSettings.isSyncEnabled(); }
/** * Updates the synchronization lists if a resource is not used during the * synchronization process.<p> * * @param res the resource whose entry must be updated */ private void skipResource(CmsResource res) { // add the file to the new sync list... String resname = m_cms.getSitePath(res); CmsSynchronizeList syncList = (CmsSynchronizeList)m_syncList.get(translate(resname)); m_newSyncList.put(translate(resname), syncList); // .. and remove it from the old one m_syncList.remove(translate(resname)); // update the report m_report.print(org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_SUCCESSION_1, String.valueOf(m_count++)), I_CmsReport.FORMAT_NOTE); m_report.print(Messages.get().container(Messages.RPT_SKIPPING_0), I_CmsReport.FORMAT_NOTE); m_report.println(org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_ARGUMENT_1, resname)); }
/** * Returns <code>true</code> if the synchonization is enabled.<p> * * The synchonization is enabled if both source and destination * path is set, and also the enabled flag is true.<p> * * @return <code>true</code> if the synchonization is enabled */ public boolean isSyncEnabled() { return isEnabled() && (m_sourceListInVfs != null) && (m_destinationPathInRfs != null); }
/** * @see org.opencms.main.CmsException#createException(org.opencms.i18n.CmsMessageContainer, java.lang.Throwable) */ @Override public CmsException createException(CmsMessageContainer container, Throwable cause) { return new CmsSynchronizeException(container, cause); } }
/** * Sets the source path list of the synchronization in the OpenCms VFS.<p> * * The objects in the list must be of type <code>{@link String}</code>. * * @param sourceListInVfs the source path list of the synchronization in the OpenCms VFS to set */ public void setSourceListInVfs(List sourceListInVfs) { if (sourceListInVfs == null) { m_sourceListInVfs = new ArrayList(); } else { m_sourceListInVfs = optimizeSourceList(sourceListInVfs); } }
/** * @see java.lang.Runnable#run() */ @Override public void run() { I_CmsReport report = getReport(); report.println(Messages.get().container(Messages.RPT_SYNCHRONIZE_BEGIN_0), I_CmsReport.FORMAT_HEADLINE); try { new CmsSynchronize(getCms(), m_settings, getReport()); } catch (Throwable e) { m_error = e; report.println(e); } report.println(Messages.get().container(Messages.RPT_SYNCHRONIZE_END_0), I_CmsReport.FORMAT_HEADLINE); } }
/** * @see org.opencms.workplace.tools.I_CmsToolHandler#isEnabled(org.opencms.file.CmsObject) */ public boolean isEnabled(CmsObject cms) { if (getPath().startsWith("/workplace/broadcast") || getPath().equals("/workplace")) { if (OpenCms.getRoleManager().hasRole(cms, CmsRole.ACCOUNT_MANAGER)) { return true; } } if (getPath().startsWith("/workplace/synchronize_action")) { CmsUserSettings settings = new CmsUserSettings(cms); CmsSynchronizeSettings syncSettings = settings.getSynchronizeSettings(); return (syncSettings != null) && syncSettings.isSyncEnabled(); } return OpenCms.getRoleManager().hasRole(cms, CmsRole.WORKPLACE_MANAGER); }