C mapping equivalent of Java narrow() method

I'm porting a Java based CORBA client to C, but having trouble finding
the C equivalent of certain things. I've attached a minimal Java example
which connects to the naming service, and then tries to get a reference
to an specific object. (Apologies if attachments are frowned upon on
this list).

The problem I'm having is finding the C mapping equivalent of lines 32
to 36 where I "narrow" my reference to the desired object. Any examples
or advice would be greatly appreciatted. In the meantime I'll carry on
reading the OMG C mapping spec.


chris.wareham@iosystems.co.uk (work)
chris.wareham@btopenworld.com (home)
// Standard Java classes
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;

// CORBA classes
import org.omg.CORBA.*;
import org.omg.CosNaming.*;

// IDL generated classes
import Adams.*;

public class CorbaTest {
	public static void main(String[] args) {
		String str = "http://indus.io/ior/adams.ior";;

		try {
			// fire up the ORB
			ORB orb = ORB.init(args, null);

			// fetch the object reference for the CORBA naming service
			URL url = new URL(str);
			BufferedReader reader = new BufferedReader(
				new InputStreamReader(url.openStream()));
			String ior = reader.readLine();

			// attach to the CORBA naming service
			org.omg.CORBA.Object obj = orb.string_to_object(ior);
			NamingContext naming_context = NamingContextHelper.narrow(obj);

			// get object reference from naming service
			NameComponent name = new NameComponent("adams_asn", "");
			NameComponent path[] = {name};
			adams_asn asn_obj;

			asn_obj = adams_asnHelper.narrow(naming_context.resolve(path));
			if(asn_obj == null) {
				System.err.println("Unable to find adams_asn object");

			// call a method on the object
				System.out.println("Valid ASN number");
				System.out.println("Invalid ASN number");
		catch(Exception exception) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]