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 128502 - Add method to Database Explorer API to remove an existing connection
Summary: Add method to Database Explorer API to remove an existing connection
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: David Vancouvering
URL:
Keywords: API_REVIEW_FAST
Depends on:
Blocks: 128369
  Show dependency tree
 
Reported: 2008-02-26 21:16 UTC by David Vancouvering
Modified: 2008-03-06 01:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Diff output for proposed change (9.54 KB, text/plain)
2008-02-26 21:30 UTC, David Vancouvering
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Vancouvering 2008-02-26 21:16:34 UTC
This is a compatible change which provides a new method on org.netbeans.modules.api.db.ConnectionManager called
removeConnection().
Comment 1 David Vancouvering 2008-02-26 21:28:21 UTC
Requesting a fast review as this is a pretty non-controversial incremental addition.  

Here is the javadoc comment for the new method, I am also attaching the full diff for the change.

    /**
     * Remove an existing connection from the Database Explorer.  This method 
     * unregisters the connection from the the explorer so it will
     * no longer appear as a connection in the UI, and disconnects the underlying
     * JDBC connection if it is connected.
     * 
     * @param dbconn the connection to be removed
     */
    public void removeConnection(DatabaseConnection dbconn) throws DatabaseException
Comment 2 David Vancouvering 2008-02-26 21:30:39 UTC
Created attachment 57310 [details]
Diff output for proposed change
Comment 3 David Vancouvering 2008-02-26 23:23:27 UTC
One small change. After further thought, I don't believe this API should have the side-effect of closing the JDBC
connection.  Doing so could have unintended consequences if some other part of the user code is holding a reference to
the connection.
Comment 4 Andrei Badea 2008-02-27 09:41:32 UTC
AB01. Not all clients close the connection when they are done with it (often because they expect to use it again soon --
think SQL editor). So if removeConnection() doesn't close the connection, who does?

AB02. Please increment the specification number and add a @since tag to the new method.

AB03. Not sure about the implementation. Do you really need the removeSubNode() method? Can't you just call destroy() on
the connection node? (I haven't seen the DB Explorer in a while, so perhaps I'm wrong though.)

AB04. Looks a space is missing before the opening usecase tag:

+  </usecase>
+ <usecase id="connect-database" name="Connecting to a database">
Comment 5 David Vancouvering 2008-02-28 00:34:04 UTC
AB01. Not all clients close the connection when they are done with it (often because they expect to use it again soon --
think SQL editor). So if removeConnection() doesn't close the connection, who does?

DVC: OK, good argument, I'll have it close the connection.

AB02. Please increment the specification number and add a @since tag to the new method.

DVC: OK

AB03. Not sure about the implementation. Do you really need the removeSubNode() method? Can't you just call destroy() on
the connection node? (I haven't seen the DB Explorer in a while, so perhaps I'm wrong though.)

DVC: I'll look into that...

AB04. Looks a space is missing before the opening usecase tag:

+  </usecase>
+ <usecase id="connect-database" name="Connecting to a database">

DVC: Sheesh! :)  OK, will fix.
Comment 6 David Vancouvering 2008-02-28 00:59:17 UTC
It looks like the spec version is already at 25, even though the apichanges file wasn't modified.  I found this changset
355394df5911 where Hrjebek bumped the spec version when branching for 6.0.  So I'll make this revision 26 of the API.
Comment 7 David Vancouvering 2008-03-06 00:35:45 UTC
The review is closed, I made the changes requested and there were no further comments
Comment 8 David Vancouvering 2008-03-06 00:38:56 UTC
http://hg.netbeans.org/main?cmd=changeset;node=6d2883ba28ca
Comment 9 David Vancouvering 2008-03-06 01:02:17 UTC
Subsequent fixes, we weren't closing the connection or removing it from the underlying connection list

http://hg.netbeans.org/main?cmd=changeset;node=ad7bfce64029
http://hg.netbeans.org/main?cmd=changeset;node=d71d7d64ed98