Jump to content
We've recently updated our Privacy Statement, available here ×

Templates and Plugins in jar for 0.5.1


2005 IR Help

Recommended Posts

By: ryust - ryust

Templates and Plugins in jar for 0.5.1

2005-09-24 08:14

Has anyone been able to store the templates and plugins in a jar and have them referenced via the classpath instead of a file directory? I seem to continue to struggle with getting iReport to be non-file based so that it can be used via WebStart or totally from jars. This problem is preventing my company from fully utilizing iReport.

 

Also, is there any documentation on how to create a template or plugin and the other XML files needed to store such in their respective jars.

 

 

 

 

By: C-Box - c-box

RE: Templates and Plugins in jar for 0.5.1

2005-09-25 22:59

Well I do provide my DataBasePlugin for IReport within a JAR-File and we also start IReport via WebStart... just copy your Plugin into the Lib-Dir of IReport... so it's within the classpath when loading.

Your configuration XML-File must be copied into the plugin dir ... and that's all...

 

just try

hth

C-Box

 

 

 

 

By: ryust - ryust

RE: Templates and Plugins in jar for 0.5.1

2005-09-26 08:10

I think you misunderstood my request. I do NOT want to put ANYTHING into any file based directories of iReport (plugin or templates). I want to be completely independent of the file directories and have templates and plugins directly referenced from jars in the classpath (including WebStart).

 

I have tested this with 0.5.1 templates in a classpath jar and it will not find any templates in it unless they are also stored outside of the jar in the templates directory. You need to understand that in a corporate environment you do not want users to manually deal with storing of jars in file directories. It should be handled by some classpath provided to them via the runtime mechanism (such as WebStart).

 

Also, I still cannot find any information or documentation of the "configuration XML-File" that describes plugins. Same for templates.

 

 

 

 

 

 

By: C-Box - c-box

RE: Templates and Plugins in jar for 0.5.1

2005-09-27 13:09

Well we do use IReport in a corporate environment and we do start it via webstart so the user just see a link on a webpage and clicks on it.... he doesn't have to copy any files anywhere... so I don't think that I missunderstood your question.

 

It's more a question how you provide the loader-class that provides both: IReport and your Plugin. So believe me, it's working quite well without any manual effort. Our plugin is always up to date and if I have to distribute a new IReportVersion there wasn't any problem till now. Just make your loader-class a bit more "clever"!?!?!? :-) So I don't see where there should be a problem with the jar location in lib-dir and the config file in plugin dir and java-webstart.

 

For an example what the config file within the plugin dir should contain just see the massive-compiler example within IReport.

 

hth

C-Box

 

 

 

 

By: ryust - ryust

RE: Templates and Plugins in jar for 0.5.1

2005-09-28 07:04

I do think you missunderstand my goal. I do not want any jars or folders in any iReport file directory (regardless whether they are populated manually or programmatically). I want iReport to load its templates and plugins from jars in the classpath, not from jars or files in a file directory.

 

Are you are saying with iReport 0.5.1 you *don't* have a templates folder in your .ireport user file directory, but have a templates jar in the classpath (not in an iReport lib directory) and the iReport wizard finds those templates? Same for plugins? Doesn't work for me!!!

 

What do you mean by a loader-class? Why would I need something outside of Java's classpath (or WebStart)? Isn't iReport responsible for locating templates and plugins from the classpath instead of a file directory? It appears you are saying that we still need to populate the file lib-dir ourselves somehow prior to starting iReport.

 

I was under the impression that iReport no longer requires templates and plugins in a file directory. Is that correct? Previously, version 0.4.1 was fixed to allow that, but it seems 0.5.1 doesn't operate that way now.

 

Templates apparently require a template.xml in the jar for the wizard to know what templates to show in the dialog. I assume plugins require the same. The massive-compiler example you sited was just for that plugin. What is the format of the XML to tell iReport of ALL the plugins to use? What is the structure within the jar it is contained in? For example, the template.xml is in a "ireport/template.xml" path while the actual templates are in a "it/businesslogic/ireport/templates/mytemplate.xml" path.

 

 

 

 

By: C-Box - c-box

RE: Templates and Plugins in jar for 0.5.1

2005-09-29 07:23

Well as every jar within the "lib" dir is automatically within the classpath and as iReport just loads plugins when it starts it's clear that it must be somewhere within the classpath.

 

As iReport makes the following when starting:

Enumeration enum_pl = this.getClass().getClassLoader().getResources("ireport/plugin.xml");

while (enum_pl.hasMoreElements())

{

Object oobj = enum_pl.nextElement();

//System.out.println( oobj+"");

plugin_files_v.add(oobj);

}

} catch (Exception ex) {

logOnConsole("Error searching ireport/plugin.xml resourcesn");

}

 

you also could add your plugin.xml into a jar archive (within the whole plugin.jar) but must ensure that this jar is within the classpath. And as this must be either within lib-dir or you do edit the startup.bat manually and add it from anywhere else to the classpath... the JVM MUST find it somewhere... so where else should it look? I don't work with templates but with plugins and I never had troubles with the logic iReport works with. So I do not say that I haven't any template dir but it's working as I don't work with templates (I generate my own from database! :-))

 

So you are right that you could create many plugins and put them into just ONE jar archive. as long as for every plugin there is a "ireport/plugin.xml" found in that archive too... and that archive must be again within the classpath iReport is started with.

 

The structure is very simple as it just needs a name, a startclass and a description. This is the content of my plugin:

 

<iReportPlugin name="DB Plugin" class="de.ibees.ireport.plugins.DBPlugin" loadOnStartup="false">

<IconFile>/de/ibees/ireport/plugins/dbplugin/form/icons/dbplugin_smallIcon.gif</IconFile>

<Description>Datenbank Plugin</Description>

</iReportPlugin>

 

Perhaps you look in the code how the templates are loaded or ask Guilio directly.

 

hth

C-Box

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...