Nathan,

The PlugIn interface init(servlet, moduleConfig) method provides them in
case you want to use them.  It's optional. Heck, I could ignore the module
config, exception, content type, etc, and just make a PlugIn to echo print
"System startup!" and "System shutting down."  Sure that would be a waste of
processing power but if it's your PlugIn, it's your choice. LOL.  Then
again, on a more practical note, how else could you store things in the
application scope (servlet),retrieve messages resources
"moduleConfig.getResources(String key);", or pull in a datasource
"moduleConfig.getDataSourceConfig(String key)" ?

Source code for the PlugIn Interface in the repository:
http://svn.apache.org/viewcvs.cgi/struts/core/trunk/src/share/org/apache/str
uts/action/PlugIn.java?rev=57589&view=auto

Regards,
David, ----- Mr. "Link to the SVN Repository" today. :)

-----Original Message-----
From: Nathan Coast [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 24, 2004 8:02 PM
To: Struts Users Mailing List
Subject: Re: plugin config confusion


thanks Craig, David,

hmmm Craig David is a crap pop singer but that's another story.

kinda obvious really,  for my info, what is passed in the properties in
the PluginConfig?

Craig McClanahan wrote:
> When you include a nested <set-property> element (as you did in your
> example below), Struts expects your PlugIn implementation class to
> have a corresponding public property setter method that can be used to
> pass on that value.  Thus, if you have:
>
>   <plug-in className="com.mycompany.MyPlugIn">
>     <set-property name="foo" value="bar"/>
>   </plug-in>
>
> then your MyPlugIn class must have a setFoo() method to receive that
value.
>
> Craig
>
>
>
> On Thu, 25 Nov 2004 07:59:46 +0800, Nathan Coast <[EMAIL PROTECTED]>
wrote:
>
>>Hi,
>>
>>I'm a bit confused about how you pass config params to a plugin.  The
>>plugin API has no mechanism to set the PluginConfig for a particular
plugin.
>>
>>The tiles plugin has a method called:
>>setCurrentPlugInConfigObject(PlugInConfig plugInConfigObject)
>>and the javadocs state that this is called by the ActionServlet  -
>>although I can't see how as it's not part of the PlugIn interface.
>>
>>   <plug-in className="mypluginclass" >
>>     <set-property property="..............
>>     <set-property property="................
>>     <set-property property="...............
>>   </plug-in>
>>
>>AFAICT the only way to access the properties passed to the plugin is to
>>call
>>
>>PlugInConfig[] pics = moduleConfig.findPlugInConfigs();
>>
>>then iterate over pics untill
>>
>>if(this.getClass().getName().equals(pics[i].getClassName()))
>>{
>>        properties = pics[i].getProperties();
>>}
>>
>>this feels a little awkward, is there a more direct mechanism for a
>>plugin to access its properties?
>>
>>thanks
>>Nathan
>>
>>--
>>Nathan Coast
>>Managing Director
>>Codeczar Ltd
>>mob : (852) 9049 5581
>>tel : (852) 2834 8733
>>fax : (852) 2834 8755
>>web : http://www.codeczar.com
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

--
Nathan Coast
Managing Director
Codeczar Ltd
mob : (852) 9049 5581
tel : (852) 2834 8733
fax : (852) 2834 8755
web : http://www.codeczar.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to