I have followed Openfire development guide to make my plugin.
Here is my build.xml :
<plugin>
<class>org.jivesoftware.openfire.plugin.Limitator</class>
<name>Limitator</name>
.....
</plugin>
Here is my plugin :
package org.jivesoftware.openfire.plugin;
public class Limitator implements Plugin {
private InterceptorManager interceptorManager;
private IQRouter iqRouter;
private IQPacketInterceptor myPacketInterceptor;
private IQHandler handler;
public Limitator() {
interceptorManager = InterceptorManager.getInstance();
iqRouter = XMPPServer.getInstance().getIQRouter();
myPacketInterceptor = new IQPacketInterceptor();
handler = new FilterIQHandler("FilterIQHandler");
RightToFile("Start");
}
public void initializePlugin(PluginManager manager, File pluginDirectory) {
interceptorManager.addInterceptor(myPacketInterceptor);
//iqRouter.addHandler(handler);
}
public void destroyPlugin() {
interceptorManager.removeInterceptor(myPacketInterceptor);
//iqRouter.removeHandler(handler);
}
private void RightToFile(String message){
Writer writer = null;
try {
writer = new BufferedWriter(new OutputStreamWriter( new FileOutputStream("D:\\filename.txt"), "utf-8"));
writer.write(message + " ");
writer.write(System.getProperty( "line.separator" ));
} catch (IOException ex) { // report }
finally { try {writer.close();} catch (Exception ex) {} }
}
}
There is no new file created after file upload. (this means plugin not started) What did I wrong? Thanks.