Bookshelf Home | Contents | Index | Search | PDF |
Siebel Object Interfaces Reference > Programming > Getting Started with the Siebel Object Interfaces >
Initializing ORB and Binding Siebel App Factory (Orbix)
To initialize and start running a client CORBA Object Manager application, an initial reference to the Siebel Application Factory Object must be performed. To obtain an initial reference to the Application Factory Object, the client application must use the ORBIX Naming Service. The Naming Service is a standard CORBA service that provides the ability to bind an object reference to a name. The names are stored in a tree structure very similar to a file systems directory structure in the naming service, but rather than directories it has Naming Contexts and rather than files it has Object References. For example in the following name:
Siebel/CorbaOm/Objmgr1
Siebel and CorbaOm are naming contexts and Objmgr1 is an object reference. The '/' delimiting the hierarchy of naming contexts is not defined by the CORBA standard, but is convenient for representing a full path to an object reference.After obtaining a reference to the Siebel Application Factory object, the Siebel Application Object can be created and initialized.
The following code sample shows how to obtain a reference to a Siebel Application Factory object and how to initialize a Siebel Application Object.
package SiebelExample;
import org.omg.CORBA.*;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
import java.io.*;public class SiebelClient
{
public static void main (String args[])
{
try {
// Siebel references
SiebelAppFactory appFact = null;
SiebelApplication siebelApp = null;
SiebelBusObject busObj = null;
SiebelBusComp busComp = null;
short viewMode = 3;// -b parameter was CORBAOM, -x parameter was SCOM
String nsName = "SCOM/CORBAOM";// CORBA references
org.omg.CosNaming.NamingContextExt root_cxt;
org.omg.CORBA.Object obj;
org.omg.CORBA.ORB orb;// Initialize the ORB
orb = ORB.init(args, null);// obtain reference to initial naming context
obj = orb.resolve_initial_references("NameService");
root_cxt = org.omg.CosNaming.NamingContextExtHelper.narrow(obj);if (root_cxt != null) {
org.omg.CORBA.Object appFact_obj = null;
appFact_obj = root_cxt.resolve_str(nsName);
appFact = SiebelAppFactoryHelper.narrow(appFact_obj);if (appFact != null) {
siebelApp = appFact.CreateSiebelAppObjectW();if (siebelApp == null
System.out.println("siebel app is null");
else
{ // Simple example showing how to login, query a
// business component, logoff, and release the
// application object
siebelApp.LoginW("SADMIN", "SADMIN");
busObj = siebelApp.GetBusObjectW("Account");
busComp = busObj.GetBusCompW("Account");
busComp.ActivateFieldW("Name");
busComp.ActivateFieldW("Location");
busComp.ActivateFieldW("Type");
busComp.ClearToQueryW();
busComp.ViewMode(viewMode);
busComp.ExecuteQueryW(false);if (busComp.FirstRecordW()) {
System.out.println("Record found: " +
busComp.GetFieldValueW("Name") + " / " +
busComp.GetFieldValueW("Location") + " / " +
busComp.GetFieldValueW("Type"));
}siebelApp.LogoffW();
appFact.ReleaseW(siebelApp);
}
}
}
}
catch (SiebelExceptionW se) {
System.out.println("Siebel exception: " + se.desc);
}
catch (SystemException ce) {
System.out.println("CORBA exception: " + ce.toString());
}
catch(Exception ex) {
System.out.println("Unexpected CORBA exception: " + ex.toString());
}
}
}
Bookshelf Home | Contents | Index | Search | PDF |
Siebel Object Interfaces Reference Published: 18 June 2003 |