1. Processors

The smallest building block in projector is called Processor. It is comparable to a method in the java world. You can do a lot inside a single method or you can do nothing. The same applies to processors in the Projector framework. Some contain a single line of code, others are fairly complex. This section will not teach you how to implement your own processor, it will just give you an impression what processors are. You will learn in a later chapter (Extending Projector) how to implement custom processors.

There are some characteristics of a processor that we need to know:

The following illustration shows you a simplified login processor. This processor needs the two parameters Username and Password to perform the provided login action. It will provide two results when the action was performed successfully: The User object that represents the authorized user and may contain the full name and address of the user. Beside this it will return the date of the last login.

When the login action will be invoked, three states can occur:

Figure 3.1. Login Processor

Login Processor

These result states can be used to build complex workflows by chaining different processors. In case of a login processor it might be a realistic workflow to show an error page if the login fails and to show a welcome page if the login was successful. We will see in a later chapter how to build workflows by chaining processors.