---------- Forwarded message ----------
From: "Conrad, Bruce A." conrad4@llnl.gov
Date: Aug 25, 2014 9:48 AM
Subject: RE: [jfig:discussion] JFig update event not getting fired
To: "Bruce Conrad" baconrad@ultramondo.com, "prateekjain jain"
prateekjainaa@users.sf.net
Cc:
The JFigListener is listening for changes to configuration values that are
made via a call to JFig.getInstance().setValue(
, <key>,
<value>); It is not listening for file change events. The documentation for
this may be a bit misleading. I may have attempted something like this in
older versions. What version are you using? I do see some posts for how to
watch for file change events which you could implement including an apache
FileAlterationListener.
Also, I see you are doing some interesting stuff with maintaining multiple
JFig instances. Since the default implementation of JFig is a singleton, I
would expect that only the last one would have any listeners in effect. The
more recent versions of JFig (after 2.0) allow for multiple named
instances. You should take a look at that as it may make your code simpler.
The named instance is identified by a string (JFig.getInstance("JFIG1");
) so you might have to use a stringified version of your ICEXConfMapKey or
maintain a map to use it.
Also, I’d be interested to know who you and your company are, how long
you’ve been using jfig, etc as I have no idea who is out there using it and
am always eager to get feedback.
(I will repost this on sourceforge discussion. My password is not working
at the moment)
From: baconrad@gmail.com [mailto:baconrad@gmail.com]On Behalf Of Bruce
Conrad Sent: Monday, August 25, 2014 8:37 AM To: bconrad@llnl.gov Subject: Fwd: [jfig:discussion] JFig update event not getting fired
---------- Forwarded message ----------
From: "prateekjain jain" prateekjainaa@users.sf.net
Date: Aug 25, 2014 12:47 AM
Subject: [jfig:discussion] JFig update event not getting fired
To: "[jfig:discussion]" 293438@discussion.jfig.p.re.sf.net
Cc:
Hi,
We are using jfig to load configuration files in a webapp deployed under
tomcat 8.x. Everything is working fine and we are getting values as
expected the only issue is once we change the files those are not getting
reflected at runtime but if we restart the server then new values are
available.
I have attached the sample code below which we are using to load config
files and attaching listeners:
public class FileLoader implements JFigListener {
private List<File> configurationFiles;
private final static String DIR_TO_LOAD = FileUtils
.getEvnProperty("ICEX_HOME") + "/conf/tenants/";
private Map<ICEXConfMapKey, JFigImpl=""> configMap = new
HashMap<ICEXConfMapKey, JFigImpl="">();
private static FileLoader loader;
public static FileLoader getInstance() {
if(null==loader) {
loader = new FileLoader();
}
return loader;
System.out.println("Starting to load configuration files");
configurationFiles = FileUtils.getAllFilesFromDirectory(DIR_TO_LOAD);
for (File f : configurationFiles) {
if(ICEXConstants.MODULE_CONFIG_FILE_NAME.toString().equalsIgnoreCase(f.getName()))
thanks for your feedback Bruce. Everything else is working fine for us. We are using 2.3.1 version of jfig. Although, the first thought was to use apache-commons only, but we were tempted to use jfig as; one of product we were evaluating for our business problem was using it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
---------- Forwarded message ----------
From: "Conrad, Bruce A." conrad4@llnl.gov
Date: Aug 25, 2014 9:48 AM
Subject: RE: [jfig:discussion] JFig update event not getting fired
To: "Bruce Conrad" baconrad@ultramondo.com, "prateekjain jain" prateekjainaa@users.sf.net
Cc:
The JFigListener is listening for changes to configuration values that are
made via a call to JFig.getInstance().setValue(
<value>); It is not listening for file change events. The documentation for
this may be a bit misleading. I may have attempted something like this in
older versions. What version are you using? I do see some posts for how to
watch for file change events which you could implement including an apache
FileAlterationListener.
Also, I see you are doing some interesting stuff with maintaining multiple
JFig instances. Since the default implementation of JFig is a singleton, I
would expect that only the last one would have any listeners in effect. The
more recent versions of JFig (after 2.0) allow for multiple named
instances. You should take a look at that as it may make your code simpler.
The named instance is identified by a string (JFig.getInstance("JFIG1");
) so you might have to use a stringified version of your ICEXConfMapKey or
maintain a map to use it.
Also, I’d be interested to know who you and your company are, how long
you’ve been using jfig, etc as I have no idea who is out there using it and
am always eager to get feedback.
(I will repost this on sourceforge discussion. My password is not working
at the moment)
From: baconrad@gmail.com [mailto:baconrad@gmail.com] On Behalf Of Bruce
Conrad
Sent: Monday, August 25, 2014 8:37 AM
To: bconrad@llnl.gov
Subject: Fwd: [jfig:discussion] JFig update event not getting fired
---------- Forwarded message ----------
From: "prateekjain jain" prateekjainaa@users.sf.net
Date: Aug 25, 2014 12:47 AM
Subject: [jfig:discussion] JFig update event not getting fired
To: "[jfig:discussion]" 293438@discussion.jfig.p.re.sf.net
Cc:
Hi,
We are using jfig to load configuration files in a webapp deployed under
tomcat 8.x. Everything is working fine and we are getting values as
expected the only issue is once we change the files those are not getting
reflected at runtime but if we restart the server then new values are
available.
I have attached the sample code below which we are using to load config
files and attaching listeners:
public class FileLoader implements JFigListener {
private List<File> configurationFiles;
private final static String DIR_TO_LOAD = FileUtils
private Map<ICEXConfMapKey, JFigImpl=""> configMap = new
HashMap<ICEXConfMapKey, JFigImpl="">();
private static FileLoader loader;
public static FileLoader getInstance() {
}
public Collection<JFigImpl> getFigObjects() {
}
public void loadFile(File file) {
}
public JFigIF explicitLoad(File file) {
}
public Map<ICEXConfMapKey, JFigImpl=""> getConfigMap() {
}
private ICEXConfMapKey makeICEXConfMapKey(File file) {
}
private void startup() {
{
}
public static void main(String[] args) {
}
@Override
public void configurationUpdate(JFigEvent event) {
System.err.println("Re-loading configurations");
Collection<JFigImpl> figs = getFigObjects();
for(JFigImpl f : figs) {
}
}
private FileLoader() {
}
}
It would be great if you have any pointers to this.
JFig update event not getting fired
https://sourceforge.net/p/jfig/discussion/293438/thread/3e297b7f/?limit=25#cf72
Sent from sourceforge.net because you indicated interest in
https://sourceforge.net/p/jfig/discussion/293438/
To unsubscribe from further messages, please visit
https://sourceforge.net/auth/subscriptions/
thanks for your feedback Bruce. Everything else is working fine for us. We are using 2.3.1 version of jfig. Although, the first thought was to use apache-commons only, but we were tempted to use jfig as; one of product we were evaluating for our business problem was using it.