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

com.yammer.dropwizard.tasks.Task Maven / Gradle / Ivy

package com.yammer.dropwizard.tasks;

import com.google.common.collect.ImmutableMultimap;

import java.io.PrintWriter;

/**
 * An arbitrary administrative task which can be performed via the internal service 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