// Path: src/main/java/org/grapheco/elfinder/controller/ErrorException.java
// public class ErrorException extends RuntimeException
// {
// 
// 	private final String error;
// 	private final String[] args;
// 
// 	/**
// 	 * See /elfinder/js/i18n/elfinder.??.js for error codes.
// 	 * 
// 	 * @param error
// 	 *            The error code.
// 	 * @param args
// 	 *            Any arguments needed by the error message.
// 	 */
// 	public ErrorException(String error, String... args)
// 	{
// 		this.error = error;
// 		this.args = args;
// 	}
// 
// 	/**
// 	 * @return The error code that will translated by elfinder to a nice
// 	 *         message.
// 	 */
// 	public String getError()
// 	{
// 		return error;
// 	}
// 
// 	/**
// 	 * @return The arguments needed by the error message.
// 	 */
// 	public String[] getArgs()
// 	{
// 		return args;
// 	}
// }
// 
// Path: src/main/java/org/grapheco/elfinder/controller/executor/CommandExecutor.java
// public interface CommandExecutor
// {
// 	void execute(CommandExecutionContext commandExecutionContext)
// 			throws Exception;
// }
// 
// Path: src/main/java/org/grapheco/elfinder/controller/executor/AbstractJsonCommandExecutor.java
// public abstract class AbstractJsonCommandExecutor extends
// 		AbstractCommandExecutor
// {
// 	@Override
// 	final public void execute(FsService fsService, HttpServletRequest request,
// 			HttpServletResponse response, ServletContext servletContext)
// 			throws Exception
// 	{
// 		JSONObject json = new JSONObject();
// 		try
// 		{
// 			execute(fsService, request, servletContext, json);
// 		}
// 		catch (ErrorException e)
// 		{
// 			if (e.getArgs() == null || e.getArgs().length == 0)
// 			{
// 				json.put("error", e.getError());
// 			}
// 			else
// 			{
// 				JSONArray errors = new JSONArray();
// 				errors.put(e.getError());
// 				for (String arg : e.getArgs())
// 				{
// 					errors.put(arg);
// 				}
// 				json.put("error", errors);
// 			}
// 		}
// 		catch (Exception e)
// 		{
// 			e.printStackTrace();
// 			json.put("error", e.getMessage());
// 		}
// 		finally
// 		{
// 			// response.setContentType("application/json; charset=UTF-8");
// 			response.setContentType("text/html; charset=UTF-8");
// 
// 			PrintWriter writer = response.getWriter();
// 			json.write(writer);
// 			writer.flush();
// 			writer.close();
// 		}
// 	}
// 
// 	protected abstract void execute(FsService fsService,
// 			HttpServletRequest request, ServletContext servletContext,
// 			JSONObject json) throws Exception;
// 
// }
// 
// Path: src/main/java/org/grapheco/elfinder/service/FsService.java
// public interface FsService
// {
// 	FsItem fromHash(String hash) throws IOException;
// 
// 	String getHash(FsItem item) throws IOException;
// 
// 	FsSecurityChecker getSecurityChecker();
// 
// 	String getVolumeId(FsVolume volume);
// 
// 	FsVolume[] getVolumes();
// 
// 	FsServiceConfig getServiceConfig();
// 
// 	/**
// 	 * find files by name pattern, this provides a simple recursively iteration
// 	 * based method lucene engines can be introduced to improve it! This
// 	 * searches across all volumes.
// 	 *
// 	 * @param filter
// 	 *            The filter to apply to select files.
// 	 * @return A collection of files that match the filter and gave the root as
// 	 *         a parent.
// 	 */
// 	// TODO: bad designs: FsItemEx should not used here top level interfaces
// 	// should only know FsItem instead of FsItemEx
// 	FsItemEx[] find(FsItemFilter filter);
// }


import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.grapheco.elfinder.controller.ErrorException;
import org.grapheco.elfinder.controller.executor.CommandExecutor;
import org.json.JSONObject;
import org.grapheco.elfinder.controller.executor.AbstractJsonCommandExecutor;
import org.grapheco.elfinder.service.FsService;
package org.grapheco.elfinder.controller.executors;




/**
 * This is a command that should be executed when a matching command can't be
 * found.
 */
public class MissingCommandExecutor extends AbstractJsonCommandExecutor
		implements CommandExecutor
{
	@Override
	protected void execute(FsService fsService, HttpServletRequest request,
			ServletContext servletContext, JSONObject json) throws Exception
	{
		String cmd = request.getParameter("cmd");
// Path: src/main/java/org/grapheco/elfinder/controller/ErrorException.java
// public class ErrorException extends RuntimeException
// {
// 
// 	private final String error;
// 	private final String[] args;
// 
// 	/**
// 	 * See /elfinder/js/i18n/elfinder.??.js for error codes.
// 	 * 
// 	 * @param error
// 	 *            The error code.
// 	 * @param args
// 	 *            Any arguments needed by the error message.
// 	 */
// 	public ErrorException(String error, String... args)
// 	{
// 		this.error = error;
// 		this.args = args;
// 	}
// 
// 	/**
// 	 * @return The error code that will translated by elfinder to a nice
// 	 *         message.
// 	 */
// 	public String getError()
// 	{
// 		return error;
// 	}
// 
// 	/**
// 	 * @return The arguments needed by the error message.
// 	 */
// 	public String[] getArgs()
// 	{
// 		return args;
// 	}
// }
// 
// Path: src/main/java/org/grapheco/elfinder/controller/executor/CommandExecutor.java
// public interface CommandExecutor
// {
// 	void execute(CommandExecutionContext commandExecutionContext)
// 			throws Exception;
// }
// 
// Path: src/main/java/org/grapheco/elfinder/controller/executor/AbstractJsonCommandExecutor.java
// public abstract class AbstractJsonCommandExecutor extends
// 		AbstractCommandExecutor
// {
// 	@Override
// 	final public void execute(FsService fsService, HttpServletRequest request,
// 			HttpServletResponse response, ServletContext servletContext)
// 			throws Exception
// 	{
// 		JSONObject json = new JSONObject();
// 		try
// 		{
// 			execute(fsService, request, servletContext, json);
// 		}
// 		catch (ErrorException e)
// 		{
// 			if (e.getArgs() == null || e.getArgs().length == 0)
// 			{
// 				json.put("error", e.getError());
// 			}
// 			else
// 			{
// 				JSONArray errors = new JSONArray();
// 				errors.put(e.getError());
// 				for (String arg : e.getArgs())
// 				{
// 					errors.put(arg);
// 				}
// 				json.put("error", errors);
// 			}
// 		}
// 		catch (Exception e)
// 		{
// 			e.printStackTrace();
// 			json.put("error", e.getMessage());
// 		}
// 		finally
// 		{
// 			// response.setContentType("application/json; charset=UTF-8");
// 			response.setContentType("text/html; charset=UTF-8");
// 
// 			PrintWriter writer = response.getWriter();
// 			json.write(writer);
// 			writer.flush();
// 			writer.close();
// 		}
// 	}
// 
// 	protected abstract void execute(FsService fsService,
// 			HttpServletRequest request, ServletContext servletContext,
// 			JSONObject json) throws Exception;
// 
// }
// 
// Path: src/main/java/org/grapheco/elfinder/service/FsService.java
// public interface FsService
// {
// 	FsItem fromHash(String hash) throws IOException;
// 
// 	String getHash(FsItem item) throws IOException;
// 
// 	FsSecurityChecker getSecurityChecker();
// 
// 	String getVolumeId(FsVolume volume);
// 
// 	FsVolume[] getVolumes();
// 
// 	FsServiceConfig getServiceConfig();
// 
// 	/**
// 	 * find files by name pattern, this provides a simple recursively iteration
// 	 * based method lucene engines can be introduced to improve it! This
// 	 * searches across all volumes.
// 	 *
// 	 * @param filter
// 	 *            The filter to apply to select files.
// 	 * @return A collection of files that match the filter and gave the root as
// 	 *         a parent.
// 	 */
// 	// TODO: bad designs: FsItemEx should not used here top level interfaces
// 	// should only know FsItem instead of FsItemEx
// 	FsItemEx[] find(FsItemFilter filter);
// }


// Path: src/main/java/org/grapheco/elfinder/controller/executors/MissingCommandExecutor.java
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.grapheco.elfinder.controller.ErrorException;
import org.grapheco.elfinder.controller.executor.CommandExecutor;
import org.json.JSONObject;
import org.grapheco.elfinder.controller.executor.AbstractJsonCommandExecutor;
import org.grapheco.elfinder.service.FsService;

package org.grapheco.elfinder.controller.executors;




/**
 * This is a command that should be executed when a matching command can't be
 * found.
 */
public class MissingCommandExecutor extends AbstractJsonCommandExecutor
		implements CommandExecutor
{
	@Override
	protected void execute(FsService fsService, HttpServletRequest request,
			ServletContext servletContext, JSONObject json) throws Exception
	{
		String cmd = request.getParameter("cmd");
		throw new ErrorException("errUnknownCmd", cmd);