protected void fireDirectoryFailureEvent(DirectoryEvent.Operation operation,
            Throwable failure) throws GuacamoleException {
        listenerService.handleEvent(new DirectoryFailureEvent<InternalType>() {

            @Override
            public Directory.Type getDirectoryType() {
                return Directory.Type.of(internalType);
            }

            @Override
            public DirectoryEvent.Operation getOperation() {
                return operation;
            }

            @Override
            public String getObjectIdentifier() {
                return object.getIdentifier();
            }

            @Override
            public InternalType getObject() {
                return object;
            }

            @Override
            public AuthenticatedUser getAuthenticatedUser() {
                return authenticatedUser;
            }

            @Override
            public AuthenticationProvider getAuthenticationProvider() {
                return userContext.getAuthenticationProvider();
            }

            @Override
            public Throwable getFailure() {
                return failure;
            }

        });
    }
Notifies all registered listeners that the given operation has failed
against the object represented by this resource.

@param operation
    The operation that failed.

@param failure
    The failure that occurred.

@throws GuacamoleException
    If a listener throws a GuacamoleException from its event handler.
guacamole/src/main/java/org/apache/guacamole/rest/directory/DirectoryObjectResource.java