answersLogoWhite

0

Develop a middleware component for retrieving Weather Forecast information using CORBA

Program Code:

IDL Class:-

module Hello1

{

interface Hello

{

string sayHello();

};

};

Client Class:-

import Hello1.*;

import org.omg.CosNaming.*;

import org.omg.CosNaming.NamingContextPackage.*;

import org.omg.CORBA.*;

public class HelloClient

{

static Hello helloImpl;

public static void main(String args[])

{

try

{

// create and initialize the ORB

ORB orb = ORB.init(args, null);

// get the root naming context

org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");

NamingContext ncRef = NamingContextHelper.narrow(objRef);

// resolve the Object Reference in Naming

NameComponent nc=new NameComponent ("Hello","");

NameComponent path[] = {nc};

helloImpl = HelloHelper.narrow(ncRef.resolve(path));

System.out.println(helloImpl.sayHello());

}

catch (Exception e)

{

System.out.println("ERROR : " + e) ;

}

}

}

Implement Class:

import Hello1.*;

import org.omg.CosNaming.*;

import org.omg.CosNaming.NamingContextPackage.*;

import org.omg.CORBA.*;

import java.util.Properties;

class HelloImpl extends _HelloImplBase

{

// implement sayHello() method

public String sayHello()

{

return "\nHello world !!\n";

}

}

Server Class:-

import Hello1.*;

import org.omg.CosNaming.*;

import org.omg.CosNaming.NamingContextPackage.*;

import org.omg.CORBA.*;

public class HelloServer {

public static void main(String args[]) {

try

{

// create and initialize the ORB

ORB orb = ORB.init(args, null);

// create servant and register it with the ORB

HelloImpl helloImpl = new HelloImpl();

orb.connect(helloImpl);

// get object reference from the servant

org.omg.CORBA.Object objRef =orb.resolve_initial_references("NameService");

// Use NamingContext

NamingContext ncRef = NamingContextHelper.narrow(objRef);

// bind the Object Reference in Naming

NameComponent nc=new NameComponent ("Hello","");

NameComponent path[] = {nc};

ncRef.rebind(path, helloImpl);

System.out.println("HelloServer ready and waiting ...");

// wait for invocations from clients

orb.run();

}

catch (Exception e)

{

System.err.println("ERROR: " + e);

}

System.out.println("HelloServer Exiting ...");

}

}

Output:

Impl Side:

Z:\Middle ware\corba1>idlj -fclient -fserver -implBase hello.idl

Z:\Middle ware\corba1>cd hello1

Z:\Middle ware\corba1\Hello1>javac *.java

Z:\Middle ware\corba1>tnameserv

Initial Naming Context:

IOR:000000000000002849444c3a6f6d672e6f72672f436f734e616d696e672f4e616d696e

67436f6e746578743a312e3000000000010000000000000054000101000000000d313732

2e31362e312e3130380000041f00000018afabcafe00000002584b271b000000080000000

000000000000000010000000100000014000000000001002000000000000101000000000

TransientNameServer: setting port for initial object references to: 900

Ready.

Server Side:

Z:\Middle ware\corba1>javac *.java

Z:\Middle ware\corba1>java HelloServer

HelloServer ready and waiting...

Client Side:

Z:\Middle ware\corba1>java HelloClient

Hello world!!

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

Where can you find information about forecast?

If you would like information about forecast you can go to The website for The National Weather Service, or The Weather Channel. Your local area news channel would also have forecast information.


Where can someone find information on the Harmon Forecast?

One can find information on the Harmon Forecast on the CBS Sports website. It is a forecast that predicts the outcome of college football games each week.


What information can be given by looking at a seismogram?

A forecast for Earthquack


How do you choose appropriate forecasting model?

1) Who will be using the forecast and what information do they require? 2) How relevant is historical data, and what is its availability? 3) How accurate does the forecast have to be? 4) What is the time period of the forecast? 5) How much time do we have to develop the forecast? 6) What is the cost or benefit (value) of this forecast to our company?


Which primary source should information be obtained regarding expected weather at the estimated time of arrival if your destination has no Terminal Forecast?

Area Forecast.


Which website has the most accurate Forex forecast?

The most accurate Forex forecast was the USD/JPY Forecast on May 1st. The website containing this information was Forex Cycle: Free Forex Market Analysis.


Where is it possible for me to check the weather forecast in Mexico?

You can check the weather forecast in Mexico at several sites. However, the bes site to do this is the Weather Channel's website which gives you up to date information and the weekend forecast.


What is data predicted outside the given information or graph?

"Extrapolation" or "forecast".


What important information does weather forecast give you?

you should bring umbrella to be safe


What is the TV weather forecast?

you forecast the weather by goig outside and say hi to the sky and everybody u see outside and then say what are you looking at and then u have forecasted the weather


Where can a person find forecast information on the Australian dollar?

There are many resources available to those who wish to find out the forecast information on the Australian dollar. Yahoo provides a financial guide to the AUD, as well as currency from all over the world.


Where can someone find information on how to make a shipping forecast?

Information on how to make a shipping forecast can be found on various websites that specialize in the shipping. First, you must choose what you want to ship and deliver it to an agent on such a website for the information.