Cayenne
  1. Cayenne
  2. CAY-1394

DI-based replacement for JNDI hack

    Details

    • Type: Task Task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1M1
    • Fix Version/s: 3.1M1
    • Component/s: Core Library
    • Labels:
      None

      Description

      Cayenne up to 3.0 supported emulation of JNDI DataSource for local work based on the Modeler preferences (aka "JNDI hack"):

      http://cayenne.apache.org/doc30/using-jndi.html

      In 3.1, Modeler preferences are implemented differently, using "java.util.prefs", and instead of porting the JNDI hack to the new mechanism, I will provide a more sensible replacement, based on JVM startup properties. The name of the new DS factory will be PropertyDataSourceFactory. PropertyDataSourceFactory will be used to override not only JNDI DataSources, but any other DataSource configured in the Modeler.

      The property names will be the same as the properties used in unit testing:

      http://cayenne.apache.org/running-unit-tests.html

      But with a few changes:

      • we'll support dot notation, not capitalized notation. Dot notation is traditional Java property naming approach, while capitalized notation was introduced to be able to run unit tests on Hudson that breaks on dot notation.
      • property names will allow an (optional) suffix with <domain_name>.<node_name> to make sure multiple connections can be specified per JVM.
      • cayenne.jdbc.driver[.domain_name.node_name]
      • cayenne.jdbc.url[.domain_name.node_name]
      • cayenne.adapter[.domain_name.node_name]
      • cayenne.jdbc.username[.domain_name.node_name]
      • cayenne.jdbc.password[.domain_name.node_name]
      • cayenne.jdbc.min.connections[.domain_name.node_name]
      • cayenne.jdbc.max.conections[.domain_name.node_name]

      At the minimum, cayenne.jdbc.url and cayenne.jdbc.driver must be present for the overrides to kick in.

        Activity

        Andrus Adamchik created issue -
        Andrus Adamchik made changes -
        Field Original Value New Value
        Description Cayenne up to 3.0 supported emulation of JNDI DataSource for local work based on the Modeler preferences (aka "JNDI hack"):

        http://cayenne.apache.org/doc30/using-jndi.html

        In 3.1, Modeler preferences are implemented differently, using "java.util.prefs", and instead of porting the JNDI hack to the new mechanism, I will provide a more sensible replacement, based on JVM startup properties. The property names will be the same as the properties used in unit testing:

        http://cayenne.apache.org/running-unit-tests.html

        Note that we'll support both dot notation and capitalized notation. Dot notation is traditional Java property naming approach, while capitalized notation was intriduced to be able to run unit tests on Hudson that breaks on dot notation. (I guess we can only document dot notation for official use and keep capitalized location as an unofficial hack)

        * cayenne.jdbc.driver / cayenneJdbcDriver
        * cayenne.jdbc.url / cayenneJdbcUrl
        * cayenne.adapter / cayenneAdapter
        * cayenne.jdbc.username / cayenneJdbcUsername
        * cayenne.jdbc.password / cayenneJdbcPassword
        * cayenne.jdbc.min.connections / cayenneJdbcMinConnections
        * cayenne.jdbc.max.conections / cayenneJdbcMaxConnections

        At the minimum, cayenne.jdbc.url and cayenne.jdbc.driver must be present for the overrides to kick in.
        Cayenne up to 3.0 supported emulation of JNDI DataSource for local work based on the Modeler preferences (aka "JNDI hack"):

        http://cayenne.apache.org/doc30/using-jndi.html

        In 3.1, Modeler preferences are implemented differently, using "java.util.prefs", and instead of porting the JNDI hack to the new mechanism, I will provide a more sensible replacement, based on JVM startup properties. The name of the new DS factory will be PropertyDataSourceFactory. PropertyDataSourceFactory will be used to override not only JNDI DataSources, but any other DataSource configured in the Modeler.

        The property names will be the same as the properties used in unit testing:

        http://cayenne.apache.org/running-unit-tests.html

        But with a few changes:

        * we'll support dot notation, not capitalized notation. Dot notation is traditional Java property naming approach, while capitalized notation was introduced to be able to run unit tests on Hudson that breaks on dot notation.
        * property names will allow an (optional) suffix with <domain_name>.<node_name> to make sure multiple connections can be specified per JVM.

        * cayenne.jdbc.driver[.domain_name.node_name]
        * cayenne.jdbc.url[.domain_name.node_name]
        * cayenne.adapter[.domain_name.node_name]
        * cayenne.jdbc.username[.domain_name.node_name]
        * cayenne.jdbc.password[.domain_name.node_name]
        * cayenne.jdbc.min.connections[.domain_name.node_name]
        * cayenne.jdbc.max.conections[.domain_name.node_name]

        At the minimum, cayenne.jdbc.url and cayenne.jdbc.driver must be present for the overrides to kick in.
        Andrus Adamchik made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 3.1M1 [ 12314299 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Andrus Adamchik
            Reporter:
            Andrus Adamchik
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development