Anatomy of a Command

Release 1.02 - ...

Identification

A spice command is uniquely identified by an id. A command contains one or more command parameters, where each parameter is identified by its name. The combination of spice command id and parameter name identifies a command parameter within a command consumer. Since there may be multiple command consumers a fully qualified command parameter name is prefixed with the name of the command consumer. In the spice model, a command consumer name is called the scope.

A fully qualified command parameter name has the following syntax; [consumer scope].[command id].[parameter name].

Example: In order to address the angle of the image rotate command, the full name 'img.rotate.degrees' is used.

Next to addressing command parameters by fullname, a command parameter can also be referenced using it's shortcut. A shortcut is a unique identifier within a scope.

Example: To address the angle of the image rotate command the shortcut 'r' is used. 

Command Parameters

A spice command act as a container for one or more command parameters. As mentioned before, a command parameter is identified by either a fully qualified name or the combination of scope and shortcut. All parameter-related methods on the command manager implement overloads for both full names and shortcuts.

Next to the parameter identification, a command parameter has a value. The command manager provides methods to manipulate command parameter values.

A parameter may have a default value and a constraint. Default command parameter values are configured in the various configuration files. The constraint limits the possible parameter values. It is up to the implementation of the command to define the actual behavior of a constraint. A typical example of a parameter contraint is defined on the maximum width parameter of the image resize command.

Finally a command parameter may be publicly accessible or not. Public access is introduced in order to limit access from so-called public command producers such as the querystring command producer. A typical example of access restriction is the use of the image metadata command. One does not want a client to provide a copyright statement to be stored in an image. Setting a copyright statement is explicitly reserved for server-side business logic.