Hi,

Thanks for these suggestions. I will get to work on this. But I have no experience with the wrapper shell script/batch files you mention to be placed in a separate jar file. Maybe we can do that in a second step. In the first step I would get the command line interface to work using commons-cli with the ddlutils jar and leave out the more complex issues such as classpath invocation etc.

Cheers
-Alexander

Thomas Dudziak (JIRA) wrote:
     [ http://issues.apache.org/jira/browse/DDLUTILS-133?page=all ]

Thomas Dudziak updated DDLUTILS-133:
------------------------------------

    Fix Version/s: 1.1

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.

Command-Line Invoker
--------------------

                Key: DDLUTILS-133
                URL: http://issues.apache.org/jira/browse/DDLUTILS-133
            Project: DdlUtils
         Issue Type: New Feature
         Components: Ant Tasks
           Reporter: Alexander Hars
        Assigned To: Thomas Dudziak
           Priority: Minor
            Fix For: 1.1


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.

Reply via email to