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

base.query.Help Maven / Gradle / Ivy

/**
 * Creative commons Attribution-NonCommercial license.
 *
 * http://creativecommons.org/licenses/by-nc/2.5/au/deed.en_GB
 *
 * NO WARRANTY IS GIVEN OR IMPLIED, USE AT YOUR OWN RISK.
 */
package base.query;

import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.ServiceLoader;

import base.Command;
import base.KeyValue;
import base.Query;
import base.security.PermissionException;

public class Help extends Query {

	public List execute() throws IOException {
		List results = new LinkedList<>();
		ServiceLoader commands = ServiceLoader.load(Command.class);
		ServiceLoader queries = ServiceLoader.load(Query.class);

		for(Command c : commands) {
			results.add(new KeyValue(c.getClass().getSimpleName(), "Command"));
		}

		for(Query q : queries) {
			results.add(new KeyValue(q.getClass().getSimpleName(), "Query"));
		}

		return results;
	}

	@Override
	public String getJsonParameters() {
		return "{}";
	}

	@Override
	public Query newWithParameters(Map parameters) throws IOException, PermissionException {
		return new Help();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy