/** * Sets if the publish queue is re-initialized on startup.<p> * * @param publishQueuePersistance the persistence flag, parsed as <code>boolean</code> */ public void setPublishQueuePersistance(String publishQueuePersistance) { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0)); } m_publishQueuePersistance = Boolean.valueOf(publishQueuePersistance).booleanValue(); }
/** * Sets if the publish queue is re-initialized on startup.<p> * * @param publishQueuePersistance the persistence flag, parsed as <code>boolean</code> */ public void setPublishQueuePersistance(String publishQueuePersistance) { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0)); } m_publishQueuePersistance = Boolean.valueOf(publishQueuePersistance).booleanValue(); }
/** * Sets the publish History Size.<p> * * @param publishHistorySize the publish History Size to set */ public void setPublishHistorySize(String publishHistorySize) { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0)); } m_publishHistorySize = Integer.parseInt(publishHistorySize); }
/** * Sets the publish queue shutdown time. * * @param publishQueueShutdowntime the shutdown time to set, parsed as <code>int</code> */ public void setPublishQueueShutdowntime(String publishQueueShutdowntime) { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0)); } m_publishQueueShutdowntime = Integer.parseInt(publishQueueShutdowntime); }
/** * Sets the publish queue shutdown time. * * @param publishQueueShutdowntime the shutdown time to set, parsed as <code>int</code> */ public void setPublishQueueShutdowntime(String publishQueueShutdowntime) { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0)); } m_publishQueueShutdowntime = Integer.parseInt(publishQueueShutdowntime); }
/** * Sets the publish History Size.<p> * * @param publishHistorySize the publish History Size to set */ public void setPublishHistorySize(String publishHistorySize) { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0)); } m_publishHistorySize = Integer.parseInt(publishHistorySize); }
/** * Sets the publish engine during initialization.<p> * * @param publishEngine the publish engine instance */ public void setPublishEngine(CmsPublishEngine publishEngine) { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0)); } m_publishEngine = publishEngine; }
/** * Sets the security manager during initialization.<p> * * @param securityManager the security manager */ public void setSecurityManager(CmsSecurityManager securityManager) { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0)); } m_securityManager = securityManager; }
/** * Sets the publish engine during initialization.<p> * * @param publishEngine the publish engine instance */ public void setPublishEngine(CmsPublishEngine publishEngine) { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0)); } m_publishEngine = publishEngine; }
/** * Sets the security manager during initialization.<p> * * @param securityManager the security manager */ public void setSecurityManager(CmsSecurityManager securityManager) { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0)); } m_securityManager = securityManager; }
/** * Sets the publish list remove mode.<p> * * @param publishListRemoveMode the publish list remove mode */ public void setPublishListRemoveMode(CmsPublishManager.PublishListRemoveMode publishListRemoveMode) { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0)); } m_publishListRemoveMode = publishListRemoveMode; }
/** * Aborts the current job.<p> * * This can only be done until the publish job started event is fired.<p> * * @throws CmsPublishException if the current publish can not be aborted */ protected void abort() throws CmsPublishException { if (m_started) { throw new CmsPublishException(Messages.get().container(Messages.ERR_PUBLISH_ENGINE_MISSING_PUBLISH_JOB_0)); } m_abort = true; }
/** * Aborts the current job.<p> * * This can only be done until the publish job started event is fired.<p> * * @throws CmsPublishException if the current publish can not be aborted */ protected void abort() throws CmsPublishException { if (m_started) { throw new CmsPublishException(Messages.get().container(Messages.ERR_PUBLISH_ENGINE_MISSING_PUBLISH_JOB_0)); } m_abort = true; }
/** * Signalizes the start of the publish job.<p> * Actually sets the starting time, writes the report header and sets the running thread uuid.<p> * * @param threadUUID the running thread uuid */ protected void start(CmsUUID threadUUID) { if (m_startTime != 0) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_PUBLISH_JOB_ALREADY_STARTED_0)); } m_startTime = System.currentTimeMillis(); m_threadUUID = threadUUID; if (getPublishReport() instanceof CmsPublishReport) { ((CmsPublishReport)m_publishReport).start(); } } }
/** * Signalizes the start of the publish job.<p> * Actually sets the starting time, writes the report header and sets the running thread uuid.<p> * * @param threadUUID the running thread uuid */ protected void start(CmsUUID threadUUID) { if (m_startTime != 0) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_PUBLISH_JOB_ALREADY_STARTED_0)); } m_startTime = System.currentTimeMillis(); m_threadUUID = threadUUID; if (getPublishReport() instanceof CmsPublishReport) { ((CmsPublishReport)m_publishReport).start(); } } }
/** * Signalizes the end of the publish job.<p> * Actually only sets the finish time and closes the publish report stream.<p> */ protected void finish() { if (m_finishTime != 0) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_PUBLISH_JOB_ALREADY_FINISHED_0)); } m_cms = null; m_report = null; m_size = m_publishList.size(); m_publishList = null; if (m_publishReport instanceof CmsPublishReport) { ((CmsPublishReport)m_publishReport).finish(); } m_threadUUID = null; m_finishTime = System.currentTimeMillis(); }
/** * Signalizes the end of the publish job.<p> * Actually only sets the finish time and closes the publish report stream.<p> */ protected void finish() { if (m_finishTime != 0) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_PUBLISH_JOB_ALREADY_FINISHED_0)); } m_cms = null; m_report = null; m_size = m_publishList.size(); m_publishList = null; if (m_publishReport instanceof CmsPublishReport) { ((CmsPublishReport)m_publishReport).finish(); } m_threadUUID = null; m_finishTime = System.currentTimeMillis(); }
/** * Checks whether the given publish job is OK, and throws an exception otherwise.<p> * * @param publishList the publish list * @throws CmsException if there's something wrong with the publish job */ public void checkPublishList(CmsPublishList publishList) throws CmsException { for (CmsResource resource : publishList.getAllResources()) { for (ForbiddenFolderEntry entry : m_forbiddenParentFolders.values()) { if (CmsStringUtil.isPrefixPath(entry.getRootPath(), resource.getRootPath())) { throw new CmsPublishException( Messages.get().container( Messages.ERR_PUBLISH_FORBIDDEN_PARENT_FOLDER_3, resource.getRootPath(), entry.getRootPath(), entry.getReason())); } } } }
/** * Aborts the given publish job.<p> * * @param cms the cms context * @param publishJob the publish job to abort * @param removeJob indicates if the job will be removed or added to history * * @throws CmsException if there is some problem during unlocking the resources * @throws CmsSecurityException if the current user has not enough permissions * @throws CmsPublishException if the publish job can not been aborted */ public void abortPublishJob(CmsObject cms, CmsPublishJobEnqueued publishJob, boolean removeJob) throws CmsException, CmsSecurityException, CmsPublishException { if (!OpenCms.getRoleManager().hasRole(cms, CmsRole.PROJECT_MANAGER) && !cms.getRequestContext().getCurrentUser().getId().equals(publishJob.getUserId())) { // Can only be executed by somebody with the role CmsRole#PROJECT_MANAGER or the owner of the job throw new CmsSecurityException( Messages.get().container( Messages.ERR_PUBLISH_ENGINE_ABORT_DENIED_1, cms.getRequestContext().getCurrentUser().getName())); } m_publishEngine.abortPublishJob(cms.getRequestContext().getCurrentUser().getId(), publishJob, removeJob); }
/** * Aborts the given publish job.<p> * * @param cms the cms context * @param publishJob the publish job to abort * @param removeJob indicates if the job will be removed or added to history * * @throws CmsException if there is some problem during unlocking the resources * @throws CmsSecurityException if the current user has not enough permissions * @throws CmsPublishException if the publish job can not been aborted */ public void abortPublishJob(CmsObject cms, CmsPublishJobEnqueued publishJob, boolean removeJob) throws CmsException, CmsSecurityException, CmsPublishException { if (!OpenCms.getRoleManager().hasRole(cms, CmsRole.PROJECT_MANAGER) && !cms.getRequestContext().currentUser().getId().equals(publishJob.getUserId())) { // Can only be executed by somebody with the role CmsRole#PROJECT_MANAGER or the owner of the job throw new CmsSecurityException(Messages.get().container( Messages.ERR_PUBLISH_ENGINE_ABORT_DENIED_1, cms.getRequestContext().currentUser().getName())); } m_publishEngine.abortPublishJob(cms.getRequestContext().currentUser().getId(), publishJob, removeJob); }