[Building Sakai] How to find undocumented properties in code

Bryan Holladay holladay at longsight.com
Wed May 18 18:28:09 PDT 2011


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
> 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"
> 
> 
> 
> -- 
> John Bush
> 602-490-0470
> _______________________________________________
> 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/20110518/acd4a929/attachment.html 


More information about the sakai-dev mailing list