Chapter 5: Defining Component Interfaces  Importing interfaces from compiled Java files

Chapter 5: Defining Component Interfaces

Defining interfaces graphically

A component’s Interfaces folder contains icons for the IDL interfaces implemented by the component. These interfaces define the methods that can be called by client applications.

When you define a new component, EAServer 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, EAServer Manager creates a new IDL interface with no methods. If you have imported an EJB component, the importer has also created an IDL home interface for the component.

StepsAdding 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:

  1. Highlight the Interfaces folder beneath the component icon and choose File | Add Interfaces. The Install Interfaces dialog displays.

  2. You can perform the following operations in the dialog:

  3. When you are done, click Install to close the dialog.

  4. If you defined new interfaces, add methods to the interfaces as described below.

StepsRemoving interfaces

These steps remove an interface from the list of interfaces supported by a component, but do not affect the IDL definition:

  1. Expand the Interfaces folder beneath the component icon. The list of interfaces supported by the component displays.

  2. Highlight the interface to remove, and choose File | Remove.

NoteRules for removing interfaces:

StepsChanging 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:

  1. Expand the Interfaces folder below the component icon.

  2. Highlight the Interfaces folder and choose File | Set Home interface if changing the home interface, or choose File | Set Remote Interface if changing the remote interface.

  3. Enter an IDL name for the interface, specifying an IDL module hierarchy and interface name to match the intended Java package hierarchy and interface name. For example, if the Java class will be foo.bar.MyBeanHome, enter foo::bar::MyBeanHome. EAServer Manager creates specified modules and interfaces if they do not already exist.


Editing interfaces

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.

NoteInterface and method name conventions Sybase recommends that you begin interface names with a capital letter, and method names with a lowercase letter.

StepsEditing 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.

  1. Highlight the icon for the interface of interest.

  2. Choose File | Edit IDL

  3. The IDL interface definition displays in the IDL Editor window.

  4. Make any changes, then choose File | Save. If the changes have introduced syntax errors, EAServer Manager displays the error text in a dialog box. Fix the errors, then try to save again.

  5. When you have made all changes and saved them, choose File | Exit.

StepsAdding methods graphically

  1. Highlight the icon for the interface of interest.

  2. Choose File | New Method.

  3. Enter a name for the method and click Create New Method.

  4. The Method Properties dialog box displays. Use the controls on the General tab to define the method parameters, return type, and exceptions raised. See “Method properties” for more information.

StepsEditing 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.

  1. Highlight the icon for the interface of interest.

  2. Highlight the icon for the method to be edited.

  3. Choose File | Method Properties.

  4. The Method Properties dialog box displays. See “Method properties” for more information.

StepsRemoving methods graphically

  1. Expand the icon for the interface of interest.

  2. Highlight the icon for the method to be deleted.

  3. Choose File | Delete Method.


Method properties

Method properties are organized on the following tabs:


Parameter properties

The New Parameter and Modify Parameter dialog boxes allow you to configure the type and modality of each method parameter using the controls described in Table 5-2.

Table 5-2: Parameter properties

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:

  • in – Input only. No new value is returned when the method completes.

  • inout – Input and output. Input values are not ignored, and output values are returned to caller.

  • out – Output only. Input values will be ignored; output values are returned to caller.

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.


Parameter and return value datatypes

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.

Predefined datatypes

The following table lists the predefined EAServer Manager datatypes and their IDL equivalents. These types display when you change the datatype of a parameter or change the method’s return type.

Table 5-3: Predefined EAServer IDL datatypes

EAServer Manager display datatype

CORBA IDL type

Description

boolean

boolean

One bit of binary data; a value that is either true or false

integer<16>

short

A 16-bit integer

integer<32>

long

A 32-bit integer

integer<64>

long long

A 64-bit integer

float

float

Single-precision IEEE floating point numbers

double

double

Double-precision IEEE floating point numbers

string

string

A sequence of characters of any length

binary

BCD::Binary

Sequence of bytes

decimal

BCD::Decimal

Fixed-point decimal

money

BCD::Money

Same as decimal

date

MJD::Date

A date including year, month, day, hour, minute, second, and millisecond values

time

MJD::Time

Holds the time of day, including hours, minutes, seconds, milliseconds

timestamp

MJD::Timestamp

Holds the same data as date, plus a nanoseconds value

ResultSet

TabularResults::ResultSet

A single table of relational database rows

ResultSets

TabularResults::ResultSets

A sequence of 0 or more ResultSet objects

Using IDL and Java datatypes

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, interfaces, and types 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 EAServer 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.

NoteJava 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 © 2005. Sybase Inc. All rights reserved. Importing interfaces from compiled Java files