Issue Details (XML | Word | Printable)

Key: DERBY-2296
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Myrna van Lunteren
Reporter: Matt Hogstrom
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

getProperties method deprecated on ClientDataSource

Created: 06/Feb/07 10:37 PM   Updated: 16/May/07 04:59 PM
Return to search
Component/s: Network Client
Affects Version/s: 10.2.1.6, 10.2.2.0
Fix Version/s: 10.3.1.4

Time Tracking:
Not Specified

File Attachments:
  Size
HTML File Licensed for inclusion in ASF works DERBY-2296.htm 2007-04-23 02:59 AM Myrna van Lunteren 4 kB
File Licensed for inclusion in ASF works DERBY-2296_20070412.diff 2007-04-12 06:16 PM Myrna van Lunteren 17 kB
File Licensed for inclusion in ASF works DERBY-2296_20070413.diff 2007-04-13 11:25 PM Myrna van Lunteren 20 kB
HTML File Licensed for inclusion in ASF works releaseNote.html 2007-05-14 10:11 PM Rick Hillegas 3 kB
HTML File Licensed for inclusion in ASF works releaseNote.html 2007-05-14 09:46 PM Rick Hillegas 3 kB
HTML File Licensed for inclusion in ASF works releaseNote.html 2007-05-14 09:40 PM Rick Hillegas 3 kB
HTML File Licensed for inclusion in ASF works releaseNote.html 2007-05-14 09:16 PM Rick Hillegas 3 kB
HTML File Licensed for inclusion in ASF works releaseNote.html 2007-05-14 07:19 AM Myrna van Lunteren 5 kB
HTML File Licensed for inclusion in ASF works releaseNote.html 2007-05-14 06:44 AM Myrna van Lunteren 4 kB
HTML File Licensed for inclusion in ASF works relnoteDERBY-2296.html 2007-04-23 04:44 PM Myrna van Lunteren 4 kB
Environment: All
Issue Links:
Reference
 

Issue & fix info: Release Note Needed
Resolution Date: 16/May/07 04:59 PM


 Description  « Hide
Not sure exactly where this was deprecated but on Client DataSources it appears that the getProperties method was made private. In Geronimo we were using this to inquire and set whether a create=true was set for a database.


We are moving from 10.1.3.1 to 10.2.1.6 (or perhaps 10.2.2.0) for our next version which we are targetting for April of this year.

Is it possible to add the following methods on the ClientDataSource:

 setCreateDatabase (String)
 getCreateDatabase()
 setShutdownDatabase (String)
 getShutdownDatabase()

as they are on the EmbeddedDataSource?


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Myrna van Lunteren added a comment - 12/Apr/07 06:16 PM
attaching a patch that appends create=true for ds.setCreateDatabase, or shutdown=true for ds.setShutdownDatabase, to the connectionAttributes already getting send to the server.

Also adds a junit test.

Reviews are welcome.


Daniel John Debrunner added a comment - 13/Apr/07 07:34 PM
I don't think this patch works as expected for a couple of reasons:

1) If setConnectionAttributes() is called after setCreateDatabase or setShutdownDatabase then the create/shutdown state will be lost.

2) If the order is reversed to 1) then getConnectionAttributes() will not return the same value as the one set by the application.

3) Repeated calls to setCreateDatabase or setShutdownDatabase will continually add create=true/shutdown=true to connection attributes.


why are the fields public?

Myrna van Lunteren added a comment - 13/Apr/07 11:25 PM
Second attempt. I think this addresses Dan's comments (thx dan). Also added more test cases.

Daniel John Debrunner added a comment - 17/Apr/07 10:56 PM
+ public final void setCreateDatabase(String create) {
+ if (create != null && create.equalsIgnoreCase("create"))
+ this.createDatabase = true;
+ }

This doesn't reset the createDatabase state if a value is passed in that is not "create".

Same for shutdown.

Myrna van Lunteren added a comment - 18/Apr/07 02:45 AM
Thx Dan for noticing that...

I fixed this up, and added a test case, with revision 529838:
see: http://svn.apache.org/viewvc?view=rev&revision=529838

I also added a description of the properties to the list in the server & admin guide with revision 529836.
see: http://svn.apache.org/viewvc?view=rev&revision=529836

I believe, that concludes the work for this. Unless there are further comments, I'll close this issue tomorrow.

Myrna van Lunteren added a comment - 20/Apr/07 06:49 PM
I realized that there was one missing step - the incentive for me to fix this was that I had to add special if (usingDerbyNetClient()) code into the junit framework; and that could now be simplified.

