@Override
    public void entityCapabilitiesChanged( @Nonnull final JID entity,
                                           @Nonnull final EntityCapabilities updatedEntityCapabilities,
                                           @Nonnull final Set<String> featuresAdded,
                                           @Nonnull final Set<String> featuresRemoved,
                                           @Nonnull final Set<String> identitiesAdded,
                                           @Nonnull final Set<String> identitiesRemoved )
    {
        // Look for new +notify features. Those are the nodes that the entity is now interested in.
        final Set<String> nodeIDs = featuresAdded.stream()
            .filter(feature -> feature.endsWith("+notify"))
            .map(feature -> feature.substring(0, feature.length() - "+notify".length()))
            .collect(Collectors.toSet());

        if ( nodeIDs.isEmpty() ) {
            return;
        }
        Log.debug( "Entity '{}' expressed new interest in receiving notifications for nodes '{}'", entity, String.join( ", ", nodeIDs ) );

        // Find all the nodes that the entity is subscribed to, including its own.
        final Set<Node> nodesToBeProcessed = new HashSet<>();
        for ( final String nodeID : nodeIDs ) {
            nodesToBeProcessed.addAll(findSubscribedNodes(entity, nodeID));
        }
        if (UserManager.getInstance().isRegisteredUser(entity,false)) {
            final PEPService service = getPEPService( entity );
            for ( final String nodeID : nodeIDs ) {
                final Node node = service.getNode( nodeID );
                if ( node != null ) {
                    nodesToBeProcessed.add(node);
                }
            }
        }

        Log.debug( "Entity '{}' has {} applicable nodes (through ownership and subscription).", entity, nodesToBeProcessed.size() );
        if ( nodesToBeProcessed.isEmpty() )
        {
            return;
        }

        Log.trace( "Entity '{}' is eligible to receive notifications of nodes '{}'. Sending last published items for each of these nodes.", entity, String.join( ", ", nodesToBeProcessed.stream().map(Node::getUniqueIdentifier).map(Node.UniqueIdentifier::toString).collect(Collectors.toSet()) ) );
        for ( final Node node : nodesToBeProcessed )
        {
            ((PEPService)node.getService()).sendLastPublishedItems(entity, nodeIDs);
        }
    }
Deletes the {@link PEPService} belonging to the specified owner.

@param owner
           The JID of the owner of the service to be deleted.
xmppserver/src/main/java/org/jivesoftware/openfire/pep/PEPServiceManager.java