Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 13095 invoked from network); 24 Nov 2002 23:43:02 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 24 Nov 2002 23:43:02 -0000 Received: (qmail 16266 invoked by uid 97); 24 Nov 2002 23:44:02 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 16241 invoked by uid 97); 24 Nov 2002 23:44:01 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 16221 invoked by uid 98); 24 Nov 2002 23:44:01 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Date: Sun, 24 Nov 2002 23:43:04 +0000 Subject: Re: [BeanUtils] - some small fixes, plus a proposal for namespace resolutions Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Mime-Version: 1.0 (Apple Message framework v482) Cc: "Rune Toalango Johannesen" To: "Jakarta Commons Developers List" From: robert burrell donkin In-Reply-To: <001901c293ef$a023e910$0300000a@TOSHIBA> Message-Id: <79B74C3C-0006-11D7-A71E-003065DC754C@blueyonder.co.uk> Content-Transfer-Encoding: quoted-printable X-Mailer: Apple Mail (2.482) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N hi you'll find that different open source projects are managed differently.=20= here at apache, nearly all of our development is done in the open on=20 public mailing lists. so rather than discuss the issues you've raised, what i'm going to do is=20= point you at the documents we've written to help people who want to=20 contribute. once you've read them, post again to commons-dev mailing so=20= that everyone has a chance look at your ideas and (if they wish) comment=20= on them. you should start by browsing the web site and in particular read http://jakarta.apache.org/site/getinvolved.html if you want to submit some patches, then you might find this document=20 useful: http://jakarta.apache.org/commons/patches.html if you want to know about the apache software foundation, then browse http://apache.org/foundation hopefully these should answer most of your questions! - robert On Sunday, November 24, 2002, at 07:27 PM, Rune Toalango Johannesen = wrote: > Hi chaps, > > I have picked your addresses from the project.xml file of=20 > Jakarta-Commons-BeanUtils. > > I have never contributed to any open source projects before, so I am = not=20 > quite sure about the procedure for commiting without "committer" = status.=20 > I downloaded the attached files from CVS yesterday and filtered out = only=20 > the files I have changed in the attached .zip file. A commit comment = is=20 > also attached in the .txt file. Not a big change - general QA - mostly=20= > for myself to get familiar with the way this works. > > <<...>> <<...>> > All the unit tests worked fine after the changes. Please let me know = if=20 > there is an easier way for non-commiters to commit proposals. > > I have used the BeanUtils as help classes in a project to accomplish = the=20 > following: > > Once you have a number of classes, potentially nested into maps and=20 > arrays/lists, and you want to query this as a dedicated namespace, the=20= > existing PropertyUtils comes to short. I also had a requirement to use=20= > dots to separate the different elements in the namespace, regardles of=20= > the underlying structure (map, bean, list, array). > > Example data structure: > > =95 Hashtable containing two entries, "foo" and "bar", each having a = List=20 > as their values. > =95 The lists contain various Person bean objects with properties = that=20 > might return new beans, lists, maps or arrays > > Person { > =A0=A0=A0=A0=A0=A0=A0 Person[] getChildren(); > =A0=A0=A0=A0=A0=A0=A0 Map getPhones(); > =A0=A0=A0=A0=A0=A0=A0 String getFirstName(); > =A0=A0=A0=A0=A0=A0=A0 String getLastName(); > } > > Example queries for this "namespace" structure: > > =95 foo.0.children.0.lastName > =95 foo.5.firstName > =95 bar.3.phones.work.extension > > A significant benefit of this approach is that the underlying = structure=20 > is not that relevant to the author of the queries. We could for = instance=20 > imagine that the above-mentioned getPhones() method returned a Phones=20= > bean instead of the Map: > > Phone { > =A0=A0=A0=A0=A0=A0=A0 PhoneNumber getWork(); > =A0=A0=A0=A0=A0=A0=A0 PhoneNumber getHome(); > =A0=A0=A0=A0=A0=A0=A0 PhoneNumber getMobile(); > } > > PhoneNumber { > =A0=A0=A0=A0=A0=A0=A0 String getExtension(); > =A0=A0=A0=A0=A0=A0=A0 String getCountryCode(); > =A0=A0=A0=A0=A0=A0=A0 String getNumber(); > } > > The last example query wouldn't need to change, and the author doesn't=20= > have to know what the actual data structure is. > > The missing features of the current PropertyUtils to accomplish this = are: > > =95 Support for List, Array and Map implementations as "standalone"=20= > structures outside bean properties in a nested set of objects > =95 A proactive introspection of the "current" object ("Oh, I have a = Map,=20 > then the next element in the query must be the key") > > The latter is essential to be able to use one unified delimitor in the=20= > queries. With the current PropertyUtils the query will fail if the = query=20 > contains "(aMapKey)" but the underlying structure isn't a map. > > I have gathered this feature in a class named ObjectUtils ("object"=20 > because List, Map and Array implementations are not recognized as = beans).=20 > Additional features in this class include: > > =95 Nested keys: = "a.key.with.{a.nested.key}.lots.of.dots.{another.one}".=20 > The sub-keys in the {} are separate queries within the same = "namespace"=20 > object > =95 A toString() method to print the whole content of nested bean=20 > properties, lists, maps and arrays: > > foo.0.children.0.lastName =3D [Smith] > foo.5.firstName =3D [John] > bar.3.phones.work.extension =3D [45] > > The last method is a bit tricky once the structure contains circular=20= > references=85 you can imagine how fast a recursive method eats up the=20= > memory once a child bean references its parent, and vica versa. I am=20= > working on a solution to prevent this. The toString() method is useful=20= > during development time for debug purposes ("Give me the content of = the=20 > session object right now"), and it also helps authors of queries = because=20 > you can copy and paste the available keys directly. > > Do you think this additional feature is suitable within the BeanUtils=20= > package? I could adapt the code conventions and logging facilities and=20= > provide you with the ObjectUtils class for a future release if you = think=20 > it suits into the framework. The class doesn't contain support for=20 > DynaBeans yet, but I think that could easily be added. I have also = been=20 > reluctant to throw exceptions - if the query doesn't find the "target"=20= > value it simply returns null. > > To accomplish the nested keys I used some StringUtils from the=20 > Commons-Lang package. I guess the introduction of new "external"=20 > dependencies is not that popular, but the alternative is to clone a = piece=20 > of code. Any opinions about this? Struts has a lot of "external" = Jakarta=20 > dependencies already, and a danger is of course the potential version=20= > conflicts this might cause once you have too many inter-dependencies. > > I'll sign up for the Jakarta-Commons email list shortly - I guess that = is=20 > where these discussions should find place? > > Keep up the good work! > > > Best regards > > Rune Toalango Johannesen > > -- To unsubscribe, e-mail: For additional commands, e-mail: