Init

Sets ORB property values or initializes an instance of the CORBACurrent service object.

To

Use

Set ORB property values for client connections to EAServer using the JaguarORB object

Syntax 1For setting ORB property values

Initialize an instance of the CORBACurrent service object for client- or component-managed transactions

Syntax 2For initializing CORBACurrent


Syntax 1For setting ORB property values

Description

Sets ORB property values. This function is used by PowerBuilder clients connecting to EAServer.

Applies to

JaguarORB objects

Syntax

jaguarorb.Init ( options )

Argument

Description

jaguarorb

An instance of JaguarORB.

options

A string that specifies one or more ORB property values. If you specify multiple property values, you need to separate the property values with commas.

For a complete list of supported ORB properties, see the online Help for the Options property of the Connection object.

Returns

Long. Returns 0 if it succeeds and a negative number if an error occurs.

Usage

ORB properties configure settings required by the EAServer ORB driver.

You do not need to call the Init function to use the JaguarORB object. If you do not call Init, the EAServer ORB driver uses the default property values.

The Init function can be called multiple times on the same JaguarORB object. PowerBuilder creates a new internal instance of the JaguarORB object the first time and uses this object for all subsequent calls.

For additional examples, see the functions on the See also list.

Examples

Example 1

The following example shows the use of the Init function to set the RetryCount and RetryDelay ORB properties:

JaguarORB my_orb

CORBAObject my_corbaobj

...

...

my_orb = CREATE JaguarORB

my_orb.Init("ORBRetryCount=3,ORBRetryDelay=1000")

...

...

See also


Syntax 2For initializing CORBACurrent

Description

Initializes an instance of the CORBACurrent service object.

Applies to

CORBACurrent objects

Syntax

CORBACurrent.Init ( { connection | URL} )

Argument

Description

CORBACurrent

Reference to the CORBACurrent service instance.

connection

The name of the Connection object for which a connection has already been established to a valid EAServer host. Either connection or URL is required if the Init function is called by a client.

URL

String. The name of a URL that identifies a valid EAServer host. Either connection or URL is required if the Init function is called by a client.

Returns

Integer. Returns 0 if it succeeds and one of the following values if the service object could not be initialized:

Usage

The Init function can be called from a PowerBuilder component running in EAServer whose transaction property is marked as OTS style, or by a PowerBuilder client. The Init function must be called to initialize the CORBACurrent object before any other functions are called. EAServer must be using the two-phase commit transaction coordinator (OTS/XA) and a reference to the CORBACurrent object must first be obtained using the GetContextService function.

When Init is called from a PowerBuilder component running in EAServer, no arguments are required. If the calling component is not marked as OTS style, the CORBACurrent object is not initialized.

When Init is called from a PowerBuilder client and the client is responsible for the transaction, the CORBACurrent object must be initialized by calling Init with either a Connection object or a URL string as the argument. In the case of a Connection object, the client must already be connected to a valid EAServer host using that Connection object. Using a Connection object is preferred because the code is more portable.

Examples

Example 2

This example shows the use of Init in a PowerBuilder EAServer component to initialize an instance of the CORBACurrent object:

// Instance variables:
// CORBACurrent corbcurr
int li_rc

li_rc = this.GetContextService("CORBACurrent", 
    corbcurr)
IF li_rc <> 1 THEN    
    // handle the error
ELSE
    li_rc = corbcurr.init()
    IF li_rc <> 0 THEN
      // handle the error
    END IF
END IF

In this example, Init is called by a PowerBuilder client application that has already connected to EAServer using the myconn Connection object and has created a reference called corbcurr to the CORBACurrent object:

li_rc = corbcurr.init( myconn )
IF li_rc <> 0 THEN
    // handle the error
END IF

In this example, the PowerBuilder client application calls the Init function using a valid URL:

li_rc = corbcurr.init( "iiop://localhost:2000" )
IF li_rc <> 0 THEN
    // handle the error
END IF

See also