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

io.dropwizard.servlets.tasks.Task Maven / Gradle / Ivy

There is a newer version: 5.0.0-alpha.2
Show newest version
package io.dropwizard.servlets.tasks;

import com.google.common.collect.ImmutableMultimap;

import java.io.PrintWriter;

/**
 * An arbitrary administrative task which can be performed via the admin interface.
 *
 * @see TaskServlet
 */
public abstract class Task {
    private final String name;

    /**
     * Create a new task with the given name.
     *
     * @param name the task's name
     */
    protected Task(String name) {
        this.name = name;
    }

    /**
     * Returns the task's name,
     *
     * @return the task's name
     */
    public String getName() {
        return name;
    }

    /**
     * Executes the task.
     *
     * @param parameters the query string parameters
     * @param output     a {@link PrintWriter} wrapping the output stream of the task
     * @throws Exception if something goes wrong
     */
    public abstract void execute(ImmutableMultimap parameters,
                                 PrintWriter output) throws Exception;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy