Author: jleroux
Date: Wed Dec 14 10:16:04 2016 New Revision: 1774165 URL: http://svn.apache.org/viewvc?rev=1774165&view=rev Log: No functional change, assures that all Java files are svn:native This is mostly related with the new pricat component and 2 files in cmssite (I guess also related with the new pricat component ) Modified: ofbiz/trunk/specialpurpose/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/MultiSiteRequestWrapper.java (props changed) ofbiz/trunk/specialpurpose/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/WebSiteFilter.java (props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractHtmlReport.java (contents, props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java (contents, props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReportThread.java (contents, props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java (contents, props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/InterfaceReport.java (contents, props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/InterfaceReportThread.java (contents, props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/sample/SampleHtmlReport.java (props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/sample/SampleHtmlThread.java (props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ReportEncoder.java (contents, props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ReportStringUtil.java (contents, props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java (props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/pricat/InterfacePricatParser.java (props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/pricat/PricatEvents.java (contents, props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/pricat/PricatParseExcelHtmlReport.java (props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/pricat/PricatParseExcelHtmlThread.java (props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatEvents.java (contents, props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java (props changed) ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/poi/xssf/usermodel/OFBizPricatUtil.java (contents, props changed) Propchange: ofbiz/trunk/specialpurpose/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/MultiSiteRequestWrapper.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/WebSiteFilter.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractHtmlReport.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractHtmlReport.java?rev=1774165&r1=1774164&r2=1774165&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractHtmlReport.java (original) +++ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractHtmlReport.java Wed Dec 14 10:16:04 2016 @@ -1,140 +1,140 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - *******************************************************************************/ -package org.apache.ofbiz.htmlreport; - -import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.jsp.JspException; - -import org.apache.ofbiz.htmlreport.util.ReportStringUtil; - -/** - * HTML report output to be used for database create tables / drop tables operations. - * - */ -public abstract class AbstractHtmlReport extends HtmlReport { - - public static final String module = AbstractHtmlReport.class.getName(); - - public final static String THREAD_TYPE = "thread_type"; - - public final static String RUN_CREATETABLE_SCRIPT = "runcreatetablescript"; - - public final static String RUN_DROPTABLE_SCRIPT = "rundroptablescript"; - - public final static String FILE_REPORT_OUTPUT = "specialpurpose/pricat/webapp/pricat/ftl/report.ftl"; - - /** - * Constructs a new report using the provided locale for the output language. - * - * @param request HttpServletRequest - * @param response HttpServletResponse - */ - public AbstractHtmlReport(HttpServletRequest request, HttpServletResponse response) { - this(request, response, false, false); - } - - /** - * Constructs a new report using the provided locale for the output language. - * - * @param request HttpServletRequest - * @param response HttpServletResponse - * @param writeHtml if <code>true</code>, this report should generate HTML instead of JavaScript output - * @param isTransient If set to <code>true</code> nothing is kept in memory - */ - public AbstractHtmlReport(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient) { - super(request, response, writeHtml, isTransient); - } - - /** - * Prepare display an html report. - * - * @throws IOException - */ - public void prepareDisplayReport(HttpServletRequest request, HttpServletResponse response, String name, String dialogUri) throws IOException { - - if (ReportStringUtil.isNotEmpty(dialogUri)) { - setDialogRealUri(request, dialogUri); - } - - String action = getParamAction(request); - if (action == null) action = ""; - if (action.equals("reportend") || action.equals("cancel")) { - setParamAction("reportend"); - } else if (action.equals("reportupdate")) { - setParamAction("reportupdate"); - } else { - InterfaceReportThread thread = initializeThread(request, response, name); - thread.start(); - setParamAction("reportbegin"); - setParamThread(thread.getUUID().toString()); - } - } - - /** - * Initializes the report thread to use for this report.<p> - * - * @return the reported thread to use for this report. - */ - public abstract InterfaceReportThread initializeThread(HttpServletRequest request, HttpServletResponse response, String name); - - /** - * Set the report dialog uri. - * - * @param dialogUri - */ - public void setDialogRealUri(HttpServletRequest request, String dialogUri) { - request.setAttribute(DIALOG_URI, dialogUri); - } - - public static String checkButton(HttpServletRequest request, HttpServletResponse response) { - String action = request.getParameter("action"); - if (ReportStringUtil.isNotEmpty(action)) { - if (action.equalsIgnoreCase("ok")) { - request.removeAttribute(SESSION_REPORT_CLASS); - request.removeAttribute(DIALOG_URI); - return "ok"; - } else if (action.equalsIgnoreCase("cancel")) { - request.removeAttribute(SESSION_REPORT_CLASS); - request.removeAttribute(DIALOG_URI); - return "cancel"; - } - } - action = request.getParameter("ok"); - if (ReportStringUtil.isNotEmpty(action)) { - if (action.equalsIgnoreCase("ok")) { - request.removeAttribute(SESSION_REPORT_CLASS); - request.removeAttribute(DIALOG_URI); - return "ok"; - } - } - action = request.getParameter("cancel"); - if (ReportStringUtil.isNotEmpty(action)) { - if (action.equalsIgnoreCase("cancel")) { - request.removeAttribute(SESSION_REPORT_CLASS); - request.removeAttribute(DIALOG_URI); - return "cancel"; - } - } - - return "success"; - } +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.apache.ofbiz.htmlreport; + +import java.io.IOException; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.jsp.JspException; + +import org.apache.ofbiz.htmlreport.util.ReportStringUtil; + +/** + * HTML report output to be used for database create tables / drop tables operations. + * + */ +public abstract class AbstractHtmlReport extends HtmlReport { + + public static final String module = AbstractHtmlReport.class.getName(); + + public final static String THREAD_TYPE = "thread_type"; + + public final static String RUN_CREATETABLE_SCRIPT = "runcreatetablescript"; + + public final static String RUN_DROPTABLE_SCRIPT = "rundroptablescript"; + + public final static String FILE_REPORT_OUTPUT = "specialpurpose/pricat/webapp/pricat/ftl/report.ftl"; + + /** + * Constructs a new report using the provided locale for the output language. + * + * @param request HttpServletRequest + * @param response HttpServletResponse + */ + public AbstractHtmlReport(HttpServletRequest request, HttpServletResponse response) { + this(request, response, false, false); + } + + /** + * Constructs a new report using the provided locale for the output language. + * + * @param request HttpServletRequest + * @param response HttpServletResponse + * @param writeHtml if <code>true</code>, this report should generate HTML instead of JavaScript output + * @param isTransient If set to <code>true</code> nothing is kept in memory + */ + public AbstractHtmlReport(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient) { + super(request, response, writeHtml, isTransient); + } + + /** + * Prepare display an html report. + * + * @throws IOException + */ + public void prepareDisplayReport(HttpServletRequest request, HttpServletResponse response, String name, String dialogUri) throws IOException { + + if (ReportStringUtil.isNotEmpty(dialogUri)) { + setDialogRealUri(request, dialogUri); + } + + String action = getParamAction(request); + if (action == null) action = ""; + if (action.equals("reportend") || action.equals("cancel")) { + setParamAction("reportend"); + } else if (action.equals("reportupdate")) { + setParamAction("reportupdate"); + } else { + InterfaceReportThread thread = initializeThread(request, response, name); + thread.start(); + setParamAction("reportbegin"); + setParamThread(thread.getUUID().toString()); + } + } + + /** + * Initializes the report thread to use for this report.<p> + * + * @return the reported thread to use for this report. + */ + public abstract InterfaceReportThread initializeThread(HttpServletRequest request, HttpServletResponse response, String name); + + /** + * Set the report dialog uri. + * + * @param dialogUri + */ + public void setDialogRealUri(HttpServletRequest request, String dialogUri) { + request.setAttribute(DIALOG_URI, dialogUri); + } + + public static String checkButton(HttpServletRequest request, HttpServletResponse response) { + String action = request.getParameter("action"); + if (ReportStringUtil.isNotEmpty(action)) { + if (action.equalsIgnoreCase("ok")) { + request.removeAttribute(SESSION_REPORT_CLASS); + request.removeAttribute(DIALOG_URI); + return "ok"; + } else if (action.equalsIgnoreCase("cancel")) { + request.removeAttribute(SESSION_REPORT_CLASS); + request.removeAttribute(DIALOG_URI); + return "cancel"; + } + } + action = request.getParameter("ok"); + if (ReportStringUtil.isNotEmpty(action)) { + if (action.equalsIgnoreCase("ok")) { + request.removeAttribute(SESSION_REPORT_CLASS); + request.removeAttribute(DIALOG_URI); + return "ok"; + } + } + action = request.getParameter("cancel"); + if (ReportStringUtil.isNotEmpty(action)) { + if (action.equalsIgnoreCase("cancel")) { + request.removeAttribute(SESSION_REPORT_CLASS); + request.removeAttribute(DIALOG_URI); + return "cancel"; + } + } + + return "success"; + } } \ No newline at end of file Propchange: ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractHtmlReport.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java?rev=1774165&r1=1774164&r2=1774165&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java (original) +++ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java Wed Dec 14 10:16:04 2016 @@ -1,187 +1,187 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - *******************************************************************************/ -package org.apache.ofbiz.htmlreport; - -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - -/** - * Base report class. - * - */ -public abstract class AbstractReport implements InterfaceReport { - - /** Contains all error messages generated by the report. */ - private List<Object> errors; - - /** The locale this report is written in. */ - private Locale locale; - - /** Runtime of the report. */ - private long startTime; - - /** Contains all warning messages generated by the report. */ - private List<Object> warnings = new ArrayList<Object>(); - - /** Day constant. */ - private static final long DAYS = 1000 * 60 * 60 * 24; - - /** Hour constant. */ - private static final long HOURS = 1000 * 60 * 60; - - /** Minute constant. */ - private static final long MINUTES = 1000 * 60; - - /** Second constant. */ - private static final long SECONDS = 1000; - - public static final String SESSION_REPORT_CLASS = "OFBIZ_HTML_REPORT"; - - public void addError(Object obj) { - - errors.add(obj); - } - - public void addWarning(Object obj) { - - warnings.add(obj); - } - - public String formatRuntime() { - - long runtime = getRuntime(); - long seconds = (runtime / SECONDS) % 60; - long minutes = (runtime / MINUTES) % 60; - long hours = (runtime / HOURS) % 24; - long days = runtime / DAYS; - StringBuffer strBuf = new StringBuffer(); - - if (days > 0) { - if (days < 10) { - strBuf.append('0'); - } - strBuf.append(days); - strBuf.append(':'); - } - - if (hours < 10) { - strBuf.append('0'); - } - strBuf.append(hours); - strBuf.append(':'); - - if (minutes < 10) { - strBuf.append('0'); - } - strBuf.append(minutes); - strBuf.append(':'); - - if (seconds < 10) { - strBuf.append('0'); - } - strBuf.append(seconds); - - return strBuf.toString(); - } - - public List<Object> getErrors() { - return errors; - } - - public Locale getLocale() { - return locale; - } - - public long getRuntime() { - return System.currentTimeMillis() - startTime; - } - - public List<Object> getWarnings() { - return warnings; - } - - public boolean hasError() { - return (errors.size() > 0); - } - - public boolean hasWarning() { - return (warnings.size() > 0); - } - - public void resetRuntime() { - startTime = System.currentTimeMillis(); - } - - /** - * Initializes some member variables for this report.<p> - * - * @param locale the locale for this report - */ - protected void init(Locale locale) { - startTime = System.currentTimeMillis(); - this.locale = locale; - errors = new ArrayList<Object>(); - } - - /** - * Prints a String to the report.<p> - * - * @param value the String to add - */ - public void print(String value) { - print(value, FORMAT_DEFAULT); - } - - /** - * Prints a String to the report, using the indicated formatting.<p> - * - * Use the contants starting with <code>FORMAT</code> from this interface - * to indicate which formatting to use.<p> - * - * @param value the message container to add - * @param format the formatting to use for the output - */ - public abstract void print(String value, int format); - - /** - * Prints a String with line break to the report.<p> - * - * @param value the message container to add - */ - public void println(String value) { - - println(value, FORMAT_DEFAULT); - } - - /** - * Prints a String with line break to the report, using the indicated formatting.<p> - * - * Use the contants starting with <code>FORMAT</code> from this interface - * to indicate which formatting to use.<p> - * - * @param value the String to add - * @param format the formatting to use for the output - */ - public void println(String value, int format) { - print(value, format); - println(); - } - +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.apache.ofbiz.htmlreport; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +/** + * Base report class. + * + */ +public abstract class AbstractReport implements InterfaceReport { + + /** Contains all error messages generated by the report. */ + private List<Object> errors; + + /** The locale this report is written in. */ + private Locale locale; + + /** Runtime of the report. */ + private long startTime; + + /** Contains all warning messages generated by the report. */ + private List<Object> warnings = new ArrayList<Object>(); + + /** Day constant. */ + private static final long DAYS = 1000 * 60 * 60 * 24; + + /** Hour constant. */ + private static final long HOURS = 1000 * 60 * 60; + + /** Minute constant. */ + private static final long MINUTES = 1000 * 60; + + /** Second constant. */ + private static final long SECONDS = 1000; + + public static final String SESSION_REPORT_CLASS = "OFBIZ_HTML_REPORT"; + + public void addError(Object obj) { + + errors.add(obj); + } + + public void addWarning(Object obj) { + + warnings.add(obj); + } + + public String formatRuntime() { + + long runtime = getRuntime(); + long seconds = (runtime / SECONDS) % 60; + long minutes = (runtime / MINUTES) % 60; + long hours = (runtime / HOURS) % 24; + long days = runtime / DAYS; + StringBuffer strBuf = new StringBuffer(); + + if (days > 0) { + if (days < 10) { + strBuf.append('0'); + } + strBuf.append(days); + strBuf.append(':'); + } + + if (hours < 10) { + strBuf.append('0'); + } + strBuf.append(hours); + strBuf.append(':'); + + if (minutes < 10) { + strBuf.append('0'); + } + strBuf.append(minutes); + strBuf.append(':'); + + if (seconds < 10) { + strBuf.append('0'); + } + strBuf.append(seconds); + + return strBuf.toString(); + } + + public List<Object> getErrors() { + return errors; + } + + public Locale getLocale() { + return locale; + } + + public long getRuntime() { + return System.currentTimeMillis() - startTime; + } + + public List<Object> getWarnings() { + return warnings; + } + + public boolean hasError() { + return (errors.size() > 0); + } + + public boolean hasWarning() { + return (warnings.size() > 0); + } + + public void resetRuntime() { + startTime = System.currentTimeMillis(); + } + + /** + * Initializes some member variables for this report.<p> + * + * @param locale the locale for this report + */ + protected void init(Locale locale) { + startTime = System.currentTimeMillis(); + this.locale = locale; + errors = new ArrayList<Object>(); + } + + /** + * Prints a String to the report.<p> + * + * @param value the String to add + */ + public void print(String value) { + print(value, FORMAT_DEFAULT); + } + + /** + * Prints a String to the report, using the indicated formatting.<p> + * + * Use the contants starting with <code>FORMAT</code> from this interface + * to indicate which formatting to use.<p> + * + * @param value the message container to add + * @param format the formatting to use for the output + */ + public abstract void print(String value, int format); + + /** + * Prints a String with line break to the report.<p> + * + * @param value the message container to add + */ + public void println(String value) { + + println(value, FORMAT_DEFAULT); + } + + /** + * Prints a String with line break to the report, using the indicated formatting.<p> + * + * Use the contants starting with <code>FORMAT</code> from this interface + * to indicate which formatting to use.<p> + * + * @param value the String to add + * @param format the formatting to use for the output + */ + public void println(String value, int format) { + print(value, format); + println(); + } + } \ No newline at end of file Propchange: ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReportThread.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReportThread.java?rev=1774165&r1=1774164&r2=1774165&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReportThread.java (original) +++ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReportThread.java Wed Dec 14 10:16:04 2016 @@ -1,213 +1,213 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - *******************************************************************************/ -package org.apache.ofbiz.htmlreport; - -import java.util.List; -import java.util.Locale; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.ofbiz.base.util.UtilHttp; -import org.safehaus.uuid.EthernetAddress; -import org.safehaus.uuid.UUID; -import org.safehaus.uuid.UUIDGenerator; - -/** - * Provides a common Thread class for the reports. - * - */ -public abstract class AbstractReportThread extends Thread implements InterfaceReportThread { - - /** Indicates if the thread was already checked by the grim reaper. */ - private boolean doomed; - - /** The report that belongs to the thread. */ - private InterfaceReport report; - - /** The time this report is running. */ - private long startTime; - - private UUID uuid; - - private Locale locale; - - /** - * Constructs a new report Thread with the given name. - */ - protected AbstractReportThread(HttpServletRequest request, HttpServletResponse response, String name) { - - super(Thread.currentThread().getThreadGroup(), name); - // report Threads are never daemon Threads - setDaemon(false); - // the session must not be updated when it is used in a report - EthernetAddress ethernetAddress = UUIDGenerator.getInstance().getDummyAddress(); - uuid = UUIDGenerator.getInstance().generateTimeBasedUUID(ethernetAddress); - - setName(name + " [" + uuid.toString() + "]"); - // new Threads are not doomed - doomed = false; - // set start time - startTime = System.currentTimeMillis(); - locale = UtilHttp.getLocale(request); - } - - - public UUID getUUID() { - return uuid; - } - - /** - * Adds an error object to the list of errors that occured during the report. - * - * @param obj the error object - */ - public void addError(Object obj) { - - if (getReport() != null) { - getReport().addError(obj); - } - } - - /** - * Returns the error exception in case there was an error during the execution of - * this Thread, null otherwise. - * - * @return the error exception in case there was an error, null otherwise - */ - public Throwable getError() { - - return null; - } - - /** - * Returns a list of all errors that occured during the report. - * - * @return an error list that occured during the report - */ - public List<?> getErrors() { - - if (getReport() != null) { - return getReport().getErrors(); - } else { - return null; - } - } - - /** - * Returns the part of the report that is ready for output. - * - * @return the part of the report that is ready for output - */ - public abstract String getReportUpdate(); - - /** - * Returns the time this report has been running. - * - * @return the time this report has been running - */ - public synchronized long getRuntime() { - - if (doomed) { - return startTime; - } else { - return System.currentTimeMillis() - startTime; - } - } - - /** - * Returns if the report generated an error output. - * - * @return true if the report generated an error, otherwise false - */ - public boolean hasError() { - - if (getReport() != null) { - return (getReport().getErrors().size() > 0); - } else { - return false; - } - } - - /** - * Returns true if this thread is already "doomed" to be deleted. - * - * A OFBiz deamon Thread (the "Grim Reaper") will collect all - * doomed Threads, i.e. threads that are not longer active for some - * time. - * - * @return true if this thread is already "doomed" to be deleted - */ - public synchronized boolean isDoomed() { - - if (isAlive()) { - // as long as the Thread is still active it is never doomed - return false; - } - if (doomed) { - // not longer active, and already doomed, so rest in peace... - return true; - } - // condemn the Thread to be collected by the grim reaper next time - startTime = getRuntime(); - doomed = true; - return false; - } - - /** - * Returns the report where the output of this Thread is written to. - * - * @return the report where the output of this Thread is written to - */ - protected InterfaceReport getReport() { - - return report; - } - - /** - * Initialize a HTML report for this Thread. - * - */ - protected void initHtmlReport(HttpServletRequest request, HttpServletResponse response) { - - report = HtmlReport.getInstance(request, response); - ((HtmlReport) report).setParamThread(getUUID().toString()); - } - - /** - * Initialize a HTML report for this Thread. - * - */ - protected void initHtmlReport(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient) { - - report = HtmlReport.getInstance(request, response, writeHtml, isTransient); - ((HtmlReport) report).setParamThread(getUUID().toString()); - } - - protected void initHtmlReport(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient, String logFileName) { - - report = HtmlReport.getInstance(request, response, writeHtml, isTransient, logFileName); - ((HtmlReport) report).setParamThread(getUUID().toString()); - } - - protected Locale getLocale() { - return locale; - } - -} +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.apache.ofbiz.htmlreport; + +import java.util.List; +import java.util.Locale; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.ofbiz.base.util.UtilHttp; +import org.safehaus.uuid.EthernetAddress; +import org.safehaus.uuid.UUID; +import org.safehaus.uuid.UUIDGenerator; + +/** + * Provides a common Thread class for the reports. + * + */ +public abstract class AbstractReportThread extends Thread implements InterfaceReportThread { + + /** Indicates if the thread was already checked by the grim reaper. */ + private boolean doomed; + + /** The report that belongs to the thread. */ + private InterfaceReport report; + + /** The time this report is running. */ + private long startTime; + + private UUID uuid; + + private Locale locale; + + /** + * Constructs a new report Thread with the given name. + */ + protected AbstractReportThread(HttpServletRequest request, HttpServletResponse response, String name) { + + super(Thread.currentThread().getThreadGroup(), name); + // report Threads are never daemon Threads + setDaemon(false); + // the session must not be updated when it is used in a report + EthernetAddress ethernetAddress = UUIDGenerator.getInstance().getDummyAddress(); + uuid = UUIDGenerator.getInstance().generateTimeBasedUUID(ethernetAddress); + + setName(name + " [" + uuid.toString() + "]"); + // new Threads are not doomed + doomed = false; + // set start time + startTime = System.currentTimeMillis(); + locale = UtilHttp.getLocale(request); + } + + + public UUID getUUID() { + return uuid; + } + + /** + * Adds an error object to the list of errors that occured during the report. + * + * @param obj the error object + */ + public void addError(Object obj) { + + if (getReport() != null) { + getReport().addError(obj); + } + } + + /** + * Returns the error exception in case there was an error during the execution of + * this Thread, null otherwise. + * + * @return the error exception in case there was an error, null otherwise + */ + public Throwable getError() { + + return null; + } + + /** + * Returns a list of all errors that occured during the report. + * + * @return an error list that occured during the report + */ + public List<?> getErrors() { + + if (getReport() != null) { + return getReport().getErrors(); + } else { + return null; + } + } + + /** + * Returns the part of the report that is ready for output. + * + * @return the part of the report that is ready for output + */ + public abstract String getReportUpdate(); + + /** + * Returns the time this report has been running. + * + * @return the time this report has been running + */ + public synchronized long getRuntime() { + + if (doomed) { + return startTime; + } else { + return System.currentTimeMillis() - startTime; + } + } + + /** + * Returns if the report generated an error output. + * + * @return true if the report generated an error, otherwise false + */ + public boolean hasError() { + + if (getReport() != null) { + return (getReport().getErrors().size() > 0); + } else { + return false; + } + } + + /** + * Returns true if this thread is already "doomed" to be deleted. + * + * A OFBiz deamon Thread (the "Grim Reaper") will collect all + * doomed Threads, i.e. threads that are not longer active for some + * time. + * + * @return true if this thread is already "doomed" to be deleted + */ + public synchronized boolean isDoomed() { + + if (isAlive()) { + // as long as the Thread is still active it is never doomed + return false; + } + if (doomed) { + // not longer active, and already doomed, so rest in peace... + return true; + } + // condemn the Thread to be collected by the grim reaper next time + startTime = getRuntime(); + doomed = true; + return false; + } + + /** + * Returns the report where the output of this Thread is written to. + * + * @return the report where the output of this Thread is written to + */ + protected InterfaceReport getReport() { + + return report; + } + + /** + * Initialize a HTML report for this Thread. + * + */ + protected void initHtmlReport(HttpServletRequest request, HttpServletResponse response) { + + report = HtmlReport.getInstance(request, response); + ((HtmlReport) report).setParamThread(getUUID().toString()); + } + + /** + * Initialize a HTML report for this Thread. + * + */ + protected void initHtmlReport(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient) { + + report = HtmlReport.getInstance(request, response, writeHtml, isTransient); + ((HtmlReport) report).setParamThread(getUUID().toString()); + } + + protected void initHtmlReport(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient, String logFileName) { + + report = HtmlReport.getInstance(request, response, writeHtml, isTransient, logFileName); + ((HtmlReport) report).setParamThread(getUUID().toString()); + } + + protected Locale getLocale() { + return locale; + } + +} Propchange: ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReportThread.java ------------------------------------------------------------------------------ svn:eol-style = native |
Free forum by Nabble | Edit this page |