commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joakim Ohlrogge" <j_ohlro...@hotmail.com>
Subject Sandbox Candidate
Date Sat, 18 Oct 2003 22:43:33 GMT
Hi all!

I don't know the proper procedure for getting a project into the sandbox 
area. I have put together a nifty framework that greatly sipmplifies writing 
commandline tools that I think would fit nicely into the commons project.

I'll describe it shortly here and see what you think.

When I was refactoring yet another "if else if else" comandline parser I 
wondered if there wasn't a more generic approach to the problem. After some 
pondering I came up with the folowing solution:

Writing the command line tool as a bean would make the tools parameter self 
describing using introspection. Since introspection supports a short 
description I realized that I could even generate a print usage for the 
bean.

So this is what I have today:

* a framework to configure a bean from a string array (like the arguments 
passed to the main method for instance)
* a runner that can configure and execute any bean that implements 
executeable.
* an automaticly generated print usage that uses introspection to find 
descriptions for each parameter
* a way of giving a parameter a shorter name than the property name ( -cp 
instead of -classpath for instance)
* treating null values from get methods as required properties

In the pipe features

* support "unflagged" parameters like <class> as opposed to -cp <path> a -cp 
<path> <class>"
* support for optional extra arguments like <file>[<file>*]


So basically any java class conforming to the JavaBeans specification is 
configurable.

If you want to make it runnable the bean has to implement a custom interface 
called Executeable. Executeable just adds an execute() method. (In practice 
this is the command pattern)

If you want descriptions of the parameters in your print usage rather than 
just a listing of the parameter names you can use... Just create a regular 
BeanInfo class and make sure it accessible from the introspector.

It's pretty simple actually :)

So, are you guys interested and how do I proceed if I want to donate the 
code to the commons project?

/J

_________________________________________________________________
Hitta rätt köpare på MSN Köp & Sälj http://www.msn.se/koposalj


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message