This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 21323 - Move registration of builder, properties, etc. from module install to layer
Summary: Move registration of builder, properties, etc. from module install to layer
Status: RESOLVED WONTFIX
Alias: None
Product: obsolete
Classification: Unclassified
Component: jarpackager (show other bugs)
Version: 3.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@obsolete
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2002-03-07 18:29 UTC by Rochelle Raccah
Modified: 2004-08-13 12:11 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rochelle Raccah 2002-03-07 18:29:18 UTC
The registration of archive builder and properties are done like this:
JarCreator.addBuilder(<my builder>.getInstance());
JarCreator.addExtendedProperty(new <my property>);
JarOption.singleton().addOption(<my option node>.getInstance());

These should be moved to xml layers but I suspect the jar packager code needs to
implement the framework for that first.
Comment 1 Milos Kleint 2002-04-04 09:25:24 UTC
for the options it should be fairly easy (ContextOption is said to be
deprecated anyway and JarOption.singleton() is not nice either.)
However the issue here is backward compatibility. I've checked the
Enterprise edition and noone seems to be adding an option under the
jar node. Rochelle, do you add some options there?

I didn't fully understand what the JarCreator stuff is doing. Can you
give an example, please? Thanks.
Comment 2 Rochelle Raccah 2002-04-08 19:55:13 UTC
Milos, we do add an option, but if you require a change which is not
backwards compatible, as long as there is a clear/easy mechanism to
change the module code, it is okay for us.  As far as the JarCreator
stuff, I'm not entirely sure, but please see section 2.2.2 at
<http://jarpackager.netbeans.org/jarpackdesign.html>
Comment 3 Milos Kleint 2002-04-25 13:34:01 UTC
well, I think we can have a backward compatible stage, when old way of
adding options will still work along with the new way (*fingers crossed*)

I think the way to go is to move the registration to the layer
definition.. 
Comment 4 Milos Kleint 2002-04-26 09:07:16 UTC
ok, I have the code for the settings alomost done. (still figuring out
if I can make it fully backward compatible)
The sub-options will be declared in layer.xml in folder
Services/Hidden/JarPackager.. any such options will be treated as
subnodes of the main JarOption node..

I'll address the Builders and Extended properties in the same way. As
I figured it out both these should be added only at module startup and
removed during module uninstallation, right?


Comment 5 Rochelle Raccah 2002-04-26 17:43:47 UTC
Yes, the builds and extended properties are only at module
restored/uninstall time.
Comment 6 Milos Kleint 2002-04-29 15:25:14 UTC
The registration of archive builder and properties are done like this:
JarCreator.addBuilder(<my builder>.getInstance());
JarCreator.addExtendedProperty(new <my property>);
JarOption.singleton().addOption(<my option node>.getInstance());


It will be moved to declarative layer definition, you should remove the
add/remove methods from your module install classes.

for Builders:
    <folder name="JarPackager">
<folder name="Builders">
<file name="org-netbeans-modules-jarpackager-TestBuilder.instance">
<attr name="instanceOf"
stringvalue="org.netbeans.modules.jarpackager.api.ArchiveBuilder"/>
</file>
</folder>
</folder>

For extended properties:
    <folder name="JarPackager">
<folder name="ExtendedProperties">
<file name="org-netbeans-modules-jarpackager-TestFactory.instance">
<attr name="instanceOf"
stringvalue="org.netbeans.modules.jarpackager.api.ExtendedPropertyFactory"/>
</file>
</folder>
</folder>

both these should be fully backward compatible and your old code will work
without problems.

for settings the JarOption.singleton() method is deprecated (JarOption
still
remains to be ContextOption however once the ContextOption class gets
deprecated, it will change it's superclass as well) and the
registration of
options is done on layer this way:
Put your setting in the folder Services/Hidden/JarPackager:

    <folder name="Services">
<folder name = "Hidden">
<folder name="JarPackager">
<file name="jarpackager-settings.settings"
url="jarpackager-settings.settings">
<attr name="SystemFileSystem.localizingBundle"
stringvalue="org.netbeans.modules.jarpackager.options.Bundle"/>
<attr name="SystemFileSystem.icon"
urlvalue="nbres:/org/netbeans/modules/jarpackager/resources/jar_recipe.gif"/>
</file>
</folder>
</folder>

This change is not fully backward compatible, diong it the old way
will result
in you settings to be missing in Tools/Options dialog..

Comment 7 Milos Kleint 2002-05-02 12:33:29 UTC
integrated into main trunk.
Comment 8 Rochelle Raccah 2002-05-06 20:47:18 UTC
I assume this is done in the trunk.  Can you add a section or a link
to this issue in the 3.3->3.4 migration guide?
Comment 9 Jesse Glick 2002-06-25 18:14:55 UTC
This is in the upgrade guide.
Comment 10 Rochelle Raccah 2002-12-20 23:18:18 UTC
I'm trying to verify this and have some comments:
1) I found that my builder and property factory classes were
previously package private and I needed to change them to be public.
2) The examples below are not detailed in terms of <my builder>, <my
property>, and <my option node>.  As it is I was slightly confused and
had to rely on my past knowledge of layer editing.  I added a
.settings property and entries to the bundle for the Services/Hidden -
not sure if I had to do that.
3) You should specify which version of jarpackager module I need to
declare.  I guessed and changed from 1.6.x to 1.10.  Does this change
require a new IDE-Dependencies version?  Any package/api dependencies?
Comment 11 Ondrej Rypacek 2003-01-28 17:42:01 UTC
Sorry Rochelle, I came to jarpackager well after this change was made
so I don't know much about it - nothing more than written here. I'm
sorry, I cannot tell you wether all the changes you made were
necessary. Nevertheless, I'll try to help you as much as I can and
investigate everything necessary. Do you have any problems with the
fix now?
Comment 12 Rochelle Raccah 2003-01-28 18:10:46 UTC
I am not actively using a build with this fix yet, so I can't tell if
I have problems with it.  However, I think it's valuable to ask Milos
the answers to my questions and use them to update the entry in the
upgrade guide on this topic.
Comment 13 Milos Kleint 2003-01-29 01:23:44 UTC
re 1. I assume that is the result of layer definition. Maybe you could
keep them package private if you define a factory method to create them??
re 2. I don't quite follow you, but I assume you did just well in the
end, right?
re 3. No idea, it's 6+ month back. I can't recall what I did last week :)

Comment 14 Rochelle Raccah 2003-01-30 01:03:36 UTC
For 1) This was just a comment and suggestion that might be needed for
the upgrade guide entry.
For 2) I figured something out, but I'm not sure if it's correct. 
Again, I am pointing out where the upgrade guide should be improved.
For 3) This information should be found and added to the upgrade
guide.
Comment 15 Rochelle Raccah 2003-07-10 01:52:26 UTC
Please investigate issues 1-3 and improve the upgrade guide entry
accordingly.
Comment 16 Milos Kleint 2003-07-10 02:55:14 UTC
not working on jarpackager for more than a year, reassigning.
Comment 17 Jesse Glick 2004-03-19 14:25:18 UTC
Now irrelevant.