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 46833 - Allow a module to be run only on some class of operating systems
Summary: Allow a module to be run only on some class of operating systems
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Module System (show other bugs)
Version: 4.x
Hardware: All All
: P1 blocker (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks: 46811
  Show dependency tree
 
Reported: 2004-08-02 15:27 UTC by Jaroslav Tulach
Modified: 2008-12-23 08:42 UTC (History)
5 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Support for dependencies on MacOSX, Unix and Windows (9.22 KB, patch)
2004-08-02 15:32 UTC, Jaroslav Tulach
Details | Diff
Improved patch that works on MacOSX as well (actually it is also Unix so it has both tokens) (5.77 KB, patch)
2004-08-02 16:25 UTC, Jaroslav Tulach
Details | Diff
Unit test was in the original diff, I messed the second one on mac. Here is a complete version. (9.66 KB, patch)
2004-08-03 12:26 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 2004-08-02 15:27:32 UTC
There was a lot of request to solve the problem
specific tailoring of the product for certain
operation systems' specifics (recently for example
issue 46808 or issue 46807, more historically the
ide/applemenu module, J2ME emulators, etc.). In my
opinion it makes sence to invest a bit of time and
try to solve it in a bit more systematic way
instead of neverending hacking.
Comment 1 Jaroslav Tulach 2004-08-02 15:31:09 UTC
The solution I have in mind is inspired by the way RPM would handle
dependencies (any dependency on specific OS is like dependency on a
specific library/token). So module that would like to restrict itself
to be executed on a specific OS could use

OpenIDE-Module-Requires: blablabla

to request the OS. The list of OSes does not need to be big, we have
explicit requrest for MacOSX right now, but it can surely grow in a
future as we get new requirements.
Comment 2 Jaroslav Tulach 2004-08-02 15:32:24 UTC
Created attachment 16611 [details]
Support for dependencies on MacOSX, Unix and Windows
Comment 3 Jaroslav Tulach 2004-08-02 15:36:15 UTC
My patch defines new API - three tokens that other modules can depend
on and thus restrict its enablement only to certain platforms. The
code may not be nicest (attaches the OS token to org.openide), but I
tried to separate it to NbInstaller, so it does not influence the
generic module system and also it can be rewritten any time still
keeping those three new tokens working. 

I guess this solution should work well with autoupdate (e.g. not offer
applemenu for download or at least warn when it is selected) but I
have not tested that. Now I am waiting for Jesse to review it.
Comment 4 Jaroslav Tulach 2004-08-02 16:25:17 UTC
Created attachment 16615 [details]
Improved patch that works on MacOSX as well (actually it is also Unix so it has both tokens)
Comment 5 Jesse Glick 2004-08-02 19:52:47 UTC
Patch looks fine to me, except for new ArrayList() should be new
ArrayList(2), and it would be nice to have a unit test.

Might need to separately patch autoupdate in order to get that to
work. Not sure if it will pick up the "live" Module for org.openide w/
the adjusted provides list. Maybe.
Comment 6 Jaroslav Tulach 2004-08-03 12:26:01 UTC
Created attachment 16623 [details]
Unit test was in the original diff, I messed the second one on mac. Here is a complete version.
Comment 7 Jesse Glick 2004-08-03 16:09:31 UTC
Looks fine.
Comment 8 Jesse Glick 2004-08-03 16:10:18 UTC
Of course need patch to
openide/api/doc/org/openide/modules/doc-files/api.html at some point
as well, and also openide/api/doc/changes/apichanges.xml at time of
integration.
Comment 9 Jaroslav Tulach 2004-08-09 08:51:20 UTC
I think the review has not brought any problems, I am ready to
integrate this, I'll apply the latest diff and update API changes and
the documentation as Jesse pointed out.
Comment 10 _ ttran 2004-08-09 09:30:12 UTC
Hey, guys isn't it too late for D?  Even if we do this for D, who
would be the users of the new API in D timeframe?
Comment 11 Jaroslav Tulach 2004-08-09 14:51:15 UTC
Thanks for rising your objection. I agree, that this is not the best
time for enhancements, but I've been under the impression that there
is a pressing need to support mac os and support it well, so I
justified the fix for myself.

