You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-user@ws.apache.org by "Vinh Nguyen (vinguye2)" <vi...@cisco.com> on 2006/11/22 11:21:58 UTC

dynamic resource properties

What's the best way to customize Muse so that values in the resource
properties document can be loaded dynamically from an external source?
In a stateless environment, we do not want to use the default
implementation where resource properties are loaded into memory from the
wsdl file when the resource is first called. We'd like requests to pass
thru, and resource properties be retrieved from an external source, like
a database.
 
For testing, I've been able to extend the SimpleGetCapability class and
override the getResourcePropertyDocument() method to dynamically add
properties to the collection to be returned.  Then I specify my custom
class in muse.xml, replacing the original SimpleGetCapability reference.
 
This method works easily, but I'm not sure if it's the best/recommended
way to do it.
-Vinh

Re: dynamic resource properties

Posted by Daniel Jemiolo <da...@us.ibm.com>.
I would actually override SimpleGetCapability.getResourceProperty(), 
because the other two WSRP 'get' operations use getResourceProperty() as 
part of their implementation. So, if you override this one, you get the 
other two for free.

This will work just fine, but I'm not sure the problem you stated is 
accurate. Muse reads in the WSRP document *schema* and creates data 
structures around it in order to provide proper WSRP behavior... but it 
certainly does not load your actual WSRP *document* (the thing with all of 
the actual names-values). The code that is generated by wsdl2java does 
have Java fields for each of your resource properties, but that's only 
because it has no other option (it has no idea what kind of technology you 
intend to use for state, so it just makes fields as a default). The 
process you're referring to is valuable in that it ensures you have setup 
your WSRP doc correctly, that it remains schema valid, that proper faults 
are thrown at proper times, and that there is some handler/implementor for 
each property (even if that's just one piece of code).

So... you may want to just implement the getter methods generated by 
wsdl2java with logic similar to the above rather than modifying 
getResourceProperty(). Then you can read resource properties on the server 
side (between capabilities) without parsing DOM fragments. Either way, I 
don't think you want to disconnect the WSRP schema loader...

Dan


"Vinh Nguyen \(vinguye2\)" <vi...@cisco.com> wrote on 11/22/2006 
05:21:58 AM:

> What's the best way to customize Muse so that values in the resource
> properties document can be loaded dynamically from an external source?
> In a stateless environment, we do not want to use the default
> implementation where resource properties are loaded into memory from the
> wsdl file when the resource is first called. We'd like requests to pass
> thru, and resource properties be retrieved from an external source, like
> a database.
> 
> For testing, I've been able to extend the SimpleGetCapability class and
> override the getResourcePropertyDocument() method to dynamically add
> properties to the collection to be returned.  Then I specify my custom
> class in muse.xml, replacing the original SimpleGetCapability reference.
> 
> This method works easily, but I'm not sure if it's the best/recommended
> way to do it.
> -Vinh


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org