Namingcontext

Info icon This preview shows pages 50–51. Sign up to view the full content.

View Full Document Right Arrow Icon
NamingContext nobj=NamingContextHelper.narrow(orb.resolve_initial_references("NameService")); NameComponent nc=new NameComponent("LIB"," "); NameComponent[] path ={nc}; nobj.rebind(path,obj); java.lang.Object oobj=new java.lang.Object(); synchronized(oobj) { oobj.wait(); } } } Client Program: client.java import lib.*; import org.omg.CORBA.*; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import java.io.*; import java.util.*; public class client { public static void main(String args[]) throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); ORB orb =ORB.init(args,null); implservent obj=new implservent();
Image of page 50

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
DS & ADB DCET RAHEEM UNNISA 51 160317742004 orb.connect(obj); NamingContext nobj=NamingContextHelper.narrow(orb.resolve_initial_references("NameService")); NameComponent nc=new NameComponent("LIB"," "); NameComponent[] path={nc}; lib_intf li=lib_intfHelper.narrow(nobj.resolve(path)); System.out.print("Enter Book id:"); String rval=obj.getStatus(Integer.parseInt(br.readLine())); if(!rval.equals("~")) System.out.println("Current Status is: "+rval); else System.out.println("Invalid book Number"); } } Execution steps: idlj fall oldbase lib_intf.idl start ordb javac *.java start java server java client Output:
Image of page 51
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern