[jboss-user] [Microcontainer] - Re: How do you override the source for configuration propert

alesj do-not-reply at jboss.com
Thu Jul 19 09:56:04 EDT 2007


"rbuckvrsn" wrote : 
  | Apart from modifying the microkernel itself to call directly into our properties manager, are there any other options? Are there any interceptors for property expansion or resolution?
  | 

You could do something like this:

  |    <bean name="LDAPSystemPropertyHolder" class="org.acme.LDAPPropProvider"/>
  | 
  |    <bean name="NeedsOurSystemProperty" class="org.acme.PropWanna">
  |       <install bean="LDAPSystemPropertyHolder" method="provideProperty">
  |          <parameter><this/></parameter>
  |          <parameter>setMyPropertyWanna</parameter>
  |          <parameter replace="false">${somekey:somedefault} </parameter>                  
  |       </install>
  |    </bean>
  | 

Where mock classes look like:

  | 
  |    public class LDAPPropProvider
  |    {
  |       public void provideProperty(Object target, String method, String propKey)
  |       {
  |          String ldapProp = LDAP.lookup(propKey);
  |          Method m = ... // find method on target
  |          m.invoke(target, ldapProp);
  |       }
  |    }
  | 
  |    public class PropWanna
  |    {
  |       public void setMyPropertyWann(String prop)
  |       {
  |          ...
  |       }
  |    }
  | 

This is first that it comes to my mind.
It's a big long, but it should work.

But I don't really like it, since it includes that reflection call.
I'll see if there is some better way.

Aha, just remembered one ... one sec ;-)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4065795#4065795

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4065795



More information about the jboss-user mailing list