Skip to main content



      Home
Home » Archived » BIRT » Intergrate own resource locator
Intergrate own resource locator [message #244618] Mon, 25 June 2007 11:18 Go to next message
Eclipse UserFriend
I am trying to integrate my own resource locator into the
BIRT Web application to be able to work with various libraries.

Therefore I implemented a class derived from IResourceLocator.
As far as I understand this class must be set in the EngineConfig
via setResourceLocator().

Could anyone point out how/where this is achieved in a web application?

Thanks a lot!

Peter Fopma
Re: Intergrate own resource locator [message #244869 is a reply to message #244618] Tue, 26 June 2007 09:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Peter,

Take a look at the constructor in
ReportEngineService.java.

Jason

Peter Fopma wrote:
> I am trying to integrate my own resource locator into the BIRT Web
> application to be able to work with various libraries.
>
> Therefore I implemented a class derived from IResourceLocator.
> As far as I understand this class must be set in the EngineConfig
> via setResourceLocator().
>
> Could anyone point out how/where this is achieved in a web application?
>
> Thanks a lot!
>
> Peter Fopma
>
>
Re: Intergrate own resource locator [message #244914 is a reply to message #244869] Tue, 26 June 2007 11:20 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Jason,

that's the place I choose to put it. I was just wondering whether there
is a solution to integrate the resource locator without modifying the code.

My aim is to be able to create two version of a report. A HTML for display
in the browser and a PDF for printing. Since the formating for HTML and PDF
differ quite a bit, I choose to create two libraries. One with the tables
formatted in pixel-units and one with the tables formatted in point-units.
The names for all the reportitems are identical in the two libraries.
Therefore it is sufficient to replace the library in the report design and
the report is formatted in HTML or PDF.

To avoid changing the report design at all, I descided to implement a
resource locator, check the parameter value for __format=pdf/html and
return the URL for the accordant library.

The problem is the resource locator does not know about parameter values
and where I know the parameter values, I cannot influence the resource
locator...
I imagine there must be a code section where the parameter definitions
from the design file are matched with the parameters passed in the
HTTP-request. (I guess that's where __format is evaluated, too)

Could that be the place to set the resource locator which either returns
the pdf or the html library (i.e. I use two resource locators)?
Could you help me find the code where this is done?

Thanks
Peter
Re: Intergrate own resource locator [message #244957 is a reply to message #244914] Tue, 26 June 2007 16:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Peter,

Why not change it in the ReportEngineService.java where the output
format is checked? You will need to do this in a couple of places in
this file.

if ( format == null )
format = ParameterAccessor.getFormat( request );

if ( IBirtConstants.PDF_RENDER_FORMAT.equalsIgnoreCase( format )
|| IBirtConstants.POSTSCRIPT_RENDER_FORMAT
.equalsIgnoreCase( format ) )
{
renderOption = createPDFRenderOption( servletPath, request,
ParameterAccessor.isDesigner( request ) );
}

BTW did you try using 2 libs and then just use script to change the
namespace for the extends property?

Jason

Peter Fopma wrote:
> Thanks Jason,
>
> that's the place I choose to put it. I was just wondering whether there
> is a solution to integrate the resource locator without modifying the code.
>
> My aim is to be able to create two version of a report. A HTML for display
> in the browser and a PDF for printing. Since the formating for HTML and PDF
> differ quite a bit, I choose to create two libraries. One with the tables
> formatted in pixel-units and one with the tables formatted in point-units.
> The names for all the reportitems are identical in the two libraries.
> Therefore it is sufficient to replace the library in the report design and
> the report is formatted in HTML or PDF.
>
> To avoid changing the report design at all, I descided to implement a
> resource locator, check the parameter value for __format=pdf/html and
> return the URL for the accordant library.
>
> The problem is the resource locator does not know about parameter values
> and where I know the parameter values, I cannot influence the resource
> locator...
> I imagine there must be a code section where the parameter definitions
> from the design file are matched with the parameters passed in the
> HTTP-request. (I guess that's where __format is evaluated, too)
> Could that be the place to set the resource locator which either returns
> the pdf or the html library (i.e. I use two resource locators)?
> Could you help me find the code where this is done?
>
> Thanks
> Peter
>
Re: Intergrate own resource locator [message #245035 is a reply to message #244957] Wed, 27 June 2007 04:02 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Jason,

using two libraries and changing the namespace/extends via script sounds
like a
better approach to me.

Can I change the namespace of the library - i.e. change the namespace of
the one library I want to use to the namespace which is referenced by the
report elements?
Or do I change the extends of each report element?
Could you tell me how this can be done via script?

Thanks
Peter
Re: Intergrate own resource locator [message #245412 is a reply to message #245035] Thu, 28 June 2007 11:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Peter,

I tried swapping the libraries tags in the beforeFactory but that may be
to late. I was able to get this to work by adding lib1 and lib2 to the
report and then in the beforeFactory changing the extends property like
this:

if( reportContext.getOutputFormat() == "html" ){
reportContext.getReportRunnable().designHandle.getDesignHand le().findElement( "NewLabel").setStringProperty("extends",
"lib2.NewLabel")
}else{
reportContext.getReportRunnable().designHandle.getDesignHand le().findElement( "NewLabel").setStringProperty("extends",
"lib1.NewLabel")
}

Jason

Peter Fopma wrote:
> Thanks Jason,
>
> using two libraries and changing the namespace/extends via script sounds
> like a
> better approach to me.
>
> Can I change the namespace of the library - i.e. change the namespace of
> the one library I want to use to the namespace which is referenced by the
> report elements?
> Or do I change the extends of each report element?
> Could you tell me how this can be done via script?
>
> Thanks
> Peter
>
>
Re: Intergrate own resource locator [message #245628 is a reply to message #245412] Fri, 29 June 2007 11:35 Go to previous messageGo to next message
Eclipse UserFriend
Jason, should this work in version 2.1 or is this only possible in version
2.2?

Thanks
Peter
Re: Intergrate own resource locator [message #245693 is a reply to message #245628] Sat, 30 June 2007 13:58 Go to previous message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Peter,

I did that in 2.2, but I would think it would work in 2.1.x.

Jason

Peter Fopma wrote:
> Jason, should this work in version 2.1 or is this only possible in
> version 2.2?
>
> Thanks
> Peter
>
Previous Topic:problem with restarting platform and jdbc
Next Topic:Runtime vs Development & Birt 2.2RC4
Goto Forum:
  


Current Time: Mon Jun 02 17:56:36 EDT 2025

Powered by FUDForum. Page generated in 0.24766 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top