Creating and running an IDL interface Assignment, programming homework help

Anonymous
account_balance_wallet $40

Question Description

Hello I need help with the following. It is important to read the deliverables because i will need the files I have attached both instructions and Grading Rubic to understand what the teacher is looking for...thank you


LibertyU Assignment Instructions

For this assignment, you will create and run an IDL interface using the provided example.

Applications Needed: Java JDK software and IDLTOJAVA compiler. The JDK has a built in ORB and API which enables CORBA distributed object interaction. The IDLTOJAVA compiler converts IDL-to-Java mapping in order to convert IDL interface definitions to Java methods, classes, and interfaces that can be used to implement the server and client code.

To get the latest version of the IDL-to-Java compiler, download the latest version of the Java™ Platform, Standard Edition (Java SE). When Java SE is installed, idlj will be located in the bin directory.

Step 1: Create an IDL Interface

In this step you will map the IDL to Java in order to define the contract between the server and client for your application. The code for this is language independent and will not look like your traditional Java code. Create a new IDL file using your downloaded IDLTOJAVA compiler. Name the file, “Liberty.idl” and enter the following code:

module LibertyApp
{
interface Liberty
{
String libertyU();
};
};

This Liberty U application will only have a single operation. This is all the code that you will need for this step.

Step 2: Mapping Liberty.idl to Java

In this step you will create the required java files through the IDLTOJAVA tool. Open up your command line prompt. Change the directory to the location of your Liberty.idl file. Enter the compiler command:

idltojava Liberty.idl

You will see that a directory called LibertyApp has been created and it will contain 5 files. Open up Liberty.java. I will contain these lines of code:

/* Liberty.java as generated by idltojava */

package LibertyApp;

public interface Liberty

extends org.omg.CORBA.Object {

String libertyU();

}

Step 3: Create LibertyClient.java

Copy and paste the code into LibertyClient.java

import LibertyApp.*; // The package containing your stubs.

import org.omg.CosNaming.*; // LibertyClient will use the naming service.

import org.omg.CORBA.*; // All CORBA applications need these classes.

public class LibertyClient

{

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("Liberty", "");

NameComponent path[] = {nc};

Liberty libertyRef = LibertyHelper.narrow(ncRef.resolve(path));

// call the Liberty server object and print results

String liberty = libertyRef.libertyU();

System.out.println(liberty);

} catch(Exception e) {

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

e.printStackTrace(System.out);

}

}

}

Save and close LibertyClient.java

Step 4: Create a Liberty U Server

Create a file called LibertyServer.java

Copy and paste this code into your file:

// included are all packages imported in order to make this app work

import LibertyApp.*;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.CORBA.*;

public class LibertyServer

{

public static void main(String args[])

{

try{

// create and initialize the ORB

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

// create the servant and register it with the ORB

LibertyServant libertyRef = new LibertyServant();

orb.connect(libertyRef);

// get root naming context

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

NamingContext ncRef = NamingContextHelper.narrow(objRef);

// bind the object reference in naming

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

NameComponent path[] = {nc};

ncRef.rebind(path, libertyRef);

// wait for invocations from clients

java.lang.Object sync = new java.lang.Object();

synchronized(sync){

sync.wait();

}

} catch(Exception e) {

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

e.printStackTrace(System.out);

}

}

}

class LibertyServant extends _LibertyImplBase

{

public String libertyU()

{

return "\nLiberty U!!\n";

}

}

Step 5: Compile and run LibertyU Application

Compile both LibertyClient.java and LibertyServer.java. You should see the following classes created once you do: LibertyClient.class, LibertyServer.class and LibertyServant.class.

Run the application from the command prompt. Start the Java IDL name server with the following command:

tnameserv –ORBInitialPort nameserverport

Open up a second command prompt and start the Liberty server with the following command:

java LibertyServer –ORBInitialHost nameserverhost
-ORBInitialPort nameserverport

Open up a third command prompt and run the Liberty application client with the the following command:

java LibertyClient –ORBInitialHost nameserverhost
-ORBInitialPort nameserverport

The client will return the string from the server to the command line: Liberty U!!

Turn off tnameserv and LibertyServer processes after the client application returns successfully.

Deliverables: Take a screen shot of the “Liberty U!!” command prompt output and save it to the java project folder. Compress all of the files within your java project and upload it to the final project assignment link.

Unformatted Attachment Preview

