JBoss.orgCommunity Documentation

Chapter 3. Architecture

3.1. OSGi Infrastructure
3.2. Core Components
3.2.1. Error Logging
3.2.2. Protocol Model
3.2.3. Protocol Parser
3.2.4. Protocol Projection
3.2.5. Protocol Validation Manager and Validators
3.2.6. Exporting the Protocol model to other representations
3.2.7. Scribble Protocol Monitor
3.3. Command Line Actions

The Scribble architecture is based on OSGi, to provide a means of managing the individual modules, but without causing tight coupling.

Service bundles enable implementations to be specified that implement defined interfaces. Other services can then request access to services that implement a particular interface.

The OSGi service container takes responsibility of managing the services, and providing access to requesting components.

This provides flexibility for Scribble tooling in two respects:

There is a generic logging API within the Scribble framework that can be used for reporting errors, warnings, information or debuging details. This API is org.scribble.common.logging.Journal .

The methods generally take two parameters, a message and a property map. The message is simply a description of the issue being reported. The property map contain specific details about the issue being reported.

For example, when the parser detects a problem, it can report the nature of the problem, and provide the location of the issue in the source file.

The first step is to define the command implementation of the org.scribble.command.Command interface. This can be created in the org.scribble.command Eclipse plugin.

To initialise the command, as part of an OSGi runtime environment, the command implementation can be instantiated in the org.scribble.command plugin's Activator , and then registered with the bundle context.

If the command requires other OSGi services, then these can be established by setting up service listeners for the relevant service interface classes. When OSGi services are registered, then the relationship can be established.

This command mechanism will generally only be used as part of the command line approach, and therefore does not need to be initialised in other ways. However other dependency injection techniques could be used if appropriate.

The only remaining step is to create the scripts necessary to enable a user to invoke the command. This can be achieved by copying one of the existing scripts, in the distribution/src/main/release folder (such as parse.sh ), and modify the parameter details as necessary.