![]() |
![]() |
|
|
CORBA Bootstrapping Programming Reference
This topic includes the following sections:
Why Bootstrapping Is Needed
To communicate with BEA Tuxedo objects, a client application must obtain object references. Without an object reference, there can be no communication. To solve this problem, client applications use a bootstrapping mechanism to obtain object references to objects in a BEA Tuxedo domain.
Supported Bootstrapping Mechanisms
In the Tuxedo 8.0 release and later, two bootstrapping mechanisms are supported:
Use this mechanism if you using the BEA client ORB.
Use this mechanism if you using a client ORB from another vendor.
Note: The CORBA C++ and Java clients provided with BEA Tuxedo software may use the Interoperable Naming Service bootstrapping mechanism, however, for performance reasons, this is not recommended.
BEA Bootstrapping Mechanism
The BEA bootstrapping mechanism uses the Bootstrap object. Bootstrap objects are local programming objects, not remote CORBA objects, in both the client and the server. When Bootstrap objects are created, their constructor requires the network address of a BEA Tuxedo IIOP Listener/Handler. Given this information, the bootstrapping object can generate object references for the key remote objects in the BEA Tuxedo domain. These object references can then be used to access services available in the BEA Tuxedo domain.
How Bootstrap Objects Work
Bootstrap objects are created by a client or a server application that must access object references to the following BEA Tuxedo CORBA interfaces:
Bootstrap objects may represent the first connection to a specific BEA Tuxedo domain depending on the format of the IIOP Listener/Handler address. If the NULL scheme Universal Resource Locator (URL) format is used (the only address format supported in releases of BEA WebLogic Enterprise prior to version 5.1 and BEA Tuxedo release 8.0), the Bootstrap objects represent the first connection. However, if the URL format is used, the connection will not occur until after creation of the Bootstrap object. For more information on address formats and connection times, refer to Tobj_Bootstrap.
For a BEA Tuxedo CORBA remote client, Bootstrap objects are created with the host and the port for the BEA Tuxedo IIOP Listener/Handler. However, for BEA Tuxedo native client and server applications, there is no need to specify a host and port because they execute in a specific BEA Tuxedo domain. The IIOP Listener/Handler host and the port ID are included in the BEA Tuxedo domain configuration information.
After they are created, Bootstrap objects satisfy requests for object references for objects in a particular BEA Tuxedo domain. Different Bootstrap objects allow the application to use multiple domains.
Using the Bootstrap object, you can obtain references to the following objects:
The SecurityCurrent object is used to establish a security context within a BEA Tuxedo domain. The client can then obtain the PrincipalAuthenticator from the principal_authenticator attribute of the SecurityCurrent object.
The TransactionCurrent object is used to participate in a BEA Tuxedo transaction. The basic operations are as follows:
Begin a transaction. Future operations take place within the scope of this transaction.
End the transaction. All operations on this client application have completed successfully.
Abort the transaction. Tell all other participants to roll back.
Suspend participation in the current transaction. This operation returns an object that identifies the transaction and allows the client application to resume the transaction later.
Resume participation in the specified transaction.
The FactoryFinder object is used to obtain a factory. In the BEA Tuxedo system, factories are used to create application objects. The FactoryFinder provides the following different methods to find factories:
The Interface Repository contains the interface descriptions of the CORBA objects that are implemented within the BEA Tuxedo domain. Clients using the Dynamic Invocation Interface (DII) need a reference to the Interface Repository to be able to build CORBA request structures. The ActiveX Client is a special case of this. Internally, the implementation of the COM/IIOP Bridge uses DII, so it must get the reference to the Interface Repository, although this is transparent to the desktop client.
A NamingService object is used to obtain a reference to the root namespace. When you use this object, the ORB locates the root of the namespace.
The NotificationService object is used to obtain a reference to the event channel factory (CosNotifyChannelAdmin::EventChannelFactory) in the CosNotification Service. In the BEA Tuxedo system, the EventChannelFactory is used to locate the Notification Service channel.
The Tobj_SimpleEventsService object is used to obtain a reference to the event channel factory (Tobj_SimpleEvents::ChannelFactory) in the BEA Simple Events Service. In the BEA Tuxedo system, the ChannelFactory is used to locate the BEA Simple Events Service channel.
The FactoryFinder and Interface Repository objects are not implemented in the environmental objects library. However, they are specific to a BEA Tuxedo domain and are thus conceptually similar to the SecurityCurrent and TransactionCurrent objects in use.
The Bootstrap object implies an association or "session" between the client application and the BEA Tuxedo domain. Within the context of this association, the Bootstrap object imposes a containment relationship with the other Current objects (or contained objects); that is, the SecurityCurrent and TransactionCurrent. Current objects are valid only for this domain and only while the Bootstrap object exists.
Note: Resolving the SecurityCurrent when using the new URL address format (corbaloc://hostname:port_number) is a local operation; that is, no connection is made by the client to the IIOP Listener/Handler.
In addition, a client can have only one instance of each of the Current objects at any time. If a Current object already exists, an attempt to create another Current object does not fail. Instead, another reference to the already existing object is handed out; that is, a client application may have more than one reference to the single instance of the Current object.
To create a new instance of a Current object, the application must first invoke the destroy_current() method on the Bootstrap object. This invalidates all of the Current objects, but does not destroy the session with the BEA Tuxedo domain. After invoking destroy_current(), new instances of the Current objects can be created within the BEA Tuxedo domain using the existing Bootstrap object.
To obtain Current objects for another domain, a different Bootstrap object must be constructed. Although it is possible to have multiple Bootstrap objects at one time, only one Bootstrap object may be "active;" that is, have Current objects associated with it. Thus, an application must first invoke destroy_current() on the "active" Bootstrap object before obtaining new Current objects on another Bootstrap object, which then becomes the active Bootstrap object.
Note: If you want to access objects in multiple domains, either import the object to the local domain or administratively configure your application access multiple domains. For more information on multi-domain configurations configurations, see "Configuring Multiple CORBA Domains" in Using the BEA Tuxedo Domains Component
.Servers and native clients are inside of the BEA Tuxedo domain; therefore, no "session" is established. However, the same containment relationships are enforced. Servers and native clients access the domain they are currently in by specifying an empty string, rather than //host:port.
Note: When using the Bootstrap object, client and server applications must use the Tobj_Bootstrap::resolve_initial_references()method, not the ORB::resolve_initial_references() method.
Types of BEA Remote Clients Supported
Table 4-1 shows the types of remote clients that can use the Bootstrap object to access the other environmental objects, such as FactoryFinder, SecurityCurrent, TransactionCurrent, and InterfaceRepository. These clients are provided with the BEA Tuxedo CORBA software. Third-party client ORBs should use the CORBA Interoperable Naming Service.
Capabilities and Limitations
Bootstrap objects have the following capabilities and limitations:
Bootstrap Object API
The Bootstrap object application programming interface (API) is described first in terms of the OMG Interface Definition Language (IDL) (for portability), and then in C++, Java, and ActiveX. The C++ and Java descriptions add the necessary constructor to build a Bootstrap object for a particular BEA Tuxedo domain.
Tobj Module
Table 4-2 shows the object reference that is returned for each type ID.
Table 4-3 describes the Tobj module exceptions.
C++ Mapping
Listing 4-1 shows the C++ declarations in the Tobj_bootstrap.h file.
Listing 4-1 Tobj_boostrap.h Declarations
#include <CORBA.h>
class Tobj_Bootstrap {
public:
Tobj_Bootstrap(CORBA::ORB_ptr orb, const char* address);
CORBA::Object_ptr resolve_initial_references(
const char* id);
void register_callback_port(CORBA::Object_ptr objref);
void destroy_current( );
};
Java Mapping
Listing 4-2 shows the Tobj_Bootstrap.java mapping.
Listing 4-2 Tobj_Bootstrap.java Mapping
package com.beasys;
public class Tobj_Bootstrap {
public Tobj_Bootstrap(org.omg.CORBA.ORB orb,
String address)
throws org.omg.CORBA.SystemException;
public class Tobj_Bootstrap {
public Tobj_Bootstrap(org.omg.CORBA.ORB orb, String address,
java.applet.Applet applet)
throws org.omg.CORBA.SystemException;
public void register_callback_port(orb.omg.CORBA.Object objref)
throws org.omg.CORBA.SystemException;
public org.omg.CORBA.Object
resolve_initial_references(String id)
throws Tobj.InvalidName,
org.omg.CORBA.SystemException;
public void destroy_current()
throws org.omg.CORBA.SystemException;
}
Microsoft Desktop Client Mapping
The Bootstrap object is provided in the BEA ActiveX Client software for use by clients that are implemented on Microsoft desktops. There are two possible interfaces that desktop clients may use:
Automation Mapping
Listing 4-3 shows Automation Bootstrap interface mapping.
Listing 4-3 Automation (Dual) Bootstrap Interface Mapping
interface DITobj_Bootstrap : IDispatch
{
HRESULT Initialize(
[in] BSTR address);
HRESULT CreateObject(
[in] BSTR progid,
[out, retval] IDispatch** rtrn);
HRESULT destroy_current();
};
C++ Member Functions
This section describes the C++ member functions supported by the BEA bootstrapping mechanism.
Tobj_Bootstrap
Synopsis
The Bootstrap object constructor.
C++ Mapping
Tobj_Bootstrap(CORBA::ORB_ptr orb, const char* address);
throws Tobj::BAD_PARAM
org.omg.CORBA.SystemException;
Parameters
For a description of the remote clients supported by BEA Tuxedo CORBA, see the section Types of BEA Remote Clients Supported.
For remote clients, address specifies the network address of an IIOP Listener/Handler through which client applications gain access to a BEA Tuxedo domain.
The address may be specified in either of the following formats:
"//hostname:port_number"
"//#.#.#.#:port_number"
"corbaloc://hostname:port_number"
"corbalocs://hostname:port_number"
In the first format, the domain finds an address for hostname using the local name resolution facilities (usually DNS). The hostname must be the remote machine, and the local name resolution facilities must unambiguously resolve hostname to the address of the remote machine.
Note: The hostname must begin with a letter character.
In the second format, the #.#.#.# is in dotted decimal format. In dotted decimal format, each # should be a number from 0 to 255. This dotted decimal number represents the IP address of the remote machine.
In both the first and second formats, port_number is the TCP port number at which the domain process listens for incoming requests. The port_number should be a number between 0 and 65535.
You can specify one or more TCP/IP addresses. You specify multiple addresses using a comma-separated list. For example:
If you specify multiple addresses, the BEA Tuxedo software tries the addresses in order, left to right, until a connection is established. If a syntax error is detected in any of the addresses as it is being tried, a BAD_PARAM exception is returned to the caller immediately and the BEA Tuxedo software aborts the attempt to make a connection. For example, if the first address in the comma-separated list shown above were //m1.3050, a syntax error would be detected and the attempt to make a connection would be aborted. If the BEA Tuxedo software encounters the end of the address list before it tries an address that is valid, that is, a connection cannot be made to any of the addresses listed, the INVALID_DOMAIN exception is returned to the caller. If an exception other than INVALID_DOMAIN is raised, it is returned to the caller immediately.
BEA Tuxedo also supports random address selection. To use random address selection, you can specify any member of an address list as a grouping of pipe-separated (|) network addresses enclosed in parentheses. For example:
When you use this format, the BEA Tuxedo system randomly selects one of the addresses enclosed in parentheses, either //m1.acme:3050 or //m2.acme:3050. If an exception other than INVALID_DOMAIN is raised, it is returned to the caller immediately. If a connection cannot be made to the address selected, the next element that follows the addresses enclosed in parentheses is attempted. If the end of the string is encountered before a connection can be made, the INVALID_DOMAIN exception is thrown to the caller.
Note: If you specify an address list in the following format:
(//m1.acme:3050||//m2.acme:3050),//r1.acme:7000
the NULL address in the pipe-separated list is considered invalid. If the BEA Tuxedo software randomly selects the invalid address, the BAD_PARAM exception is returned to the caller and the BEA Tuxedo software aborts the connection attempt.
The address string can be specified either in the TOBJADDR environment variable or in the address parameter of the Tobj_Bootstrap constructor.
For information about the TOBJADDR environment variable, see the section Managing Remote Client Applications in the Setting Up a BEA Tuxedo Application. However, the address specified in Tobj_Bootstrap always take precedence over the TOBJADDR environment variable. To use the TOBJADDR environment variable to specify an address string, you must specify an empty string in the Tobj_Bootstrap address parameter.
Note: For C++ applications, TOBJADDR is an environment variable; for Java applications, it is a property; for Java applets, it is an HTML parameter.
The third and fourth formats are called Uniform Resource Locator (URL) address formats and were introduced in the BEA WebLogic Enterprise version 5.1 release. As with the NULL scheme URL address format (//hostname:port_number), you use the URL address formats to specify the location of the IIOP Listener/Handler. However, when the corbaloc URL address format is used, the client application's initial connection to the IIOP Listener/Handler is deferred until authentication of the principal's, or client's, identity or the first user initiated operation. Using the corbalocs URL address format has the same effect on the deferred connection time as corbaloc, but, additionally, the client application makes its initial connection to the ISL/ISH using the Secure Sockets Layer (SSL) protocol. Table 4-4 highlights the differences between the two URL address formats.
These URL address formats are a subset of the definition of object URLs adopted by the OMG as part of the Interoperable Naming Service submission. The BEA Tuxedo software also extends the URL format described in the OMG Interoperable Naming Service submission to support a secure form that is modeled after the URL for secure HTTP, as well as to support the randomize functionality that was added in the BEA WebLogic Enterprise version 4.2.
The corbaloc and corbalocs URL schemes provide locations that are easily manipulated in both TCP/IP and DNS centric environments. These URL schemes contain a DNS-style hostname or IP address and a port_number. The following are some examples of the URL formats:
corbaloc://curly:1024,larry:1022,joe:1999
corbalocs://host1:1024,{host2:1022|host3:1999}
corbalocs://curly:1024,corbaloc://larry:1111,
corbalocs://ctxobj:3434,mthd:3434,corbaloc://force:1111
In the above example, if the parser reaches the URL corbaloc://force:1111, it resets its internal state as if it had never attempted secure connections and then begins attempting unprotected connections.
Caution: Do not mix the use of NULL scheme URL addresses (//hostname:port_number) with corbaloc and corbalocs URL addresses.
Note: The Bootstrap object supplied for use with the Netscape embedded Java ORB and JavaSoft JDK ORB does not support corbaloc and corbalocs URLs.
Note: For more information on using the corbaloc and corbalocs URL address formats, see Using Security in CORBA Applications.
Note: The network address that is specified in the Bootstrap constructor or in TOBJADDR must exactly match the network address in the server application's UBBCONFIG file, both the address as well as the capitalization. If the addresses do not match, the invocation to the Bootstrap constructor will fail with the following seemingly unrelated error message:
ERROR: Unofficial connection from client at
<tcp/ip address>/<port-number>
For example, if the network address is specified (using the NULL URL address format) as //TRIXIE:3500 in the ISL command-line option string in the server application's UBBCONFIG file, specifying either //192.12.4.6:3500 or //trixie:3500 in the Bootstrap constructor or in TOBJADDR will cause the connection attempt to fail. On UNIX systems, use the uname -n command on the host system to determine the capitalization used. On Windows 2000 systems, see the host system's network settings in the Control Panel to determine the correct capitalization.
Note: The error in the previous note is deferred when the URL address format is used, that is, the error does not occur at the time of Bootstrap object construction because the connection to the ISL/ISH is deferred until later.
For a native client, the address parameter in the Tobj_Bootstrap constructor must always be an empty string (not a NULL pointer). The native client connects to the application that is specified in the TUXCONFIG environment variable. The constructor raises CORBA::BAD_PARAM if the address is not empty.
When servers need access to the Bootstrap object, they should obtain a reference to it using the TP framework by invoking TP.bootstrap(). Servers should not attempt to create a new instance of the Bootstrap object.
Exception
Description
A C++ member function (or Java method) that creates Bootstrap objects.
Return Values
A pointer to a newly created Bootstrap object.
Tobj_Bootstrap::register_callback_port
Synopsis
Registers the joint client/server's listening port in IIOP Handler (ISH).
C++ Mapping
void register_callback_port(CORBA::Object_ptr objref);
Parameter
Exceptions
Description
This C++ member function (or Java method) is called to notify the ISH of a listening port in the joint client/server. This method should only be used for joint client/server ORBs that do not support GIOP 1.2 bidirectional capabilities (that is GIOP 1.0 and 1.1 client ORBs). For GIOP 1.0 and 1.1, the ISH supports only one listening port per joint client/server; therefore, the register_callback_port method should only be called once per connected joint client/server.
Usage Notes
The following information must be given consideration when using this method:
Return Values
None.
Tobj_Bootstrap::resolve_initial_references
Synopsis
Acquires CORBA object references.
C++ Mapping
CORBA::Object_ptr resolve_initial_references(
const char* id);
throws Tobj::InvalidName,
org.omg.CORBA.SystemException;
Parameter
"InterfaceRepository"
"NameService"
"NotificationService"
"SecurityCurrent"
"TransactionCurrent"
"Tobj_SimpleEventsService"
Exceptions
Description
This C++ member function (or Java method) acquires CORBA object references for the FactoryFinder, SecurityCurrent, TransactionCurrent, NotificationService, Tobj_SimpleEventsService, and InterfaceRepository objects. For the specific object reference, invoke the _narrow function. For example, for FactoryFinder, invoke Tobj::FactoryFinder::_narrow.
Return Values
Table 4-2 shows the object reference that is returned for each type id.
Tobj_Bootstrap::destroy_current()
Synopsis
Destroys the Current objects for the domain represented by the Bootstrap object.
C++ Mapping
void destroy_current();
Exception
Raises CORBA::NO_PERMISSION if the Bootstrap object is not the owner of the Current objects.
Description
This C++ member function invalidates the Current objects for the domain represented by the Bootstrap object. After invoking the destroy_current() method, the Current objects are marked as invalid. Any subsequent attempt to use the old Current objects will throw the exception CORBA::BAD_INV_ORDER. Good programming practice is to release all Current objects before invoking destroy_current().
Note: The destroy_current() method must be invoked on the Bootstrap object for the domain that currently owns the two Current objects (Transaction and Security). This also results in an implicit invocation to logoff for security and implicitly rolls back any transaction that was begun by the client.
The application must invoke destroy_current() before invoking resolve-_initial_references for TransactionCurrent or SecurityCurrent on another domain; otherwise, resolve_initial_references raises CORBA::NO_PERMISSION.
Return Values
None.
Java Methods
The Java BEA bootstrapping API supports the following methods:
For a description of these Java methods, see the Javadoc API.
Automation Methods
This section describes the Automation methods supported by the BEA bootstrapping mechanism.
Initialize
Synopsis
Initializes the Bootstrap object into a BEA Tuxedo domain.
MIDL Mapping
HRESULT Initialize(
[in] BSTR host);
Automation Mapping
Sub Initialize(address As String)
Parameter
Note: The network address that is specified in the Bootstrap constructor or in TOBJADDR must exactly match the network address in the application's UBBCONFIG file, both the format of the address as well as the capitalization. If the addresses do not match, the invocation to the Bootstrap constructor will fail with the following seemingly unrelated error message:
ERROR: Unofficial connection from client at
<tcp/ip address>/<port-number>
For example, if the network address is specified as //TRIXIE:3500 in the ISL command-line option string, specifying either //192.12.4.6:3500 or //trixie:3500 in the Bootstrap constructor or in TOBJADDR will cause the connection attempt to fail. On UNIX systems, use the uname -n command on the host system to determine the capitalization used. On Windows systems, see the host system's network settings in the Control Panel to determine the correct capitalization.
Return Values
None.
Exceptions
Table 4-5 describes the exceptions.
CreateObject
Synopsis
Creates an instance of a Current environmental object.
MIDL Mapping
HRESULT CreateObject(
[in] BSTR progid,
[out, retval] IDispatch** rtrn);
Automation Mapping
Function CreateObject(progid As String) As Object
Parameter
Tobj.SecurityCurrent
Tobj.TransactionCurrent
Return Value
A reference to the interface pointer of the created environmental object.
Exceptions
Table 4-6 describes the exceptions.
DestroyCurrent
Synopsis
Logs out of the BEA Tuxedo domain and invalidates the TransactionCurrent and SecurityCurrent objects.
MIDL Mapping
HRESULT destroy_current();
Automation Mapping
Sub destroy_current()
Parameters
None.
Return Value
None.
Exceptions
None.
Bootstrap Object Programming Examples
This section provides the following programming examples that use Bootstrap objects.
Java Client Example: Getting a SecurityCurrent Object
Listing 4-4 shows how to program a Java client to get a SecurityCurrent object.
Listing 4-4 Programming a Java Client to Get a SecurityCurrent Object
import java.util.*;
import org.omg.CORBA.*;
import com.beasys.*;
class client {
public static void main(String[] args)
{
Properties prop = null;
Tobj.PrincipalAuthenticator auth = null;
String host_port = "//COLORMAGIC:10000";
// Set host and port.
if (args.length == 1) host_port = args[0];
try {
// Initialize ORB
ORB orb = ORB.init(args, prop);
// Create Bootstrap object
Tobj_Bootstrap bs=new Tobj_Bootstrap(orb,host_port);
// Get security current
org.omg.CORBA.Object ocur =
bs.resolve_initial_references("SecurityCurrent");
SecurityLevel2.Current cur =
SecurityLevel2.CurrentHelper.narrow(ocur);
}
catch (Tobj.InvalidName e) {
System.out.println("Invalid name: "+e);
System.exit(1);
}
catch (Tobj.InvalidDomain e) {
System.out.println("Invalid domain address: "+host_port +" "+e);
System.exit(1);
}
catch (SystemException e) {
System.out.println("Exception getting security current: "+e);
e.printStackTrace();
System.exit(1);
}
}
}
Visual Basic Client Example: Using the Bootstrap Object
Listing 4-5 shows how to program a Visual Basic client to use the Bootstrap object.
Listing 4-5 Programming a Client in Visual Basic
`Declare the Bootstrap object
Public oBootstrap As DITobj_Bootstrap
`Declare the FactoryFinder object
Public oBsFactoryFinder As DITobj_FactoryFinder
`Declare factory for Registrar object
Public oRegistrarFactory As DIUniversityB_RegistrarFactory
`Declare actual Registrar object
Public oRegistrarFactory As DIUniversityB_RegistrarFactory
....
`Create the Bootstrap object
Set oBootstrap = CreateObject("Tobj.Bootstrap")
`Connect to the BEA Tuxedo Domain
oBootstrap.Initialize "//host:port"
`Get the FactoryFinder for the BEA Tuxedo Domain
Set oBSFactoryFinder = oBootstrap.CreateObject("Tobj.FactoryFinder")
`Get a factory for the Registrar object
`using the FactoryFinder method find_one_factory_by_id
Set oRegistrarFactory = oBSFactoryFinder.find_one_factory_by_id("RegistrarFactoryID")
'Create a Registrar object
Set oRegistrar = oRegistrarFactory.find_registrar(exc)
Interoperable Naming Service Bootstrapping Mechanism
This topic includes the following topics:
Introduction
As of release 8.0, the BEA Tuxedo ORB supports the CORBA Naming Service bootstrapping mechanism (referred to in this document as the Interoperable Naming Service), as specified in Chapters 4 and 13 of the CORBA Specification revision 2.4.2.
This support enables ORBs that implement the Interoperable Naming Service (INS) bootstrapping mechanism to query the BEA Tuxedo server-side ORB to get object references to initial objects such as FactoryFinder and to PrincipalAuthenticator to the BEA Tuxedo environment. This support along with client support for interoperable initial object references enables clients to use the INS bootstrapping mechanism instead of the BEA bootstrapping mechanism.
Note: The CORBA C++ and Java clients provided with BEA Tuxedo software may use the INS bootstrapping mechanism, however, for performance reasons, this is not recommended.
INS Object References
Table 4-7 shows the object reference that is returned for each type ID.
INS Command-line Options
As of release 8.0, BEA Tuxedo CORBA supports the -ORBInitRef and -ORBDefaultInitRef command-line options. For a complete description of these options, see "ORB Initialization Member Function" on page 14-85.
The following example assumes a BEA Tuxedo CORBA IIOP client is talking to a BEA Tuxedo CORBA IIOP server environment:
client_app -ORBid BEA_IIOP -ORBInitRef
FactoryFinder=corbaloc::myhost:2468/FactoryFinder
Given this example, a call to ORB::resolve_initial_references for the FactoryFinder will result in an interoperable initial reference request being sent to the ISL/ISH on myhost at port 2468. Note that the case of myhost must exactly match the case of the host specified for the ISL/ISH in the tuxconfig file.
INS Initialization Operations
To use the INS bootstrapping mechanism, applications programmers must observe the following requirements:
Note: The Tobj_Bootstrap API is still supported and its behavior has not changed.
INS Object URL Schemes
As of release 8.0, BEA Tuxedo CORBA supports an additional Uniform Resource Locator (URL) format to be used for the specification of the location for access to a BEA Tuxedo CORBA server environment and from where to retrieve references to initial object. The new URL format both follows and extends the definition of object URLs adopted by the OMG as part of the INS specification. The URL format described in the INS specification has also been extended to support a secure form modeled after the URL for secure HTTP, as well as the ability to support the randomize functionality initially provided in BEA WebLogic Enterprise version 5.1.
The CORBA 2.4.2 specification requires that three object URL schemes must be supported by a compliant ORB. These schemes are defined as IOR, corbaloc, and corbaname.
Note: The new URL string formats may also be passed to the ORB::string_to_object function.
IOR URL Scheme
The IOR scheme takes the form of a string that is formatted as IOR:hex_octets. The scheme name is IOR and the text after the `:' is defined in the CORBA specification. The IOR URL scheme is robust and insulates the client from the encapsulated transport information and object key used to reference the object.
corbaloc URL Scheme
It is difficult for humans to exchange IORs through nonelectronic means because of their lengths and the text encoding of binary information. The corbaloc and corbalocs URL schemes provide stringified object references in a format that is familiar to people and similar to the popular URL schemes of FTP and HTTP. The URL schemes defined for corbaloc and corbalocs are easily manipulated in both TCP/IP and DNS centric environments. The corbaloc and corbalocs URL contains:
By default, corbaloc URLs denote objects that can be contacted over IIOP, while corbalocs URLs denote objects that can be contacted using IIOP over SSL.
Table 4-8 lists the BNF syntax for each URLs element.
Table 4-9 describes each URL element.
The following are some examples of using the new URL format:
corbaloc::555xyz.com:1024,555backup.com:1022,555last.com:1999
corbalocs::555xyz.com:1024,{555backup.com:1022|555last.com:1999}
corbaloc::1.2@555xyz.com:1111
corbalocs::1.1@24.128.122.32:1011,1.0@24.128.122.34
As an enhancement to the URL syntax described in the INS submission, BEA Tuxedo 8.0 has extended the syntax to support a list of multiple URLs, each with a different scheme. The following are some examples of the extension:
corbalocs::555xyz.com:1024,corbaloc::1.2@555xyz.com:1111
corbalocs::ctxobj:3434,mthd:3434,corbaloc::force:1111
In the above example, if the parser reaches the URL corbaloc::force.com:1111, it will reset its internal state as if it had never attempted secure connections and then begins attempting unprotected connections.
corbaname URL Scheme
The corbaname URL scheme extends the capabilities of the corbaloc scheme to allow URLs to denote entries in a Naming Service. Resolving corbaname URLs does not require a Naming Service implementation in the ORB core. An example of a corbaname URL is:
corbaname:555objs.com#a/string/path/to/obj
This URL specifies that at host 555objs.com, an object of type NamingContext (with an object key of NamingService) can be found, or alternatively, that an agent running at that location will return a reference to a NamingContext. The stringified name a/string/path/to/obj is then used as the argument to the resolve operation on that NamingContext.
A corbaname URL is similar to a corbaloc URL except that a corbaname URL also contains a stringified name that identifies a binding in a naming context. The # character denotes the start of the stringified name.
The BNF syntax for the URL is listed in Table 4-10.
Resolution of a corbaname URL is implemented as a simple extension to corbaloc URL processing. To illustrate the implementation, we will use the following corbaname URL:
corbaname:<corbaloc_obj>["#"<string_name>]
The resolution process is as follows:
By following this resolution process, you eliminate the possibility of returning an object reference for a naming context that does not exist in the Naming Service. One side effect of this approach is that it requires that stubs for the Naming Service be part of the ORB core or that there be an internal mechanism for sending the request for the resolve operation. Because of the complexity, it is recommended that stubs for the Naming Service be embedded within the ORB core.
Getting a FactoryFinder Object Reference Using INS
Listing 4-6 shows an example of how a client application, using INS, gets an object reference to the FactoryFinder object. For a complete code example, see the client application in the University Sample.
Listing 4-6 Code Example for Getting the FactoryFinder Object
// utility to get the registrar
static UniversityW::Registrar_ptr get_registrar(
CORBA::ORB_ptr orb
)
{
// Get the factory finder from the ORB:
CORBA::Object_var v_fact_finder_oref =
orb->resolve_initial_references("FactoryFinder");
// Narrow the factory finder :
Tobj::FactoryFinder_var v_fact_finder_ref =
Tobj::FactoryFinder::_narrow(v_fact_finder_oref.in());
// Use the factory finder to find the
// university's registrar factory :
CORBA::Object_var v_reg_fact_oref =
v_fact_finder_ref->find_one_factory_by_id(
UniversityW::_tc_RegistrarFactory->id()
);
// Narrow the registrar factory :
UniversityW::RegistrarFactory_var v_reg_fact_ref =
UniversityW::RegistrarFactory::_narrow(
v_reg_fact_oref.in()
);
// Return the university's registrar :
return v_reg_fact_ref->find_registrar();
}
Getting a PrincipalAuthenticator Object Reference Using INS
Listing 4-7 shows an example of how a client application, using INS, gets an object reference to the PrincipalAuthenticator object. For a complete code example, see the client application in the University Sample.
Listing 4-7 Code Example for Getting the PrincipalAuthenticator Object
// utility to log on to the security system
static SecurityLevel2::PrincipalAuthenticator_ptr logon(
CORBA::ORB_ptr orb,
const char* program_name,
UniversityW::StudentId stu_id
)
{
// Get a Principal Authenticator directly from the ORB:
CORBA::Object_var v_pa_obj =
orb->resolve_initial_references("PrincipalAuthenticator");
// Narrow the Principal Authenticator :
SecurityLevel2::PrincipalAuthenticator_var v_pa =
SecurityLevel2::PrincipalAuthenticator::_narrow(
v_pa_obj.in());
Getting a TransactionFactory Object Reference Using INS
As of release 8.0, BEA Tuxedo CORBA supports the use of the CORBA Transaction Service Interface for beginning transactions. Using the ORB::resolve_initial_references("FactoryFinder") function, a client gets an object reference to a FactoryFinder. The client then uses the FactoryFinder to get a reference to a TransactionFactory, that it in turn uses to create (begin) a transaction.
Listing 4-8 shows an example of how a client application, using INS, gets an object reference to the TransactionFactory object. For a complete code example, see the client application in the University Sample.
Listing 4-8 Code Example for a Client Application That Uses INS
// Get the factory finder from the ORB:
CORBA::Object_var v_fact_finder_oref =
orb->resolve_initial_references("FactoryFinder");
// Narrow the factory finder :
Tobj::FactoryFinder_var v_fact_finder_ref =
Tobj::FactoryFinder::_narrow(v_fact_finder_oref.in());
// Get the TransactionFactory from the FactoryFinder
CORBA::Object_var v_txn_fac_oref =
v_fact_finder_ref->find_one_factory_by_id(
"IDL:omg.org/CosTransactions/TransactionFactory:1.0");
// Narrow the TransactionFactory object reference
CosTransactions::TransactionFactory_var v_txn_fac_ref =
CosTransactions::TransactionFactory::_narrow(
v_txn_fac_oref.in());
The sequence of events using the INS bootstrapping mechanism is as follows:
The TransactionFactory returns objects that adhere to the standard CORBA Transaction Service interfaces instead of the BEA delegated interfaces. This means that a third party ORB can use their ORB's resolve_initial_references function to get a reference to a TransactionFactory from a BEA Tuxedo CORBA server and use stubs generated from standard OMG IDL to act on the instances returned.
Restrictions
For the BEA Tuxedo 8.0 release, the actions of the TransactionFactory and the client's Current are not coordinated. This means that clients should use one mechanism or the other to control and get status about transactions, not both. Also, only the interfaces and operations listed in Table 4-11 are supported. The other operations, as described in the OMG IDL, return the CORBA::NO_IMPLEMENT exception.
![]() |
![]() |
![]() |
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|