Derby
  1. Derby
  2. DERBY-2296

getProperties method deprecated on ClientDataSource

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.2.1.6, 10.2.2.0
    • Fix Version/s: 10.3.1.4
    • Component/s: Network Client
    • Labels:
      None
    • Environment:
      All
    • Issue & fix info:
      Release Note Needed

      Description

      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?

      1. DERBY-2296_20070412.diff
        17 kB
        Myrna van Lunteren
      2. DERBY-2296_20070413.diff
        20 kB
        Myrna van Lunteren
      3. DERBY-2296.htm
        4 kB
        Myrna van Lunteren
      4. relnoteDERBY-2296.html
        4 kB
        Myrna van Lunteren
      5. releaseNote.html
        4 kB
        Myrna van Lunteren
      6. releaseNote.html
        5 kB
        Myrna van Lunteren
      7. releaseNote.html
        3 kB
        Rick Hillegas
      8. releaseNote.html
        3 kB
        Rick Hillegas
      9. releaseNote.html
        3 kB
        Rick Hillegas
      10. releaseNote.html
        3 kB
        Rick Hillegas

        Issue Links

          Activity

          Hide
          Myrna van Lunteren added a comment -

          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.

          Show
          Myrna van Lunteren added a comment - 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.
          Hide
          Daniel John Debrunner added a comment -

          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?

          Show
          Daniel John Debrunner added a comment - 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?
          Hide
          Myrna van Lunteren added a comment -

          Second attempt. I think this addresses Dan's comments (thx dan). Also added more test cases.

          Show
          Myrna van Lunteren added a comment - Second attempt. I think this addresses Dan's comments (thx dan). Also added more test cases.
          Hide
          Daniel John Debrunner added a comment -

          + 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.

          Show
          Daniel John Debrunner added a comment - + 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.
          Hide
          Myrna van Lunteren added a comment -

          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.

          Show
          Myrna van Lunteren added a comment - 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.
          Hide
          Myrna van Lunteren added a comment -

          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.

          Show
          Myrna van Lunteren added a comment - 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.
          Hide
          Myrna van Lunteren added a comment -

          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.

          Show
          Myrna van Lunteren added a comment - 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.
          Hide
          Myrna van Lunteren added a comment -

          html version of release note. Attaching as file as well as in comment to hopefully facilitate possible release note generating tool.

          Show
          Myrna van Lunteren added a comment - html version of release note. Attaching as file as well as in comment to hopefully facilitate possible release note generating tool.
          Hide
          John H. Embretsen added a comment -

          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?

          Show
          John H. Embretsen added a comment - 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?
          Hide
          Myrna van Lunteren added a comment -

          good point, John. I changed the offending sentence as you suggested.
          Attaching updated proposed release note with name 'relnoteDERBY-2296.html'.

          Show
          Myrna van Lunteren added a comment - good point, John. I changed the offending sentence as you suggested. Attaching updated proposed release note with name 'relnoteDERBY-2296.html'.
          Hide
          Myrna van Lunteren added a comment -

          adding release note with releaseNote.html name.

          Show
          Myrna van Lunteren added a comment - adding release note with releaseNote.html name.
          Hide
          Myrna van Lunteren added a comment -

          this is the release note following the new release note template.

          Show
          Myrna van Lunteren added a comment - this is the release note following the new release note template.
          Hide
          Rick Hillegas added a comment -

          Amending release note so that it can be digested by the DOM parser used by the ReleaseNoteGenerator.

          Show
          Rick Hillegas added a comment - Amending release note so that it can be digested by the DOM parser used by the ReleaseNoteGenerator.
          Hide
          Rick Hillegas added a comment -

          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.

          Show
          Rick Hillegas added a comment - 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.
          Hide
          Rick Hillegas added a comment -

          Previous rev of the release notes had an unbalanced paragraph tag. Browsers forgive this sort of thing but xml parsers don't.

          Show
          Rick Hillegas added a comment - Previous rev of the release notes had an unbalanced paragraph tag. Browsers forgive this sort of thing but xml parsers don't.
          Hide
          Daniel John Debrunner added a comment -

          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"

          Show
          Daniel John Debrunner added a comment - 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"
          Hide
          Rick Hillegas added a comment -

          Attaching a next rev of the release note with Dan's suggested summary.

          Show
          Rick Hillegas added a comment - Attaching a next rev of the release note with Dan's suggested summary.
          Hide
          Myrna van Lunteren added a comment -

          I think this can be closed again now that the release note file has been molded some more.

          Show
          Myrna van Lunteren added a comment - I think this can be closed again now that the release note file has been molded some more.

            People

            • Assignee:
              Myrna van Lunteren
              Reporter:
              Matt Hogstrom
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development