/** * Returns a publish report instance that writes to the given report as well as * to the given temporary file.<p> * * @param report the report to decorate * * @return the publish report */ protected static CmsPrintStreamReport decorate(final I_CmsReport report) { return new CmsPublishReport(report); }
/** * Constructs a new publish report using the provided locale for the output language.<p> * * @param outputStream the underlying byte array output stream * @param locale the locale to use for the output language * */ private CmsPublishReport(ByteArrayOutputStream outputStream, Locale locale) { super(new PrintStream(outputStream), locale, true); init(locale, null); m_outputStream = outputStream; }
/** * 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; }
/** * 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()); } }
/** * Constructs a new publish report decorating the provided report.<p> * * @param report the report to decorate */ private CmsPublishReport(I_CmsReport report) { this(new ByteArrayOutputStream(), report.getLocale()); m_report = report; if (report instanceof CmsHtmlReport) { if (((CmsHtmlReport)report).isWriteHtml()) { try { m_outputStream.write(CmsStringUtil.substitute(getReportUpdate(), "\\n", "").getBytes()); } catch (IOException e) { // ignore } } } }
/** * 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(); }
/** * 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; }
/** * 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()); } }
/** * Constructs a new publish report decorating the provided report.<p> * * @param report the report to decorate */ private CmsPublishReport(I_CmsReport report) { this(new ByteArrayOutputStream(), report.getLocale()); m_report = report; if (report instanceof CmsHtmlReport) { if (((CmsHtmlReport)report).isWriteHtml()) { try { m_outputStream.write(CmsStringUtil.substitute(getReportUpdate(), "\\n", "").getBytes()); } catch (IOException e) { // ignore } } } }
/** * 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(); }
/** * Constructs a new publish report using the provided locale for the output language.<p> * * @param outputStream the underlying byte array output stream * @param locale the locale to use for the output language * */ private CmsPublishReport(ByteArrayOutputStream outputStream, Locale locale) { super(new PrintStream(outputStream), locale, true); init(locale, null); m_outputStream = outputStream; }
/** * Returns a publish report instance that writes to the given report as well as * to the given temporary file.<p> * * @param report the report to decorate * * @return the publish report */ protected static CmsPrintStreamReport decorate(final I_CmsReport report) { return new CmsPublishReport(report); }