All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.ravendb.client.serverwide.operations.logs.GetLogsConfigurationOperation Maven / Gradle / Ivy

There is a newer version: 6.0.1
Show newest version
package net.ravendb.client.serverwide.operations.logs;

import net.ravendb.client.documents.conventions.DocumentConventions;
import net.ravendb.client.http.RavenCommand;
import net.ravendb.client.http.ServerNode;
import net.ravendb.client.primitives.Reference;
import net.ravendb.client.serverwide.operations.IServerOperation;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpRequestBase;

import java.io.IOException;

public class GetLogsConfigurationOperation implements IServerOperation {
    @Override
    public RavenCommand getCommand(DocumentConventions conventions) {
        return new GetLogsConfigurationCommand();
    }

    private static class GetLogsConfigurationCommand extends RavenCommand {

        public GetLogsConfigurationCommand() {
            super(GetLogsConfigurationResult.class);
        }

        @Override
        public boolean isReadRequest() {
            return true;
        }

        @Override
        public HttpRequestBase createRequest(ServerNode node, Reference url) {
            url.value = node.getUrl() + "/admin/logs/configuration";

            return new HttpGet();
        }

        @Override
        public void setResponse(String response, boolean fromCache) throws IOException {
            if (response == null) {
                throwInvalidResponse();
            }

            result = mapper.readValue(response, resultClass);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy