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 17164 - Allow modules to enhance the Utilities.translate
Summary: Allow modules to enhance the Utilities.translate
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Module System (show other bugs)
Version: 3.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
Depends on: 20417 20418 20419 20420
Blocks: 19483
  Show dependency tree
 
Reported: 2001-10-31 13:05 UTC by Jaroslav Tulach
Modified: 2008-12-22 23:16 UTC (History)
6 users (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments
A patch to move packages.txt from openide to core/ide/src (3.04 KB, patch)
2002-02-19 16:45 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2001-10-31 13:05:17 UTC
There is a place in OpenIDE which references classes from different modules -
Utilities.translate. It translates package names of old classes into new onces,
so deserialization of old settings continues to work even after repackaging.

It might be nice to enhance the Utility to easily allow modules to add their
classes there. For example each module could provide a file

META-INF/translate.txt

and this utility method would read them and convert into new package names. 

Another task is to rewrite the method to use regular expressions (probably from
JDK1.4) so the checking is linear to the length of the package name and does not
slow down with the number of packages that need to be translated.
Comment 1 _ pkuzel 2001-11-01 09:36:31 UTC
It makes sense, it was also our original intention, but we are too
conservative regarding OpenIDE :-). Going to implement a part allowing
modules to plugin their translation tables...
Comment 2 _ pkuzel 2001-11-01 14:31:17 UTC
Implemented by looking for all "META-INF/OpenIDE/translate.txt"
resources using IDE system class loader. It may be a little bit slower
that previous hard wired implemetation.

New OpenIDE specification version 1.43.

This enhancement allows old modules to be used with new OpenIDE
without senseless translation of their class names.
Comment 3 Jaroslav Tulach 2001-11-06 07:24:47 UTC
org.openide.util package should not depend on other packages. Please
rewrite the code not to listen on ModuleItem

Try to build
openide$ ant lib-util

and check whether classes  from that library (that were loadable - not
all them could be made) are still loadable.
Comment 4 Jaroslav Tulach 2001-11-06 07:26:23 UTC
Also consider renaming META-INF/OpenIDE/translate.txt to something
less IDE dependent like META-INF/classname.translate  please.
Comment 5 _ pkuzel 2001-11-06 15:27:48 UTC
Leaving as an enhancement for Module API. It should load needed
metadata (e.g. from module manifests) and communitate it to Utilities
(while leaving Utilities independent on module API). Currently it
sounds like unsolveable task without such support.

I also increased enhancement priority as it affect back compatability
of OpenIDE (while using an old module version that was repackaged with
new OpenIDE).

To Yarda's naming suggestion "package.translation" i.e. giving stress
to package.
Comment 6 Jan Chalupa 2001-11-27 13:03:19 UTC
Target milestone -> 3.3.1.
Comment 7 Jaroslav Tulach 2002-02-06 11:19:48 UTC
I'll investigate it.
Comment 8 Jaroslav Tulach 2002-02-06 15:16:15 UTC
Hi Jesse, it seems I have a solution to this issue and also to the
ability to suppress missing SUID. Implemented in branch
serialization_17164 and here are the diffs:


http://www.netbeans.org/source/browse/openide/src/org/openide/util/Utilities.java.diff?r1=1.80&r2=1.80.2.1
http://www.netbeans.org/source/browse/openide/src/org/openide/util/io/NbObjectInputStream.java.diff?r1=1.22&r2=1.22.6.1
http://www.netbeans.org/source/browse/openide/src/org/openide/util/packages.txt.diff?r1=1.14&r2=1.14.2.1

A review would be nice. Before I merge it I would like to distribute
the content of packages.txt to different modules (mostly XML ;-). Is
it ok to create a directory META-INF under xml/src and put the
"translate.packages" file there?
Comment 9 _ pkuzel 2002-02-06 15:27:05 UTC
For xml modules it is already in place under
xml/{submodule}/compat/src/META-INF/OpenIDE/translate.txt.

Yarda, do you really dislike the idea of putting it into META-INF
subdirectory (e.g. OpenIDE)? It creates a "namespace".
Comment 10 Jesse Glick 2002-02-07 13:33:20 UTC
Looks reasonable to me. Some more comments in Utilities.java
explaining what it is doing might be nice. Also a comment in
NbObjectInputStream.java explaining the distinction between name==newN
(normal behavior) and name!=newN&&name.equals(newN) (same name, broken
svuid) would be useful, as this is subtle.

I think I saw that you were adding some unit tests for this too, which
is good.
Comment 11 Jaroslav Tulach 2002-02-08 09:46:59 UTC
Thanks Jesse, I'll separate packages.txt and improve the
documentation.

Ok Petr, namespace would be good. Can I use
META-INF/netbeans/translate.names?
Comment 12 _ pkuzel 2002-02-08 09:56:53 UTC
Cool namespace.
Comment 13 _ pkuzel 2002-02-08 13:40:03 UTC
XML module updated to this new schema.
Comment 14 Jaroslav Tulach 2002-02-11 09:48:00 UTC
Merged into main trunk. Now waiting for module owners to take their
part of packages.txt and put it into their modules.

After that the rest of packages.txt should be deleted and moved to
core-ide as soon as Hrebejk finishes it.
Comment 15 Jaroslav Tulach 2002-02-19 16:45:18 UTC
Created attachment 4749 [details]
A patch to move packages.txt from openide to core/ide/src
Comment 16 Jaroslav Tulach 2002-02-20 09:43:40 UTC
packages.txt moved to core/ide/src/META-INF/netbeans/translate.names