The problem is longstanding, we were just unwilling to address it
during more sooner phases of the promoD, it is summarized as: "be able
to enable a module only on a specific class of OS". We desperatelly
need such functionality - we've encountered this when writing the
ide/applemenu module, Dafe would use it for fixing different shortcuts
between Unix and Windows, mobility might do that for their emulators
and now issue 46811 needs similar functionality for Mac.

If the patch is integrated, there will be an immediate user benefit -
applemenu will be completely disabled on all other platforms than Mac.
 Another consumer of the patch is issue 46881, which Tim seems to be
willing to integrate for promoD. Those would be the two consumers of
this API for promoD.

If this is not convicing enough, feel free to change the target
milestone (probably to promoE). I'd like to emphatize that without
this issue Tim can hardly solve issue 46881 without bunch of hacks -
to prevent that, I am ready to suffer the maintainance problems
related to this enhancement (which I do not expect any).
Comment 12 Jesse Glick 2004-08-09 15:52:10 UTC
Agreed that this RFE is sensible in general and the best solution I
can see for Mac support in the D timeframe - decent Mac KB support
needs *some* kind of infrastructure change in order to work, and this
is most straightforward and apparent.

The patch itself is quite simple.

One other thing: I would request that ModuleInstaller.refineProvides
get a @since tag and that core/manifest.mf have its spec version
increased. Generally I try to track API changes in the module subsystem.
Comment 13 Jaroslav Tulach 2004-08-11 11:08:11 UTC
cvs ci -m "#46833: Allow a module to be run only on some class of
operating systems"
Checking in core/manifest.mf;
/cvs/core/manifest.mf,v  <--  manifest.mf
new revision: 1.38; previous revision: 1.37
done
Processing log script arguments...
More commits to come...
Checking in core/src/org/netbeans/core/modules/Module.java;
/cvs/core/src/org/netbeans/core/modules/Module.java,v  <--  Module.java
new revision: 1.55; previous revision: 1.54
done
Checking in core/src/org/netbeans/core/modules/ModuleInstaller.java;
/cvs/core/src/org/netbeans/core/modules/ModuleInstaller.java,v  <-- 
ModuleInstaller.java
new revision: 1.10; previous revision: 1.9
done
Checking in core/src/org/netbeans/core/modules/ModuleManager.java;
/cvs/core/src/org/netbeans/core/modules/ModuleManager.java,v  <-- 
ModuleManager.java
new revision: 1.63; previous revision: 1.62
done
Checking in core/src/org/netbeans/core/modules/NbInstaller.java;
/cvs/core/src/org/netbeans/core/modules/NbInstaller.java,v  <-- 
NbInstaller.java
new revision: 1.77; previous revision: 1.76
done
Processing log script arguments...
More commits to come...
RCS file:
/cvs/core/test/unit/src/org/netbeans/core/modules/PlatformDependencySatisfiedTest.java,v
done
Checking in
core/test/unit/src/org/netbeans/core/modules/PlatformDependencySatisfiedTest.java;
/cvs/core/test/unit/src/org/netbeans/core/modules/PlatformDependencySatisfiedTest.java,v
 <--  PlatformDependencySatisfiedTest.java
initial revision: 1.1
done
Processing log script arguments...
More commits to come...
Checking in ide/applemenu/manifest.mf;
/cvs/ide/applemenu/manifest.mf,v  <--  manifest.mf
new revision: 1.2; previous revision: 1.1
done
Processing log script arguments...
More commits to come...
Checking in ide/applemenu/nbproject/project.properties;
/cvs/ide/applemenu/nbproject/project.properties,v  <--  project.properties
new revision: 1.2; previous revision: 1.1
done
Processing log script arguments...
More commits to come...
Checking in openide/openide-spec-vers.properties;
/cvs/openide/openide-spec-vers.properties,v  <-- 
openide-spec-vers.properties
new revision: 1.154; previous revision: 1.153
done
Processing log script arguments...
More commits to come...
Checking in openide/api/doc/changes/apichanges.xml;
/cvs/openide/api/doc/changes/apichanges.xml,v  <--  apichanges.xml
new revision: 1.214; previous revision: 1.213
done
Processing log script arguments...
More commits to come...
Checking in openide/api/doc/org/openide/modules/doc-files/api.html;
/cvs/openide/api/doc/org/openide/modules/doc-files/api.html,v  <-- 
api.html
new revision: 1.96; previous revision: 1.95
done