Chapter 6 Defining Component Interfaces
A component's Interfaces folder contains icons for the IDL interfaces used by the component. Remote interfaces define the business methods that can be called by client applications.
When you define a new component, Jaguar Manager creates an interface for the component. If you defined the component by importing a Java or ActiveX class, the interface contains IDL definitions matching the Java or ActiveX methods. If you are defining a component from scratch, Jaguar Manager creates a new IDL interface with no methods. If you have imported an Enterprise JavaBean, the importer has also created an IDL home interface for the component.
Adding interfaces
Use these steps to configure which interfaces a non-EJB component implements, or to add interfaces to an EJB component in addition to the home and remote interfaces:
Removing interfaces
These steps remove an interface from the list of interfaces supported by a component, but do not affect the IDL definition:
Rules for removing interfaces:
Changing the EJB remote or home interface
Home and remote interfaces are used by EJB clients and components. To change a component's home or remote interface:
You can edit method signatures graphically in the Method Properties dialog, or by editing CORBA IDL directly. Some method properties such as the transactional attribute and run-as mode properties are not defined in IDL. To configure these settings, you must display the Method Properties window.
Interface and method name conventions Sybase recommends that you begin interface names with a capital letter, and method names with a lowercase letter.
Editing methods in IDL
You define or edit method signatures by editing the CORBA IDL interface definition directly. Use this procedure if you are comfortable with CORBA IDL and prefer it to point-and-click interface editing.
Adding methods graphically
Editing method properties
Use this procedure to display the method properties window, which provides a point-and-click controls to edit the method's IDL signature and also configures settings that are not represented in IDL.
Removing methods graphically
Method properties are organized on the following tabs:
Property |
Description |
Notes |
---|---|---|
Description |
Specifies a description of what the method does. The description can be up to 255 characters. |
You can enter comments about the method here. |
Exceptions Raised |
Specifies the user-level exceptions raised by this method. Enter exceptions in the form: Module::ExceptionName You can enter multiple exceptions, separated by commas. |
User-level exceptions must be defined in IDL before you can specify that a method raises the exception. See "User-defined exceptions" for more information. |
Read only |
For stateful components specifies whether the method can change the component's state. The default setting is off, which indicates that the method can change the component's state. |
Setting this field is an optimization that allows the server to omit processing that is otherwise required to save a component's state. For example, the ejbStore method is not called for an EJB entity Bean if a read only method has been invoked. |
Returns |
Specifies the return type of the method. Select the return type from the drop-down list or enter the name of an IDL or Java datatype into the input field. See "Parameter and return value datatypes" for more information. |
Method implementations cannot return null values. If there are cases where the method must return no value, specify an IDL sequence type as the return value, and implement the method to return an empty sequence to indicate the no-value case. |
Parameters |
Displays the name, type, and mode of each parameter. |
To add a parameter, click Add, and complete the information described in "Parameter properties". To modify a parameter, highlight the parameter you want to modify, click Modify, and complete the information described in "Parameter properties". To delete a parameter, highlight the parameter you want to delete, and click Delete. |
The Parameter Properties dialog box appears when you click Add or Modify in the Method Properties window. The following table describes the controls within the window.
Property |
Description |
Notes |
---|---|---|
Parameter Number |
Displays the parameter number |
No input is required. |
Name |
Specifies the name of the parameter |
A name is required. |
Mode |
Specifies how values are passed for the parameter. |
Supported modes are as follows:
|
Type |
Specifies the datatype of the parameter. |
Select a datatype from the drop-down list or type the name of an IDL or Java datatype in the input field. See "Parameter and return value datatypes" for more information. |
Description |
Describes how the parameter is to be used. |
Optional. You can use this field to describe how the parameter is to be used. |
For method parameters and return values, you can choose predefined types from the drop-down list or enter a Java or IDL datatype name by typing it in the input field.
The following table lists the predefined Jaguar Manager datatypes and their IDL equivalents. These types display when you change the datatype of a parameter or change the method's return type.
In addition to the predefined types listed in "Predefined datatypes", you can also apply IDL and Java datatypes to parameters and return values by typing the name of an IDL or Java datatype.
IDL datatypes You can define your own datatypes and use them when defining method signatures. "Defining modules and interfaces in IDL" discusses IDL in more detail.
To specify an IDL type name in the Method Properties dialog
box, simply enter the type name in the Returns or Parameter Datatype
field--for example, MyModule::MyType
.
The IDL module must be present in the Jaguar IDL repository, and
the module must contain a declaration for that type name.
Java datatypes You can specify Java datatypes as input parameters or return types. You cannot specify Java datatypes for parameters that use the inout or output modes. "Java class names used as IDL datatypes" describes which interfaces and classes can be used.
To specify a Java datatype, simply type the full class or
interface name in the Returns or Parameter Datatype field--for
example, java.util.Properties
.
Java datatypes and interoperability If a method is defined using a Java datatype, only Java components can implement the method and only Java clients can invoke the method.
Copyright © 2000 Sybase, Inc. All rights reserved. |