/** * Returns the publish history id.<p> * * @return the publish history id */ public CmsUUID getPublishHistoryId() { return m_publishJob.getPublishHistoryId(); }
/** * Returns the publish history id.<p> * * @return the publish history id */ public CmsUUID getPublishHistoryId() { return m_publishJob.getPublishHistoryId(); }
/** * Returns the publish job from the history with the given cache key or <code>null</code> if not found.<p> * * @param key the cache key to look for * * @return the publish job with the given cache key */ public CmsPublishJobInfoBean getCachedPublishJobInHistory(String key) { for (Object obj : m_publishHistory) { CmsPublishJobInfoBean publishJob = (CmsPublishJobInfoBean)obj; if (publishJob.getPublishHistoryId().toString().equals(key)) { return publishJob; } } return null; }
/** * Returns the publish job with the given cache key or <code>null</code> if not found.<p> * * @param key the cache key to look for * * @return the publish job with the given cache key */ public CmsPublishJobInfoBean getCachedPublishJob(String key) { synchronized (m_publishQueue) { for (Object obj : m_publishQueue) { CmsPublishJobInfoBean publishJob = (CmsPublishJobInfoBean)obj; if (publishJob.getPublishHistoryId().toString().equals(key)) { return publishJob; } } } return null; }
/** * Returns the publish job from the history with the given cache key or <code>null</code> if not found.<p> * * @param key the cache key to look for * * @return the publish job with the given cache key */ public CmsPublishJobInfoBean getCachedPublishJobInHistory(String key) { for (Iterator<CmsPublishJobInfoBean> i = m_publishHistory.iterator(); i.hasNext();) { CmsPublishJobInfoBean publishJob = i.next(); if (publishJob.getPublishHistoryId().toString().equals(key)) { return publishJob; } } return null; }
/** * Returns the publish job with the given cache key or <code>null</code> if not found.<p> * * @param key the cache key to look for * * @return the publish job with the given cache key */ public CmsPublishJobInfoBean getCachedPublishJob(String key) { for (Iterator<CmsPublishJobInfoBean> i = m_publishQueue.iterator(); i.hasNext();) { CmsPublishJobInfoBean publishJob = i.next(); if (publishJob.getPublishHistoryId().toString().equals(key)) { return publishJob; } } return null; }
result.append(this.getClass().getName()); result.append(", history id: "); result.append(getPublishHistoryId().toString()); result.append(", project id "); result.append(getProjectId().toString());
/** * Writes the publish report for a publish job.<p> * * @param dbc the current database context * @param publishJob the publish job * @throws CmsException if something goes wrong */ public void writePublishReport(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) throws CmsException { CmsPublishReport report = (CmsPublishReport)publishJob.removePublishReport(); if (report != null) { m_projectDriver.writePublishReport(dbc, publishJob.getPublishHistoryId(), report.getContents()); } }
/** * Writes the publish report for a publish job.<p> * * @param dbc the current database context * @param publishJob the publish job * @throws CmsException if something goes wrong */ public void writePublishReport(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) throws CmsException { CmsPublishReport report = (CmsPublishReport)publishJob.removePublishReport(); if (report != null) { getProjectDriver(dbc).writePublishReport(dbc, publishJob.getPublishHistoryId(), report.getContents()); } }
/** * @see org.opencms.db.I_CmsProjectDriver#writePublishJob(org.opencms.db.CmsDbContext, org.opencms.publish.CmsPublishJobInfoBean) */ public void writePublishJob(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) throws CmsDataAccessException { Connection conn = null; PreparedStatement stmt = null; try { conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, "C_PUBLISHJOB_WRITE"); stmt.setString(1, publishJob.getProjectId().toString()); stmt.setString(2, publishJob.getProjectName()); stmt.setString(3, publishJob.getUserId().toString()); stmt.setString(4, publishJob.getLocale().toString()); stmt.setInt(5, publishJob.getFlags()); stmt.setInt(6, publishJob.getSize()); stmt.setLong(7, publishJob.getEnqueueTime()); stmt.setLong(8, publishJob.getStartTime()); stmt.setLong(9, publishJob.getFinishTime()); stmt.setString(10, publishJob.getPublishHistoryId().toString()); stmt.executeUpdate(); } catch (SQLException e) { throw new CmsDbSqlException(Messages.get().container( Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, null); } }
/** * @see org.opencms.db.I_CmsProjectDriver#writePublishJob(org.opencms.db.CmsDbContext, org.opencms.publish.CmsPublishJobInfoBean) */ public void writePublishJob(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) throws CmsDataAccessException { Connection conn = null; PreparedStatement stmt = null; try { conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, "C_PUBLISHJOB_WRITE"); stmt.setString(1, publishJob.getProjectId().toString()); stmt.setString(2, publishJob.getProjectName()); stmt.setString(3, publishJob.getUserId().toString()); stmt.setString(4, publishJob.getLocale().toString()); stmt.setInt(5, publishJob.getFlags()); stmt.setInt(6, publishJob.getSize()); stmt.setLong(7, publishJob.getEnqueueTime()); stmt.setLong(8, publishJob.getStartTime()); stmt.setLong(9, publishJob.getFinishTime()); stmt.setString(10, publishJob.getPublishHistoryId().toString()); stmt.executeUpdate(); } catch (SQLException e) { throw new CmsDbSqlException( Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, null); } }
/** * Aborts the given publish job.<p> * * @param publishJob the publish job to abort * * @return <code>true</code> if the publish job was found */ protected boolean abortPublishJob(CmsPublishJobInfoBean publishJob) { if (OpenCms.getMemoryMonitor().getCachedPublishJob(publishJob.getPublishHistoryId().toString()) != null) { // remove publish job from cache OpenCms.getMemoryMonitor().uncachePublishJob(publishJob); return true; } else { return false; } }
/** * Aborts the given publish job.<p> * * @param publishJob the publish job to abort * * @return <code>true</code> if the publish job was found */ protected boolean abortPublishJob(CmsPublishJobInfoBean publishJob) { if (OpenCms.getMemoryMonitor().getCachedPublishJob(publishJob.getPublishHistoryId().toString()) != null) { // remove publish job from cache OpenCms.getMemoryMonitor().uncachePublishJob(publishJob); return true; } else { return false; } }
/** * Removes the given job from the list.<p> * * @param publishJob the publish job to remove * * @throws CmsException if something goes wrong */ protected void remove(CmsPublishJobInfoBean publishJob) throws CmsException { try { // signalizes that job will be removed m_publishEngine.publishJobRemoved(publishJob); } finally { // remove publish job from cache OpenCms.getMemoryMonitor().uncachePublishJob(publishJob); } // remove job from database if necessary if (OpenCms.getMemoryMonitor().requiresPersistency()) { CmsDbContext dbc = m_publishEngine.getDbContext(null); try { m_publishEngine.getDriverManager().deletePublishJob(dbc, publishJob.getPublishHistoryId()); } catch (CmsException e) { dbc.rollback(); LOG.error(e.getLocalizedMessage(), e); throw e; } finally { dbc.clear(); } } }
/** * Removes the given job from the list.<p> * * @param publishJob the publish job to remove * * @throws CmsException if something goes wrong */ protected void remove(CmsPublishJobInfoBean publishJob) throws CmsException { OpenCms.getMemoryMonitor().uncachePublishJobInHistory(publishJob); // delete job from db if necessary if (OpenCms.getMemoryMonitor().requiresPersistency()) { CmsDbContext dbc = m_publishEngine.getDbContext(null); try { OpenCms.getPublishManager().getEngine().getDriverManager().deletePublishJob( dbc, publishJob.getPublishHistoryId()); } catch (CmsException e) { dbc.rollback(); LOG.error(e.getLocalizedMessage(), e); throw e; } finally { dbc.clear(); } } m_publishEngine.publishJobRemoved(publishJob); } }
/** * Adds the given publish job to the list.<p> * * @param publishJob the publish job object to add * * @throws CmsException if something goes wrong */ protected void add(CmsPublishJobInfoBean publishJob) throws CmsException { OpenCms.getMemoryMonitor().cachePublishJobInHistory(publishJob); // write job to db if necessary if (OpenCms.getMemoryMonitor().requiresPersistency()) { CmsDbContext dbc = m_publishEngine.getDbContext(null); try { m_publishEngine.getDriverManager().writePublishJob(dbc, publishJob); // additionally, write the publish report m_publishEngine.getDriverManager().writePublishReport(dbc, publishJob); // delete publish list of started job m_publishEngine.getDriverManager().deletePublishList(dbc, publishJob.getPublishHistoryId()); } catch (CmsException e) { dbc.rollback(); LOG.error(e.getLocalizedMessage(), e); throw e; } finally { dbc.clear(); } } }
/** * Removes the given job from the list.<p> * * @param publishJob the publish job to remove * * @throws CmsException if something goes wrong */ protected void remove(CmsPublishJobInfoBean publishJob) throws CmsException { try { // signalizes that job will be removed m_publishEngine.publishJobRemoved(publishJob); } finally { // remove publish job from cache OpenCms.getMemoryMonitor().uncachePublishJob(publishJob); } // remove job from database if necessary if (OpenCms.getMemoryMonitor().requiresPersistency()) { CmsDbContext dbc = m_publishEngine.getDbContextFactory().getDbContext(); try { m_publishEngine.getDriverManager().deletePublishJob(dbc, publishJob.getPublishHistoryId()); } finally { dbc.clear(); } } }
/** * Removes the given job from the list.<p> * * @param publishJob the publish job to remove * * @throws CmsException if something goes wrong */ protected void remove(CmsPublishJobInfoBean publishJob) throws CmsException { OpenCms.getMemoryMonitor().uncachePublishJobInHistory(publishJob); // delete job from db if necessary if (OpenCms.getMemoryMonitor().requiresPersistency()) { CmsDbContext dbc = m_publishEngine.getDbContextFactory().getDbContext(); try { OpenCms.getPublishManager().getEngine().getDriverManager().deletePublishJob( dbc, publishJob.getPublishHistoryId()); } finally { dbc.clear(); } } m_publishEngine.publishJobRemoved(publishJob); } }
/** * Adds the given publish job to the list.<p> * * @param publishJob the publish job object to add * * @throws CmsException if something goes wrong */ protected void add(CmsPublishJobInfoBean publishJob) throws CmsException { OpenCms.getMemoryMonitor().cachePublishJobInHistory(publishJob); // write job to db if necessary if (OpenCms.getMemoryMonitor().requiresPersistency()) { CmsDbContext dbc = m_publishEngine.getDbContextFactory().getDbContext(); try { m_publishEngine.getDriverManager().writePublishJob(dbc, publishJob); // additionally, write the publish report m_publishEngine.getDriverManager().writePublishReport(dbc, publishJob); // delete publish list of started job m_publishEngine.getDriverManager().deletePublishList(dbc, publishJob.getPublishHistoryId()); } finally { dbc.clear(); } } }
/** * @see org.opencms.db.I_CmsProjectDriver#writePublishJob(org.opencms.db.CmsDbContext, org.opencms.publish.CmsPublishJobInfoBean) */ public void writePublishJob(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) throws CmsDataAccessException { try { CmsDAOPublishJobs pj = m_sqlManager.find( dbc, CmsDAOPublishJobs.class, publishJob.getPublishHistoryId().toString()); if (pj != null) { pj.setProjectId(publishJob.getProjectId().toString()); pj.setProjectName(publishJob.getProjectName()); pj.setUserId(publishJob.getUserId().toString()); pj.setPublishLocale(publishJob.getLocale().toString()); pj.setPublishFlags(publishJob.getFlags()); pj.setResourceCount(publishJob.getSize()); pj.setEnqueueTime(publishJob.getEnqueueTime()); pj.setStartTime(publishJob.getStartTime()); pj.setFinishTime(publishJob.getFinishTime()); } } catch (PersistenceException e) { throw new CmsDataAccessException(Messages.get().container(Messages.ERR_JPA_PERSITENCE_1, e), e); } }