/** * Sets publish locks of resources in a publish list.<p> * * @param publishJob the publish job * @throws CmsException if something goes wrong */ protected void lockPublishList(CmsPublishJobInfoBean publishJob) throws CmsException { CmsPublishList publishList = publishJob.getPublishList(); // lock them CmsDbContext dbc = getDbContextFactory().getDbContext(publishJob.getCmsObject().getRequestContext()); try { Iterator itResources = publishList.getAllResources().iterator(); while (itResources.hasNext()) { CmsResource resource = (CmsResource)itResources.next(); m_driverManager.lockResource(dbc, resource, CmsLockType.PUBLISH); } } finally { dbc.clear(); } }
/** * Removes all publish locks of resources in a publish list of a publish job.<p> * * @param publishJob the publish job * @throws CmsException if something goes wrong */ protected void unlockPublishList(CmsPublishJobInfoBean publishJob) throws CmsException { CmsPublishList publishList = publishJob.getPublishList(); List allResources = publishList.getAllResources(); // unlock them CmsDbContext dbc = getDbContextFactory().getDbContext(publishJob.getCmsObject().getRequestContext()); try { Iterator itResources = allResources.iterator(); while (itResources.hasNext()) { CmsResource resource = (CmsResource)itResources.next(); m_driverManager.unlockResource(dbc, resource, true, true); } } finally { dbc.clear(); } }
/** * Sets publish locks of resources in a publish list.<p> * * @param publishJob the publish job * @throws CmsException if something goes wrong */ protected void lockPublishList(CmsPublishJobInfoBean publishJob) throws CmsException { CmsPublishList publishList = publishJob.getPublishList(); // lock them CmsDbContext dbc = getDbContext(publishJob.getCmsObject().getRequestContext()); try { Iterator<CmsResource> itResources = publishList.getAllResources().iterator(); while (itResources.hasNext()) { CmsResource resource = itResources.next(); m_driverManager.lockResource(dbc, resource, CmsLockType.PUBLISH); } } catch (CmsException e) { dbc.rollback(); LOG.error(e.getLocalizedMessage(), e); throw e; } finally { dbc.clear(); } }
/** * Removes all publish locks of resources in a publish list of a publish job.<p> * * @param publishJob the publish job * @throws CmsException if something goes wrong */ protected void unlockPublishList(CmsPublishJobInfoBean publishJob) throws CmsException { CmsPublishList publishList = publishJob.getPublishList(); List<CmsResource> allResources = publishList.getAllResources(); // unlock them CmsDbContext dbc = getDbContext(publishJob.getCmsObject().getRequestContext()); try { Iterator<CmsResource> itResources = allResources.iterator(); while (itResources.hasNext()) { CmsResource resource = itResources.next(); m_driverManager.unlockResource(dbc, resource, true, true); } } catch (CmsException e) { dbc.rollback(); LOG.error(e.getLocalizedMessage(), e); throw e; } finally { dbc.clear(); } }
/** * Returns the report for this publish job.<p> * * This is not the original report, it is wrapper that * also writes to a temporary file.<p> * * It will be <code>null</code> before starting and after finishing.<p> * * @return the report for this publish job * * @see CmsPublishJobEnqueued#getReport() */ public I_CmsReport getPublishReport() { if ((m_publishReport == null) && (m_finishTime == 0) && (m_startTime > 0)) { m_publishReport = getReport(); if (m_publishReport == null) { m_publishReport = new CmsPublishReport(getCmsObject().getRequestContext().getLocale()); } else { m_publishReport = CmsPublishReport.decorate(m_publishReport); } } return m_publishReport; }
/** * Returns the report for this publish job.<p> * * This is not the original report, it is wrapper that * also writes to a temporary file.<p> * * It will be <code>null</code> before starting and after finishing.<p> * * @return the report for this publish job * * @see CmsPublishJobEnqueued#getReport() */ public I_CmsReport getPublishReport() { if ((m_publishReport == null) && (m_finishTime == 0) && (m_startTime > 0)) { m_publishReport = getReport(); if (m_publishReport == null) { m_publishReport = new CmsPublishReport(getCmsObject().getRequestContext().getLocale()); } else { m_publishReport = CmsPublishReport.decorate(m_publishReport); } } return m_publishReport; }
CmsDbContext dbc = m_dbContextFactory.getDbContext(publishJob.getCmsObject().getRequestContext()); try {
CmsDbContext dbc = m_dbContextFactory.getDbContext(publishJob.getCmsObject().getRequestContext()); try {
/** * Creates a thread that start a new publish job with the given information.<p> * * @param publishEngine the publish engine instance * @param publishJob the publish job to process * * @see org.opencms.publish.CmsPublishManager#getPublishList(org.opencms.file.CmsObject, org.opencms.file.CmsResource, boolean) * @see org.opencms.publish.CmsPublishManager#getPublishList(org.opencms.file.CmsObject) */ protected CmsPublishThread(CmsPublishEngine publishEngine, CmsPublishJobInfoBean publishJob) { super(publishJob.getCmsObject(), Messages.get().getBundle().key(Messages.GUI_PUBLISH_TRHEAD_NAME_0)); m_publishJob = publishJob; m_publishEngine = publishEngine; // if the project to publish is a temporary project if (getCms().getRequestContext().getCurrentProject().getType() == CmsProject.PROJECT_TYPE_TEMPORARY) { // we have to update the user info after publishing m_updateSessionInfo = true; } else { m_updateSessionInfo = false; } try { m_jspLoader = (CmsJspLoader)OpenCms.getResourceManager().getLoader(CmsJspLoader.RESOURCE_LOADER_ID); } catch (ArrayIndexOutOfBoundsException e) { // ignore, loader not configured } }
/** * Creates a thread that start a new publish job with the given information.<p> * * @param publishEngine the publish engine instance * @param publishJob the publish job to process * * @see org.opencms.publish.CmsPublishManager#getPublishList(org.opencms.file.CmsObject, org.opencms.file.CmsResource, boolean) * @see org.opencms.publish.CmsPublishManager#getPublishList(org.opencms.file.CmsObject) */ protected CmsPublishThread(CmsPublishEngine publishEngine, CmsPublishJobInfoBean publishJob) { super(publishJob.getCmsObject(), Messages.get().getBundle().key(Messages.GUI_PUBLISH_TRHEAD_NAME_0)); m_publishJob = publishJob; m_publishEngine = publishEngine; // if the project to publish is a temporary project if (getCms().getRequestContext().currentProject().getType() == CmsProject.PROJECT_TYPE_TEMPORARY) { // we have to update the user info after publishing m_updateSessionInfo = true; } else { m_updateSessionInfo = false; } try { m_jspLoader = (CmsJspLoader)OpenCms.getResourceManager().getLoader(CmsJspLoader.RESOURCE_LOADER_ID); } catch (ArrayIndexOutOfBoundsException e) { // ignore, loader not configured } }
try { CmsObject jspCms = OpenCms.initCmsObject(m_publishJob.getCmsObject()); jspCms.getRequestContext().setCurrentProject(jspCms.readProject(CmsProject.ONLINE_PROJECT_ID));
try { CmsObject jspCms = OpenCms.initCmsObject(m_publishJob.getCmsObject()); jspCms.getRequestContext().setCurrentProject(jspCms.readProject(CmsProject.ONLINE_PROJECT_ID));