resource folder

View: New views
4 Messages — Rating Filter:   Alert me  

resource folder

by arnaudcz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have already find how to set a resource folder for the Birt Viewer or the Designer, but not for the Report Engine.

Without this setting, the rep \birt-runtime-2_3_0\ReportEngine is the resource folder but i want to change it.

Does anyone know how to configure the resource folder for the Report Engine?


Thanks

Re: resource folder

by sforbes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

My solution to this was to use an IResourceLocator when opening the report design, something like this:

        design = engine.openReportDesign(file.getAbsolutePath(), inputStream, new IResourceLocator() {
            public URL findResource(ModuleHandle moduleHandle, String name, int type) {
                File f = new File(resourceFiles.getParentFile(), name);
                if ( f.exists() ) {
                    try {
                        return f.toURL();
                    } catch (MalformedURLException muex) {
                        return null;
                    }
                }
                f = new File(name);
                if ( f.exists() ) {
                    try {
                        return f.toURL();
                    } catch (MalformedURLException muex) {
                        return null;
                    }
                }
                return null;
            }
        });

Not sure if the second "new File(name)" is required (or secure), but this works for me.

Shaun

arnaudcz wrote:
Does anyone know how to configure the resource folder for the Report Engine?

RE: resource folder

by portal on behalf of Scott Rosenbaum :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ResourceLocators are good, but may be overkill for this.  If you just need a
base location for resources you can:

    final String BIRT_RUNTIME_HOME = new File( "/path/to_birt/home" );
    final String RESOURCE_PATH = new File("/path_to/resource/home" );
    EngineConfig config = new EngineConfig();
    config.setBIRTHome( BIRT_RUNTIME_HOME.getAbsolutePath() );
    config.setResourcePath( RESOURCE_PATH.getAbsolutePath() );

-----Original Message-----
From: birt-report-engine-dev-bounces@...
[mailto:birt-report-engine-dev-bounces@...] On Behalf Of sforbes
Sent: Wednesday, July 29, 2009 6:39 PM
To: birt-report-engine-dev@...
Subject: Re: re[birt-report-engine-dev] source folder


My solution to this was to use an IResourceLocator when opening the report
design, something like this:

        design = engine.openReportDesign(file.getAbsolutePath(),
inputStream, new
IResourceLocator() {
            public URL findResource(ModuleHandle moduleHandle, String name,
int
type) {
                File f = new File(resourceFiles.getParentFile(), name);
                if ( f.exists() ) {
                    try {
                        return f.toURL();
                    } catch (MalformedURLException muex) {
                        return null;
                    }
                }
                f = new File(name);
                if ( f.exists() ) {
                    try {
                        return f.toURL();
                    } catch (MalformedURLException muex) {
                        return null;
                    }
                }
                return null;
            }
        });

Not sure if the second "new File(name)" is required (or secure), but this
works for me.

Shaun


arnaudcz wrote:
>
> Does anyone know how to configure the resource folder for the Report
> Engine?
>

--
View this message in context:
http://www.nabble.com/resource-folder-tp24714137p24729956.html
Sent from the Eclipse BIRT - Report Engine - Dev mailing list archive at
Nabble.com.

_______________________________________________
birt-report-engine-dev mailing list
birt-report-engine-dev@...
https://dev.eclipse.org/mailman/listinfo/birt-report-engine-dev


_______________________________________________
birt-report-engine-dev mailing list
birt-report-engine-dev@...
https://dev.eclipse.org/mailman/listinfo/birt-report-engine-dev

RE: resource folder

by arnaudcz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you for your quick response, but actually i haven't integrated the Birt Runtime into a Java application.

I'm just using batch or shell to launch a Java command on the Report Engine.

I think i will use the \birt-runtime-2_3_0\ReportEngine folder which is the default resource folder.

Thanks.