org.alfresco.web.app.servlet.command
Interface CommandProcessor

All Known Subinterfaces:
ExtCommandProcessor
All Known Implementing Classes:
BaseNodeCommandProcessor, ScriptCommandProcessor, TaskCommandProcessor, UIActionCommandProcessor, WorkflowCommandProcessor

public interface CommandProcessor

This interfaces defines the contract and lifecycle of a Servlet Command Processor.

A command processor is defined as a class capable of executing a set of related Command objects. It performs the bulk of the work for the command servlet. The processor impl is responsible for validating that the command can be processed (given the supplied remaining URL arguments from the servlet) and processing the command. It is also responsible for supply an output status page on successfuly execution of the command.

The arguments passed to a Command Processor are the remaining URL elements from the command servlet URL after removing the web-app name, servlet name and command processor name.


Method Summary
 void outputStatus(java.io.PrintWriter out)
          Output a simple status message to the supplied PrintWriter.
 void process(org.alfresco.service.ServiceRegistry serviceRegistry, javax.servlet.http.HttpServletRequest request, java.lang.String command)
          Process the supplied command name.
 boolean validateArguments(javax.servlet.ServletContext sc, java.lang.String command, java.util.Map args, java.lang.String[] urlElements)
          Pass and validate URL arguments for the command processor.
 

Method Detail

validateArguments

boolean validateArguments(javax.servlet.ServletContext sc,
                          java.lang.String command,
                          java.util.Map args,
                          java.lang.String[] urlElements)
Pass and validate URL arguments for the command processor. Validate if the command can be executed given the arguments supplied. Generally at this post a Command Processor will convert the supplied arguments to the objects it expects, and also check any permissions that are required by the current user to execute the command.

Parameters:
sc - ServletContext, can be used to retrieve ServiceRegistry instance from the Repository bean.
command - Name of the command the arguments are for
args - Map of URL args passed to the command servlet
urlElements - String[] of the remaining URL arguments to the command servlet
Returns:
true if the command can be executed by the current user given the supplied args.

process

void process(org.alfresco.service.ServiceRegistry serviceRegistry,
             javax.servlet.http.HttpServletRequest request,
             java.lang.String command)
Process the supplied command name. It is the responsibility of the Command Processor to lookup the specified command name using the CommandFactory registry. For that reason it also has the responsiblity to initially register commands it is responsible for so they can be constructed later. If the supplied command is unknown to it then an exception should be thrown to indicate this.

Parameters:
serviceRegistry - ServiceRegistry
request - HttpServletRequest
command - Name of the command to construct and execute

outputStatus

void outputStatus(java.io.PrintWriter out)
Output a simple status message to the supplied PrintWriter. It can be assumed that the process() method was successful if this method is called.

Parameters:
out - PrintWriter


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.