GeoTools
  1. GeoTools
  2. GEOT-2677

static DBTYPE and PORT parameters

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.6-M2
    • Fix Version/s: 2.6-M3
    • Component/s: jdbc
    • Labels:
      None

      Description

      As part of UDIG-1558 we have transitioned to using jdbc-ng datastores across the board. One of the difficulties in doing the transition is the reliance of default values for DBTYPE and PORT.

      The jdbc-ng implementation correctly returns a copy of DBTYPE from the getParameterInfo method; but client code (and documentation) has been written to access the static final parameter associated with the factory. So I would like to push these two down into the individual datastores; or provide a static final constant that can be referred to for the default value.

        Issue Links

          Activity

          Hide
          Jody Garnett added a comment -
          Please see UDIG-15578 for details on MySQL:
          - PORT should be 3306
          - MySQL does not have schemas in the same sense as PostGIS (this may be a uDig specific problem?)

          This category of errors is mostly showing up in client code as a NPE - since the sample value for a parameter such as DBTYPE ends up being null.
          Show
          Jody Garnett added a comment - Please see UDIG-15578 for details on MySQL: - PORT should be 3306 - MySQL does not have schemas in the same sense as PostGIS (this may be a uDig specific problem?) This category of errors is mostly showing up in client code as a NPE - since the sample value for a parameter such as DBTYPE ends up being null.
          Hide
          Andrea Aime added a comment -
          Jody, see how the port has been re-declared in postgis for an example of how to give it a default value.
          Show
          Andrea Aime added a comment - Jody, see how the port has been re-declared in postgis for an example of how to give it a default value.
          Hide
          Jody Garnett added a comment -
          Yes I see that - it does not help code such as:

          map.put( DBTYPE.key, DBTYPE.sample )

          I have hacked in uDig and look up the DBTYPE coming out of the postgis factory; but I really don't want to make lots of code examples like this.

          The other alternative is to have a static final constant defined in the factory that is just the correct String to use; anything so I do not have to run around example code writing in "postgisng".
          Show
          Jody Garnett added a comment - Yes I see that - it does not help code such as: map.put( DBTYPE.key, DBTYPE.sample ) I have hacked in uDig and look up the DBTYPE coming out of the postgis factory; but I really don't want to make lots of code examples like this. The other alternative is to have a static final constant defined in the factory that is just the correct String to use; anything so I do not have to run around example code writing in "postgisng".
          Hide
          Andrea Aime added a comment -
          Did you even look at the code?

          {code}

          public class PostgisNGDataStoreFactory extends JDBCDataStoreFactory {
              /** parameter for namespace of the datastore */
              public static final Param LOOSEBBOX = new Param("Loose bbox", Boolean.class, "Perform only primary filter on bbox", false, Boolean.TRUE);
              
              /** parameter for database port */
              public static final Param PORT = new Param("port", Integer.class, "Port", true, 5432);
          {code}

          How is that PostgisNGDataStoreFactory.PORT not usable as you said?
          Show
          Andrea Aime added a comment - Did you even look at the code? {code} public class PostgisNGDataStoreFactory extends JDBCDataStoreFactory {     /** parameter for namespace of the datastore */     public static final Param LOOSEBBOX = new Param("Loose bbox", Boolean.class, "Perform only primary filter on bbox", false, Boolean.TRUE);          /** parameter for database port */     public static final Param PORT = new Param("port", Integer.class, "Port", true, 5432); {code} How is that PostgisNGDataStoreFactory.PORT not usable as you said?
          Hide
          Jody Garnett added a comment -
          No I did not look at the code; I was operating from memory from last week. I will use the same technique to sort out DBTYPE - thank you for the suggestion.
          Show
          Jody Garnett added a comment - No I did not look at the code; I was operating from memory from last week. I will use the same technique to sort out DBTYPE - thank you for the suggestion.
          Hide
          Jody Garnett added a comment - - edited
          Attach a patch treating DBTYPE and PORT in the same manner as the postgis datastore port. I took some care to refer return (String) DBTYPE.sample from the getDatabaseID() method so we will not be inconsistent.

          Thanks to Emily (UDIG-1558) for supplying the MySQL default port.

          Patch (just for MySQLDataStore) applied to 2.6-M2 tag as of -r33807 and deployed.

          Applied to trunk as of -r33808

          Can I ask someone to apply this to 2.5.x so we can close this issue.
          Show
          Jody Garnett added a comment - - edited Attach a patch treating DBTYPE and PORT in the same manner as the postgis datastore port. I took some care to refer return (String) DBTYPE.sample from the getDatabaseID() method so we will not be inconsistent. Thanks to Emily ( UDIG-1558 ) for supplying the MySQL default port. Patch (just for MySQLDataStore) applied to 2.6-M2 tag as of -r33807 and deployed. Applied to trunk as of -r33808 Can I ask someone to apply this to 2.5.x so we can close this issue.
          Hide
          Andrea Aime added a comment -
          Jody, I see you've modified classes other than the Mysql one, in particular the DB2 one, maintainer by Christian, the Oracle and Postgis, mantained by me, the SqlServer and H2, maintained by Justin.

          Now, the change is trivial but it would have been courtesy to ask the various maintainers before commiting?
          If you look at all other JDBC-NG issue we setup a 3 way discussion in the jira for any issue that is cross-db and get to an agreement before making a commit...
          Show
          Andrea Aime added a comment - Jody, I see you've modified classes other than the Mysql one, in particular the DB2 one, maintainer by Christian, the Oracle and Postgis, mantained by me, the SqlServer and H2, maintained by Justin. Now, the change is trivial but it would have been courtesy to ask the various maintainers before commiting? If you look at all other JDBC-NG issue we setup a 3 way discussion in the jira for any issue that is cross-db and get to an agreement before making a commit...
          Hide
          Jody Garnett added a comment -
          I see - thanks for the tip Andrea; I am still getting used to everyone talking via Jira. I have been sending email on this topic for the last couple weeks so I hope all those mentioned were aware of the trouble I have been having making the transition. In this case I thought it would be better to make everything consistent - and I though that was the point of you showing me how PostGIS NG handled the PORT field?
          Show
          Jody Garnett added a comment - I see - thanks for the tip Andrea; I am still getting used to everyone talking via Jira. I have been sending email on this topic for the last couple weeks so I hope all those mentioned were aware of the trouble I have been having making the transition. In this case I thought it would be better to make everything consistent - and I though that was the point of you showing me how PostGIS NG handled the PORT field?

            People

            • Assignee:
              Unassigned
              Reporter:
              Jody Garnett
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: