class DBService implements RolesProvider {

    void executeDeleteUser(ResourceContext ctx, String userName, String domainName,
             String auditRef, String caller) {

        // our exception handling code does the check for retry count
        // and throws the exception it had received when the retry
        // count reaches 0

        for (int retryCount = defaultRetryCount; ; retryCount--) {

            try (ObjectStoreConnection con = store.getConnection(true, true)) {

                // remove all principal domains

                removePrincipalDomains(con, domainName);

                // extract all principals that this user has - this would
                // include the user self plus all services this user
                // has created in the personal domain + sub-domains

                List<String> userSvcPrincipals = con.listPrincipals(domainName);

                // remove this user from all roles manually so that we
                // can have an audit log record for each role

                final String adminPrincipal = getPrincipalName(ctx);
                removePrincipalFromAllRoles(con, userName, adminPrincipal, auditRef);
                for (String userSvcPrincipal : userSvcPrincipals) {
                    removePrincipalFromAllRoles(con, userSvcPrincipal, adminPrincipal, auditRef);
                }

                // finally delete the principal object. any roles that were
                // left behind will be cleaned up from this operation

                if (!con.deletePrincipal(userName, true)) {
                    throw ZMSUtils.notFoundError(caller + ": unable to delete user: "
                            + userName, caller);
                }

                // audit log the request

                auditLogRequest(ctx, userName, auditRef, caller, ZMSConsts.HTTP_DELETE,
                        userName, null);

                return;

            } catch (ResourceException ex) {
                if (!shouldRetryOperation(ex, retryCount)) {
                    throw ex;
                }
            }
        }
    }

    public  DBService(ObjectStore store, AuditLogger auditLogger, ZMSConfig zmsConfig, AuditReferenceValidator auditReferenceValidator);

}