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 179934 - Add org.openide.modules.arch.* tokens
Summary: Add org.openide.modules.arch.* tokens
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: Module System (show other bugs)
Version: 6.x
Hardware: PC All
: P3 normal with 3 votes (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: API
Depends on:
Blocks:
 
Reported: 2010-01-27 16:21 UTC by matteodg
Modified: 2011-04-18 12:34 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Proposed patch to code.startup module for release691 branch (1.29 KB, patch)
2010-10-08 01:18 UTC, matteodg
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description matteodg 2010-01-27 16:21:58 UTC
It would be useful to add tokens org.openide.modules.arch.x64 or org.openide.modules.arch.x86. This way we will be able to install a module depending on a architecture of the current NetBeans installation, not only the OS.
Comment 1 matteodg 2010-10-08 01:18:45 UTC
Created attachment 102303 [details]
Proposed patch to code.startup module for release691 branch
Comment 2 Petr Nejedly 2010-10-08 13:00:14 UTC
I would be interested in an use case for this.
I have had an example with native libraries (JNI), but that use case got solved on the class loader level and without any need for separate module for each architecture.
Comment 3 matteodg 2010-10-08 16:34:42 UTC
We are distributing using NBMs updates an executable to be launched by our RCP application. We have 4 different modules (linux32, linux64, win32, win64) containing the executable for each arch/os combination we have to support.

FYI currently we have this solution: we are storing the executable in a resources package of each module (so 4 modules) and we copy only the correct executable in the <cluster>/modules/ext folder, checking os.name and os.arch at runtime in a ModuleInstaller class.

Ideally we do not want the user to download all executables when he really needs only one. More than that we also want that only the needed NBM is visible in the update center so the user can just install it and we do not need that "copy exe" code anymore.

The same argument can be stated for installation of libraries (like JOGL), users do not need to download all .so/.dll libraries when they really need one for their particular OS/arch combination.
Comment 4 arittner 2010-10-12 15:27:23 UTC
An other example are the SWT Libraries. SWT runs only in exactly matching OS<->VM. You need a SWT Library for "Win32/Java VM 32Bit" and a library for "Win64/Java VM 64Bit". (used by DJ Native Swing)

Without an arch-token it's hard to load only one JAR with the standard module loader system. 

br, josh.
Comment 5 Jaroslav Tulach 2011-04-14 10:57:40 UTC
Good, I can accept the API change. I need patch with test and description of changes in openide.modules/src/org/openide/modules/doc-files/api.html, changes to module versioning.

When ready, reopen.
Comment 6 Jesse Glick 2011-04-14 15:01:00 UTC
(In reply to comment #3)
> currently we have this solution: we are storing the executable in a
> resources package of each module (so 4 modules) and we copy only the correct
> executable in the <cluster>/modules/ext folder, checking os.name and os.arch at
> runtime in a ModuleInstaller class.

If by "executable" you mean "native library", much better is to statically bundle all the arch variants for a given OS under modules/lib, but using different basenames. Then call System.loadLibrary using a basename corresponding to the current arch.

That assumes that it is your own code which is calling loadLibrary, not some third-party Java library. If you do not control the call to loadLibrary, the enhancement in bug #186000 is less flexible but can be used to address the most common requirement of loading a different SO/DLL according to arch token - you just need to arrange the files in a particular hierarchy.

Of course, this enhancement is still desirable so that the user can avoid even downloading irrelevant libraries, which may be a concern when each library is in the megabyte range. Currently the best you can do is have the user download libraries for all possible architectures on a given OS.

If by "executable" you really mean "standalone executable to be launched via ProcessBuilder", then of course you would just determine the desired executable at runtime before launching it, finding the actual File path using InstalledFileLocator. No copying or ModuleInstall needed. ('modules/ext' is not the conventional cluster-relative path for such files; use 'bin'.) Again there is the potential issue of download size if several architectures must be packaged in one OS-dependent module.
Comment 7 matteodg 2011-04-18 12:34:16 UTC
(In reply to comment #6)
> (In reply to comment #3)
> > currently we have this solution: we are storing the executable in a
> > resources package of each module (so 4 modules) and we copy only the correct
> > executable in the <cluster>/modules/ext folder, checking os.name and os.arch at
> > runtime in a ModuleInstaller class.
> 
> If by "executable" you mean "native library", much better is to statically
> bundle all the arch variants for a given OS under modules/lib, but using
> different basenames. Then call System.loadLibrary using a basename
> corresponding to the current arch.
> 
> That assumes that it is your own code which is calling loadLibrary, not some
> third-party Java library. If you do not control the call to loadLibrary, the
> enhancement in bug #186000 is less flexible but can be used to address the most
> common requirement of loading a different SO/DLL according to arch token - you
> just need to arrange the files in a particular hierarchy.
> 
> Of course, this enhancement is still desirable so that the user can avoid even
> downloading irrelevant libraries, which may be a concern when each library is
> in the megabyte range. Currently the best you can do is have the user download
> libraries for all possible architectures on a given OS.
> 
> If by "executable" you really mean "standalone executable to be launched via
> ProcessBuilder", then of course you would just determine the desired executable
> at runtime before launching it, finding the actual File path using
> InstalledFileLocator. No copying or ModuleInstall needed. ('modules/ext' is not
> the conventional cluster-relative path for such files; use 'bin'.) Again there
> is the potential issue of download size if several architectures must be
> packaged in one OS-dependent module.


Yes, I was meaning "standalone executable to be launched via ProcessBuilder" and the main reason for this enhancement of arch tokens was about the download size since we have executables for each arch/os combination, we would like to avoid irrelevant downloads.

Thanks for the comments, I will provide a patch with test and api.html changes.