@Override
    public void execute(@Nonnull SessionData sessionData, Element command) {
        final Locale preferredLocale = SessionManager.getInstance().getLocaleForSession(sessionData.getOwner());

        Element note = command.addElement("note");

        Map<String, List<String>> data = sessionData.getData();

        // Gets the username
        String username;
        try {
            username = get(data, "username", 0);
        }
        catch (NullPointerException npe) {
            note.addAttribute("type", "error");
            note.setText(LocaleUtils.getLocalizedString("commands.event.userdeleting.note.username-required", preferredLocale));
            return;
        }

        // Sends the event
        User user;
        try {
            // Gets current user
            user = UserManager.getInstance().getUser(username);
            
            Map<String, Object> params = Collections.emptyMap();
            UserEventDispatcher.dispatchEvent(user, UserEventDispatcher.EventType.user_deleting, params);
        } catch (UserNotFoundException e) {
            // It's ok, user doesn't exist, so deleting it is nothing
        }

        // Answer that the operation was successful
        note.addAttribute("type", "info");
        note.setText(LocaleUtils.getLocalizedString("commands.global.operation.finished.success", preferredLocale));
    }
Notifies the deletion of a user. It can be used by user providers to notify Openfire of the
deletion of a user.

@author Gabriel Guarincerri
xmppserver/src/main/java/org/jivesoftware/openfire/commands/event/UserDeleting.java