Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 1.3
    • Component/s: Ant Tasks
    • Labels:
      None

      Description

      We should be able to use DdlUtils even in non-Java, non-Ant environments. For example, I would like to use DdlUtils for running unit tests in PHP. My Php tests are not executed using Ant.

      It would not be very complicated to extend the tasks classes with a few CommandLine tasks. They can be modeled on the Ant tasks.

      Parameters could be, for example (just an initial set):
      cmd=(createDb | dropDb | SchemaToDb | DataToDb | DbToDtd | DataToFile | SchemaToFile | SchemaSqlToFile)
      driver=<database driver class>
      url=<database url>
      user=<databaser user name>
      password=<database password>
      file=<file to be written to or read from>
      ..

      This way, DdlUtils could be used very easily with many more programming languages and target environments. The programmer would only have to have the JRE, the DdlUtils jars (including dependencies) and the database driver installed to use DdlUtils.

      I am willing to do this, but need your feedback if this makes sense.

        Activity

        Hide
        Thomas Dudziak added a comment -

        Sounds good too me ! Please check out whether you can use commons-cli (http://jakarta.apache.org/commons/cli/) to do the commandline parsing.
        Some suggestions:

        • In general, it is most useful to have the CLI in one jar file with wrapper shell script/batch files. Invocation then would be

        java -jar ddlutils-cli.jar ...

        or

        ddlutils ...

        • I would organize the commandline as follows:

        ddlutils <main command> <options>

        E.g. ddlutils createdb -cp $CLASSPATH -driver ... -username ...

        • For entering the password, the commandline interface should provide some interactive means (e.g. stdin).
        • It is quite useful to allow the specification of options via properties files. E.g.

        ddlutils createdb -cp $CLASSPATH -options classpath:derby.properties

        (loads the options file from the classpath) or

        ddlutils createdb -cp $CLASSPATH -options derby/derby.properties

        • Normal output should go to stdout (esp. if reading a schema XML from the database) unless a -output (or similar) option is used. This makes piping quite easy.
        • Logging should be configured to print to stderr, and have WARN as default. This can be done in code or via a log4j proeprties file embedded in the cli jar.

        Let me know wdyt and if you need help with this.

        Show
        Thomas Dudziak added a comment - Sounds good too me ! Please check out whether you can use commons-cli ( http://jakarta.apache.org/commons/cli/ ) to do the commandline parsing. Some suggestions: In general, it is most useful to have the CLI in one jar file with wrapper shell script/batch files. Invocation then would be java -jar ddlutils-cli.jar ... or ddlutils ... I would organize the commandline as follows: ddlutils <main command> <options> E.g. ddlutils createdb -cp $CLASSPATH -driver ... -username ... For entering the password, the commandline interface should provide some interactive means (e.g. stdin). It is quite useful to allow the specification of options via properties files. E.g. ddlutils createdb -cp $CLASSPATH -options classpath:derby.properties (loads the options file from the classpath) or ddlutils createdb -cp $CLASSPATH -options derby/derby.properties Normal output should go to stdout (esp. if reading a schema XML from the database) unless a -output (or similar) option is used. This makes piping quite easy. Logging should be configured to print to stderr, and have WARN as default. This can be done in code or via a log4j proeprties file embedded in the cli jar. Let me know wdyt and if you need help with this.

          People

          • Assignee:
            Thomas Dudziak
            Reporter:
            Alexander Hars
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development