Ask Java Expert


Home >> Java

LIBERTY ASSIGNMENT 1

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 JavaTM 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:

moduleLibertyApp
{
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:

idltojavaLiberty.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 */
packageLibertyApp;
public interface Liberty
extendsorg.omg.CORBA.Object {
StringlibertyU();
}

Step 3: Create LibertyClient.java

Copy and paste the code into LibertyClient.java

importLibertyApp.*; // The package containing your stubs.
importorg.omg.CosNaming.*; // LibertyClient will use the naming service.
importorg.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.ObjectobjRef = orb.resolve_initial_references("NameService");
NamingContextncRef = NamingContextHelper.narrow(objRef);

// resolve the object reference in naming
NameComponentnc = new NameComponent("Liberty", "");
NameComponentpath[] = {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

importLibertyApp.*;
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
LibertyServantlibertyRef = new LibertyServant();
orb.connect(libertyRef);

// get root naming context
org.omg.CORBA.ObjectobjRef = orb.resolve_initial_references("NameService");
NamingContextncRef = NamingContextHelper.narrow(objRef);

// bind the object reference in naming
NameComponentnc = new NameComponent("Liberty", "");
NameComponentpath[] = {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);
}
}
}

classLibertyServant extends _LibertyImplBase
{
public String libertyU()
{
return "\nLibertyU!!\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 -ORBInitialPortnameserverport

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

-ORBInitialPortnameserverport

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

-ORBInitialPortnameserverport

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.

PROJECT Assignemnt 2

INSTRUCTIONS

Welcome to your Final Project! The Final Project will consist of building a CORBA distributed application using Java IDL. You are to build a CORBA IDL program as a distributed application. The program will have multiple operations that return a string to be printed. The client will invoke the method of the server. The ORB will transfer that invocation to the servant object registered for that specific IDL interface. The server servant's method will return a Java string. The ORB will transfer that string back to the client. Finally, the client will print the value of that string.

To complete your Final Project, you will need to identify a distributed system that already exists or create one that is necessary for a current business, church, or school. Preferably, you need to select an organization that has business processes and operations you are familiar with. Develop a CORBA application that integrates with the identified distributed system. The LibertyU assignment that you recently completed provides a general example of this project. However, your CORBA application will be designed to meet the specific distributed business needs that you have identified. In addition, your project will design multiple interfaces that facilitate these needs. If you are uncertain of your business problem, make sure you contact your professor for prior approval. You will need to take a screenshot of multiple steps and save these throughout the creation of your Final Project.

Develop a 450-500 word, current APA-formatted report that describes:

• The business problem;
• The scope of the distributed system objectives; and
• The CORBA solution including its design and implementation.

Step 1: Start your project by identifying your server-side mappings. Justify your selection using scholarly or industry research and include this justification in your report.

• The inheritance model
• The delegation model

Step 2: Define your interfaces. Your project mustinclude at least 2 interfaces that meet the specified needs of the business.

Step 3: Implement your server that operates with EACH of your interfaces in Step 2. At the minimum, this mustinclude:

• Developing the ORB instance;
• Referencing the proper POA;
• Developing a servant instance;
• Designing a root naming context; and
• Registering your new objects.

Step 4: Implement your client application. Your client application must:

• Initialize an ORB;
• References the root naming context;
• References the appropriate naming contexts for your CORBA object; and
• Designs an invocates at least 2 operations and prints the results.

Step 5: Build and run the client-server application.

• Include at least 10 screenshots along the way that include a date, time, and visible element on your computer showing authenticity.
• Include a copy of your log files.
• Compile your .java files.
• Start ORBD.
• Start your new business server.
• Run your new client application.
• Take a screen shot of your program running.
• Save it to the java project folder.

Your Final Project must include the following items, compressed and submitted to the assignment link:

• 450-500 word report on the business problem and solution;
• At least 10 screenshots of each step to include: date, time, and visible element showing authenticity;
• Copy of your log files; and
• Screen shot of the running program.

Java, Programming

  • Category:- Java
  • Reference No.:- M92568802
  • Price:- $75

Guranteed 36 Hours Delivery, In Price:- $75

Have any Question?


Related Questions in Java

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As