private IQ handleIQSetToService( IQ packet) {
        final JID senderJID = packet.getFrom();
        final JID bareJidFrom = senderJID.asBareJID();
        packet = packet.createCopy();
        packet.setTo(bareJidFrom);

        // Only service local, registered users.
        if ( !UserManager.getInstance().isRegisteredUser( senderJID, false ))
        {
            final IQ reply = IQ.createResultIQ(packet);
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(PacketError.Condition.not_allowed);
            return reply;
        }

        PEPService pepService = pepServiceManager.getPEPService(bareJidFrom);

        // If publishing a node, and the node doesn't exist, create it.
        final Element childElement = packet.getChildElement();
        final Element publishElement = childElement.element("publish");
        if (publishElement != null) {
            final String nodeID = publishElement.attributeValue("node");

            if (pepService.getNode(nodeID) == null) {
                // Create the node
                final JID creator = bareJidFrom;
                final DefaultNodeConfiguration defaultConfiguration = pepService.getDefaultNodeConfiguration(true);
                final LeafNode newNode = new LeafNode(pepService.getUniqueIdentifier(), pepService.getRootCollectionNode(), nodeID, creator, defaultConfiguration);
                final DataForm publishOptions = PubSubEngine.getPublishOptions( packet );
                if ( publishOptions != null )
                {
                    try
                    {
                        newNode.configure( publishOptions );
                    }
                    catch ( NotAcceptableException e )
                    {
                        Log.warn( "Unable to apply publish-options when creating a new PEP node {} for {}", nodeID, creator, e );
                    }
                }
                newNode.addOwner(creator);
                newNode.saveToDB();
            }
        }

        // Process with PubSub as usual.
        pepServiceManager.process(pepService, packet);
        return null;
    }
Process an IQ set stanza that was addressed to the service (rather than to a node/user).

@param packet The stanza to process.
@return A response (can be null).
xmppserver/src/main/java/org/jivesoftware/openfire/pep/IQPEPHandler.java