@Override
    public void process(Packet packet) throws PacketException {
        List<Component> components = getComponents(packet.getFrom());
        // Only process packets that were sent by registered components
        if (!components.isEmpty()) {
            if (packet instanceof IQ && IQ.Type.result == ((IQ) packet).getType()) {
                IQ iq = (IQ) packet;
                Element childElement = iq.getChildElement();
                if (childElement != null) {
                    String namespace = childElement.getNamespaceURI();
                    if ("http://jabber.org/protocol/disco#info".equals(namespace)) {
                        // Add a disco item to the server for the component that supports disco
                        Element identity = childElement.element("identity");
                        if (identity == null) {
                            // Do nothing since there are no identities in the disco#info packet
                            return;
                        }
                        try {
                            XMPPServer.getInstance().getIQDiscoItemsHandler().addComponentItem(packet.getFrom()
                                    .toBareJID(),
                                    identity.attributeValue("name"));
                            for (Component component : components) {
                                if (component instanceof ComponentSession.ExternalComponent) {
                                    ComponentSession.ExternalComponent externalComponent =
                                            (ComponentSession.ExternalComponent) component;
                                    externalComponent.setName(identity.attributeValue("name"));
                                    externalComponent.setType(identity.attributeValue("type"));
                                    externalComponent.setCategory(identity.attributeValue("category"));
                                }
                            }
                        }
                        catch (Exception e) {
                            Log.error("Error processing disco packet of components: " + components +
                                    " - " + packet.toXML(), e);
                        }
                        // Store the IQ disco#info returned by the component
                        addComponentInfo(iq);
                        // Notify listeners that a component answered the disco#info request
                        notifyComponentInfo(iq);
                        // Alert other cluster nodes
                        CacheFactory.doClusterTask(new NotifyComponentInfo(iq));
                    }else if ("query".equals(childElement.getQName().getName()) && "jabber:iq:version".equals(namespace)) {
                        try {
                            List<Element> elements =  childElement.elements();
                            for (Component component : components) {
                                if (component instanceof LocalComponentSession.LocalExternalComponent) {
                                    LocalComponentSession.LocalExternalComponent externalComponent =
                                            ( LocalComponentSession.LocalExternalComponent) component;
                                    LocalComponentSession session = externalComponent.getSession();
                                    if(session != null && session.getAddress() == iq.getFrom()){
                                        if (!elements.isEmpty()){
                                            for (Element element : elements){
                                                session.setSoftwareVersionData(element.getName(), element.getStringValue());
                                            }
                                        } 
                                    }    

                                }
                            }  
                        } catch (Exception e) {
                            Log.error(e.getMessage(), e);
                        }
                    }else if("query".equals(childElement.getQName().getName()) && "http://jabber.org/protocol/disco#info".equals(namespace)){
                        //XEP-0232 if responses service discovery can include detailed information about the software application
                        for (Component component : components) {
                            if (component instanceof LocalComponentSession.LocalExternalComponent) {
                                LocalComponentSession.LocalExternalComponent externalComponent =
                                        ( LocalComponentSession.LocalExternalComponent) component;
                                LocalComponentSession session = externalComponent.getSession();
                                if(session != null && session.getAddress() == iq.getFrom()){
                                    IQDiscoInfoHandler.setSoftwareVersionDataFormFromDiscoInfo(childElement, session);
                                }    
                            }
                        }  
                    }
                }
            }
        }
    }
Processes packets that were sent to this service. Currently only packets that were sent from
registered components are being processed. In the future, we may also process packet of
trusted clients. Trusted clients may be able to execute ad-hoc commands such as adding or
removing components.

@param packet the packet to process.
xmppserver/src/main/java/org/jivesoftware/openfire/component/InternalComponentManager.java