I also tried to write a test, similar to DSCreateShutdownDBTest, for ConnectionPoolDataSources and XADataSources, but ran into trouble - see DERBY-2576 for that.

With those last changes committed, I can close this particular issue.

Myrna van Lunteren added a comment - 23/Apr/07 02:57 AM
Release Note text attempt:

PROBLEM:
With version 10.2.1.6 an incompatibility with 10.1.1.0 was introduced - since revision 393003, the undocumented, non-standard but previously public method, getProperties for Client DataSources was removed for security reasons. This leaves only the setConnectionAttributes method available for creating or shutting down a database. For instance, in Geronimo the getProperties method was previously used to inquire and set whether a create=true was set for a database.
It would be helpful if ClientDataSource could have the same methods available as EmbeddedDataSource:
 setCreateDatabase (String)
 getCreateDatabase()
 setShutdownDatabase (String)
 getShutdownDatabase()

SYMPTOM
The getProperties() method is no longer available, nor are alternative methods except the setConnectionAttributes(String) and getConnectionAttributes() methods.

CAUSE
The getProperties() method was removed as part of DERBY-446; make ClientDataSource use public getter and setter methods as standard for Java bean properties. It should not have been public.

SOLUTION
4 new public methods were created for ClientDataSource:
 setCreateDatabase (String)
 getCreateDatabase()
 setShutdownDatabase (String)
 getShutdownDatabase()
These methods should behave similarly to the ones in Embedded, i.e. only valid value for setCreateDatabase is "create", and for setShutdownDatabase is "shutdown". In essence, at connection time, if set to a valid value, the property is passed on to the server side with the ConnectionAttributes.
Note, that the result for setting contradicting properties for createDatabase and ShutdownDatabase, whether through setCreateDatabase("create") and setShutdownDatabase("shutdown") or via setConnectionAttributes("create=true") or ("shutdown=true") is undefined.

WORKAROUND
set and get of ConnectionAttributes can be used to create or shutdown a database.

INCOMPATIBILITIES: none from 10.2.1.6 to 10.3

REQUIRED CHANGES TO EXISTING APPLICATIONS: there are no required changes. Applications can now use the setCreateDatabase, getCreateDatabase, setShutdownDatabase, and getShutdownDatabase methods with DerbyNetClient as well as with Embedded.

Myrna van Lunteren added a comment - 23/Apr/07 02:59 AM
html version of release note. Attaching as file as well as in comment to hopefully facilitate possible release note generating tool.

John H. Embretsen added a comment - 23/Apr/07 07:20 AM
Just a small comment on the Release Note's section on "REQUIRED CHANGES TO EXISTING APPLICATIONS":

The term "DerbyNetClient" is as far as I know mostly used in Derby's testing framework(s), and may not be familiar to the average user. Would using the terms "ClientDataSource" and "EmbeddedDataSource" suffice?

Myrna van Lunteren added a comment - 23/Apr/07 04:44 PM
good point, John. I changed the offending sentence as you suggested.
Attaching updated proposed release note with name 'relnoteDERBY-2296.html'.

Myrna van Lunteren added a comment - 14/May/07 06:44 AM
adding release note with releaseNote.html name.

Myrna van Lunteren added a comment - 14/May/07 07:19 AM
this is the release note following the new release note template.

Rick Hillegas added a comment - 14/May/07 09:16 PM
Amending release note so that it can be digested by the DOM parser used by the ReleaseNoteGenerator.

Rick Hillegas added a comment - 14/May/07 09:40 PM
Attaching yet another rev of the release notes. The previous revs had long summary sections. The summary is supposed to be a 1 line precis.

Rick Hillegas added a comment - 14/May/07 09:46 PM
Previous rev of the release notes had an unbalanced paragraph tag. Browsers forgive this sort of thing but xml parsers don't.

Daniel John Debrunner added a comment - 14/May/07 09:47 PM
Since this summary isn't very useful, e.g. I can't determine from the summary if this would concern me or not:

"4 new public methods were created for ClientDataSource:"

How about something like:

 "ClientDataSource now supports the createDatabase and shutdownDatabase properties"

Rick Hillegas added a comment - 14/May/07 10:11 PM
Attaching a next rev of the release note with Dan's suggested summary.

Myrna van Lunteren added a comment - 16/May/07 04:59 PM
I think this can be closed again now that the release note file has been molded some more.