Overriding modules

I’ve noticed that, in OpenFire 3.6.4, there is no way to override modules loaded by the XMPPServer. All the methods dealing with modules are private. For reasons I won’t go into here, I need to subclass certain modules, and replace actively running modules with my own subclasses, which I want to provide from plugins. I am accomplishing this by adding this method to XMPPServer:

public void setModule( Class clazz, Module module ) {

Module current = modules.get(clazz);

if ( current != null ){

current.stop();

current.destroy();

}

this.modules.put(clazz, module);

}

public void setModule( Class clazz, Module module ) {

Module current = modules.get(clazz);

if ( current != null ){

current.stop();

current.destroy();

}

this.modules.put(clazz, module);

}

Is this a good idea? Is there a reason that users can’t already do this, or is this just something that developers figured users wouldn’t need?

Thanks,

Mike Shea.

Hi Mike,

Do you need to swap out the modules at runtime? If not, you might want to take a look at the ant build file to see how you can setup “overlay” directories that can be used when building Openfire. Files in the overlay directories get copied over during compile time and can be a nice way to modify Openfire without having to directly alter any of it’s source.

Hope that helps,
Ryan

Hey Ryan - That is exactly what I need, thanks!