Chapter 5 Defining Components
The Component Properties window configures the settings that Jaguar uses to load the component and invoke its methods. Component properties are organized on the following tabs:
The General tab defines basic information about the component, including the supported IDL interfaces, the component type, and implementation details. If you imported a Java or ActiveX component, these properties have already been configured correctly by the import process. The following table describes the window controls.
The Transactions tab configures the component's transactional properties. Chapter 3, "Understanding Transactions and Component Lifecycles" provides useful background for the transactional properties.
The transaction attribute determines how methods in your component participate in transactions; at the component level, the setting affects all methods. You can also set a transaction attribute for methods within a component (see "Method properties"). Values set at the method level override the component setting.
Transaction attribute in imported EJB components EJB 1.1 components imported from an EJB JAR file have the transaction attribute set for each method. To use the component level setting, set the transaction attribute to Default to Component for each method.
The transaction attribute can have the following values:
Jaguar allows only one transaction per component instance A component instance may not execute in two transaction contexts. You cannot set a transaction attribute at the method level that conflicts with the component level setting. For example, you cannot set the component transaction attribute to Mandatory and a method transaction attribute to Requires New. If a method invocation would cause this rule to be violated, the Jaguar server returns an exception to the client and logs the error in the server log file.
Specifies the isolation level for transactions begun by the component's method. This setting can be configured for the component and for individual methods (see "Method properties"). The choices are:
Transaction isolation level property is not supported in EJB 1.1 The EJB 1.1 specification does not require servers to support configuration of transaction isolation level as a declarative property. Future Jaguar versions that implement the EJB 1.1 specification will not export this setting in EJB-JAR files.
Applies only to non-EJB components only. When this option is enabled, Jaguar deactivates the component instance after every method invocation. Your component need not call the completeWork or rollbackWork transaction primitives when this property is enabled. If your component is transactional, calling rollbackWork or throwing the CORBA TRANSACTION_ROLLEDBACK exception aborts the transaction. Setting any other transaction state commits the transaction.
By default, this option is enabled for new components.
If component is stateful disable Automatic demarcation/deactivation If your component maintains state across method invocations, you must disable the automatic transaction demarcation property. For example, if you read and modify class member fields in response to method invocations, you must disable this option.
When this option is enabled, client proxies for the component can transparently failover to alternate servers when a server becomes unavailable. This option cannot be enabled unless you have enabled the Automatic demarcation/deactivation option.
Automatic failover requires that your application use a cluster of Jaguar servers, so that redundant servers are available to run the application's components. The cluster must include at least one name server and clients must resolve proxy references using naming services. See "Load Balancing and Failover" in the Jaguar CTS System Administration Guide for more information.
Properties on the Instances tab configure how instances of the component are created and bound to server-side threads and client-side object references. The properties are as follows:
Property |
Description |
---|---|
Concurrency |
Enabling this option allows multiple method invocations to occur simultaneously. Concurrent access can decrease the response time of client method invocations. Enable this option for any component that is thread safe. If this option is disabled, Jaguar serializes all method calls to the component. Concurrency applies to execution of all instances Concurrency option disabled If the Sharing and Bind Thread options are selected, the Concurrency option is implicitly disabled. |
Bind Object |
Applies to stateful components only (Automatic Demarcation/Deactivation must be disabled on the Transactions tab or the component must be a stateful session EJB). When this property is enabled, an instance is bound to a client's proxy reference until the client destroys or releases the reference. If you enable this option, your component must be thread-safe; that is, one instance must be able to execute on multiple threads concurrently. A client may call the proxy from multiple threads, or pass the proxy to another process or component; consequently, there is no guarantee that calls are serialized with Bind Object enabled. Component instances are destroyed when the client instance reference times out (the time out period is configured on the Instances tab-see "Instances tab component properties"). Instances are not pooled. Bind Object is most commonly used for storage components, which are used to store a component's state information in a database. See "Persistence tab component properties" for more information on storage components. |
Bind Thread |
When this option is enabled, component instances are bound to the creating thread. Enable this option if the component uses thread-local storage. For ActiveX components, this option must be enabled. For other component types, enable the option only if you are sure that your component uses thread-local storage. If the Bind Thread option is selected, multiple instances may still run concurrently on separate threads. To ensure that only one instance is active at a time, make sure that the Concurrency option is not selected. When Bind Thread is enabled, instances are pooled if the Pooling option is enabled. The thread is pooled with the instance in this case. |
Pooling |
When this option is enabled, component instances are always pooled after deactivation. For Java and ActiveX components, you can also configure pooling by implementing interfaces with a canReuse (Java) or canBePooled (ActiveX) method. If you enable the Pooling option in Jaguar Manager, your component is always pooled, and these methods are not called. See "Supporting instance pooling in your component" for more information on instance pooling. |
Sharing |
When this option is enabled, a single, shared instance of the component services all client requests. Enable this option if you are creating a service component. See Chapter 33, "Creating Service Components" for more information. A shared component can store data in instance variables. However, if the component's Concurrency option is also selected, you must add code to synchronize access to instance variables. Sharing setting overrides Pooling setting If you select both Sharing and Pooling, Sharing takes precendence. |
Stateless |
This option applies only to EJB session Beans and non-EJB components that use the control interface CtsComponents::ObjectControl. For EJB session Beans, the Stateless option is set correctly when the component type is set, and must not be changed. For other component types, the option must be set manually. |
Transient |
Applies to stateful components only. Specifies whether instances can be run on multiple servers in a cluster or survive a server restart. If this option is enabled, the server guarantees that proxy references can only be used within the same server process. For EJB stateful session Beans, this property must be enabled for the standard EJB passivation and activation to occur. It must be disabled if you want to configure a stateful session Bean to support failover using the Persistence tab properties (see "Persistence tab component properties"). |
Reentrant |
Applies to EJB entity Beans only. When this option is enabled, an instance is allowed to participate in loopback call sequences, which are call sequences where one of the Bean's methods calls another component which in turn calls a method in the calling Bean instance. Most Beans are not implemented to support reentrancy, and you must not enable this option unless the Bean developer has verified that the implementation allows it. |
Applies to EJB 1.1 components only. Environment properties allow you to specify read-only site specific data for use by the component. For example, you may have environment properties to specify the name of a logging file, or to tune cache usage, or to specify an email address for the site administrator. See "Configuring environment properties" for more information.
Applies to EJB 1.1 components only. EJB references provide an alias mechanism for the home names used to create proxies for intercomponent calls. The home names used in your compoent must be cataloged on this tab if the component is to run on other servers. When deploying the component, a site administrator can map site-specific EJB home names to the references used by your component. See "Configuring EJB references" for more information.
Applies to EJB 1.1 components only. Resource references are used to obtain database connections and JavaMail sessions. The reference allows you to obtain resource factories using JNDI, rather than hard-coding connection parameters in your application. See "Configuring resource references" for more information.
Applies to EJB 1.1 components only. Role references are required if you call the isCallerInRole Java method to restrict access. Each reference maps a string used in isCallerInRole calls to a J2EE role that is configured in the package Role Mappings. See "Configuring role references and method permissions" for more information.
Properties on this tab govern the allocation and deallocation of resources required by the component.
The Persistence tab allows you to specify an EJB entity Bean's primary key and configure settings that allow Jaguar to save component state to a database server. e.
Table 5-2 summarizes the Persistence settings. See Chapter 29, "Managing Persistent Component State" for detailed information on these fields.
Field |
Description |
---|---|
Persistence |
Specifies whether component state is saved, and if so, how. The available options are:
|
Primary Key |
The primary key for EJB entity Beans
or for CORBA components that follow the EJB entity Bean style of
state management. Specify the IDL type of the components primary
key. For example: Unless you have defined an entity Bean by importing class or EJB-JAR files, you must define the primary key type yourself. For a CORBA component, you can specify any valid IDL type as the primary key. For an EJB entity Bean, choose from the types listed in "Allowable primary key types". |
State |
When using automatic persistence, specifies the name of an IDL type or serializable Java class. The named type must encapsulate all data to be persisted. |
State Methods |
The names of methods in the implementation
class that get and set the state datatype, specified as a 2-item
comma separated list. The default is |
Generated Class |
The name of generated C++ or Java class that saves and restores component state from a remote database. Jaguar Manager does not generate such classes, but third-party tool vendors can use this option. The generated class can inherit from or delegate to the component's implementation class to save and restore component state. |
Storage Component |
Specifies the name of a component that reads and writes component state information from a remote database server. Required when using automatic persistence, or when using component-managed persistence with an implementation that delegates to Jaguar's built-in storage component. See "Storage components" for more information. |
Connection Cache |
Specifies the connection cache used by the storage component. The cache must be installed on all servers where your component runs and allow by-name access. |
Table |
Specifies the name of the database table to store component state information. If the table name is prefixed with "map:", as in "map:MyTable", field and column names must be mapped to implementation class fields as described in "Specify field to column mapping properties". If just the table name is specified, the table must have the schema described in "Table schema for binary storage". |
Timestamp |
When using a mapped database table, specifies the timestamp used for optimistic concurrency control. Specify one of the following:
For best performance, use a 4-byte integer timestamp column. The timestamp column need not be mapped to the component's persistent state fields. 16-byte binary timestamp values are not useable when other processes (besides Jaguar server) update a table. |
Timeout |
This setting is reserved for future use. |
This tab specifies the user name and password that are used when methods call other Jaguar components installed in the same server or server cluster. The setting in the Component Properties dialog box is the default for all methods in the component. You can override the component level setting for individual methods (see "Method properties").
The choices for Run As Mode are:
When Run-As Mode is set to Specified, you must enter a logical entity name, then map the logical identity name to an identity that is defined in the Jaguar Manager identities folder. If there are no identities defined, you must close the Component Properties dialog, go to the Identities folder, and create at least one identity to map logical identities to. For more information, see the Jaguar Manager online help or the Jaguar CTS System Administration Guide.
Mappings specified in the Component Properties dialog are stored as package properties and apply to all other components in the package.
The All Properties tab allows you to edit component property settings as they are stored in the Jaguar configuration repository. You can only delete properties that you have added--you cannot delete default properties, such as the Instance Timeout property.
You can set properties as follows:
Repository property names are listed in the documentation for the Jaguar::Repository IDL interface, in the description of the define method. To read this documentation, load your server's main HTML page into a Web browser, and follow the "Interface Repository" link.
When to use the All Properties tab Though you can use the All Properties tab to set any property prefixed with "com.sybase.jaguar.component", Sybase recommends that you use this tab to set properties only as specified by the Jaguar documentation or by Sybase Technical Support. Most properties can be configured graphically elsewhere in the Jaguar Manager user interface.
The following component properties can be configured only from the All Properties tab:
com.sybase.jaguar.component.keys For an EJB entity Bean, specifies the name of an IDL typedef for a sequence of the Bean's primary key structures. This type is used when generating the skeleton and implementation classes for the component.
When you manually specify a value for the Primary Key field
on the Persistence tab, Jaguar Manager sets this property to module::componentKeys
where module is
the module containing the primary key type, and component is
the component name. Jaguar Manager defines the type if it does not
exist, using the following structure:
typedef <sequence pk> componentKeyswhere pk is the primary key type, and component is the component name.
Set the com.sybase.jaguar.component.keys property only when you have manually defined a sequence that uses another naming convention or that is located in another module.
If you have used PowerJ or the Jaguar Manager import feature to import an entity Bean, the com.sybase.jaguar.component.keys typedef may use a different naming convention.
com.sybase.jaguar.component.list For an EJB 1.0 entity Bean, specifies the name of an IDL typedef for a sequence of the Bean's remote interface type. In an entity Bean's IDL home interface, methods that return a collection of instances must return the type name specified by this property.
When you manually specify a value for the Primary Key field
on the Persistence tab, Jaguar Manager sets this property to module::componentList
where module is
the module containing the primary key type, and component is
the component name. Jaguar Manager defines the type if it does not
exist, using the following structure:
typedef <sequence ri> componentListwhere ri is the remote interface name, and component is the component name.
Set the com.sybase.jaguar.component.list property only when you have manually defined a sequence that uses another naming convention or that is located in another module.
If you have used PowerJ or the Jaguar Manager import feature to import an entity Bean, the com.sybase.jaguar.component.keys typedef may use a different naming convention.
com.sybase.jaguar.component.tx_outcome Determines whether a CORBA::TRANSACTION_ROLLEDBACK exception is thrown to the client when a transaction is rolled back. The allowable settings are:
You can set this property to failed
if
you require that no exceptions are sent to the client for rolled-back
transactions or that an alternate exception is sent. This setting
is useful if you require that the client be able to retrieve output parameters
after a transaction is rolled back: if an exception is thrown, the output
parameters are not available.
com.sybase.jaguar.component.cpp.debug When set to true
, specifies that
the component should be executed outside of the scope of Jaguar's
internal C++ exception handling. The default is false
.
You must set this property to true
in
order to debug an executing C++ component in Microsoft
Visual C++. Other C++ debuggers
may require the same setting as well. See "Debugging C++ components" for more information.
com.sybase.jaguar.component.pb.debug When set to true
, specifies
that the component can be debugged from the PowerBuilder IDE. This
property is set as a PowerBuilder deployment option, and should
not be set in Jaguar Manager. See "Debugging C++ components" for more information.
com.sybase.jaguar.component.refresh This property specifies whether the component can be refreshed.
If the value is false
, the
File | Refresh option has no effect for the component.
Allowable values are true
and false
.
The default is true
.
com.sybase.jaguar.component.java.classes For Java components, this property lists additional java classes that must be reloaded when the component is refreshed as described in "Refreshing Java components". The property takes as values a list of fully qualified class names separated by commas. You can specify all classes in a package using wildcards, as in this example:
com.xyz.MyPackage.*
You can specify all classes in a JAR file by specifying the JAR file name, as in this example:
MyEntityBean.jarThe JAR file must be deployed in the Jaguar java/classes subdirectory.
Copies of the specified classes must be deployed under one of the following locations. When loading classes required by Java components, Jaguar searches for classes in this order:
Some shared classes should not be in the custom class list Classes that are shared by multiple component instances. and that keep volatile state in static instance variables (that is, have static variables that are set after class initialization completes), must not be listed in the com.sybase.jaguar.component.classes custom class list. If these classes are in the custom class list, instances loaded by different components have different views of static instance variables.
com.sybase.jaguar.component.control Specifies the name of the IDL control interface. The control interface defines methods called by the Jaguar server in response to changes in the instance lifecycle. The choices are summarized in this table:
These interfaces are documented in the generated IDL documentation, which is available in HTML format in the html/ir subdirectory of your Jaguar installation. If you use a control interface other than JaguarEJB::ServerBean, Jaguar generates the control interface methods in the implementation template when you generate a C++ or Java skeleton.
com.sybase.jaguar.component.files Specifies additional files that are included when the component is archived with the package export feature or replicated with the synchronize feature. See "Component files property" for more information.
The com.sybase.jaguar.component.files property specifies a list of files that are to be included when the component is exported into a package archive file or replicated to another server with the synchronize feature. By default, the following files are included when you export packages or synchronize between servers:
Any additional files that are required to run the component must be listed in the com.sybase.jaguar.component.files setting. Set or modify this property on the All Properties tab in the Component Properties window. Enter a list of file names, separated by commas. Files may be specified as follows:
com.sybase.CORBA
adds
all files in the com.sybase.CORBA package. These
classes must be deployed under the Jaguar java/classes subdirectory.
myutils.dll
.
Copyright © 2000 Sybase, Inc. All rights reserved. |