HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML
 

"Discovering Distributed Objects"
Vol. 2, Issue 5, p. 48

	

Listing 1.

public abstract Object string_to_object(String ior)throws SystemException    
public abstract String object_to_string(Object object)throws SystemException

Listing 2

try 
{// initiliaze the ORB 
org.omg.CORBA.ORB orb =org.omg.CORBA.ORB.init();
// get stringified object reference from command line 
Org.omg.CORBA.Object obj = orb.string_to_object( args[1] );
// narrow orb to the right type HelloWorld.
GoodDay good_day = HelloWorld.GoodDayHelper.narrow(obj);
// invoke the operation and print result 
System.out.println(good_day.hello());}

Listing 3

CosNaming.NamingContext root_context;CosNaming.NameComponent[] name;
try 
{// initiliaze the ORB 
org.omg.CORBA.ORB orb =org.omg.CORBA.ORB.init();
I CosNaming.NameComponent[] name;        
//initialise root_context and name (omitted)
// look up the reference by the name 
omg.org.Org.omg.CORBA.Object obj = root_context.resolve( name );
// narrow orb to the right type 
HelloWorld.GoodDay good_day = HelloWorld.GoodDayHelper.narrow(obj);    
// invoke the operation and print result    
System.out.println(good_day.hello());}

Listing 4

CosTrading.Lookup.Ref lookup;
try 
{// initiliaze the ORB  
org.omg.CORBA.ORB orb =org.omg.CORBA.ORB.init();    
// declare variables needed for the query     
// in parameters of the query operation    
String service_type, constr, prefs;
CosTrading.PolicySeq query_pols;    
CosTrading.PolicyValue policy_value;
CosTrading.PropertyNameSeq desired_prop_names;    
CosTrading.Lookup.SpecifiedProps desired_props;int num_offers;    
// out parameters of the query operation 
CosTrading.OfferSeq return_offers;
CosTrading.OfferIterator.Holder iter;
CosTrading.PolicyNameSeq limits;    
// initialise lookup and initialise parameters (omitted)     
// query the Trader lookup.query
( service_type, constr, prefs, query_pols,desired_props, num_offers, return_offers, iter, limits);    
// invoke the operation and print result 
if( return_offers.length > 0 ) {good_day = return_offers[0]; 
System.out.println(good_day.hello());}}

Listing 5.

public static <class_name> bind();public static <class_name> bind(String name);
public static <class_name> bind( String name, String host );
public static <class_name> bind( String name, String host,org.omg.CORBA.BindOptions options );

Listing 6.

try 
{// initiliaze the ORB  
org.omg.CORBA.ORB orb =org.omg.CORBA.ORB.init();    
// bind to GoodDay object    
HelloWorld.GoodDay good_day = HelloWorld.GoodDayHelper.bind();
// invoke the operation and print result    
System.out.println(good_day.hello());}

Listing 7.

try 
{// initiliaze the ORB  
org.omg.CORBA.ORB orb =org.omg.CORBA.ORB.init();    
// get object from URL Naming Service    
HelloWorld.GoodDay good_day = HelloWorld.GoodDayHelper.bind
("http://www.visigenic.com/Examples/HelloWorld/GoodDay.ior" );    
// invoke the operation and print result    
System.out.println(good_day.hello());}

Listing 8.

String[] list_initial_references()
org.omg.Org.omg.CORBA.Object resolve_initial_reference
( String identifier ) throws org.omg.CORBA._ORB.InvalidName


 

All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.