FOCUS

## Feature Oriented Customizer for Middleware (FOCUS)

### Table of Contents

- Introduction
- FOCUS Options overview
- FOCUS Sample Usage
- FOCUS Structure & Organization
- Extending FOCUS

### Introduction

TAO is a highly flexible ORB that contains a wide range of ORB configuration options. One or more of these options can be combined to meet various application requirements, such as low-latency, predictable real-time behavior, or small memory footprint. TAO's ORB configuration options are managed by an object-oriented framework within the ORB Core. TAO ORB internally uses several objects called Resources, such as a reactor framework that demultiplexes new connection and data requests from a client or pluggable protocol framework to seamlessly work across different protocols. Strategies, are objects that use the Resource entities to perform various ORB tasks, such as connection management, concurrency, and demultiplexing. The Service Configurator is a framework that can be used to statically and dynamically configure components into middleware and applications. Most often, applications that run on top of TAO use only one concrete type of each resource. For example, predominantly TAO applications use the IIOP protocol for communication. In this case, the underlying framework that realizes the feature can be specialized to remove dynamic dispatching overheads. The Feature Oriented Customizer (FOCUS) tool provides a generic approach to enable middleware developers to specialize middleware Frameworks when the concrete resource type is known a priori. FOCUS provides an XML based transformation engine, where the specialization transformations are captured in XML file and a weaver specializes the code. Some important points to note about FOCUS and specialization:

- It does not modify an interface. So no application level changes are necessary.
- Once a framework has been customized using FOCUS for a concrete component, other components do not work. For example, specializing the protocol framework with IIOP, precludes the ability to plug-in other protocol implementations.
- It provides a source-to-source transformations that require re-compiling the source.

### FOCUS Options Usage

Option | Description
--- | ---
--prefix-path | prefix-path to the ACE+TAO source distribution location. For example, in most situations this path is same as the ACE_ROOT environment variable.
--reactor-spl select-st, select-mt, tp-reactor | Option to specialize the reactor framework with the concrete reactor type. select-st: select reactor which no locking. Single threaded case. select-mt: select reactor with locking enabled, multi-threaded case. tp-reactor: Thread-pool reactor
--protocol-spl iiop | Option to specialize the pluggable protocol framework in TAO for the IIOP protocol.
--messaging-spl giop | Option to specialize the messaging strategy in TAO with GIOP messaging protocol.
--wait-strategy rw | Specialize the Wait Strategy with the concrete Wait Strategy in TAO. This specialization corresponds to the -ORBWaitStrategy option in TAO.
| --output-prefix | Option to copy over the specialized files to an output directory. This option works only when a single specialization is chose. If multiple specializations are chosen, then this copies the files corresponding to the last specialization.

### FOCUS Sample Usage

cmd>$ACE_ROOT/bin/FOCUS/FOCUS.pl --reactor-spl=select-st \ --prefix-path=/build/arvindk/ACE_wrappers --output-prefix=/build/arvindk/spl-files

### FOCUS Tool Organization

FOCUS tool structure is organized as follows:

- Parser directory has all parser related modules
- specializations: Rules data base that has the XML files required for performing the individual specialization transformations. For each specialization we have the following sub directories:
  - Reactor_Family: Specializations for ACE_Reactor family
  - Protocol_Family: Specializations for TAO's protocol family
  - Messaging_Strategy: Specializations for TAO's Messaging Strategy
  - Wait_Strategy: Specializations for TAO's Wait strategies

A detailed overview of the FOCUS specialization language, that specifies the different types for specialization transformations supported in FOCUS is discussed here: {To be updated shortly!}

### Extending FOCUS

To add a new specializations, to FOCUS, one needs to do the following:

1. Use the FOCUS specification language to model the different specialization Transformations required. Add this to the repository under FOCUS/specializations. Current convention is to use a directory for each family or specific type of specialization and add specialization files for each type in the family.
2. Annotate the middleware source code where ever applicable to perform the transformations.
3. Modify the FOCUS.pl script to add a specific option similar to --reactor-spl option for executing the specializations. Also update the specialization table that maps the command-line option to the appropriate specialization file within the repository.