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 26047 - Initialization/shutdown of project
Summary: Initialization/shutdown of project
Status: CLOSED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 3.x
Hardware: PC Windows 3.1/NT
: P1 blocker (vote)
Assignee: Vitezslav Stejskal
URL:
Keywords: API
Depends on:
Blocks:
 
Reported: 2002-07-26 14:33 UTC by Pavel Buzek
Modified: 2004-04-19 16:20 UTC (History)
0 users

See Also:
Issue Type: TASK
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Buzek 2002-07-26 14:33:17 UTC
- opening/closing components
- prevent deadlocks: rules for what can be accessed in which time
Comment 1 Pavel Buzek 2002-07-30 13:20:51 UTC
Must-have features for milestone3, have impact on APIs (at least potential).
Comment 2 Torbjorn Norbye 2002-08-13 05:41:51 UTC
Here's the API for initialization and shutdown hooks: listen to the
projectManager's PROP_PROJECT_OPEN property and PROP_PROJECT_CLOSING
property.

PROP_PROJECT_OPEN will be fired AFTER a project has been fully opened
by the projects system. No locks are held when it is announced (no
project system locks that is.)   Modules may not assume anything about
the order in which other modules are notified of project open;
therefore, if you depend on the initialization performed by another
module you have to negotiate a contract with that module such that it
provides its own notification of when its initialization is done.

PROP_PROJECT_CLOSING will be fired BEFORE a project's closing process
is started (but after user confirmation). Thus, you can perform
project shutdown procedures and utility all the project contents. As
with PROPECT_OPEN no project system locks are held.
(Note - not only is the property change fired when the project
is about to be closed, but it is deliberately fired before the
final project save prior to closure; thus you can modify the
project contents and expect it to be reflected in the project
file.)

PROP_PROJECT_CLOSED is called after the project has been closed.
Comment 3 Vitezslav Stejskal 2002-08-15 13:34:33 UTC
Sounds good for listeners "outside" of project, but it would be useful to allow similar notification for 
"inside" project stuff (e.g. Containers). The primary motivation for this was the implementation of 
Container which maintains list of subprojects. Since subprojects are deffered for PM4 this can be 
probably resolved later (until there isn't other requirement which I don't know about).
Comment 4 Torbjorn Norbye 2002-08-15 17:27:46 UTC
Can you be more specific? Are you suggesting creating an SPI
so modules can listen to container additions/removals?
(This wouldn't be tied to initialization/shutdown, right?)
Or something else?
Comment 5 Vitezslav Stejskal 2002-08-15 18:06:06 UTC
Imagine that you write Container (some DataObject in ProjectFileSystem, /Containers folder) which 
maintains the list of subprojects. You need to open those subropjects when the parent project is being 
open and close them when the parent project is closed. Right now, there is no way how the Container could 
be notified about the project open event. It can't register listener to ProjectManager beacause it 
doesn't exist prior opening the project which contains this Container. So, I just wanted to remember that 
events on ProjectManger are useful for listeners "outside" of the project, which exist independently on 
the project system and can hook the ProjectManager at the begining of their live cycle. It would be 
useful to have some initialization/shitdown support for the "inside-project" components like Containers, 
etc.

I don't say that we have to do it right now. Subprojects has been deffered for milestone 4 and I don't 
know any other reason why this support would be neccessary
Comment 6 Torbjorn Norbye 2002-08-15 18:19:43 UTC
Ok - this would be like a "Startup" folder in the project where
components can place themselves and be called during startup. I agree
that we should add this later if a usage comes up.

For example, to solve the subprojects-open problem the module
providing subprojects could listen (not an object in the project
itself but rather a "subprojects manager" object) to the
ProjectManager for notification of project open, and when a project is
open it could check to see if it's a superproject and then go and open
other projects as necessary.

So I believe we should avoid adding additional APIs in this area until
we have more definite requirements. Most likely subprojects will be
implemented inside the projects infrastructure so it won't need an
exposed API.
Comment 7 Vitezslav Stejskal 2002-08-16 08:22:39 UTC
Another possibility which comes to my mind is to place the open/close methods in the NatureInstall 
introduced by David. Since the project is getting more complicated with more possible stuff registered 
by natures, delegating to NatureInstalle would provide better flexibility for the future.
Comment 8 David Konecny 2002-08-19 09:58:26 UTC
Feel free to extend NatureInstall as you need. The class was inspired 
by openide's ModuleInstall class, but I intentially put there only 
methods I really needed.
Comment 9 Pavel Buzek 2003-07-02 10:29:02 UTC
Vito, what is the status of this issue? There is a number of comments
that were added after this was marked as resolved/fixed.
Comment 10 Vitezslav Stejskal 2003-07-03 09:16:01 UTC
I think this is still TBD (at least some parts of it). Adding correct
keywords.
Comment 11 Vitezslav Stejskal 2003-11-26 12:53:09 UTC
As described in
http://www.netbeans.org/servlets/ReadMsg?msgId=619519&listName=nbdiscuss the
current work on projects prototype has been stopped.
Comment 12 Vitezslav Stejskal 2003-11-26 14:58:27 UTC
--> VERIFIED