[Building Sakai] How to find undocumented properties in code

Matthew Jones jonespm at umich.edu
Thu May 19 09:41:07 PDT 2011


Tracking down properties is for sure a pain and one that should be improved,
but it takes a decent amount of time to get a *great* solution going.

A similar script to Brian's is in the config viewer project under utils. [1]
(simplePropertyFind.sh) There are also extractors for bean style properties
like the one John mentioned (generate_bean_list.sh). I haven't ran these in
awhile, and most of them were ones that Tony Atkins wrote.

I was also thinking of adding some logging to ServerConfigurationService so
that whenever a property was set it would put out a debug message which
could be logged by someone by turning up to that level to make it easier to
track down what properties are set to. There were also some changes I'd
talked about at the  Denver conference about things that would be nice for
config viewer, but I haven't had time to do them yet. If you want to talk
about it off list or at the LA conference I'll be there! I'm still
interested in this topic. ;)

Config viewer at least *works* with newer versions of Sakai, but the
properties it knows about haven't been updated since 2.6. ;(

Task for 2.8 properties - https://jira.sakaiproject.org/browse/CNFV-20
Task for 2.7 properties - https://jira.sakaiproject.org/browse/CNFV-17

[1] https://source.sakaiproject.org/contrib/config-viewer/trunk/utils/

On Thu, May 19, 2011 at 11:47 AM, Stephen Jaegle <sjaegle at gmail.com> wrote:

>
> Thank you both. In another communication, someone also pointed out that the
> otherwise outdated Sakai Config Viewer project may have useful methodology
> in it as well.
>
> --Steve
>
>
> Bryan Holladay wrote:
> >
> > I've done some work with this for the 2.8 release and here is a helpful
> > bash script I ran to find all the properties (checked out the source code
> > and searched through it):
> >
> > Script
> >
> > #!/bin/sh
> >
> > grep -ilR "import
> > org.sakaiproject.component.api.ServerConfigurationService" . | grep java$
> > > filesListTmp.txt
> > grep -ilR "import
> > org.sakaiproject.component.cover.ServerConfigurationService" . | grep
> > java$ >> filesListTmp.txt
> >
> > echo > sakaiProps.txt
> > for line in `cat filesListTmp.txt`
> > do
> >     grep -iR -A 1 "confi.*Servic.*.getString" $line >> sakaiProps.txt
> >         grep -iR -A 1 "confi.*Servic.*.getBoolean" $line >>
> sakaiProps.txt
> >         grep -iR -A 1 "confi.*Servic.*.getInt" $line >> sakaiProps.txt
> > done
> >
> >
> >
> >
> > Instructions
> >
> > Run this script in the root folder for each source you want to compare.
> > Creates two files:
> >
> > filesListTmp.txt
> > This is a list of all the java files that have sakai properties
> >
> > sakaiProps.txt
> > This is the code that shows the sakai properties.  Use this file to
> > compare with the other source to find differences.
> >
> >
> >
> > -Bryan
> >
> >
> > On May 18, 2011, at 7:05 PM, John Bush wrote:
> >
> >> This is not an easy problem to solve.  yes you can find some properties
> >> by calls to ServerConfigurationService, but there is a whole other
> >> mechanism that can also be used that bypasses that.
> >>
> >> Sakai properties can also be spring injected using this syntax:
> >>
> >> property at some.bean.name
> >>
> >> so basically every component.xml or other Spring file exposes a lot of
> >> other properties.  You can't even get at these by looking at just the
> >> spring files, because the real list would be looking at all the setters
> >> in all of the beans prescribed by the spring config.
> >>
> >> Technically, I guess either some spring lifecycle component, or aop,
> >> bytecode injection method could probably be created to create a full
> >> list.
> >>
> >> On Wed, May 18, 2011 at 3:36 PM, Stephen Jaegle <sjaegle at gmail.com>
> >> wrote:
> >>
> >> Hi:
> >>
> >> Some time ago I found the msg.displayEid property through considerable
> >> searching effort; a web search
> >> (http://www.google.com/search?q=%22msg.displayEid%22) reveals there are
> >> few
> >> references to it anywhere as of this writing. Aside from searching
> online
> >> documentation such as the properties list on confluence and sample or
> >> default properties files, from which relatively undocumented properties
> >> such
> >> as msg.displayEid are absent (see the search results url above), what
> >> algorithms for finding otherwise undocumented properties in Sakai source
> >> code are better and more complete than simply refining a grep for
> >> ServerConfigurationService.get? Do properties generally get passed in
> >> ways
> >> other than using ServerConfigurationService?
> >>
> >> Thanks,
> >>
> >> Steve
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/How-to-find-undocumented-properties-in-code-tp31651493p31651493.html
> >
> >> John Bush
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Re%3A--Building-Sakai--How-to-find-undocumented-properties-in-code-tp31651656p31655704.html
> Sent from the Sakai - Development mailing list archive at Nabble.com.
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
> "unsubscribe"
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20110519/6aef008e/attachment.html 


More information about the sakai-dev mailing list