• No results found

OBJECT_NOT_EXIST system exception to be raised If the component denoted by the parameter does not exist in the container associated with target home object,

1.10 Configuration with Attributes

A componentÕs configuration is established primarily through its attributes. An attribute configuration is defined to be a description of a set of invocations on a componentÕs attribute set methods, with specified values as parameters. There are a variety of possible approaches to attribute configuration at run time, depending on the design of the component implementation and the needs of the application and deployment environments. The CORBA component model defines a set of basic mechanisms to support attribute configuration. These mechanisms can be

1.10.1 Attribute Configurators

A configurator is an object that encapsulates a specific attribute configuration that can be reproduced on many instances of a component type. A configurator may invoke any operations on a component that are enabled during its configuration phase. In general, a configuratorisintended to invoke attribute set operations on the target component.

1.10.1.1 The Configurator interface

The following interface is supported by all configurators: module Components {

exception WrongComponentType { }; interface Configurator {

void configure (in CCMObject comp) raises (WrongComponentType);}; };

configure

The configure operation establishes its encapsulated configuration on the target component. If the target component is not of the type expected by the configurator, the configure operation shall raise the WrongComponentType exception.

1.10.1.2 The StandardConfigurator interface

The StandardConfigurator has the following definition: module Components {

valuetype ConfigValue { public FeatureName name; public any value;

};

typedef sequence<ConfigValue> ConfigValues; interface StandardConfigurator : Configurator {

void set_configuration (in ConfigValues descr); };

};

The StandardConfigurator interface supports the ability to provide the configurator with a set of values defining an attribute configuration.

set_configuration

The set_configuration operation accepts a parameter containing a sequence of ConfigValue instances, where each ConfigValue contains the name of an attribute and a value for that attribute, in the form of an any. The name member of the ConfigValue type contains the unqualified name of the attribute as declared in the component definition IDL. After a configuration has been provided with

set_configuration, subsequent invocations of configure will establish the

configuration on the target component by invoking the set operations on the attributes named in the value set, using the corresponding values provided in the anys.

Invocations on attribute set methods will be made in the order in which the values occur in the sequence.

1.10.2 Factory-based Configuration

Factory operations on home objects may participate in the configuration process in a variety of ways.

¥

A factory operation may be explicitly implemented to establish a particular configuration.

¥

A factory operation may apply a configurator to newly-created component

instances. The configurator may be supplied by an agent responsible for deploying a component implementation or a component assembly.

¥

A factory operation may apply an attribute configuration (in the form of a

Components::ConfigValues sequence) to newly-created instances. The attribute configuration may be supplied to the home object by an agent responsible for deploying a component implementation or a component assembly.

¥

A factory operation may be explicitly implemented to invoke

configuration_complete on newly-created component instances, or to leave component instances open for further configuration by clients.

¥

A factory operation may be directed by an agent responsible for deploying a component implementation or assembly to invoke configuration_complete on newly-created instances, or to leave them open for further configuration by clients. If no attribute configuration is applied by a factory or by a client, the state established by the component implementationÕs instance initialization mechanism (e.g., the component servant constructor) constitutes the default configuration.

1.10.2.1 HomeConfiguration interface

The implementation of a component typeÕs home object may optionally support the HomeConfiguration interface. The HomeConfiguration interface is derived from Components::CCMHome. In general, the HomeConfiguration interface is intended for use by an agent deploying a component implementation into a container, or an agent deploying an assembly.

The HomeConfiguration interface allows the caller to provide a Configurator object and/or a set of configuration values that will be applied to instances created by factory operations on the home object. It also allows the caller to cause the home objectÕs factory operations to invoke configuration_complete on newly-created instances, or to leave them open for further configuration.

The HomeConfiguration allows the caller to disable further use of the HomeConfiguration interface on the home object.

The Configurator interface and the HomeConfiguration interface are designed to promote greater re-use, by allowing a component implementor to offer a wide range of behavioral variations in a component implementa- tion. As stated previously, the CORBA component specification is intended to enable assembling applications from pre-built, off-the-shelf component implementations. An expected part of the assembly process is the customi- zation (read: configuration) of a component implementation, to select from among available behaviors the behaviors suited to the application being assembled. We anticipate that assemblies will need to define configurations for specific component instances in the assembly, but also that they will need to define configurations for a deployed component type, i.e., all of the instances of a component type managed by a particular home object. The HomeConfiguration interface is defined by the following IDL: module Components {

interface HomeConfiguration : CCMHome { void set_configurator (in Configurator cfg); void set_configuration_values (

in ConfigValues config);

void complete_component_configuration (in boolean b); void disable_home_configuration();

}; };

set_configurator

This operation establishes a configurator object for the target home object. Factory operations on the home object will apply this configurator to newly-created instances. set_configuration_values

This operation establishes an attribute configuration for the target home object, as an instance of Components::ConfigValues. Factory operations on the home object will apply this configurator to newly-created instances.

complete_component_configuration

This operation determines whether factory operations on the target home object will invoke configuration_complete on newly-created instances. If the value of the boolean parameter is TRUE, factory operations will invoke

configuration_complete on component instances after applying any required configurator or configuration values to the instance. If the parameter is FALSE, configuration_complete will not be invoked.

disable_home_configuration

This operation serves the same function with respect to the home object that the configuration_complete operation serves for components. This operation disables further use of operations on the HomeConfiguration interface of the target home object. If a client attempts to invoke HomeConfiguration operations, the request will raise a BAD_INV_ORDER system exception. This operation may also be

interpreted by the implementation of the home as demarcation between its own configuration and operational phases, in which case the home implementation may disable operations and attributes on the home interface.

If a home object is supplied with both a configurator and a set of configuration values, the order in which set_configurator and set_configuration_values are invoked determines the order in which the configurator and configuration values will be applied to component instances. If set_configurator is invoked before

set_configuration_values, the configurator will be applied before the configuration values, and vice-versa.

The component implementation framework defines default implementations of factory operations that are automatically generated. These generated implementations will behave as specified here. Component implementors are free to replace the default factory implementations with customized implementations. If a customized home implementation chooses to support the HomeConfiguration interface, then the factory operation implementations must behave as specified, with respect to component configuration.