Академический Документы
Профессиональный Документы
Культура Документы
Resource are shared through message passing in a network environment that may
be unreliable and contain un-trusted components.
Difference between various computers and the ways in which they communicate
are mostly hidden from users.
User and application can interact with a distributed system in a consistent
(reliable) way, regardless where and when interaction takesplace.
It should be relatively easy to expand.
DS will normally be available continuously, if some parts may be temporarily out of
order.
Here we can develop each tier separately without having any communication between
them.
For example we can develop business tier without having the support of presentation
tier.
Tiers may be in one computer or a tier may separately contain in each
machine.
Client Tier (Layer): End user interacts with the application through the client
interface (Client Tier/Browser soft ware / cell phone).
This tier offers user interface to the end users i.e. any internet based
web application is used by the end user with the help of client-tier. Here browser
is nothing but an application running in the client-tier.
In the client tier HTML and java script are executed. But in the client
machine no code is stored.
Client tier is the mediator between the end user and presentation tier. It
takes the user requests and submits them to the presentation tier. It also receives the
output from the presentation tier and gives to the end user.
Presentation Tier:
Business Tier:
Data Tier:
rules
are
Ex:
Oracle
Sybase server
SQL server
Note: SERVLETS, EJBS, JSPS make use of JDBC Technology to interact with the
data tier.
Therefore JDBC is known as the service technology.
Business
Tier
Tier
Servlets,jsp
EJB
Data Tier
Oracle,sqlservr
,Sybase server
PL/per L/B L
Server
Data
Presentation Logic:
View: it is responsible to take the requests from the client. and presenting the response
to the clients.
Business Logic:
Persistent Logic: set of operations are used to persist the data. (Using
JDBC we can persist the data).
Example of two tiered application
client
DBserver
AWT
RDBMS
Draw backs:
client tier complexity is high
No proper division of work
Heavy weight application (memory , processing time, and resource requirement
increases) to execute Presentation Logic, Persistent Logic ,Business Logic
Ex: But Mobile System doesnt contain persistence logic and Business Logic at client
side. Makes the client application a heavy weight application. We need additional
resources since the resources required for presentation, business, and persistence logic has
to be accommodated in to the client side. We use AWT, SWINGS concepts to develop an
application we can use it in any O.S (sun salaries, UNIX, Linux, window). Here if
each client is in a separate (different) O.S we need separate JVM for every O.S so it
is costlier.
Type-2 drivers:these drivers translates the JDBC API calls to vender specific
APIS the Data Base will process the requests and send results back through the
API which will in turn forward them back to the JDBC Driver. Nearly we have
300 drivers provided by different venders. This translation from one API to another API
will be held in client side (in JVM) burden will become high.
Increase the cost of the application when we target application to be used with the
different JVM for each O.S)]
The Business Logic cant be reused means B.L cant be reused by different types of
clients.
Note:
Root cause:-
Logic.
To solve the above problems we want to separate B.L and persistence logic from the
presentation logic and as a result of the requirement 3-tier Architecture is designed.
client
Middle server
Presentation
Logic
Business Logic
Persistence
Logic
DB server
RDBMS
client
Middle server
AWT
RMI/Socket
DBserver
D.B
Draw Backs:
Complexity is increased compared with 2-tired architecture because in 2-tier
architecture there is no network communication so there is no need for the network
logic in 2- tier architecture.
It is mostly costlier than 2-tier architecture
In traditional architecture partial Business Logic will be implemented in client side.
Separate client s/w we need to install compared with web based Architecture(there the
client is browser no need to install any s/w)
Network Logic: It is a logic which is used to communicate with middle ware
server to understand the client requests.
Web Based Architecture:
To reach out the services to number of clients we need web based
Architecture.
client
Middle server
Browser
Business Logic
Persistence
Logic
DBserver
RDBMS
In this case middle ware server takes additional responsibilities compare to traditional
3-tier architecture.
Middle Tier (Middle Ware Server): Middle
Tier
has
the
additional
responsibility to prepare presentation content that can explain generic web client about
what to present and how to present
Yahoo
Sun
Browser
IBM
Rediff
Here one client (browser) is able to communicate with more than one server there is no
need to install separate soft ware for separate servers. It is a generic client it can
communicate with any other app server.
In general Two possible out comes can occur from server to clients
Correct
Wrong (Exception)
But it is not in all the cases
What we can do
if the number of outcomes increases
if the same application(server) has to connect to the different
databases
if different type of requests are sent to communicate with
different Data Base servers
The middle ware must be intelligent to handle above three problems
We can do it by separating persistent logic, Business Logic, Presentation
Logic etc in server (middle ware server).
N-Tier Architecture:
Here in N-tier architecture the middle ware server is divided into multiple
divisions (tiers).
In this case as the number of types of clients and the back-end data store
types increases complexity of middle ware application also increases.
And to simplify this we are recommended to divide this middle ware into
multiple tiers which provides the following benefits
Reusability:
reusability of Persistent Logic, Presentation Logic, Business Logic
and the cost of development will be reduced. Proper Responsibility division that can
improve the productivity of the application.
client
Middle server
Data base
Http
Browser
Per Logic
Mobile
Awt/vb
B.L
Pre Logic
In the given above example we divide our middle tier into 3 divisions
(components)
Http
Presentation Logic to present the content to the web clients Business Logic to
implement the business Logic Persistent Logic to persist the data
When we develop a system following n-tier architecture model then first of all we need
to decide how many number of tiers our system should be divided into and what should
be the responsibility of each of these tiers.
Objects are classified in two main classes based on when they are bound and how long
they exist.
Based on the time of binding, objects are classified as runtime and compile time.
Runtime objects:
The object adapter acts as a wrapper around the implementation detail to give in the
appearance of an object.
An interface is defined to implement the object which can be later registered. The
objects are now available for remote invocations.
Persistent objects:
These objects exist even if they are not contained in the server process address space.
It implies that the client manages the persistent object and can store its state on any
secondary storage and exit.
Transient objects:
They exist only for the time when the server manages the object. When the server
ceases to exist, the object gets vanished.
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:
It writes and transmits (marshals) the parameters to the remote Virtual Machine (JVM),
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:
In the Java 2 SDK, an stub protocol was introduced that eliminates the need for skeletons.
CORBA
CORBA, or Common Object Request Broker Architecture, is a standard
architecture for distributed object systems. It allows a distributed, heterogeneous
collection of objects to interoperate.
4. CORBA is a standard defined by the OMG (Object Management Group). It
describes an architecture, interfaces, and protocols that distributed objects can use
to interact with each other.
Part of the CORBA standard is the Interface Definition Language
(IDL), which is an implementation-independent language for
describing the interfaces of remote objects.
5. Unlike RMI, objects that are exported using CORBA can be accessed by
clients implemented in any language with an IDL binding (C, C++, Ada etc.).
6. The CORBA standard is extensive and provides a rich set of services.
The major components that make up the CORBA architecture include the:
4. Interface Definition Language (IDL), which is how CORBA interfaces are
defined.
5. Object Request Broker (ORB), which is responsible for all interactions
between remote objects and the applications that use them,
6. The Portable Object Adaptor (POA), which is responsible for object
Activation / deactivation, mapping object ids to actual object
implementations.
7. Naming Service, a standard service in CORBA that lets remote clients
find remote objects on the networks, and
8. Internet Inter-ORB Protocol (IIOP).
This figure shows how a one-method distributed object is shared between a
CORBA client and server to implement the classic "Hello World"
application.
interfaces that enables one java object to call the public methods of another java
object running on a different virtual machine.
As a distributed computing architecture, the RMI allows objects to
communicate through a pre-defined interface that allows them to function as if the
objects are local to them, so they can invoke their methods directly.
The RMI architecture allows an applet or application to call methods contained within
an object running on a remote host.
The RMI registry is an application that works as the 'gateway' between the remote
object and the RMI client.
A security manager must be present within the architecture to govern the access
attempts made by the client to the remote object. RMI applications use the RMI
Security Manager class as their security manager, and applets use their own built-in
security manager.
Stub and skeleton object perform the exchange of information between the client and
remote object using TCP sockets and object serialization.
Objects which are passed between the client and the remote objects must implement
the Serializable interface.
The Remote interface is used to define the structure of the remote object.
The Unicast Remote Object class is used to create the remote object as an RMI server
process. This remote object binds itself to the RMI registry through the Naming class
in order to be seen and accessed by RMI clients.
Several Exception classes may be thrown by the RMI process. These exception should
be caught by the client and remote objects in order to control the activity of the
program if an error is generated.
RMI clients access the remote object by obtaining a reference to it through the RMI
registry using Naming class. This reference is preformed through the remote object's
stub.
Multi-user support can be enabled through the used of threads. Since threads are not
serializable, they must be implemented and managed within the remote object and not
the RMI client.
RMI Architecture:
A client process and a remote (server) object are logically linked to each other through a
registry.
As the start of the process, a Java application (the remote object) executes as a server
process on Virtual Machine A and identifies itself with the RMI registry.
The registry is another Java application whose role is to maintain active reference to
remote objects. These references are stored within an internal table contained within the
registry program.
A java Client running on Virtual Machine B needs to request the service from the
registry to invoke the method contained within the remote object. It does this by access
the RMI registry on the host where the remote object resides (Virtual Machine A) through
a TCP socket connection. Once the registry accepts the clients request, it deliveries a
reference to the remote object in the form of a stub back to the client.
The client now invokes a method within the remote object's stub. This invocation may
also involve the exchange of additional objects as parameters, and the receipt of the
return values from the method call. These communications occur through the network
streams made available by the TCP socket, using object serialization.
The parameters are forwarded to the remote object through a skeleton object. The
skeleton object then dispatch them to the remote object and invoke the remote method.
The return value is sent back through the skeleton and the stub and finally received by the
client.
A security manager governs the access as the stub and the skeleton communicates with
each other.
import java.rmi.*;
import java.rmi.server.*;
public class Adder extends UnicastRemoteObject implements AddServerInterface
{
Adder()throws RemoteException{
super();
}
public int sum(int a,int b)
{
return a+b;
}
}
}catch(Exception e){System.out.println(e);}
}
}
try{
AddServerInterface
st=(AddServerInterface)Naming.lookup("rmi://"+args[0]+"/AddService");
System.out.println(st.sum(25,8));
}catch(Exception e){System.out.println(e);}
}
}
Steps involved in running the RMI application in case the server application
and the client application is running in the same machine:
(javax.xml.registry.infomodel.Key) keyIter.next();
id = orgKey.getId();
System.out.println("Object key was " + id);
}
}
Deleting an Organization does not delete the Service and User objects
the Organization. You must delete them separately.
that
belong to
Deleting a Service object deletes the Service Binding objects that belong to it, and also
the Specification Link objects that belong to the Service Binding objects. Deleting
the Specification Link objects, however, does not delete the associated Extrinsic Object instances
and their associated repository items. You must delete the extrinsic objects separately.
AuditableEvent and Association objects are not always deleted when the objects associated with
them are deleted. You may find that as you use the Registry, a large number of these objects
accumulates.
Remote Method Invocation (RMI) allows a Java object that executes on one machine to
invoke a method of a Java object that executes on another machine.
All remote objects must extend UnicastRemoteObject, which provides functionality that is needed
to make objects available from remote machines.
It contains one method that accepts two double arguments and returns their sum.
The third source file, AddServer.java, contains the main program for the server
machine.
Its primary function is to update the RMI registry on that machine.
This is done by using the rebind( ) method of the Naming class (found in java.rmi).
That method associates a name with an object reference.
The first argument to the rebind( ) method is a string that names the server as AddServer.
Its second argument is a reference to an instance of AddServerImpl.
The fourth source file, AddClient.java, implements the client side of this
distributed application.
In the context of RMI, a stub is a Java object that resides on the client machine.
Its function is to present the same interfaces as the remote server.
Remote method calls initiated by the client are actually directed to the stub.
The stub works with the other parts of the RMI system to formulate a request that is sent to the
remote machine.
A remote method may accept arguments that are simple types or objects. In the latter case, the object
may have references to other objects.
All of this information must be sent to the remote machine. That is, an object passed as an
argument to a remote method call must be serialized and sent to the remote machine.
If a response must be returned to the client, the process works in reverse. Note that the
serialization and deserialization facilities are also used if objects are returned to a client.
To generate a stub, you use a tool called the RMI compiler, which is invoked from the
command line, as shown here:
rmic AddServerImpl
This command generates the file AddServerImpl_Stub.class. When using rmic, be sure that
CLASSPATH is set to include the current directory.
Copy
AddServerIntf.class,
AddServerImpl_Stub.class, and
AddServer.class to a directory on the server machine.
AddServerImpl.class,
It maps names to object references. First, check that the CLASSPATH environment variable
includes the directory in which your files are located.
Then, start the RMI Registry from the command line, as shown here:
start rmiregistry
When this command returns, you should see that a new window has been created. You
need to leave this window open until you are done experimenting with the RMI
example
.Step Five: Start the Server.
Recall that the AddServer code instantiates AddServerImpl and registers that object with the name
AddServer.
You may invoke it from the command line by using one of the two formats
shown here:
Java AddClient server1 8 9
java AddClient 11.12.13.14 8 9
In the first line, the name of the server is provided. The second line uses its IP
address (11.12.13.14).
// addserverintf.java
import java.rmi.*;
public interface addserverintf extends Remote
{
double add(double d1,double d2) throws RemoteException;
}
// addserverimpl.java
import java.rmi.*;
import java.rmi.server.*;
public class addserverimpl extends UnicastRemoteObject implements addserverintf
{
public addserverimpl() throws RemoteException{ }
public double add(double d1,double d2) throws RemoteException
{
return d1+d2;
}
}
// addserver.java
import java.net.*; import
java.rmi.*; public class
addserver
{ public static void main(String args[])
{ try
{
addserverimpl addsi=new addserverimpl();
Naming.rebind("addserver", addsi);}
catch(Exception e)
{
System.out.println("exception" + e);
}
}
}
//addclient.java
import java.rmi.*;
public class addclient
{
public static void main(String args[])
{ try
{
String addServerURL="rmi://" +args[0]+ "/addserver";
addserverintf addsintf = (addserverintf)Naming.lookup(addServerURL);
System.out.println("the first no is" + args[1]);
double d1=Double.valueOf(args[1]).doubleValue();
System.out.println("the second no is"+args[2]); double
d2=Double.valueOf(args[2]).doubleValue();
System.out.println("the sum is: "+addsintf.add(d1,d2));
}
catch(Exception e)
{
System.out.println("Exception "+e);
}
}
}
Execution procedure
if there is no change in the class path this is the procedure
Place all the files in one directory
TERMINAL 0
command 0:
Satish@CentOS$ javac *.javac command 1:
Satish@CentOS /$ rmic addserverimpl command 2:
Satish@CentOS $ rmiregistry&
command 3:
Satish@CentOS /$ java addserver
Satish@CentOS /$ java addclient 127.0.0.1 8 9
output
the first no is 6
the second no is9 the
sum is: 15.0
Distributed computing is a field of computer science that studies distributed systems. A
distributed system consists of multiple autonomous computers that communicate through a
computer network. The computers interact with each other in order to achieve a common goal. A
computer program that runs in a distributed system is called a distributed program, and
distributed programming is the process of writing such programs.
Distributed computing also refers to the use of distributed systems to solve computational
problems. In distributed computing, a problem is divided into many tasks, each of which is
solved by one or more computers.[
J2EE
Java EE is defined by its specification. As with other Java Community Process
specifications, providers must meet certain conformance requirements in order to declare their
products as Java EE compliant.
Java EE includes several API specifications, such as JDBC, RMI, e-mail, JMS, web services,
XML, etc., and defines how to coordinate them. Java EE also features some specifications
unique to Java EE for components. These include Enterprise JavaBeans, Connectors, servlets,
portlets (following the Java Portlet specification), JavaServer Pages and several web service
technologies. This allows developers to create enterprise applications that are portable and
scalable, and that integrate with legacy technologies. A Java EE application server can handle
transactions, security, scalability, concurrency and management of the components that are
deployed to it, in order to enable developers to concentrate more on the business logic of the
components rather than on infrastructure and integration tasks.
CORBA:
administrative and ownership reasons. The owner may permit the data to be
accessed remotely but not stored locally. Or perhaps the data cannot be colocated and must exist on multiple heterogeneous systems for historical
reasons.
Computation is Distributed
Some applications execute on multiple computers in order to take advantage
of multiple processors computing in parallel to solve some problem. Other
applications may execute on multiple computers in order to take advantage
of some unique feature of a particular system. Distributed applications can
take advantage of the scalability and heterogeneity of the distributed
system.
that platform. Major ORB vendors like Inprise have CORBA ORB implementations through
their VisiBroker product for Windows, UNIX and mainframe platforms and Iona through their
Orbix product.
DCOM which is often called 'COM on the wire', supports remoting objects by running on
a protocol called the Object Remote Procedure Call (ORPC). This ORPC layer is built on top
of DCE's RPC and interacts with COM's run-time services. A DCOM server is a body of code
that is capable of serving up objects of a particular type at runtime. Each DCOM server object
can support multiple interfaces each representing a different behavior of the object. A DCOM
client calls into the exposed methods of a DCOM server by acquiring a pointer to one of the
server object's interfaces. The client object then starts calling the server object's exposed methods
through the acquired interface pointer as if the server object resided in the client's address space.
As specified by COM, a server object's memory layout conforms to the C++ vtable layout. Since
the COM specification is at the binary level it allows DCOM server components to be written in
diverse programming languages like C++, Java, Object Pascal (Delphi), Visual Basic and even
COBOL. As long as a platform supports COM services, DCOM can be used on that platform.
DCOM is now heavily used on the Windows platform. Companies like Software AG provide
COM service implementations through their EntireX product for UNIX, Linux and mainframe
platforms; Digital for the Open VMS platform and Microsoft for Windows and Solaris
platforms.
Java/RMI relies on a protocol called the Java Remote Method Protocol (JRMP). Java
relies heavily on Java Object Serialization, which allows objects to be marshaled (or transmitted)
as a stream. Since Java Object Serialization is specific to Java, both the Java/RMI server object
and the client object have to be written in Java. Each Java/RMI Server object defines an interface
which can be used to access the server object outside of the current Java Virtual Machine(JVM)
and on another machine's JVM. The interface exposes a set of methods which are indicative of
the services offered by the server object. For a client to locate a server object for the first time,
RMI depends on a naming mechanism called an RMIRegistry that runs on the Server machine
and holds information about available Server Objects. A Java/RMI client acquires an object
reference to a Java/RMI server object by doing a lookup for a Server Object reference and
invokes methods on the Server Object as if the Java/RMI server object resided in the client's
address space. Java/RMI server objects are named using URLs and for a client to acquire a
server object reference, it should specify the URL of the server object as you would with the
URL to a HTML page. Since Java/RMI relies on Java, it can be used on diverse operating system
platforms from mainframes to UNIX boxes to Windows machines to handheld devices as long as
there is a Java Virtual Machine (JVM) implementation for that platform. In addition to Javasoft
and Microsoft, a lot of other companies have announced Java Virtual Machine ports.