commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Moein Enayati <moein.enay...@gmail.com>
Subject [Configuration] Problem in using FileChangedReloadingStrategy events ...
Date Tue, 15 Feb 2011 06:35:45 GMT
Dear All

I’ve just  have an XMLConfiguration object  initialized like this :


 * *

*            this.xmlConfig = new XMLConfiguration("preferences.xml");*

*            this.xmlConfig.setAutoSave(true);*

*            this.xmlConfig.setReloadingStrategy(new
FileChangedReloadingStrategy());*




and a bean  implements ConfigurationListener  Interface like this :




*public abstract class DefaultBean implements
Serializable,ConfigurationListener {*

*protected PropertyChangeSupport propertyChangeSupport = new
PropertyChangeSupport(this);*

* public abstract String getXmlBeanPropertyAddress();*

* public void configurationChanged(ConfigurationEvent event) {*

*System.out.println(“Event Type Value is 20 ! >> ”+event.getType());*

*}*

*}*


Also I’ve registered my bean and the XMLConfigoration as listeners :




*        this.xmlConfig.addConfigurationListener(myBeanInstance);*

*
myBeanInstance.addPropertyChangeListener(getPropertyChangeListener());*




To test the AutoReloadEvents , simply I used a timer which gets a property
of my XMLConfiguration object each 2 Seconds and it seems working .
*myBeanInstance.
configurationChanged() * is invoked  about two minutes after any change in
the source *preferences.xml*.

*
*

*But there is a small problem! *


The *event.getType()* returns a value of  *20*  which I could not find it in
*XMLConfiguration.EVENT_* constants.

Would you please help me to find the mistake I’ve probably done or is there
any way to have a trace line?



I could find only these EVENT_ constants :



*XMLConfiguration.EVENT_ADD_NODES = 11*

*XMLConfiguration.EVENT_ADD_PROPERTY = 1*

*XMLConfiguration.EVENT_CLEAR = 4*

*XMLConfiguration.EVENT_CLEAR_PROPERTY = 2*

*XMLConfiguration.EVENT_CLEAR_TREE =10*

*XMLConfiguration.EVENT_READ_PROPERTY =5*

*XMLConfiguration.EVENT_SET_PROPERTY =3*

*XMLConfiguration.EVENT_SUBNODE_CHANGED =12*




Thanks / Moein

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message