CBD-3314 Enterprise Middleware
Mid Term Practice Questions:
What is the Enterprise?
The collection of business processes that makes the work that delivers the output products and services of the company.
#StudyTip: Be able to draw this document out on a blank sheet of paper:
Discuss some methods we have talked about in lecture to build distributed information systems.
Watch this Video:
Step 1:
We write Java Objects to wrap around business processes. These Java Objects that wrap up business processes are Business Objects.
We put those OBJECTS into a protocol (data format) called SOAP - it is the nature of SOAP that it enables conveying Java objects between end points.
We write Java applications using as Spring WS to connect end points in different network locations. From one network domain to another.
What is enterprise application integration - and how do we implement it?
Discuss Enterprise Middleware.
Consider the Enterprise has many Application Domains around the World.
Let’s consider these little “pools” of enterprises as as being like Islands.
We can then visualize that to make something work, we must be able to locate/to address the needed Java Class on some other Island.
Once we have addressed it (gotten a handle on it): we need to RMI remote method invoke the method on the Java Class on Island B from a Java Class on Island A.
Each Java class is a Service Provider, and the Methods are the Services.
A couple of considerations to bear in Mind:
A. On the other Island, there are many Java classes: How to address the specific one we need. (We will find out later that we address the Island via IP ADDRESS, and the specific Java Object as a Port Number.).
B. The way of connecting Java Objects on different Islands is called Web Services - Why? Because we can convey SOAP-encoded packets containing the Java Objects we need to move around. This process of conveying packets is called Web Services.
Enterprise Middleware is what happens when: We connect pieces of the Business Domain (Java Programs) by SOAP.
How do we describe business processes in a Java System?
We write Java Classes - the methods perform the business processes.
consider this example: the business process is converting Celsius to Fahrenheit.
watch this video but will not be on test:
=======The section below is a description of RMI. You will not be asked about this on the Nov 11 Test
What is Remote Method Invocation in Java?
Definition
RMI is the object-oriented version of Remote Procedure Calls. – it is a mechanism use to invoke methods of objects that reside in different address spaces. Objects running in one JVM can access methods of objects present in another JVM – it is used to create distributed applications in Java.
RMI is carried out by two objects, stub and skeleton.
Stub
A stub is an object that is present at the client side and represents the functionality of the remote object. The stub receives the parameters from the client-side and is responsible for getting the return values from the server. All requests from the client to the server are routed through the stub.
Skeleton
Just as the stub acts as a middleman at the client-side, the skeleton receives incoming requests at the server-side. It is responsible for passing the parameters and invoking the server’s service, getting the result from the server, and sending it back to the client.
RMI Registry
The RMI Registry is kind of like a directory that acts as a liaison between the server and client. The server registers its services with the registry and the client can look these services up from there.
Steps for implementing RMI in Java
Step 1: Definition and implementation of the remote server
The interface should extend Remote and all method definitions should throw RemoteException. The implementation of the interface should extend UnicastRemoteObject and it should have a constructor that throws RemoteException.
For the sake of this example, let’s consider an interface Library and its implementation AcademicLibrary, which provides the getBooks() method.
Step 2: Creation of stub and skeleton objects
Execute the following command on the command prompt:
rmic AcademicLibrary
Step 3: Initialization of the RMI Registry
Execute the following command on the command prompt:
start rmiregistry 5000.
Here, 5000 specifies the port.
Step 4: Creation and execution of server and client applications
import java.rmi.*;
import java.rmi.registry.*;
public class LibraryServer
{
public static void main(String args[])
{
try
{
// An object of the remote interface implementation
Library library = new AcademicLibrary();
// Binding the remote object to the name library
Naming.rebind("rmi://localhost:5000/library",library);
}
catch(Exception exception)
{
System.out.println(exception);
}
}
}
import java.rmi.*;
public class LibraryClient
{
public static void main(String args[])
{
try
{
//Finding reference of the remote object
Library library = (Library)Naming.lookup("rmi://localhost:5000/library");
String[] books = library.getBooks();
for (String book : books)
System.out.println(book);
}
catch(Exception exception)
{
System.out.println(exception);
}
}
}