result.append(this.getClass().getName()); result.append(", history id: "); result.append(getPublishHistoryId().toString()); result.append(", project id "); result.append(getProjectId().toString()); result.append(", project name: "); result.append(getProjectName()); result.append(", user id: "); result.append(getUserId().toString()); result.append(", locale: "); result.append(getLocale().toString()); result.append(", flags: "); result.append(getFlags()); result.append(", size: "); result.append(getSize()); result.append(", enqueue time: "); result.append(getEnqueueTime()); result.append(", start time: "); result.append(getStartTime()); result.append(", finish time: "); result.append(getFinishTime()); result.append("]");
CmsPublishJobInfoBean job = (CmsPublishJobInfoBean)i.next(); dbc = m_publishEngine.getDbContextFactory().getDbContext(); if (!job.isStarted()) { job.revive(adminCms, driverManager.readPublishList(dbc, job.getPublishHistoryId())); m_publishEngine.lockPublishList(job); OpenCms.getMemoryMonitor().cachePublishJob(job); LOG.error(Messages.get().getBundle().key( Messages.ERR_PUBLISH_JOB_INVALID_1, job.getPublishHistoryId()), exc); m_publishEngine.getDriverManager().deletePublishJob(dbc, job.getPublishHistoryId()); } finally { dbc.clear(); try { job.revive(adminCms, driverManager.readPublishList(dbc, job.getPublishHistoryId())); m_publishEngine.unlockPublishList(job); new CmsPublishJobEnqueued(job).m_publishJob.finish(); m_publishEngine.getPublishHistory().add(job); } catch (CmsException exc) {
CmsDbContext dbc = m_dbContextFactory.getDbContext(publishJob.getCmsObject().getRequestContext()); try { eventData.put(I_CmsEventListener.KEY_REPORT, publishJob.getPublishReport()); eventData.put( I_CmsEventListener.KEY_PUBLISHID, publishJob.getPublishList().getPublishHistoryId().toString()); eventData.put(I_CmsEventListener.KEY_PROJECTID, dbc.currentProject().getUuid()); eventData.put(I_CmsEventListener.KEY_DBCONTEXT, dbc); publishJob.getPublishReport().println(t); } finally { if (dbc != null) { publishJob.finish(); } catch (Throwable t) {
m_publishJob.start(getUUID()); m_report = m_publishJob.getPublishReport(); try { CmsObject jspCms = OpenCms.initCmsObject(m_publishJob.getCmsObject()); jspCms.getRequestContext().setCurrentProject(jspCms.readProject(CmsProject.ONLINE_PROJECT_ID)); Messages.get().container(Messages.RPT_JSPLOADER_UPDATE_CACHE_BEGIN_0), I_CmsReport.FORMAT_HEADLINE); Iterator it = m_publishJob.getPublishList().getFileList().iterator(); while (it.hasNext()) { CmsResource resource = (CmsResource)it.next(); try { m_publishEngine.getDriverManager().publishJob(getCms(), dbc, m_publishJob.getPublishList(), m_report);
/** * 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(); } }
/** * 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; }
CmsPublishJobInfoBean publishJob = new CmsPublishJobInfoBean(cms, publishList, report); try { Messages.get().container(Messages.ERR_PUBLISH_ENGINE_QUEUE_1, publishJob.getPublishHistoryId()), t);
/** * Returns the time this object has been created.<p> * * @return the time this object has been created */ public long getEnqueueTime() { return m_publishJob.getEnqueueTime(); }
/** * Creates a <code>CmsPublishJobInfoBean</code> from a result set.<p> * * @param res the result set * @return an initialized <code>CmsPublishJobInfoBean</code> * @throws SQLException if something goes wrong */ protected CmsPublishJobInfoBean createPublishJobInfoBean(ResultSet res) throws SQLException { return new CmsPublishJobInfoBean( new CmsUUID(res.getString("HISTORY_ID")), new CmsUUID(res.getString("PROJECT_ID")), res.getString("PROJECT_NAME"), new CmsUUID(res.getString("USER_ID")), res.getString("PUBLISH_LOCALE"), res.getInt("PUBLISH_FLAGS"), res.getInt("RESOURCE_COUNT"), res.getLong("ENQUEUE_TIME"), res.getLong("START_TIME"), res.getLong("FINISH_TIME")); }
/** * Returns the time the publish job ends.<p> * * @return the time the publish job ends */ public long getFinishTime() { return m_publishJob.getFinishTime(); }
/** * Returns the locale for this publish job.<p> * * @return the locale for this publish job */ public Locale getLocale() { return m_publishJob.getLocale(); }
/** * Returns the project name or {@link org.opencms.publish.Messages#GUI_DIRECT_PUBLISH_PROJECT_NAME_0} * if it is a direct publish job.<p> * * @return the project name */ public String getProjectName() { return m_publishJob.getProjectName(); }
/** * 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 } }
/** * Pushes a new publish job with the given information in publish queue.<p> * * If possible, the publish job starts immediately.<p> * * @param publishJob the publish job to enqueue * * @throws CmsException if something goes wrong */ protected void add(CmsPublishJobInfoBean publishJob) throws CmsException { // set the queue status in the publish job publishJob.enqueue(); // add job to database if necessary if (OpenCms.getMemoryMonitor().requiresPersistency()) { CmsDbContext dbc = m_publishEngine.getDbContext(null); try { // this operation may in rare circumstances fail with a DB exception // if this is the case the publish job must NOT be in the queue m_publishEngine.getDriverManager().createPublishJob(dbc, publishJob); } catch (CmsException e) { dbc.rollback(); LOG.error(e.getLocalizedMessage(), e); throw e; } finally { dbc.clear(); } } // add publish job to cache OpenCms.getMemoryMonitor().cachePublishJob(publishJob); }
publishJob.m_publishJob.finish(); getPublishHistory().add(publishJob.m_publishJob); } else {
CmsPublishJobInfoBean job = i.next(); dbc = m_publishEngine.getDbContext(null); if (!job.isStarted()) { job.revive(adminCms, driverManager.readPublishList(dbc, job.getPublishHistoryId())); m_publishEngine.lockPublishList(job); OpenCms.getMemoryMonitor().cachePublishJob(job); Messages.get().getBundle().key( Messages.ERR_PUBLISH_JOB_INVALID_1, job.getPublishHistoryId()), exc); m_publishEngine.getDriverManager().deletePublishJob(dbc, job.getPublishHistoryId()); } finally { dbc.clear(); try { job.revive(adminCms, driverManager.readPublishList(dbc, job.getPublishHistoryId())); m_publishEngine.unlockPublishList(job); new CmsPublishJobEnqueued(job).m_publishJob.finish(); m_publishEngine.getPublishHistory().add(job); } catch (CmsException exc) {
CmsDbContext dbc = m_dbContextFactory.getDbContext(publishJob.getCmsObject().getRequestContext()); try { eventData.put(I_CmsEventListener.KEY_REPORT, publishJob.getPublishReport()); eventData.put( I_CmsEventListener.KEY_PUBLISHID, publishJob.getPublishList().getPublishHistoryId().toString()); eventData.put(I_CmsEventListener.KEY_PROJECTID, dbc.currentProject().getUuid()); eventData.put(I_CmsEventListener.KEY_DBCONTEXT, dbc); } catch (Throwable t) { publishJob.getPublishReport().println(t); } finally { try { publishJob.finish();
/** * 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(); } }
/** * 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; }
CmsPublishJobInfoBean publishJob = new CmsPublishJobInfoBean(cms, publishList, report); try { publishJob.getPublishHistoryId()), t);