Procedure for creating C components  Generate C component files

Appendix C: Creating C Components

Define component interface and properties

The definition of a C component specifies the interfaces that the component implements as well as its other properties.

The component’s transaction property determines how it participates in transactions. The threading property imposes constraints on concurrent execution of the component.

Define the component’s interfaces

All component interfaces for EAServer components are defined in CORBA IDL modules that are stored in EAServer’s IDL Repository. Chapter 5, “Defining Component Interfaces” describes how to define IDL interfaces.

Component developers typically use one of the following to define the interface or interfaces that their component implements:

Transaction property

The component’s transaction property determines how it participates in transactions. You can view and change this property using the Transactions tab of the component’s property sheet.

When you mark a component as “Requires Transaction,” commands that the component sends to third-tier database servers are automatically performed within a transaction. By default, components are not transactional.

Transactional component attribute describes the settings for this attribute. Chapter 2, “Understanding Transactions and Component Lifecycles” introduces the EAServer transaction processing model.

Instance properties

The Instances property imposes constraints on the concurrent execution of the component in different threads. You can view and change these properties using the Instances tab of the component’s property sheet.

For a single-threaded component, multiple instances may exist simultaneously, but only one can be active at any one time. EAServer synchronizes instantiations, method invocations, and destructions of all instances. Use the single-threaded model if your component shares volatile global data or stateful resources between instances. For example, volatile global data might be a counter that is stored in a global variable. Sharing a stateful resource would occur if, for example, every component instance opened the same file and wrote text to it. Either example requires the single-threading model. To enable single-threading, do not select any of the options in the Instance Properties tab.

The following settings specify the constraints that are placed on concurrent execution of different instances of the component. The choices are:

Copyright © 2005. Sybase Inc. All rights reserved. Generate C component files