Professional Documents
Culture Documents
AJP Unit III
AJP Unit III
The RMI (Remote Method Invocation) is an API that provides a mechanism to create
distributed application in java. The RMI allows an object to invoke methods on an object
running in another JVM.
The RMI provides remote communication between the applications using two
objects stub and skeleton.
stub
The stub is an object, acts as a gateway for the client side. All the outgoing requests are routed
through it. It resides at the client side and represents the remote object. When the caller
invokes method on the stub object, it does the following tasks:
skeleton
The skeleton is an object, acts as a gateway for the server side object. All the incoming requests
are routed through it. When the skeleton receives the incoming request, it does the following
tasks:
Syntax
import java.rmi.*;
import java.rmi.registry.*;
public class SearchServer
{
public static void main(String args[])
{
………….
} }
import java.rmi.*;
public class SearchClient
{
public static void main(String args[])
{
……………………..
}}
3.2 RMI activation
In the RMI activation system, activatable objects belong to activation groups, and each
activation group runs within its own Java VM. If you don't group your activatable objects, simply
assigning a new activation group to each activatable object you create, then each object runs
inside a separate Java VM.
This tutorial shows you the steps to follow to implement and use a custom RMI socket factory.
A custom RMI socket factory is useful if
(1) your RMI client and server need to use sockets that encrypt or compress data, and/or
(2) your application requires different socket types for different remote objects.
3.4 RMI-IIOP
The Java RMI-IIOP specification was created to simplify the development of CORBA
applications, while preserving all major benefits. It was developed by Sun Microsystems and
IBM, combining features of Java RMI technology with features of CORBA technology.
The stub forwards the request to the remote object, where the operation runs and the results
are returned to the client. The client-side ORB is responsible for creating an IIOP request that
contains the operation and required parameters, and for sending the request on the network.
o A stub (proxy) program in the client side of the client/server relationship, and a
corresponding skeleton at the server end. The stub appears to the calling
program to be the program being called for a service.
o A Remote Reference Layer that can behave differently depending on the
parameters passed by the calling program. For example, this layer can determine
whether the request is to call a single remote service or multiple remote
programs as in a multicast.
o A Transport Connection Layer, which sets up and manages the request.
A single request travels down through the layers on one computer and up through the layers at
the other end
3.5 IDL technology
Java IDL enables objects to interact regardless of whether they're written in the Java
programming language or another language such as C, C++, COBOL, or others.
IDL is independent of any particular programming language. Mappings, or bindings, from IDL to
specific programming languages are defined and standardized as part of the CORBA
specification. At the time of this writing, standard bindings for C, C++, Smalltalk, Ada, COBOL,
and Java have been approved by the OMG.
The core of the CORBA architecture is the Object Request Broker, as shown in following Figure .
Each machine involved in a CORBA application must have an ORB running in order for processes
on that machine to interact with CORBA objects running in remote processes. Object clients
and servers make requests through their ORBs; the ORB is responsible for making the requests
happen or indicating why they cannot. The client ORB provides a stub for a remote object.
Requests made on the stub are transferred from the client's ORB to the ORB servicing the
implementation of the target object. The request is passed onto the implementation through its
skeleton interface.
A JAR (Java Archive) is a package file format typically used to aggregate many Java class files
and associated metadata and resources (text, images, etc.) into one file to distribute
application software or libraries on the Java platform.
In simple words, a JAR file is a file that contains a compressed version of .class files, audio
files, image files, or directories. We can imagine a .jar file as a zipped file(.zip) that is created
by using WinZip software. Even, WinZip software can be used to extract the contents of
a .jar . So you can use them for tasks such as lossless data compression, archiving,
decompression, and archive unpacking.
1 ) In order to create a .jar file, we can use jar cf command in the following ways as discussed
below:
Syntax:
Here, cf represents to create the file. For example , assuming our package pack is available in
C:\directory , to convert it into a jar file into the pack.jar , we can give the command as:
jar xf jarfilename
Here, xf represents extract files from the jar files. For example, to extract the contents of our
pack.jar file, we can write: