svn commit: r831503 [7/17] - in /ofbiz/branches/addbirt: framework/ framework/base/config/ framework/birt/ framework/birt/build/ framework/birt/build/classes/ framework/birt/build/classes/org/ framework/birt/build/classes/org/ofbiz/ framework/birt/buil...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r831503 [7/17] - in /ofbiz/branches/addbirt: framework/ framework/base/config/ framework/birt/ framework/birt/build/ framework/birt/build/classes/ framework/birt/build/classes/org/ framework/birt/build/classes/org/ofbiz/ framework/birt/buil...

hansbak-2
Propchange: ofbiz/branches/addbirt/framework/birt/lib/platform/plugins/org.w3c.sac_1.3.0.v20070710/about_files/copyright-software-20021231_files/base.css
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/addbirt/framework/birt/lib/platform/plugins/org.w3c.sac_1.3.0.v20070710/about_files/copyright-software-20021231_files/base.css
------------------------------------------------------------------------------
    svn:executable = *

Propchange: ofbiz/branches/addbirt/framework/birt/lib/platform/plugins/org.w3c.sac_1.3.0.v20070710/about_files/copyright-software-20021231_files/base.css
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/addbirt/framework/birt/lib/platform/plugins/org.w3c.sac_1.3.0.v20070710/about_files/copyright-software-20021231_files/base.css
------------------------------------------------------------------------------
    svn:mime-type = text/css

Added: ofbiz/branches/addbirt/framework/birt/lib/platform/plugins/org.w3c.sac_1.3.0.v20070710/eclipse32.png
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/lib/platform/plugins/org.w3c.sac_1.3.0.v20070710/eclipse32.png?rev=831503&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ofbiz/branches/addbirt/framework/birt/lib/platform/plugins/org.w3c.sac_1.3.0.v20070710/eclipse32.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: ofbiz/branches/addbirt/framework/birt/lib/platform/plugins/org.w3c.sac_1.3.0.v20070710/eclipse32.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: ofbiz/branches/addbirt/framework/birt/lib/platform/plugins/org.w3c.sac_1.3.0.v20070710/lib/flute.jar
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/lib/platform/plugins/org.w3c.sac_1.3.0.v20070710/lib/flute.jar?rev=831503&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ofbiz/branches/addbirt/framework/birt/lib/platform/plugins/org.w3c.sac_1.3.0.v20070710/lib/flute.jar
------------------------------------------------------------------------------
    svn:executable = *

Propchange: ofbiz/branches/addbirt/framework/birt/lib/platform/plugins/org.w3c.sac_1.3.0.v20070710/lib/flute.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: ofbiz/branches/addbirt/framework/birt/lib/saaj.jar
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/lib/saaj.jar?rev=831503&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ofbiz/branches/addbirt/framework/birt/lib/saaj.jar
------------------------------------------------------------------------------
    svn:executable = *

Propchange: ofbiz/branches/addbirt/framework/birt/lib/saaj.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: ofbiz/branches/addbirt/framework/birt/lib/scriptapi.jar
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/lib/scriptapi.jar?rev=831503&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ofbiz/branches/addbirt/framework/birt/lib/scriptapi.jar
------------------------------------------------------------------------------
    svn:executable = *

Propchange: ofbiz/branches/addbirt/framework/birt/lib/scriptapi.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: ofbiz/branches/addbirt/framework/birt/lib/viewservlets.jar
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/lib/viewservlets.jar?rev=831503&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ofbiz/branches/addbirt/framework/birt/lib/viewservlets.jar
------------------------------------------------------------------------------
    svn:executable = *

Propchange: ofbiz/branches/addbirt/framework/birt/lib/viewservlets.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: ofbiz/branches/addbirt/framework/birt/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/ofbiz-component.xml?rev=831503&view=auto
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/ofbiz-component.xml (added)
+++ ofbiz/branches/addbirt/framework/birt/ofbiz-component.xml Sat Oct 31 01:22:47 2009
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<ofbiz-component name="birt"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
+    <resource-loader name="main" type="component"/>
+    <classpath type="jar" location="lib/*"/>
+    <classpath type="jar" location="build/lib/*"/>
+    <classpath type="dir" location="config"/>
+    <entity-resource type="data" reader-name="seed" loader="main" location="data/BirtHelpData.xml"/>
+    <service-resource type="model" loader="main" location="servicedef/services.xml"/>
+    <webapp name="birt"
+        title="BIRT"
+        menu-name="secondary"
+        server="default-server"
+        location="webapp/birt"
+        base-permission="OFBTOOLS,WEBTOOLS"
+        mount-point="/birt"/>
+</ofbiz-component>

Propchange: ofbiz/branches/addbirt/framework/birt/ofbiz-component.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/addbirt/framework/birt/ofbiz-component.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/addbirt/framework/birt/ofbiz-component.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/branches/addbirt/framework/birt/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/servicedef/services.xml?rev=831503&view=auto
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/servicedef/services.xml (added)
+++ ofbiz/branches/addbirt/framework/birt/servicedef/services.xml Sat Oct 31 01:22:47 2009
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
+    <description>OFBiz BIRT Services</description>
+    <vendor>OFBiz</vendor>
+    <version>1.0</version>
+
+    <!--BIRT Email Services -->
+    <service name="sendBirtMail" engine="java" location="org.ofbiz.birt.email.BirtEmailServices" invoke="sendBirtMail">
+        <description>BIRT Email Service</description>
+        <implements service="sendMailInterface"/>
+        <attribute name="bodyText" type="String" mode="IN" optional="true"/>
+        <attribute name="bodyScreenUri" type="String" mode="IN" optional="true"/>
+        <attribute name="birtReportLocation" type="String" mode="IN" optional="false"/>
+        <attribute name="attachmentName" type="String" mode="IN" optional="false"/>
+        <attribute name="bodyParameters" type="Map" mode="IN" optional="true"/>
+        <attribute name="birtParameters" type="Map" mode="IN" optional="true"/>
+        <attribute name="birtLocale" type="Locale" mode="IN" optional="true"/>
+        <attribute name="birtContentType" type="String" mode="IN" optional="true"></attribute>
+        <attribute name="webSiteId" type="String" mode="IN" optional="true"/>
+        <attribute name="body" type="String" mode="OUT" optional="false"/>
+    </service>
+</services>

Propchange: ofbiz/branches/addbirt/framework/birt/servicedef/services.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/addbirt/framework/birt/servicedef/services.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/addbirt/framework/birt/servicedef/services.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/BirtWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/BirtWorker.java?rev=831503&view=auto
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/BirtWorker.java (added)
+++ ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/BirtWorker.java Sat Oct 31 01:22:47 2009
@@ -0,0 +1,122 @@
+package org.ofbiz.birt;
+
+import java.io.OutputStream;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Locale;
+import java.util.Map;
+
+import org.eclipse.birt.report.engine.api.EXCELRenderOption;
+import org.eclipse.birt.report.engine.api.EngineException;
+import org.eclipse.birt.report.engine.api.HTMLRenderOption;
+import org.eclipse.birt.report.engine.api.HTMLServerImageHandler;
+import org.eclipse.birt.report.engine.api.IPDFRenderOption;
+import org.eclipse.birt.report.engine.api.IReportEngine;
+import org.eclipse.birt.report.engine.api.IReportRunnable;
+import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
+import org.eclipse.birt.report.engine.api.PDFRenderOption;
+import org.eclipse.birt.report.engine.api.RenderOption;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.birt.container.BirtContainer;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.jdbc.ConnectionFactory;
+
+public class BirtWorker {
+    
+    public final static String module = BirtWorker.class.getName();
+    
+    public final static String BIRT_PARAMETERS = "birtParameters";
+    public final static String REPORT_ENGINE = "reportEngine";
+    public final static String BIRT_LOCALE = "birtLocale";
+    public final static String BIRT_IMAGE_DIRECTORY = "birtImageDirectory";
+    public final static String BIRT_CONTENT_TYPE = "birtContentType";
+    
+    private static HTMLServerImageHandler imageHandler = new HTMLServerImageHandler();
+    
+    /**
+     * export report
+     * @param design
+     * @param context
+     * @param contentType
+     * @param output
+     * @throws EngineException
+     * @throws GeneralException
+     * @throws SQLException
+     */
+    public static void exportReport(IReportRunnable design, Map context, String contentType, OutputStream output)
+        throws EngineException, GeneralException, SQLException {
+    
+        Locale birtLocale = (Locale)context.get(BIRT_LOCALE);
+        String birtImageDirectory = (String)context.get(BIRT_IMAGE_DIRECTORY);
+
+        if (contentType == null) {
+            contentType = "text/html";
+        }
+        if (birtImageDirectory == null) {
+             birtImageDirectory = "/";
+        }
+        Debug.logInfo("Get report engine", module);
+        IReportEngine engine = BirtContainer.getReportEngine();
+    
+        // set the jdbc connection
+        String delegatorGroupHelperName = BirtContainer.getDelegatorGroupHelperName();
+        Delegator delegator = BirtContainer.getDelegator();
+        Debug.logInfo("Get the JDBC connection from group helper's name:" + delegatorGroupHelperName, module);
+        String helperName = delegator.getGroupHelperName(delegatorGroupHelperName);    // gets the helper (localderby, localmysql, localpostgres, etc.) for your entity group org.ofbiz
+        Connection connection = ConnectionFactory.getConnection(helperName);
+        engine.getConfig().getAppContext().put("OdaJDBCDriverPassInConnection", connection);
+        
+        IRunAndRenderTask task = engine.createRunAndRenderTask(design);
+        if (birtLocale != null) {
+            Debug.logInfo("Set birt locale:" + birtLocale, module);
+            task.setLocale(birtLocale);
+        }
+        
+        // set parameters if exists
+        Map parameters = (Map)context.get(BirtWorker.BIRT_PARAMETERS);
+        if (parameters != null) {
+            Debug.logInfo("Set birt parameters:" + parameters, module);
+            task.setParameterValues(parameters);
+        }
+        
+        // set output options
+        RenderOption options = new RenderOption();
+        if ("text/html".equalsIgnoreCase(contentType)) {
+            options.setOutputFormat(RenderOption.OUTPUT_FORMAT_HTML);
+        } else if ("application/pdf".equalsIgnoreCase(contentType)) {
+            options.setOutputFormat(RenderOption.OUTPUT_FORMAT_PDF);
+        } else if ("application/vnd.ms-word".equalsIgnoreCase(contentType)) {
+            options.setOutputFormat("doc");
+        }  else if ("application/vnd.ms-excel".equalsIgnoreCase(contentType)) {
+            options.setOutputFormat("xls");
+        } else if ("application/vnd.ms-powerpoint".equalsIgnoreCase(contentType)) {
+            options.setOutputFormat("ppt");
+        } else {
+            throw new GeneralException("Unknown content type : " + contentType);
+        }
+        
+        if (options.getOutputFormat().equalsIgnoreCase(RenderOption.OUTPUT_FORMAT_HTML)) {
+            // set html render options
+            HTMLRenderOption htmlOptions = new HTMLRenderOption(options);
+            htmlOptions.setImageDirectory(birtImageDirectory);
+            htmlOptions.setBaseImageURL(birtImageDirectory);
+            options.setImageHandler(imageHandler);
+        } else if (options.getOutputFormat().equalsIgnoreCase(RenderOption.OUTPUT_FORMAT_PDF)) {
+            // set pdf render options
+            PDFRenderOption pdfOptions = new PDFRenderOption(options);
+            pdfOptions.setOption(IPDFRenderOption.PAGE_OVERFLOW, new Boolean(true) );
+        } else if (options.getOutputFormat().equalsIgnoreCase("xls")) {
+            // set excel render options
+            EXCELRenderOption excelOptions = new EXCELRenderOption(options);
+        }
+        options.setOutputStream(output);
+        task.setRenderOption(options);
+        
+        // run report
+        Debug.logInfo("Birt's locale is: " + task.getLocale(), module);
+        Debug.logInfo("Run report's task", module);
+        task.run();
+        task.close();
+    }
+}

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/BirtWorker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/BirtWorker.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/BirtWorker.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/container/BirtContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/container/BirtContainer.java?rev=831503&view=auto
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/container/BirtContainer.java (added)
+++ ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/container/BirtContainer.java Sat Oct 31 01:22:47 2009
@@ -0,0 +1,180 @@
+package org.ofbiz.birt.container;
+
+import java.io.File;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+
+import javolution.util.FastMap;
+
+import org.eclipse.birt.core.exception.BirtException;
+import org.eclipse.birt.core.framework.Platform;
+import org.eclipse.birt.core.framework.PlatformFileContext;
+import org.eclipse.birt.report.engine.api.EngineConfig;
+import org.eclipse.birt.report.engine.api.EngineConstants;
+import org.eclipse.birt.report.engine.api.IReportEngine;
+import org.eclipse.birt.report.engine.api.IReportEngineFactory;
+import org.ofbiz.base.container.Container;
+import org.ofbiz.base.container.ContainerConfig;
+import org.ofbiz.base.container.ContainerException;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.FileUtil;
+import org.ofbiz.base.util.UtilObject;
+import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.DelegatorFactory;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.service.GenericDispatcher;
+import org.ofbiz.service.LocalDispatcher;
+
+public class BirtContainer implements Container {
+    
+    public static final String module = BirtContainer.class.getName();
+    
+    public final static String CONFIG_FILE = "birt.properties";
+    
+    protected EngineConfig config;
+    protected String configFile;
+    
+    private static IReportEngine engine;
+    private static String delegatorGroupHelperName;
+    private static String delegatorName;
+    private static String dispatcherName;
+    private static Delegator delegator;
+    private static LocalDispatcher dispatcher;
+
+    public void init(String[] args, String configFile)
+            throws ContainerException {
+        // TODO Auto-generated method stub
+        this.configFile = configFile;
+    }
+
+    /**
+     * start container
+     */
+    public boolean start() throws ContainerException {
+        // TODO Auto-generated method stub
+        
+        Debug.logInfo("Start birt container", module);
+        
+        // make sure the subclass sets the config name
+        if (this.getContainerConfigName() == null) {
+            throw new ContainerException("Unknown container config name");
+        }
+        // get the container config
+        ContainerConfig.Container cc = ContainerConfig.getContainer(this.getContainerConfigName(), configFile);
+        if (cc == null) {
+            throw new ContainerException("No " + this.getContainerConfigName() + " configuration found in container config!");
+        }
+
+        config = new EngineConfig();
+        
+        // set osgi config
+        Map<String, String> osgiConfig = FastMap.newInstance();
+        osgiConfig.put("osgi.configuration.area", new File(System.getProperty("ofbiz.home"), "runtime" + File.separator + "tempfiles").getPath());
+        config.setOSGiConfig(osgiConfig);
+        
+        HashMap context = config.getAppContext();
+        
+        // set delegator, dispatcher and security objects to report
+        
+        delegatorGroupHelperName = ContainerConfig.getPropertyValue(cc, "delegator-group-helper-name", "org.ofbiz");
+        
+        // get the delegator
+        delegatorName = ContainerConfig.getPropertyValue(cc, "delegator-name", "default");
+        try {
+              delegator = UtilObject.getObjectFromFactory(DelegatorFactory.class, delegatorName);
+        } catch (ClassNotFoundException e) {
+            Debug.logError(e, module);
+        }
+        
+        // get the dispatcher
+        dispatcher = GenericDispatcher.getLocalDispatcher(dispatcherName, delegator);
+        
+        context.put("delegator", delegator);
+        context.put("dispatcher", dispatcher);
+        
+        // set classloader for engine
+        context.put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, BirtContainer.class.getClassLoader());
+        context.put(EngineConstants.WEBAPP_CLASSPATH_KEY, BirtContainer.class.getClassLoader());
+        
+        // set log config to show all level in console
+        config.setLogConfig(null, Level.ALL);
+        
+        // set engine home
+        String reportEnginePath = FileUtil.getFile("component://birt/lib/platform").getPath();
+        config.setEngineHome(reportEnginePath);
+        config.setBIRTHome(reportEnginePath);
+        
+        // set OSGi arguments specific in properties
+        String argumentsString = UtilProperties.getPropertyValue(BirtContainer.CONFIG_FILE, "birt.osgi.arguments");
+        config.setOSGiArguments(argumentsString.split(","));
+
+        // set platform file context
+        config.setPlatformContext(new PlatformFileContext(config));
+        config.setAppContext(context);
+        
+        // startup platform
+        try {
+            Debug.logInfo("Startup birt platform", module);
+            Platform.startup( config );
+        } catch ( BirtException e ) {
+            throw new ContainerException(e);
+        }
+
+        // create report engine
+        Debug.logInfo("Create factory object", module);
+        IReportEngineFactory factory = (IReportEngineFactory) Platform
+              .createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
+        if (factory == null) {
+            throw new ContainerException("can not create birt engine factory");
+        }
+        Debug.logInfo("Create report engine", module);
+        engine = factory.createReportEngine( config );
+        String[] supportedFormats = engine.getSupportedFormats();
+        String formatList = null;
+        for (String supportedFormat : supportedFormats) {
+            if (formatList != null) {
+                formatList += ", " + supportedFormat;
+            } else {
+                formatList = supportedFormat;
+            }
+        }
+        Debug.logInfo("BIRT supported formats: " + formatList, module);
+        return false;
+    }
+    
+    public void stop() throws ContainerException {
+        // TODO Auto-generated method stub
+        
+    }
+    
+    public String getContainerConfigName() {
+        return "birt-container";
+    }
+    
+    public static IReportEngine getReportEngine() throws GenericEntityException, SQLException {
+        return engine;
+    }
+    
+    public static String getDelegatorGroupHelperName() {
+        return delegatorGroupHelperName;
+    }
+    
+    public static String getDelegatorName() {
+        return delegatorName;
+    }
+    
+    public static String getDispatcherName() {
+        return dispatcherName;
+    }
+
+    public static Delegator getDelegator() {
+        return delegator;
+    }
+    
+    public static LocalDispatcher getDispatcher() {
+        return dispatcher;
+    }
+}

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/container/BirtContainer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/container/BirtContainer.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/container/BirtContainer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/email/BirtEmailServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/email/BirtEmailServices.java?rev=831503&view=auto
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/email/BirtEmailServices.java (added)
+++ ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/email/BirtEmailServices.java Sat Oct 31 01:22:47 2009
@@ -0,0 +1,226 @@
+package org.ofbiz.birt.email;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.sql.SQLException;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import javolution.util.FastList;
+import javolution.util.FastMap;
+
+import org.apache.fop.apps.FOPException;
+import org.eclipse.birt.report.engine.api.EngineException;
+import org.eclipse.birt.report.engine.api.IReportEngine;
+import org.eclipse.birt.report.engine.api.IReportRunnable;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.collections.MapStack;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
+import org.ofbiz.birt.BirtWorker;
+import org.ofbiz.birt.container.BirtContainer;
+import org.ofbiz.common.email.NotificationServices;
+import org.ofbiz.service.DispatchContext;
+import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ServiceUtil;
+import org.ofbiz.widget.birt.BirtFactory;
+import org.ofbiz.widget.html.HtmlScreenRenderer;
+import org.ofbiz.widget.screen.ScreenRenderer;
+import org.xml.sax.SAXException;
+
+public class BirtEmailServices {
+    
+    public static final String module = BirtEmailServices.class.getName();
+    
+    protected static final HtmlScreenRenderer htmlScreenRenderer = new HtmlScreenRenderer();
+    
+    /**
+     * send birt mail
+     *
+     * @param ctx
+     * @param context
+     * @return
+     */
+    public static Map<String, Object> sendBirtMail(DispatchContext ctx, Map<String, ? extends Object> context) {
+        Map<String, Object> serviceContext = UtilMisc.makeMapWritable(context);
+        LocalDispatcher dispatcher = ctx.getDispatcher();
+        String webSiteId = (String) serviceContext.remove("webSiteId");
+        String bodyText = (String) serviceContext.remove("bodyText");
+        String bodyScreenUri = (String) serviceContext.remove("bodyScreenUri");
+        String birtReportLocation = (String) serviceContext.remove("birtReportLocation");
+        String attachmentName = (String) serviceContext.remove("attachmentName");
+        Locale locale = (Locale) serviceContext.get("locale");
+        Map bodyParameters = (Map) serviceContext.remove("bodyParameters");
+        Locale birtLocale = (Locale) serviceContext.remove(BirtWorker.BIRT_LOCALE);
+        Map birtParameters = (Map) serviceContext.remove(BirtWorker.BIRT_PARAMETERS);
+        String birtImageDirectory = (String) serviceContext.remove(BirtWorker.BIRT_IMAGE_DIRECTORY);
+        String birtContentType = (String) serviceContext.remove(BirtWorker.BIRT_CONTENT_TYPE);
+        if (bodyParameters == null) {
+            bodyParameters = MapStack.create();
+        }
+        if (!bodyParameters.containsKey("locale")) {
+            bodyParameters.put("locale", locale);
+        } else {
+            locale = (Locale) bodyParameters.get("locale");
+        }
+        String partyId = (String) bodyParameters.get("partyId");
+        if (UtilValidate.isNotEmpty(webSiteId)) {
+            NotificationServices.setBaseUrl(ctx.getDelegator(), webSiteId, bodyParameters);
+        }
+        String contentType = (String) serviceContext.remove("contentType");
+
+        if (UtilValidate.isEmpty(attachmentName)) {
+            attachmentName = "Details.pdf";
+        }
+        StringWriter bodyWriter = new StringWriter();
+
+        MapStack screenContext = MapStack.create();
+        screenContext.put("locale", locale);
+        ScreenRenderer screens = new ScreenRenderer(bodyWriter, screenContext, htmlScreenRenderer);
+        screens.populateContextForService(ctx, bodyParameters);
+        screenContext.putAll(bodyParameters);
+
+        if (bodyScreenUri != null) {
+            try {
+                screens.render(bodyScreenUri);
+            } catch (GeneralException e) {
+                String errMsg = "Error rendering screen for email: " + e.toString();
+                Debug.logError(e, errMsg, module);
+                return ServiceUtil.returnError(errMsg);
+            } catch (IOException e) {
+                String errMsg = "Error I/O rendering screen for email: " + e.toString();
+                Debug.logError(e, errMsg, module);
+                return ServiceUtil.returnError(errMsg);
+            } catch (SAXException e) {
+                String errMsg = "Error SAX rendering screen for email: " + e.toString();
+                Debug.logError(e, errMsg, module);
+                return ServiceUtil.returnError(errMsg);
+            } catch (ParserConfigurationException e) {
+                String errMsg = "Error parser config rendering screen for email: " + e.toString();
+                Debug.logError(e, errMsg, module);
+                return ServiceUtil.returnError(errMsg);
+            }
+        }
+        
+        boolean isMultiPart = false;
+        
+        // check if attachment screen location passed in
+        if (UtilValidate.isNotEmpty(birtReportLocation)) {
+            isMultiPart = true;
+            // start processing fo pdf attachment
+            try {
+                // create the output stream for the generation
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                
+                Map birtContext = FastMap.newInstance();
+                if (birtLocale == null) {
+                    birtLocale = locale;
+                }
+                birtContext.put(BirtWorker.BIRT_LOCALE, birtLocale);
+                if (birtParameters != null) {
+                    birtContext.put(BirtWorker.BIRT_PARAMETERS, birtParameters);
+                }
+                if (birtImageDirectory != null) {
+                    birtContext.put(BirtWorker.BIRT_IMAGE_DIRECTORY, birtImageDirectory);
+                }
+                if (birtContentType == null) {
+                    birtContentType = "application/pdf";
+                }
+                IReportEngine engine = BirtContainer.getReportEngine();
+                InputStream reportInputStream = BirtFactory.getReportInputStreamFromLocation(birtReportLocation);
+                IReportRunnable design = engine.openReportDesign(reportInputStream);
+                     Debug.logInfo("Export report as content type:" + birtContentType, module);
+                     BirtWorker.exportReport(design, context, birtContentType, baos);
+                // and generate the PDF
+                baos.flush();
+                baos.close();
+
+                // store in the list of maps for sendmail....
+                List bodyParts = FastList.newInstance();
+                if (bodyText != null) {
+                    bodyText = FlexibleStringExpander.expandString(bodyText, screenContext,  locale);
+                    bodyParts.add(UtilMisc.toMap("content", bodyText, "type", "text/html"));
+                } else {
+                    bodyParts.add(UtilMisc.toMap("content", bodyWriter.toString(), "type", "text/html"));
+                }
+                bodyParts.add(UtilMisc.toMap("content", baos.toByteArray(), "type", "application/pdf", "filename", attachmentName));
+                serviceContext.put("bodyParts", bodyParts);
+            } catch (GeneralException ge) {
+                String errMsg = "Error rendering " + birtContentType + " attachment for email: " + ge.toString();
+                Debug.logError(ge, errMsg, module);
+                return ServiceUtil.returnError(errMsg);
+            } catch (IOException ie) {
+                String errMsg = "Error I/O rendering " + birtContentType + " attachment for email: " + ie.toString();
+                Debug.logError(ie, errMsg, module);
+                return ServiceUtil.returnError(errMsg);
+            } catch (FOPException fe) {
+                String errMsg = "Error FOP rendering " + birtContentType + " attachment for email: " + fe.toString();
+                Debug.logError(fe, errMsg, module);
+                return ServiceUtil.returnError(errMsg);
+            } catch (SAXException se) {
+                String errMsg = "Error SAX rendering " + birtContentType + " attachment for email: " + se.toString();
+                Debug.logError(se, errMsg, module);
+                return ServiceUtil.returnError(errMsg);
+            } catch (ParserConfigurationException pe) {
+                String errMsg = "Error parser rendering " + birtContentType + " attachment for email: " + pe.toString();
+                Debug.logError(pe, errMsg, module);
+                return ServiceUtil.returnError(errMsg);
+            } catch (EngineException ee) {
+                String errMsg = "Error rendering " + birtContentType + " attachment for email: " + ee.toString();
+                Debug.logError(ee, errMsg, module);
+                return ServiceUtil.returnError(errMsg);
+            } catch (SQLException se) {
+                String errMsg = "Error SQL rendering " + birtContentType + " attachment for email: " + se.toString();
+                Debug.logError(se, errMsg, module);
+                return ServiceUtil.returnError(errMsg);
+            }
+        } else {
+            isMultiPart = false;
+            // store body and type for single part message in the context.
+            if (bodyText != null) {
+                bodyText = FlexibleStringExpander.expandString(bodyText, screenContext,  locale);
+                serviceContext.put("body", bodyText);
+            } else {
+                serviceContext.put("body", bodyWriter.toString());
+            }
+
+            // Only override the default contentType in case of plaintext, since other contentTypes may be multipart
+            //    and would require specific handling.
+            if (contentType != null && contentType.equalsIgnoreCase("text/plain")) {
+                serviceContext.put("contentType", "text/plain");
+            } else {
+                serviceContext.put("contentType", "text/html");
+            }
+        }
+        
+        // also expand the subject at this point, just in case it has the FlexibleStringExpander syntax in it...
+        String subject = (String) serviceContext.remove("subject");
+        subject = FlexibleStringExpander.expandString(subject, screenContext, locale);
+        serviceContext.put("subject", subject);
+        serviceContext.put("partyId", partyId);
+
+        if (Debug.verboseOn()) Debug.logVerbose("sendMailFromScreen sendMail context: " + serviceContext, module);
+
+        Map result = ServiceUtil.returnSuccess();
+        try {
+            if (isMultiPart) {
+                dispatcher.runSync("sendMailMultiPart", serviceContext);
+            } else {
+                dispatcher.runSync("sendMail", serviceContext);
+            }
+        } catch (Exception e) {
+            String errMsg = "Error send email :" + e.toString();
+            Debug.logError(e, errMsg, module);
+            return ServiceUtil.returnError(errMsg);
+        }
+        result.put("body", bodyWriter.toString());
+        return result;
+    }
+}

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/email/BirtEmailServices.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/email/BirtEmailServices.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/email/BirtEmailServices.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java?rev=831503&view=auto
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java (added)
+++ ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java Sat Oct 31 01:22:47 2009
@@ -0,0 +1,171 @@
+package org.ofbiz.birt.report.context;
+
+import java.net.URL;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.eclipse.birt.report.IBirtConstants;
+import org.eclipse.birt.report.context.ViewerAttributeBean;
+import org.eclipse.birt.report.exception.ViewerException;
+import org.eclipse.birt.report.resource.BirtResources;
+import org.eclipse.birt.report.resource.ResourceConstants;
+import org.eclipse.birt.report.utility.BirtUtility;
+import org.eclipse.birt.report.utility.DataUtil;
+import org.eclipse.birt.report.utility.ParameterAccessor;
+import org.ofbiz.base.location.FlexibleLocation;
+
+public class BirtViewerAttributeBean extends ViewerAttributeBean {
+    
+    public final static String module = BirtViewerAttributeBean.class.getName();
+    
+    /**
+     * Module Options
+     */
+    private Map moduleOptions = null;
+    
+    /**
+     * Request Type
+     */
+    private String requestType;
+    
+    private Boolean reportRtl;
+
+    public BirtViewerAttributeBean(HttpServletRequest arg0) {
+        super(arg0);
+        // TODO Auto-generated constructor stub
+    }
+    
+    /**
+     * Init the bean.
+     *
+     * @param request
+     * @throws Exception
+     */
+    @Override
+    protected void __init( HttpServletRequest request ) throws Exception
+    {
+        // If GetImage operate, return directly.
+        if ( ParameterAccessor.isGetImageOperator( request )
+                && ( IBirtConstants.SERVLET_PATH_FRAMESET
+                        .equalsIgnoreCase( request.getServletPath( ) )
+                        || IBirtConstants.SERVLET_PATH_OUTPUT
+                                .equalsIgnoreCase( request.getServletPath( ) )
+                        || IBirtConstants.SERVLET_PATH_RUN
+                                .equalsIgnoreCase( request.getServletPath( ) ) || IBirtConstants.SERVLET_PATH_PREVIEW
+                        .equalsIgnoreCase( request.getServletPath( ) ) ) )
+        {
+            return;
+        }
+
+        this.category = "BIRT"; //$NON-NLS-1$
+        this.masterPageContent = ParameterAccessor
+                .isMasterPageContent( request );
+        this.isDesigner = ParameterAccessor.isDesigner( );
+        
+        if ( !ParameterAccessor.isBookmarkReportlet( request ) )
+        {
+            this.bookmark = ParameterAccessor.getBookmark( request );
+        }
+        else
+        {
+            this.bookmark = null;
+        }        
+        
+        this.isToc = ParameterAccessor.isToc( request );
+        this.reportPage = ParameterAccessor.getPage( request );
+        this.reportPageRange = ParameterAccessor.getPageRange( request );
+        this.action = ParameterAccessor.getAction( request );
+
+        // If use frameset/output/download/extract servlet pattern, generate
+        // document
+        // from design file
+        if ( IBirtConstants.SERVLET_PATH_FRAMESET.equalsIgnoreCase( request
+                .getServletPath( ) )
+                || IBirtConstants.SERVLET_PATH_OUTPUT.equalsIgnoreCase( request
+                        .getServletPath( ) )
+                || IBirtConstants.SERVLET_PATH_DOWNLOAD
+                        .equalsIgnoreCase( request.getServletPath( ) )
+                || IBirtConstants.SERVLET_PATH_EXTRACT
+                        .equalsIgnoreCase( request.getServletPath( ) ) )
+        {
+            this.reportDocumentName = ParameterAccessor.getReportDocument(
+                    request, null, true );
+        }
+        else
+        {
+            this.reportDocumentName = ParameterAccessor.getReportDocument(
+                    request, null, false );
+        }
+
+        String reportParam = DataUtil.trimString( ParameterAccessor.getParameter( request, ParameterAccessor.PARAM_REPORT ));
+        if (reportParam.startsWith("component://")) {
+            ClassLoader loader = Thread.currentThread().getContextClassLoader();
+            if (loader == null) {
+                loader = BirtViewerAttributeBean.class.getClassLoader();
+            }
+            URL reportFileUrl = null;
+            reportFileUrl = FlexibleLocation.resolveLocation(reportParam, loader);
+            if (reportFileUrl == null) {
+                throw new IllegalArgumentException("Could not resolve location to URL: " + reportParam);
+            }
+            this.reportDesignName = reportFileUrl.getPath();
+        } else {
+            this.reportDesignName = ParameterAccessor.getReport( request, null );
+        }
+
+        this.emitterId = ParameterAccessor.getEmitterId( request );
+        
+        // If print action, force to use postscript format
+        this.format = ParameterAccessor.getFormat( request );
+        if ( IBirtConstants.ACTION_PRINT.equalsIgnoreCase( action ) )
+        {
+            // Check whether turn on this funtion
+            if ( ParameterAccessor.isSupportedPrintOnServer )
+            {
+                this.format = IBirtConstants.POSTSCRIPT_RENDER_FORMAT;
+                this.emitterId = null;
+            }
+            else
+            {
+                this.action = null;
+            }
+        }
+
+        // Set locale information
+        BirtResources.setLocale( ParameterAccessor.getLocale( request ) );
+
+        // Set the request type
+        this.requestType = request
+                .getHeader( ParameterAccessor.HEADER_REQUEST_TYPE );
+
+        // Determine the report design and doc 's timestamp
+        processReport( request );
+
+        // Report title.
+        this.reportTitle = ParameterAccessor.getTitle( request );
+
+        // Set whether show the report title
+        this.isShowTitle = ParameterAccessor.isShowTitle( request );
+
+        // Set whether show the toolbar
+        this.isShowToolbar = ParameterAccessor.isShowToolbar( request );
+
+        // Set whether show the navigation bar
+        this.isShowNavigationbar = ParameterAccessor
+                .isShowNavigationbar( request );
+
+        // get some module options
+        this.moduleOptions = BirtUtility.getModuleOptions( request );
+
+        this.reportDesignHandle = getDesignHandle( request );
+        if ( this.reportDesignHandle == null )
+            throw new ViewerException(
+                    ResourceConstants.GENERAL_EXCEPTION_NO_REPORT_DESIGN );
+
+        this.reportRtl = null;
+        
+        // Initialize report parameters.
+        __initParameters( request );
+    }
+}

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java?rev=831503&view=auto
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java (added)
+++ ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java Sat Oct 31 01:22:47 2009
@@ -0,0 +1,29 @@
+package org.ofbiz.birt.report.context;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.birt.report.IBirtConstants;
+import org.eclipse.birt.report.context.BirtContext;
+import org.eclipse.birt.report.context.ViewerAttributeBean;
+
+public class OFBizBirtContext extends BirtContext {
+
+    public OFBizBirtContext(HttpServletRequest request,
+            HttpServletResponse response) {
+        super(request, response);
+        // TODO Auto-generated constructor stub
+    }
+
+    @Override
+    protected void __init() {
+        // TODO Auto-generated method stub
+        this.bean = (ViewerAttributeBean) request
+                .getAttribute( IBirtConstants.ATTRIBUTE_BEAN );
+        if ( bean == null )
+        {
+            bean = new BirtViewerAttributeBean( request );
+        }
+        request.setAttribute( IBirtConstants.ATTRIBUTE_BEAN, bean );
+    }
+}

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java?rev=831503&view=auto
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java (added)
+++ ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java Sat Oct 31 01:22:47 2009
@@ -0,0 +1,336 @@
+package org.ofbiz.birt.report.service;
+
+import java.io.File;
+import java.io.OutputStream;
+import java.rmi.RemoteException;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.TimeZone;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.eclipse.birt.core.exception.BirtException;
+import org.eclipse.birt.report.IBirtConstants;
+import org.eclipse.birt.report.context.ViewerAttributeBean;
+import org.eclipse.birt.report.engine.api.IReportRunnable;
+import org.eclipse.birt.report.engine.api.IRunTask;
+import org.eclipse.birt.report.resource.BirtResources;
+import org.eclipse.birt.report.resource.ResourceConstants;
+import org.eclipse.birt.report.service.BirtViewerReportService;
+import org.eclipse.birt.report.service.ReportEngineService;
+import org.eclipse.birt.report.service.ReportEngineService.DummyRemoteException;
+import org.eclipse.birt.report.service.api.IViewerReportDesignHandle;
+import org.eclipse.birt.report.service.api.InputOptions;
+import org.eclipse.birt.report.service.api.ReportServiceException;
+import org.eclipse.birt.report.utility.BirtUtility;
+import org.eclipse.birt.report.utility.DataUtil;
+import org.eclipse.birt.report.utility.ParameterAccessor;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.birt.container.BirtContainer;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.jdbc.ConnectionFactory;
+
+public class OFBizBirtViewerReportService extends BirtViewerReportService {
+    
+    public final static String module = OFBizBirtViewerReportService.class.getName();
+
+    public OFBizBirtViewerReportService(ServletContext servletContext) {
+        super(servletContext);
+        // TODO Auto-generated constructor stub
+    }
+    
+    @Override
+    public String runReport(IViewerReportDesignHandle design,
+            String outputDocName, InputOptions runOptions, Map parameters,
+            Map displayTexts, List<Exception> errorList) throws ReportServiceException {
+        // TODO Auto-generated method stub
+        
+        if ( design == null || design.getDesignObject( ) == null )
+            throw new ReportServiceException( BirtResources.getMessage( ResourceConstants.GENERAL_EXCEPTION_NO_REPORT_DESIGN ) );
+
+        IReportRunnable runnable;
+        HttpServletRequest request = (HttpServletRequest) runOptions.getOption( InputOptions.OPT_REQUEST );
+        Locale locale = (Locale) runOptions.getOption( InputOptions.OPT_LOCALE );
+        TimeZone timeZone = (TimeZone) runOptions.getOption( InputOptions.OPT_TIMEZONE );
+
+        ViewerAttributeBean attrBean = (ViewerAttributeBean) request.getAttribute( IBirtConstants.ATTRIBUTE_BEAN );
+        // Set parameters
+        Map parsedParams = attrBean.getParameters( );
+        if ( parameters != null )
+        {
+            parsedParams.putAll( parameters );
+        }
+        // Set display Text of select parameters
+        Map displayTextMap = attrBean.getDisplayTexts( );
+        if ( displayTexts != null )
+        {
+            displayTextMap.putAll( displayTexts );
+        }
+
+        runnable = (IReportRunnable) design.getDesignObject( );
+        try
+        {
+            // get maxRows
+            Integer maxRows = null;
+            if ( ParameterAccessor.isReportParameterExist( request,
+                    ParameterAccessor.PARAM_MAXROWS ) )
+                maxRows = Integer.valueOf( ParameterAccessor.getMaxRows( request ) );
+            
+            try {
+                // put all app context from Birt Container to Report Engine Service
+                ReportEngineService.getInstance().getEngineConfig().getAppContext().putAll(
+                        BirtContainer.getReportEngine().getConfig().getAppContext());
+                Connection connection = getConnection();
+                BirtContainer.getReportEngine().getConfig().getAppContext().put("OdaJDBCDriverPassInConnection", connection);
+            } catch (Exception e) {
+                Debug.logError(e, module);
+            }
+            List<Exception> errors = this.runReport( request,
+                            runnable,
+                            outputDocName,
+                            locale,
+                            timeZone,
+                            parsedParams,
+                            displayTextMap,
+                            maxRows );
+            if ( errors != null && !errors.isEmpty( ) )
+            {
+                errorList.addAll( errors );
+            }
+        }
+        catch ( RemoteException e )
+        {
+            if ( e.getCause( ) instanceof ReportServiceException )
+            {
+                throw (ReportServiceException) e.getCause( );
+            }
+            else
+            {
+                throw new ReportServiceException( e.getLocalizedMessage( ),
+                        e.getCause( ) );
+            }
+        }
+        return outputDocName;
+    }
+    
+    /**
+     * Run report.
+     *
+     * @param request
+     *
+     * @param runnable
+     * @param archive
+     * @param documentName
+     * @param locale
+     * @param parameters
+     * @param displayTexts
+     * @param maxRows
+     * @return list of exceptions which occured during the run or null
+     * @throws RemoteException
+     */
+    public List<Exception> runReport( HttpServletRequest request,
+            IReportRunnable runnable, String documentName, Locale locale,
+            TimeZone timeZone, Map parameters, Map displayTexts, Integer maxRows )
+            throws RemoteException
+    {
+        assert runnable != null;
+
+        // Preapre the run report task.
+        IRunTask runTask = null;
+        try {
+            runTask = BirtContainer.getReportEngine().createRunTask( runnable );
+        } catch (Exception e) {
+            throwDummyException(e);
+        }
+        runTask.setLocale( locale );
+        
+        com.ibm.icu.util.TimeZone tz = BirtUtility.toICUTimeZone( timeZone );
+        if ( tz != null )
+        {
+            runTask.setTimeZone( tz );
+        }
+
+        runTask.setParameterValues( parameters );
+
+        // set MaxRows settings
+        if ( maxRows != null )
+            runTask.setMaxRowsPerQuery( maxRows.intValue( ) );
+
+        // add task into session
+        BirtUtility.addTask( request, runTask );
+
+        // Set display Text for select parameters
+        if ( displayTexts != null )
+        {
+            Iterator keys = displayTexts.keySet( ).iterator( );
+            while ( keys.hasNext( ) )
+            {
+                String paramName = DataUtil.getString( keys.next( ) );
+                String displayText = DataUtil.getString( displayTexts
+                        .get( paramName ) );
+                runTask.setParameterDisplayText( paramName, displayText );
+            }
+        }
+
+        // set app context
+        Map context = BirtUtility.getAppContext( request );
+        runTask.setAppContext( context );
+
+        // Run report.
+        try
+        {
+            runTask.run( documentName );
+        }
+        catch ( BirtException e )
+        {
+            // clear document file
+            File doc = new File( documentName );
+            if ( doc != null )
+                doc.delete( );
+
+            throwDummyException( e );
+        }
+        finally
+        {
+            // Remove task from http session
+            BirtUtility.removeTask( request );
+
+            // Append errors
+            if ( ParameterAccessor.isDesigner( ) )
+                BirtUtility.error( request, runTask.getErrors( ) );
+
+            runTask.close( );
+
+            // check for non-fatal errors
+            List<Exception> errors = (List<Exception>) runTask.getErrors( );
+            if ( !errors.isEmpty( ) )
+            {
+                return errors;
+            }
+        }
+        return null;
+    }
+    
+    /**
+     * @see org.eclipse.birt.report.service.api.IViewerReportService#runAndRenderReport(org.eclipse.birt.report.service.api.IViewerReportDesignHandle,
+     *      java.lang.String, org.eclipse.birt.report.service.api.InputOptions,
+     *      java.util.Map, java.io.OutputStream, java.util.List, java.util.Map)
+     */
+    public void runAndRenderReport( IViewerReportDesignHandle design,
+            String outputDocName, InputOptions options, Map parameters,
+            OutputStream out, List activeIds, Map displayTexts )
+            throws ReportServiceException
+    {
+        if ( design == null || design.getDesignObject( ) == null )
+            throw new ReportServiceException( BirtResources.getMessage( ResourceConstants.GENERAL_EXCEPTION_NO_REPORT_DESIGN ) );
+
+        HttpServletRequest request = (HttpServletRequest) options.getOption( InputOptions.OPT_REQUEST );
+
+        try
+        {
+            ViewerAttributeBean attrBean = (ViewerAttributeBean) request.getAttribute( IBirtConstants.ATTRIBUTE_BEAN );
+            String reportTitle = ParameterAccessor.htmlDecode( attrBean.getReportTitle( ) );
+            IReportRunnable runnable = (IReportRunnable) design.getDesignObject( );
+
+            // get maxRows
+            Integer maxRows = null;
+            if ( ParameterAccessor.isReportParameterExist( request,
+                    ParameterAccessor.PARAM_MAXROWS ) )
+                maxRows = Integer.valueOf( ParameterAccessor.getMaxRows( request ) );
+
+            try {
+                // put all app context from Birt Container to Report Engine Service
+                ReportEngineService.getInstance().getEngineConfig().getAppContext().putAll(
+                        BirtContainer.getReportEngine().getConfig().getAppContext());
+                Connection connection = getConnection();
+                ReportEngineService.getInstance( ).getEngineConfig().getAppContext().put("OdaJDBCDriverPassInConnection", connection);
+            } catch (Exception e) {
+                Debug.logError(e, module);
+            }
+            ReportEngineService.getInstance( ).runAndRenderReport( runnable,
+                    out,
+                    options,
+                    parameters,
+                    null,
+                    null,
+                    null,
+                    displayTexts,
+                    reportTitle,
+                    maxRows );
+        }
+        catch ( RemoteException e )
+        {
+            throwReportServiceException( e );
+        }
+    }
+    
+    /**
+     * get connection
+     */
+    private Connection getConnection() {
+        Connection connection = null;
+        try {
+            String delegatorGroupHelperName = BirtContainer.getDelegatorGroupHelperName();
+            Delegator delegator = BirtContainer.getDelegator();
+            Debug.logInfo("Get the JDBC connection from group helper's name:" + delegatorGroupHelperName, module);
+            String helperName = delegator.getGroupHelperName(delegatorGroupHelperName);    // gets the helper (localderby, localmysql, localpostgres, etc.) for your entity group org.ofbiz
+            connection = ConnectionFactory.getConnection(helperName);
+        } catch (GenericEntityException e) {
+            Debug.logError(e, module);
+        } catch (SQLException e) {
+            Debug.logError(e, module);
+        }
+        return connection;
+    }
+    
+    /**
+     * @param e
+     * @throws DummyRemoteException
+     */
+    private void throwDummyException( Exception e )
+            throws DummyRemoteException
+    {
+        if ( e instanceof ReportServiceException )
+        {
+            throw new DummyRemoteException(e);
+        }
+        else
+        {
+            throw new DummyRemoteException( new ReportServiceException( e
+                .getLocalizedMessage( ), e ) );
+        }
+    }
+    
+    /**
+     * Temporary method for extracting the exception from the
+     * DummyRemoteException and throwing it.
+     */
+    private void throwReportServiceException( RemoteException e )
+            throws ReportServiceException
+    {
+        Throwable wrappedException = e;
+        if ( e instanceof ReportEngineService.DummyRemoteException )
+        {
+            wrappedException = e.getCause( );
+        }
+        if ( wrappedException instanceof ReportServiceException )
+        {
+            throw (ReportServiceException) wrappedException;
+        }
+        else if ( wrappedException != null )
+        {
+            throw new ReportServiceException( wrappedException.getLocalizedMessage( ),
+                    wrappedException );
+        }
+        else
+        {
+            throw new ReportServiceException( e.getLocalizedMessage( ), e );
+        }
+    }
+}

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java?rev=831503&view=auto
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java (added)
+++ ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java Sat Oct 31 01:22:47 2009
@@ -0,0 +1,126 @@
+package org.ofbiz.birt.report.servlet;
+
+import java.io.IOException;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.birt.core.exception.BirtException;
+import org.eclipse.birt.report.IBirtConstants;
+import org.eclipse.birt.report.context.IContext;
+import org.eclipse.birt.report.context.ViewerAttributeBean;
+import org.eclipse.birt.report.presentation.aggregation.layout.EngineFragment;
+import org.eclipse.birt.report.presentation.aggregation.layout.RequesterFragment;
+import org.eclipse.birt.report.service.BirtReportServiceFactory;
+import org.eclipse.birt.report.servlet.BaseReportEngineServlet;
+import org.eclipse.birt.report.utility.BirtUtility;
+import org.ofbiz.birt.report.context.OFBizBirtContext;
+import org.ofbiz.birt.report.service.OFBizBirtViewerReportService;
+
+public class BirtEngineServlet extends BaseReportEngineServlet {
+    /**
+     * TODO: what's this?
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Local initialization.
+     *
+     * @return
+     */
+    protected void __init( ServletConfig config )
+    {
+        BirtReportServiceFactory.init( new OFBizBirtViewerReportService( config
+                .getServletContext( ) ) );
+
+        engine = new EngineFragment( );
+
+        requester = new RequesterFragment( );
+        requester.buildComposite( );
+        requester.setJSPRootPath( "/webcontent/birt" ); //$NON-NLS-1$
+    }
+
+    /**
+     * Init context.
+     *
+     * @param request
+     *            incoming http request
+     * @param response
+     *            http response
+     * @exception BirtException
+     * @return IContext
+     */
+    protected IContext __getContext( HttpServletRequest request,
+            HttpServletResponse response ) throws BirtException
+    {
+        BirtReportServiceFactory.getReportService( ).setContext(
+                getServletContext( ), null );
+        return new OFBizBirtContext( request, response );
+    }
+
+    /**
+     * Local authentication.
+     *
+     * @param request
+     *            incoming http request
+     * @param response
+     *            http response
+     * @return
+     */
+    protected boolean __authenticate( HttpServletRequest request,
+            HttpServletResponse response )
+    {
+        return true;
+    }
+
+    /**
+     * Local do get.
+     */
+    protected void __doGet( IContext context ) throws ServletException,
+            IOException, BirtException
+    {
+        ViewerAttributeBean bean = (ViewerAttributeBean) context.getBean( );
+        assert bean != null;
+
+        if ( ( IBirtConstants.SERVLET_PATH_PREVIEW.equalsIgnoreCase( context
+                .getRequest( ).getServletPath( ) )
+                || IBirtConstants.SERVLET_PATH_DOCUMENT
+                        .equalsIgnoreCase( context.getRequest( )
+                                .getServletPath( ) ) || IBirtConstants.SERVLET_PATH_OUTPUT
+                .equalsIgnoreCase( context.getRequest( ).getServletPath( ) ) )
+                && bean.isShowParameterPage( ) )
+        {
+            requester.service( context.getRequest( ), context.getResponse( ) );
+        }
+        else if ( IBirtConstants.SERVLET_PATH_PARAMETER
+                .equalsIgnoreCase( context.getRequest( ).getServletPath( ) ) )
+        {
+            requester.service( context.getRequest( ), context.getResponse( ) );
+        }
+        else
+        {
+            engine.service( context.getRequest( ), context.getResponse( ) );
+        }
+    }
+
+    /**
+     * Process exception for non soap request.
+     *
+     * @param request
+     *            incoming http request
+     * @param response
+     *            http response
+     * @param exception
+     * @throws ServletException
+     * @throws IOException
+     */
+    protected void __handleNonSoapException( HttpServletRequest request,
+            HttpServletResponse response, Exception exception )
+            throws ServletException, IOException
+    {
+        exception.printStackTrace( );
+        BirtUtility.appendErrorMessage( response.getOutputStream( ), exception );
+    }
+}

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java?rev=831503&view=auto
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java (added)
+++ ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java Sat Oct 31 01:22:47 2009
@@ -0,0 +1,143 @@
+package org.ofbiz.birt.report.servlet;
+
+import java.io.IOException;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.birt.core.exception.BirtException;
+import org.eclipse.birt.report.IBirtConstants;
+import org.eclipse.birt.report.context.IContext;
+import org.eclipse.birt.report.presentation.aggregation.IFragment;
+import org.eclipse.birt.report.presentation.aggregation.layout.FramesetFragment;
+import org.eclipse.birt.report.presentation.aggregation.layout.RunFragment;
+import org.eclipse.birt.report.service.BirtReportServiceFactory;
+import org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet;
+import org.eclipse.birt.report.utility.BirtUtility;
+import org.ofbiz.birt.report.context.OFBizBirtContext;
+import org.ofbiz.birt.report.service.OFBizBirtViewerReportService;
+
+public class BirtViewerServlet extends BirtSoapMessageDispatcherServlet {
+    
+    public final static String module = BirtViewerServlet.class.getName();
+    
+    @Override
+    protected void __init(ServletConfig config) {
+        // TODO Auto-generated method stub
+        BirtReportServiceFactory.init( new OFBizBirtViewerReportService( config
+                .getServletContext( ) ) );
+        
+        // handle 'frameset' pattern
+        viewer = new FramesetFragment( );
+        viewer.buildComposite( );
+        viewer.setJSPRootPath( "/webcontent/birt" ); //$NON-NLS-1$
+
+        // handle 'run' pattern
+        run = new RunFragment( );
+        run.buildComposite( );
+        run.setJSPRootPath( "/webcontent/birt" ); //$NON-NLS-1$            
+    }
+    
+    /**
+     * Init context.
+     *
+     * @param request
+     *            incoming http request
+     * @param response
+     *            http response
+     * @exception BirtException
+     * @return IContext
+     */
+    protected IContext __getContext( HttpServletRequest request,
+            HttpServletResponse response ) throws BirtException
+    {
+        BirtReportServiceFactory.getReportService( ).setContext(
+                getServletContext( ), null );
+        return new OFBizBirtContext( request, response );
+    }
+    
+    /**
+     * Local process http request with GET method.
+     *
+     * @param request
+     *            incoming http request
+     * @param response
+     *            http response
+     * @exception ServletException
+     * @exception IOException
+     * @return
+     */
+    protected void __doGet( IContext context ) throws ServletException,
+            IOException, BirtException
+    {
+        IFragment activeFragment = null;
+        String servletPath = context.getRequest( ).getServletPath( );
+        if ( IBirtConstants.SERVLET_PATH_FRAMESET
+                .equalsIgnoreCase( servletPath ) )
+        {
+            activeFragment = viewer;
+        }
+        else if ( IBirtConstants.SERVLET_PATH_RUN
+                .equalsIgnoreCase( servletPath ) )
+        {
+            activeFragment = run;
+        }
+
+        if ( activeFragment != null )
+            activeFragment.service( context.getRequest( ), context
+                    .getResponse( ) );
+    }
+    
+    /**
+     * Locale process http request with POST method. Four different servlet
+     * paths are expected: "/frameset", "/navigation", "/toolbar", and "/run".
+     *
+     * @param request
+     *            incoming http request
+     * @param response
+     *            http response
+     * @exception ServletException
+     * @exception IOException
+     * @return
+     */
+    protected void __doPost( IContext context ) throws ServletException,
+            IOException, BirtException
+    {
+    }
+    
+    /**
+     * Local authentication. Alwasy returns true.
+     *
+     * @param request
+     *            incoming http request
+     * @param response
+     *            http response
+     * @return
+     */
+    protected boolean __authenticate( HttpServletRequest request,
+            HttpServletResponse response )
+    {
+        return true;
+    }
+    
+    /**
+     * Process exception for non soap request.
+     *
+     * @param request
+     *            incoming http request
+     * @param response
+     *            http response
+     * @param exception
+     * @throws ServletException
+     * @throws IOException
+     */
+    protected void __handleNonSoapException( HttpServletRequest request,
+            HttpServletResponse response, Exception exception )
+            throws ServletException, IOException
+    {
+        exception.printStackTrace( );
+        BirtUtility.appendErrorMessage( response.getOutputStream( ), exception );
+    }
+}

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/webapp/view/BirtViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/webapp/view/BirtViewHandler.java?rev=831503&view=auto
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/webapp/view/BirtViewHandler.java (added)
+++ ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/webapp/view/BirtViewHandler.java Sat Oct 31 01:22:47 2009
@@ -0,0 +1,102 @@
+package org.ofbiz.webapp.view;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.SQLException;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.ParserConfigurationException;
+
+import javolution.util.FastMap;
+
+import org.eclipse.birt.core.exception.BirtException;
+import org.eclipse.birt.report.engine.api.IReportEngine;
+import org.eclipse.birt.report.engine.api.IReportRunnable;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.UtilHttp;
+import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.birt.BirtWorker;
+import org.ofbiz.birt.container.BirtContainer;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.widget.birt.BirtFactory;
+import org.xml.sax.SAXException;
+
+public class BirtViewHandler implements ViewHandler {
+    
+    public static final String module = BirtViewHandler.class.getName();
+
+    protected ServletContext servletContext = null;
+
+    private String name = "birt";
+    
+    public void init(ServletContext context) throws ViewHandlerException {
+        // TODO Auto-generated method stub
+        this.servletContext = context;
+    }
+
+    public String getName() {
+        // TODO Auto-generated method stub
+        return name;
+    }
+
+    public void setName(String name) {
+        // TODO Auto-generated method stub
+        this.name = name;
+    }
+
+    public void render(String name, String page, String info,
+            String contentType, String encoding, HttpServletRequest request,
+            HttpServletResponse response) throws ViewHandlerException {
+        // TODO Auto-generated method stub
+        try {
+            IReportEngine engine = BirtContainer.getReportEngine();
+            // open report design
+            IReportRunnable design = null;
+            if (page.startsWith("component://")) {
+                InputStream reportInputStream = BirtFactory.getReportInputStreamFromLocation(page);
+                design = engine.openReportDesign(reportInputStream);
+            } else {
+                design = engine.openReportDesign(servletContext.getRealPath(page));
+            }
+            
+             Map context = FastMap.newInstance();
+            // set parameters from request
+             Map parameters = (Map)request.getAttribute(BirtWorker.BIRT_PARAMETERS);
+                if (parameters != null) {
+                    context.put(BirtWorker.BIRT_PARAMETERS, parameters);
+                }
+                // set locale from request
+                Locale locale = (Locale)request.getAttribute(BirtWorker.BIRT_LOCALE);
+                if (locale == null) {
+                    locale = UtilHttp.getLocale(request);
+                }
+                context.put(BirtWorker.BIRT_LOCALE, locale);
+                String birtImageDirectory = UtilProperties.getPropertyValue("birt", "birt.html.image.directory");
+                context.put(BirtWorker.BIRT_IMAGE_DIRECTORY, birtImageDirectory);
+             BirtWorker.exportReport(design, context, contentType, response.getOutputStream());
+        } catch (BirtException e) {
+            throw new ViewHandlerException("Birt Error create engine: " + e.toString(), e);
+        } catch (IOException e) {
+            throw new ViewHandlerException("Error in the response writer/output stream: " + e.toString(), e);
+        } catch (SQLException e) {
+            throw new ViewHandlerException("get connection error: " + e.toString(), e);
+        } catch (GenericEntityException e) {
+            throw new ViewHandlerException("generic entity error: " + e.toString(), e);
+        } catch (GeneralException e) {
+            throw new ViewHandlerException("general error: " + e.toString(), e);
+        } catch (SAXException se) {
+            String errMsg = "Error SAX rendering " + page + " view handler: " + se.toString();
+            Debug.logError(se, errMsg, module);
+            throw new ViewHandlerException(errMsg, se);
+        } catch (ParserConfigurationException pe) {
+            String errMsg = "Error parser rendering " + page + " view handler: " + pe.toString();
+            Debug.logError(pe, errMsg, module);
+            throw new ViewHandlerException(errMsg, pe);
+        }
+    }
+}

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/webapp/view/BirtViewHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/webapp/view/BirtViewHandler.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/webapp/view/BirtViewHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/widget/BirtFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/widget/BirtFactory.java?rev=831503&view=auto
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/widget/BirtFactory.java (added)
+++ ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/widget/BirtFactory.java Sat Oct 31 01:22:47 2009
@@ -0,0 +1,51 @@
+package org.ofbiz.widget.birt;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.ofbiz.base.location.FlexibleLocation;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.widget.screen.ScreenFactory;
+import org.xml.sax.SAXException;
+
+public class BirtFactory {
+    
+    public static final String module = BirtFactory.class.getName();
+    
+    /**
+     * get report inport stream from location
+     * @param resourceName
+     * @return
+     * @throws IOException
+     * @throws SAXException
+     * @throws ParserConfigurationException
+     */
+    public static InputStream getReportInputStreamFromLocation(String resourceName)
+        throws IOException, SAXException, ParserConfigurationException{
+        
+        InputStream reportInputStream = null;
+        synchronized (BirtFactory.class) {
+            long startTime = System.currentTimeMillis();
+            ClassLoader loader = Thread.currentThread().getContextClassLoader();
+            if (loader == null) {
+                loader = ScreenFactory.class.getClassLoader();
+            }
+            URL reportFileUrl = null;
+            reportFileUrl = FlexibleLocation.resolveLocation(resourceName, loader);
+            if (reportFileUrl == null) {
+                throw new IllegalArgumentException("Could not resolve location to URL: " + resourceName);
+            }
+            reportInputStream = reportFileUrl.openStream();
+            double totalSeconds = (System.currentTimeMillis() - startTime)/1000.0;
+            Debug.logInfo("Got report in " + totalSeconds + "s from: " + reportFileUrl.toExternalForm(), module);
+        }
+        
+        if (reportInputStream == null) {
+            throw new IllegalArgumentException("Could not find report file with location [" + resourceName + "]");
+        }
+        return reportInputStream;
+    }
+}

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/widget/BirtFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/widget/BirtFactory.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/addbirt/framework/birt/src/org/ofbiz/birt/widget/BirtFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/addbirt/framework/birt/webapp/birt/CancelTask.jsp
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/webapp/birt/CancelTask.jsp?rev=831503&view=auto
==============================================================================
--- ofbiz/branches/addbirt/framework/birt/webapp/birt/CancelTask.jsp (added)
+++ ofbiz/branches/addbirt/framework/birt/webapp/birt/CancelTask.jsp Sat Oct 31 01:22:47 2009
@@ -0,0 +1,49 @@
+<%-----------------------------------------------------------------------------
+ Copyright (c) 2004 Actuate Corporation and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Actuate Corporation - Initial implementation.
+-----------------------------------------------------------------------------%>
+<%@ page contentType="text/html; charset=utf-8" %>
+<%@ page session="false" buffer="none" %>
+<%@ page import="org.eclipse.birt.report.utility.BirtUtility,
+ org.eclipse.birt.report.IBirtConstants,
+ org.eclipse.birt.report.resource.BirtResources" %>
+
+<%-----------------------------------------------------------------------------
+ Cancel Task
+-----------------------------------------------------------------------------%>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+ <HEAD>
+ <TITLE>
+ <%= BirtResources.getMessage( "birt.viewer.title.message" )%>
+ </TITLE>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
+ <LINK REL="stylesheet" HREF="<%= request.getContextPath( ) + "/webcontent/birt/styles/style.css" %>" TYPE="text/css">
+ </HEAD>
+ <%
+ String taskid = request.getParameter( IBirtConstants.OPRAND_TASKID );
+ try
+ {
+ BirtUtility.cancelTask( request, taskid );
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace( );
+ }
+ %>
+ <BODY>
+ <TABLE CLASS="BirtViewer_Highlight_Label">
+ <TR>
+ <TD NOWRAP>
+ <%= BirtResources.getMessage( "birt.viewer.message.taskcanceled" )%>
+ </TD>
+ </TR>
+ </TABLE>
+ </BODY>
+</HTML>
\ No newline at end of file

Propchange: ofbiz/branches/addbirt/framework/birt/webapp/birt/CancelTask.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/addbirt/framework/birt/webapp/birt/CancelTask.jsp
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/addbirt/framework/birt/webapp/birt/CancelTask.jsp
------------------------------------------------------------------------------
    svn:mime-type = text/plain