Beruflich Dokumente
Kultur Dokumente
3. What is architecture?
Architecture is needed when asking for guidelines and rules for complex system design
and implementation. It prescribes proper frameworks for all the involved mechanisms,
limiting the degrees of freedom to curb variations and enable cooperation.
6. What is introspection?
Builder tools discover a bean’s features by a process called introspection. This is done
in two ways:
• Design patterns: when naming beans features. Introspection class
examines beans for these design patterns to discover bean features.
(Adhering to specific rules)
• Bean information class: implements BeanInfo interface, it lists those bean
features that are exposed to application builder tools. (Explicitly providing
information)
7. What is stub and skeleton?
initiates a connection with the remote JVM containing the remote object, marshals
(writes and transmits) the parameters to the remote JVM,
waits for the result of the method invocation,
unmarshals (reads) the return value or exception returned, and returns the value to the
caller.
The stub hides the serialization of parameters and the network-level communication in
order to present a simple invocation mechanism to the caller.
In the remote JVM, each remote object may have a corresponding skeleton (in Java 2
platform-only environments, skeletons are not required). The skeleton is responsible for
dispatching the call to the actual remote object implementation. When a skeleton receives
an incoming method invocation it does the following: unmarshals (reads) the parameters
for the remote method,
9. What is Events?
Beans use events to communicate with other beans. A bean that wants to receive
events (a listener bean) registers its interest with the bean that fires the event (a source
event). Builder tools can examine a bean and determine which events that bean can
fire (send) and which it can handle (receive).
PART-B (15X6=80)
Platform –is the substrate that allows for installation Of components and component
frameworks
Concrete-direct physical support
Visual- Emulate a platform on top of another.
Component framework-is a dedicated and focused architecture usually around a few key
mechanisms. A fixed set of policies for mechanisms at the component level Set of
abstract interactions that define protocols by which component communicate
Tiered component architecture
Layers and tiers
(or)
11.b)i.Discuss the fundamental properties of component technology.(10)
If a component fails to function it must not violate system-wide rules.
Software development processes that do not depending on testing.
Performance of a component system is affected in non-trivial ways by the
actual composition.
Technically feasible
Follow modular programming
Provide proper interface
objection serialization
Object serialization extends the core java input/output classes with support for
objects. Object serialization supports the encoding of objects, and the objects
reachable from them, into a stream of bytes; and it supports the complementary
reconstruction of the object graph from the stream.
(or)
12.b)Explain RMI-IIOP in detail.(16)
It allows RMI objects to use the CORBA network protocol to communicate with
other objects.
RMI-IIOP is the method Chosen by java programmers who want to use the rmi
interfaces,but use IIOP as the transport .RMI-IIOP requires that all remote interfaces are
defined as Java RMI interfaces.
It is developed jointly by IBM and SUN .
import java.rmi.RemoteException;
import java.net.MalformedURLException;
import java.rmi.NotBoundException;
import javax.rmi.*;
import java.util.Vector.*;
import javax.naming.InitialContext;
import javax.naming.Context;
import java.io.*;
import javax.naming.NamingException;
public class BankClient
{
public static void main(String args[])
{
Context ic;
Object ob;
BankInterface hi;
try
{
ic=new InitialContext();
ob=ic.lookup("ba");
hi=(BankInterface)PortableRemoteObject.narrow(ob,BankInterface.class);
int j=hi.add(10,10);
System.out.println(j);
}
catch(Exception e)
{
}
}
}
import javax.rmi.PortableRemoteObject;
import java.io.*;
public class BankImpl extends PortableRemoteObject implements BankInterface
{
public BankImpl() throws java.rmi.RemoteException
{
super();
}
}
}
import java.rmi.Remote;
import java.io.*;
public interface BankInterface extends java.rmi.Remote
{
}
}
COMPILATION STEPS :
2. Use rmic to generate tie and stubs
rmic -iiop BankImpl
-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
-Djava.naming.provider.url=iiop://localhost:900
BankClient
(or)
14.b)Explain about threads in detail.(16)
A thread is an independent sequential path of execution within a program. Threads
also known as execution contexts or lightweight processes. Many threads can run
concurrently within a program.
Thread states:Ready-to-run state
a. Running state
b. Dead state
c. Non-runnable states
a) Sleeping
b) Blocked
c) Waiting
AddServerInter.java
import java.rmi.*;
public interface AddServerInter extends Remote
{
public String concat(String d1,String d2) throws RemoteException;
}
AddServerImpl.java
import java.rmi.*;
import java.rmi.server.*;
public class AddServerImpl extends UnicastRemoteObject implements AddServerInter
{
public AddServerImpl()throws RemoteException
{
}
public String concat(String d1,String d2) throws RemoteException;
{
return d1+d2;
}
}
AddServer.java
import java.rmi.*;
import java.net.*;
public class AddServer
{
public static void main(String args[])
{
try
{
AddServerImpl ad=new AddServerImpl();
Naming.rebind("AddServer",ad);
System.out.println(“Registered…………..”);
}
catch(Exception e)
{
System.out.println("err");
}
}
}
AddClient.java
import java.rmi.*;
import java.net.*;
public class AddClient
{
public static void main(String args[])
{
try
{
AddServerInter ad=(AddServerInter)Naming.lookup(“ad”);
System.out.println(ad.concat(cbt,lab));
}
catch(Exception e)
{
System.out.println("Error");
}
}
}
C:\>cd jdk1.3
C:\jdk1.3>cd bin
C:\jdk1.3\bin>javac AddServerInter.java
C:\jdk1.3\bin>javac AddServerImpl.java
C:\jdk1.3\bin>javac AddServer.java
C:\jdk1.3\bin>javac AddClient.java
C:\jdk1.3\bin>start rmiregistry
C:\jdk1.3\bin>java AddServer
C:\jdk1.3\bin>java AddClient
cbtlab
5.output is displayed