|
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? Second attempt. I think this addresses Dan's comments (thx dan). Also added more test cases.
+ 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. 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. 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 With those last changes committed, I can close this particular issue. 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 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. html version of release note. Attaching as file as well as in comment to hopefully facilitate possible release note generating tool.
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? good point, John. I changed the offending sentence as you suggested.
Attaching updated proposed release note with name 'relnoteDERBY-2296.html'. adding release note with releaseNote.html name.
this is the release note following the new release note template.
Amending release note so that it can be digested by the DOM parser used by the ReleaseNoteGenerator.
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.
Previous rev of the release notes had an unbalanced paragraph tag. Browsers forgive this sort of thing but xml parsers don't.
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" Attaching a next rev of the release note with Dan's suggested summary.
I think this can be closed again now that the release note file has been molded some more.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Also adds a junit test.
Reviews are welcome.