[Hippo-cms7-user] Dynamically changing the plugin configuration

Frank van Lankvelt f.vanlankvelt at onehippo.com
Sun Apr 3 19:06:03 CEST 2011


On Sun, Apr 3, 2011 at 3:25 PM, Jeroen Reijn <j.reijn at onehippo.com> wrote:

> Hi all,
>
> I was playing around with the CMS plugin framework and I was wondering if
> it's correct, when I say that I can't programmatically change the plugin
> configuration.
>
> This is the error I'm getting:
>
> CMS 2011-04-03 15:04:09,036 ERROR
> [org.hippoecm.frontend.plugin.impl.PluginFactory]
> java.lang.UnsupportedOperationException: null
> java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>  at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>  at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> at
> org.hippoecm.frontend.plugin.impl.PluginFactory.createPlugin(PluginFactory.java:72)
>  at
> org.hippoecm.frontend.plugin.impl.PluginManager.start(PluginManager.java:86)
> ...
> Caused by: java.lang.UnsupportedOperationException
>  at java.util.AbstractMap.put(AbstractMap.java:186)
>
> when i do config.put("SOME_ID", "SOME_VALUE"); where config is
> IPluginConfig from the constructor of my plugin.
>
> I noticed it's using an AbstractMap, but apparently the put method is not
> implemented as stated by [1].
>
> that is correct; you're not looking at the directly modifiable jcr nodes
corresponding to the configuration, but at a decorator that makes sure that
variables are replaced.

Is there perhaps another way of doing this? My use case is that I would like
> to insert a dynamic variable into the plugin config, which can be used by
> another component to which it delegates.
>
> I'm not sure what you mean.  Is this configuration of a plugin that's
instantiated by the one making the change? In that case, you can create a
JavaPluginConfig (it has a copy constructor).  This implementation is
modifiable.

The typical pattern is to look up the IClusterConfig and create a
clustercontrol out of it using a parameter map (ipluginconfig itself).  The
parameter map is then the javapluginconfig that can be modified in the
plugin that instantiates the cluster.

cheers, Frank


>
> [1]
> http://download.oracle.com/javase/1.5.0/docs/api/java/util/AbstractMap.html
> Gr,
>
> Jeroen
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
>



-- 
Hippo Europe  •  Amsterdam  Oosteinde 11  •  1017 WT Amsterdam  •  +31 (0)20
522 4466
USA  • San Francisco 755 Baywood Drive, Second Floor •  Petaluma, CA. 94954
•  +1 877 414 4776 (toll free)
Canada    •   Montréal  5369 Boulevard St-Laurent #430 •  Montréal QC H2T
1S5  •  +1 (514) 316 8966
www.onehippo.com  •  www.onehippo.org  •  info at onehippo.com
________________________________________________________________
This e-mail may be privileged and/or confidential, and the sender does
not waive any related rights and obligations. Any distribution, use or
copying of this e-mail or the information it contains by other than an
intended recipient is unauthorized. If you received this e-mail in
error, please advise me (by return e-mail or otherwise) immediately.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onehippo.org/pipermail/hippo-cms7-user/attachments/20110403/a3d28966/attachment.htm>


More information about the Hippo-cms7-user mailing list