powered by Jive Software

Plugin doesn't seem to load correctly

Hello everyone,

At the moment I’m trying to develop a plugin which also registers itself as a component. But except that the plugin show up in the admin ui nothing happens. It doesn’t shows up in the service discovery and it doesn’t write any logs. I hope somebody can show me my fault. Here is my code:

/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package de.akuz.openfire.plugin.muccer; import java.io.File;
import org.dom4j.Attribute;
import org.dom4j.Element;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.container.*;
import org.jivesoftware.openfire.disco.IQDiscoInfoHandler;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log;
import org.xmpp.component.Component;
import org.xmpp.component.ComponentException;
import org.xmpp.component.ComponentManager;
import org.xmpp.component.ComponentManagerFactory;
import org.xmpp.packet.IQ;
import org.xmpp.packet.IQ.Type;
import org.xmpp.packet.JID;
import org.xmpp.packet.Packet;
import org.xmpp.packet.PacketError;
import org.xmpp.packet.PacketError.Condition;
/** * * @author Till Klocke */
public class Muccer implements Plugin,Component{     private PluginManager pluginManager;
    private ComponentManager componentManager;
    private String serverName;
    private String serviceName;
    private final static String NS_COMMAND="http://jabber.org/protocol/commands";     public void Muccer(){
        Log.error("New Muccer created");
        serverName = XMPPServer.getInstance().getServerInfo().getXMPPDomain();
    }     public void initializePlugin(PluginManager manager, File pluginDirectory){
        pluginManager = manager;
        Log.error("Muccer initialized");
        componentManager = ComponentManagerFactory.getComponentManager();
            componentManager.addComponent(serviceName, this);
        catch(ComponentException ce){
    }     public void destroyPlugin(){
        catch(ComponentException ce){
    }     public String getName(){
        return pluginManager.getName(this);
    }     public String getDescription(){
        return pluginManager.getDescription(this);
    }     public void processPacket(Packet packet){
        Log.error("Muccer: Handling Packet");
        if(!(packet instanceof IQ)){
        final IQ iq = (IQ)packet;         if(iq.getType().equals(IQ.Type.error) || iq.getType().equals(IQ.Type.result)){
        final IQ reply = handleRequest(iq);
            componentManager.sendPacket(this, reply);
        catch(ComponentException ce){
    }     private IQ handleRequest(IQ packet){
        final IQ reply;         Log.error("Muccer: Handling IQ Packet");
        if (packet == null) {
            throw new IllegalArgumentException("Argument 'iq' cannot be null.");
        }         final IQ.Type type = packet.getType();
        if (type != IQ.Type.get && type != IQ.Type.set) {
            throw new IllegalArgumentException(
                    "Argument 'iq' must be of type 'get' or 'set'");
        }         final Element childElement = packet.getChildElement();
            reply = IQ.createResultIQ(packet);
            reply.setError(new PacketError(
                            "IQ stanzas of type 'get' and 'set' MUST contain one and only one child element (RFC 3920 section 9.2.3)."));
            return reply;
        }         final String namespace = childElement.getNamespaceURI();         if (namespace == null) {
            reply = IQ.createResultIQ(packet);
            return reply;
        else if (namespace.equals(IQDiscoInfoHandler.NAMESPACE_DISCO_INFO)) {
            reply = handleDiscoInfo(packet);
            return reply;
        //TODO: Handle Request
        return null;
    }     private IQ handleDiscoInfo(IQ iq){
        if (iq == null) {
            throw new IllegalArgumentException("Argument 'iq' cannot be null.");
        Log.error("Muccer: Handling Service Discovery");         if (!iq.getChildElement().getNamespaceURI().equals(
                || iq.getType() != Type.get) {
            throw new IllegalArgumentException(
                    "This is not a valid disco#info request.");
        }         final IQ replyPacket = IQ.createResultIQ(iq);
        final Element responseElement = replyPacket.setChildElement("query",
        Element identity = responseElement.addElement("identity");
        identity.addAttribute("category", "component");
        identity.addAttribute("type", "generic");
        identity.addAttribute("name", "Muccer");
                .addAttribute("var", "http://jabber.org/protocol/disco#info");
                .addAttribute("var", "http://jabber.org/protocol/disco#items");
        responseElement.addElement("feature").addAttribute("var", NS_COMMAND);         return replyPacket;
    }     public void initialize(JID jid, ComponentManager componentManager){
        Log.info("Muccer component initialized with JID: "+jid.toString());
    }     public void start(){
        Log.error("Muccer component startet");
    }     public void shutdown(){

Sorry for the double post. But my problem is solved. You need ti implement the PropertyEventListener interface to get the plugin loaded. Even if you don’t want to listen for property events. I think that should be mentioned in the plugin dev guides.