class ConfigurationResourceManager implements LoggableResource {

    public boolean handleConfigurationResource(final HttpServerRequest request) {
        final Logger requestLog = RequestLoggerFactory.getLogger(ConfigurationResourceManager.class, request);

        if(null == getRegisteredResources().get(request.uri())){
            return false;
        }

        String resourceUri = request.uri();
        String resourceSchema = getRegisteredResources().get(request.uri());

        if(HttpMethod.PUT == request.method()) {
            requestLog.info("Refresh resource " + resourceUri);
            request.bodyHandler(buffer -> configurationResourceValidator.validateConfigurationResource(buffer, resourceSchema, event -> {
                if (event.failed() || (event.succeeded() && !event.result().isSuccess())) {
                    requestLog.error("Could not parse configuration resource for uri '" + resourceUri + "' message: " + event.result().getMessage());
                    request.response().setStatusCode(StatusCode.BAD_REQUEST.getStatusCode());
                    request.response().setStatusMessage(StatusCode.BAD_REQUEST.getStatusMessage() + " " + event.result().getMessage());
                    ResponseStatusCodeLogUtil.info(request, StatusCode.BAD_REQUEST, ConfigurationResourceManager.class);
                    if (event.result().getValidationDetails() != null) {
                        request.response().headers().add("content-type", "application/json");
                        request.response().end(event.result().getValidationDetails().encode());
                    } else {
                        request.response().end(event.result().getMessage());
                    }
                } else {
                    storage.put(resourceUri, buffer, status -> {
                        if (status == StatusCode.OK.getStatusCode()) {
                            if(logConfigurationResourceChanges){
                                RequestLogger.logRequest(vertx.eventBus(), request, status, buffer);
                            }
                            JsonObject object = new JsonObject();
                            object.put("requestUri", resourceUri);
                            object.put("type", ConfigurationResourceChangeType.CHANGE);
                            vertx.eventBus().publish(CONFIG_RESOURCE_CHANGED_ADDRESS, object);
                        } else {
                            request.response().setStatusCode(status);
                        }
                        ResponseStatusCodeLogUtil.info(request, StatusCode.fromCode(status), ConfigurationResourceManager.class);
                        request.response().end();
                    });
                }
            }));
            return true;
        }

        if(HttpMethod.DELETE == request.method()) {
            requestLog.info("Remove resource " + resourceUri);
            storage.delete(resourceUri, status -> {
                if (status == StatusCode.OK.getStatusCode()) {
                    JsonObject object = new JsonObject();
                    object.put("requestUri", resourceUri);
                    object.put("type", ConfigurationResourceChangeType.REMOVE);
                    vertx.eventBus().publish(CONFIG_RESOURCE_CHANGED_ADDRESS, object);
                } else {
                    request.response().setStatusCode(status);
                }
                request.response().end();
            });
            return true;
        }

        return false;
    }

    public  ConfigurationResourceManager(Vertx vertx, final ResourceStorage storage);

}