Tuscany
  1. Tuscany
  2. TUSCANY-863

CompanyWeb DAS Sample should create and initialize the canned database when app is loaded by first time and db is not available

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Java-DAS-beta1
    • Fix Version/s: Java-DAS-beta1
    • Component/s: Java DAS Samples
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      Today we rely on copying the java/das/samples/companyweb/dasttest database to a tomcat installation, so the canned database is available for DAS sample app companyweb. A better way for doing this would be to have a servlet (dbInit) that would load on app startup and create necessary tables and populate it with canned information if the db is not available. This would make deployment easier, would avoid external dependencies on the sample distribution, and would probably make it easier to execute htmlUnit multiple times, as the htmlUnit could call the servlet to force refresh of the database data.
      For an example on how to do this, please take a look at dbInit servlet in BigBank sample application :
      https://svn.apache.org/repos/asf/incubator/tuscany/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdb/AccountDBInit.java

      1. JIRA863-May17-Amita.txt
        57 kB
        Amita Vadhavkar
      2. JIRA863-May16-Amita.txt
        59 kB
        Amita Vadhavkar
      3. JIRA-863-Mar-2-Amita.jar
        9 kB
        Amita Vadhavkar
      4. JIRA863-dbsetup-patch-Apr23-Amita.txt
        169 kB
        Amita Vadhavkar
      5. JIRA863-dbsetup-patch-Apr23-Amita.txt
        169 kB
        Amita Vadhavkar
      6. JIRA863-Apr17-Patch-Amita.zip
        27 kB
        Amita Vadhavkar
      7. JIRA863-Apr13-Amita.zip
        32 kB
        Amita Vadhavkar

        Activity

        Hide
        Luciano Resende added a comment -

        Updating the JIRA to get placed on the wishlist

        Show
        Luciano Resende added a comment - Updating the JIRA to get placed on the wishlist
        Hide
        Amita Vadhavkar added a comment -

        Please see the note for the approach followed in the attachment and give your feedback.

        Show
        Amita Vadhavkar added a comment - Please see the note for the approach followed in the attachment and give your feedback.
        Hide
        Amita Vadhavkar added a comment -

        Please see the attached zip. It has a patch related to CompanyWeb were the utility jar
        is used. The DatabaseSetupUtil-Apr13-Amita.jar is the independent utility jar completely new, and is not a patch. This is not a patch because, as it was a new project and I do not have previledge to add it to svn, could not create patch file for it.
        Please see the readme.html in the utlity jar to see the features in it.

        Please give your feedback.

        Show
        Amita Vadhavkar added a comment - Please see the attached zip. It has a patch related to CompanyWeb were the utility jar is used. The DatabaseSetupUtil-Apr13-Amita.jar is the independent utility jar completely new, and is not a patch. This is not a patch because, as it was a new project and I do not have previledge to add it to svn, could not create patch file for it. Please see the readme.html in the utlity jar to see the features in it. Please give your feedback.
        Hide
        Amita Vadhavkar added a comment -

        It has 2 patch files - 1) the utility, 2) the CompanyWeb sample changes using this
        utility.

        Please review code , readme and let me know the feedback

        Show
        Amita Vadhavkar added a comment - It has 2 patch files - 1) the utility, 2) the CompanyWeb sample changes using this utility. Please review code , readme and let me know the feedback
        Hide
        Amita Vadhavkar added a comment -

        changes only in DBSChemaHelper - for accomodating all tables creation.

        Show
        Amita Vadhavkar added a comment - changes only in DBSChemaHelper - for accomodating all tables creation.
        Hide
        Amita Vadhavkar added a comment -

        clicked wrong choice for ASF inclusion before, so reattaching

        Show
        Amita Vadhavkar added a comment - clicked wrong choice for ASF inclusion before, so reattaching
        Hide
        Amita Vadhavkar added a comment -

        Solved a couple of problems as below:
        1) executeQuery() -> executeUpdate() for INSERT
        2) executeUpdate() does not allow ", so changed column values in xml with '
        3) when a table has auto generated keys, INSERT statement can not specify values for those columns. And in INSERT without (col1, col2,...), there is no way for DBMS to know column<->data mapping, in these cases(as the values () clause does not specify values for all columns).
        To take care of this situation, <table> has given one more attribute <column> where
        user needs to specify comma separated list of columns which will be supplied in INSERT (i.e. some way to provide column<->data mapping).

        For these changes the below files are changed and test case pass with this.
        1) CannedSampleDBConfig.xml,
        2) DBConfig.xsd,
        3) dbConfig.xml,
        4) DBHelper.java,
        5) DBDataHelper.java,
        6) DBInitializer.java
        7) readme.htm

        Show
        Amita Vadhavkar added a comment - Solved a couple of problems as below: 1) executeQuery() -> executeUpdate() for INSERT 2) executeUpdate() does not allow ", so changed column values in xml with ' 3) when a table has auto generated keys, INSERT statement can not specify values for those columns. And in INSERT without (col1, col2,...), there is no way for DBMS to know column<->data mapping, in these cases(as the values () clause does not specify values for all columns). To take care of this situation, <table> has given one more attribute <column> where user needs to specify comma separated list of columns which will be supplied in INSERT (i.e. some way to provide column<->data mapping). For these changes the below files are changed and test case pass with this. 1) CannedSampleDBConfig.xml, 2) DBConfig.xsd, 3) dbConfig.xml, 4) DBHelper.java, 5) DBDataHelper.java, 6) DBInitializer.java 7) readme.htm
        Hide
        Amita Vadhavkar added a comment -

        Removed column attribute from <table> and used MetaData instead.
        Changes in
        dbConfig.xml, CannedSampleDBConfig.xml, DBConfig.xsd, DBDataHelper.java

        Show
        Amita Vadhavkar added a comment - Removed column attribute from <table> and used MetaData instead. Changes in dbConfig.xml, CannedSampleDBConfig.xml, DBConfig.xsd, DBDataHelper.java
        Hide
        Luciano Resende added a comment -

        Feature implemented, we should now integrate the samples with this utility.

        Show
        Luciano Resende added a comment - Feature implemented, we should now integrate the samples with this utility.
        Hide
        ant elder added a comment -

        Closing because this has been in RESOLVED state for over one year, if it turns out to not be fixed please reopen.

        Show
        ant elder added a comment - Closing because this has been in RESOLVED state for over one year, if it turns out to not be fixed please reopen.

          People

          • Assignee:
            Luciano Resende
            Reporter:
            Luciano Resende
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development