What are stages?

From CCIL
Jump to: navigation, search

Stages are the building blocks of CCIL. They are small non-interactive units of logic (Java POJOs) which take inputs and provide outputs. By themselves, nothing particular can be accomplished - some open files, others write input to a file handler, database or stream. Organized in pipelines however, they can accomplish almost everything, as far as no interactivity is involved.

CCIL is designed to run at backend processing servers without any human interaction.

Stages are typical CyberCore services - POJOs, specified in the server configuration file.


Let us take as example the Hello World! tutorial.

Implementation class

TBA

Registration in the server

We need to tell the server to instantiate the stage at startup, so it become available for the execution engine:

service:echo	rdf:type	entity:service ;				
				entity:implementation	"net.ccil.stages.generic.EchoStage" ;
				entity:classpath	"" ;
				entity:arguments	"" .

In the example above, we had registered the net.ccil.stages.generic.EchoStage to be instantiated on startup and registered under the name echo. Yes, you might have a single class registered under many names. In our experience however, it was never necessary.

Use it in a context

The next logical step is to put the unit of logic in some real usage. As mentioned already, using data involves contexts.

Configure the invocation

A verys simple pipeline is to supply some text (input) to the stage and watch the result. The echo stage generates no output, so the value will stay in the runtime context variable named value until someone removes it, it is replaced by another value or the pipeline terminates.

ECHO = echo
ECHO.value = Hello World!

Since a single stage might be referenced in many different configurations within a single context, we call blocks such as above invocations. For instance, later in the context.properties you might have:

ECHO2 = echo
ECHO2.value = Hello other World!

Put in a pipeline

So far, we did only configurations. We registered the POJO in the server, and set up an invocation in the context.

The last step is to include the invocation in a pipeline:

context.echo.pipeline = ECHO 

If the context is named default, the example could be invoked in bash using:

$ ccil-app default echo