When you create a site through the Java API of the SiteBuilder
class, you're able to include sub-sites that are declared with XML. These are registered as reloadable resources and their modification time is stored and checked regularly if the SITE_AUTO_RELOAD configuration parameter is set to true. The same happens for the compiled class files of the element implementations. However, since you manually declared the main site using Java, RIFE can't automatically rebuild it (which is what it does when you create a site using XML). You can now however add a SiteListener
to your site that will receive a notification whenever RIFE detects that any of the site's resources has been modified. In your SiteListener implementation you can then rebuild the site and make it the new default instance that is used by RIFE.
For example, this is a custom site participant that does just that:
public class MySiteParticipant extends BlockingParticipant {
private Site site;
public void initialize() {
SiteBuilder builder = new SiteBuilder("main");
builder
.enterElement("YourElement")
.leaveElement()
;
site = builder.getSite();
site.addListener(new SiteListener() {
public void modified(Site modifiedSite) {
initialize();
modifiedSite.populateFromOther(site);
}
});
}
protected Object _getObject() {
return site;
}
}