CSIS 354 LIBERTYU ASSIGNMENT INSTRUCTIONS For this assignment, you will create and run an IDL interface using the provided example. Applications Needed: Java JDK software and IDLTOJAVA compiler. The JDK has a built in ORB and API which enables CORBA distributed object interaction. The IDLTOJAVA compiler converts IDL-to-Java mapping in order to convert IDL interface definitions to Java methods, classes, and interfaces that can be used to implement the server and client code. To get the latest version of the IDL-to-Java compiler, download the latest version of the Java™ Platform, Standard Edition (Java SE). When Java SE is installed, idlj will be located in the bin directory. Step 1: Create an IDL Interface In this step you will map the IDL to Java in order to define the contract between the server and client for your application. The code for this is language independent and will not look like your traditional Java code. Create a new IDL file using your downloaded IDLTOJAVA compiler. Name the file, “Liberty.idl” and enter the following code: module LibertyApp { interface Liberty { String libertyU(); }; }; This Liberty U application will only have a single operation. This is all the code that you will need for this step. Step 2: Mapping Liberty.idl to Java In this step you will create the required java files through the IDLTOJAVA tool. Open up your command line prompt. Change the directory to the location of your Liberty.idl file. Enter the compiler command: idltojava Liberty.idl You will see that a directory called LibertyApp has been created and it will contain 5 files. Open up Liberty.java. I will contain these lines of code: /* Liberty.java as generated by idltojava */ package LibertyApp; public interface Liberty extends org.omg.CORBA.Object { String libertyU(); } Step 3: Create LibertyClient.java Copy and paste the code into LibertyClient.java import LibertyApp.*; // The package containing your stubs. import org.omg.CosNaming.*; // LibertyClient will use the naming service. import org.omg.CORBA.*; // All CORBA applications need these classes. Page 1 of 4 CSIS 354 public class LibertyClient { 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("Liberty", ""); NameComponent path[] = {nc}; Liberty libertyRef = LibertyHelper.narrow(ncRef.resolve(path)); // call the Liberty server object and print results String liberty = libertyRef.libertyU(); System.out.println(liberty); } catch(Exception e) { System.out.println("ERROR : " + e); e.printStackTrace(System.out); } } } Save and close LibertyClient.java Step 4: Create a Liberty U Server Create a file called LibertyServer.java Copy and paste this code into your file: // included are all packages imported in order to make this app work import LibertyApp.*; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.CORBA.*; public class LibertyServer { public static void main(String args[]) { try{ Page 2 of 4 CSIS 354 // create and initialize the ORB ORB orb = ORB.init(args, null); // create the servant and register it with the ORB LibertyServant libertyRef = new LibertyServant(); orb.connect(libertyRef); // get root naming context org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContext ncRef = NamingContextHelper.narrow(objRef); // bind the object reference in naming NameComponent nc = new NameComponent("Liberty", ""); NameComponent path[] = {nc}; ncRef.rebind(path, libertyRef); // wait for invocations from clients java.lang.Object sync = new java.lang.Object(); synchronized(sync){ sync.wait(); } } catch(Exception e) { System.err.println("ERROR: " + e); e.printStackTrace(System.out); } } } class LibertyServant extends _LibertyImplBase { public String libertyU() { return "\nLiberty U!!\n"; } } Step 5: Compile and run LibertyU Application Compile both LibertyClient.java and LibertyServer.java. You should see the following classes created once you do: LibertyClient.class, LibertyServer.class and LibertyServant.class. Run the application from the command prompt. Start the Java IDL name server with the following command: tnameserv –ORBInitialPort nameserverport Open up a second command prompt and start the Liberty server with the following command: java LibertyServer –ORBInitialHost nameserverhost -ORBInitialPort nameserverport Page 3 of 4 CSIS 354 Open up a third command prompt and run the Liberty application client with the the following command: java LibertyClient –ORBInitialHost nameserverhost -ORBInitialPort nameserverport The client will return the string from the server to the command line: Liberty U!! Turn off tnameserv and LibertyServer processes after the client application returns successfully. Deliverables: Take a screen shot of the “Liberty U!!” command prompt output and save it to the java project folder. Compress all of the files within your java project and upload it to the final project assignment link. Submit this assignment by 11:59 p.m. (ET) on Monday of Module/Week 6. Page 4 of 4 CSIS 354 LIBERTYU ASSIGNMENT GRADING RUBRIC ...
Purchase answer to see full attachment

Tutor Answer

NToussaint
School: Purdue University

Hey there.I have completed the assignment. The only part I am confused about is the requirement for logs. The IDL project is not supposed to produce logs but I have typed ...

flag Report DMCA
Review

Anonymous
Top quality work from this guy! I'll be back!

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors