List Initial Services

This example shows how to query the ORB for initial references using the list_initial_services and resolve_initial_references methods on the ORB object. We will also see that some of these objects are locality constrained while the others are proper CORBA objects running somewhere on the network.

Initial Reference Name Remote Function
ActivationSystem
yes
provides access to Server Activation functionality
Authenticator
no
support for Authentication
CertificateManager
no
support for initializing SSL
InitialReferencesService
no
getting/setting initial object references
jBrokerAdmin
yes
Remote Monitoring
MulticastCurrent
no
determine the client of the multicast request
NameService
yes
the root NamingContext object
NameServiceFactory
no
creating in-process NameService instance
POACurrent
no
determine the current POA and object Id
RootPOA
no
support for minimal programming transient objects uisng POA
SecurityCurrent
no
get/set thread or ORB level identity
TSIdentification
no
set the Transaction Service to use with the ORB

Initial Services

The orb.list_initial_services() method returns the names of all the initial services. Some of these represent locality constrained objects while the other are running over the network and obtained using the bootstrap protocol. The locality constrained objects can not be stringified or marshalled out.

package listInitial;
                                                                           
import org.omg.CORBA.ORB;
import org.omg.CORBA.Object;
                                                                           
public class Services
{
    public static void main(String[] args)
    {
    |   try {
    |   |                                                                  
    |   |   // create the jBroker ORB
    |   |   ORB orb = ORB.init(args, null);
    |   |                                                                  
    |   |   // get the names of initial services
    |   |   String[] names = orb.list_initial_services();
    |   |                                                                  
    |   |   // print the initial services
    |   |   for (int i=0; i < names.length; i++)
    |   |       System.out.println(names[i] + (isLocalityConstrained(
    |   |           orb, names[i]) ? "" : " (remote)"));
    |   |                                                                  
    |   } catch (Exception ex) {
    |   |   ex.printStackTrace();
    |   }
    }
                                                                           
    // locality constrained objects can not be stringified or marshalled
    static boolean isLocalityConstrained(ORB orb, String name)
    {
    |   try {
    |   |   orb.object_to_string(orb.resolve_initial_references(name));
    |   |   return false;
    |   |                                                                  
    |   } catch (Exception ex) {
    |   |   return true;
    |   }
    }
}

When you run this program, you get a list like this:

ActivationSystem (remote)
jBrokerAdmin (remote)
NameService (remote)
MulticastCurrent
CertificateManager
InitialReferencesService
Authenticator
POACurrent
RootPOA
SecurityCurrent
PolicyCurrent
SessionCurrent
TSIdentification
DynAnyFactory
ORBPolicyManager
NameServiceFactory


Copyright © 2003, 2004 Novell, Inc. All rights reserved. Copyright © 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.