You are on page 1of 9

St.

JOSEPH’S COLLEGE OF ENGINEERING ,Chennai-119


Model Examination-I August 2010
Set-I
SUBJECT : Component Based Technology Code: IT1401
BRANCH : IT SEM:VII
DURATION : 3 hours MAX.MARKS:100
Model key
Answer all the questions
PART-A (10X2=20)

1. What is software component?


A software component is a binary unit of independent production, acquition and
deployment that interact to form a functional system.

2. What is an indirect interface?


Provided by objects implemented by a component, corresponding to object interfaces.
Definition and implementation might sit in different components.

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.

4. What is component framework?


A component framework is a dedicated and focused architecture, usually around a few
key mechanisms, and a fixed set of policies for mechanisms at the component level. This
framework implements protocols to connect participating components and enforce some
of the policies set by the framework.

5. What is concrete platform?


Concrete platforms provide direct physical support- that is; implement their services in
hardware.

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,

• invokes the method on the actual remote object implementation, and


• marshals (writes and transmits) the result (return value or exception) to the caller.
8. Define thread.

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

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).

10. Define java Bean.


Java beans are a set of java objects that provides the infrastructure for the components
to be written in java language. Java beans include objects for customizing,
introspecting and event handling. It provides the component framework from which
reusable components can be built.

PART-B (15X6=80)

11.a) Explain about component architecture with a neat diagram.(16).


Need for an architecture.
To create complex system ,we need guiding rules for design and implementation
It is needed to the property –independence &cooperation
It specifies the properties that characterize any system built
It is based on
Functionality
Performance
Reliability
Security
Component System architecture
Consists of a set of platform decisions, set of component frameworks and
an interoperation design for the component frameworks.

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

ii. Explain about component and object. (6)


The characteristics of a component are:
-Unit of independent deployment
-Unit of third-party composition
-No persistent state
The characteristics of an object are,
- it is a unit of instantiation.
- It may have state; can be a persistent state, so it has a unique
identity.
- It encapsulates its state and behavior.
12.a)What is object serialization? Give an example.(16)

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();
}

public int add(int amount,int choice) throws java.rmi.RemoteException,IOException


{
return amount+choice;

}
}
import java.rmi.Remote;
import java.io.*;
public interface BankInterface extends java.rmi.Remote
{

public int add(int amount,int choice) throws java.rmi.RemoteException,IOException;


}
import javax.naming.InitialContext;
import javax.naming.Context;
import java.io.*;
public class BankServer
{
public static void main (String[] args)
{
try
{
BankImpl b=new BankImpl();
Context initial=new InitialContext();
initial.rebind("ba",b);
}
catch(Exception e){}

}
}

COMPILATION STEPS :
2. Use rmic to generate tie and stubs
 rmic -iiop BankImpl

3. Compile the source files


 javac BankingInt.java
 BankServer.java
 BankClient.java
 javac BankImpl.java

4.Start the Naming Service


 tnameserv
5.Start the server
 java
-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
-Djava.naming.provider.url=iiop://localhost:900
BankServer

Bank Server: Ready ...

6. Run the client application


 java

-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
-Djava.naming.provider.url=iiop://localhost:900
BankClient

13.a)i. Components are for composition.discuss(8)


Composition enables prefabricated hings to be resued by rearranging them in ever new
composites
To create reusable component :Monolithic design is partition into fragments
Think initially,descriptions have to be carefully generalized to allow for reuse.
To enable composition –s/w component adheres to a particular component platform.
E.g. procedural libraries

ii.Specify the roles of an architecture.(8)


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.
Architecture needs to create simultaneously the basis for independence
and cooperation.
An architecture defines overall invariants.
It needs to be based on the principal considerations of overall
functionality.It prescribes proper frameworks for all involved mechanisms.
(or)

13.b) Explain in detail about


i. Message oriented middleware (MOM) (5)
ii. Object oriented middleware (OOM) (5)
iii. Specify the criteria that are used to fulfil the software definition (6).
MOM-communication via message JMS
Object oriented middleware (OOM) (5)
communication via objects eg. COM ,CORBA

Specify the criteria that is used to fulfill the software definition(6)


Multiple use
Non-context specific
Composable with other component.
Encapsulated.

14. a)Explain callback in detail.(16)


A procedure passed to a library at one point and called by the library at some later point
is called callback.
Directory service supports the callbacks to notify clients of changes in the
managed directory .The directory service interface is grouped into two parts.
*File lookup and manipulations.
*Registration and unregistration of callbacks
Every window that has to respond to messages must have a callback procedure.
Through callback procedures windows (os) communicates with the application
Eg.user generates event
Converted into message
Application gets the message and request windows to send the
message to call the appropriate procedure.
It is a common feature in procedural libraries that have to handle asynchronous message.
Eg.windowing libraries use a callback to notify a particular window’s client code when
the user resized the window.

(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

15a)Explain about the features of java bean in detail. (16)


There are five aspects to a bean model are:
• Events
• Properties
• Persistence
• Introspection
• Customization
(or)
15.b)Write a rmi program to concatenate two numbers.(16)

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");
}
}
}

3. run ->cmd prompt

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>rmic AddServerImpl (rmi compiler)

C:\jdk1.3\bin>start rmiregistry

C:\jdk1.3\bin>java AddServer

4. run ->cmd prompt

C:\jdk1.3\bin>java AddClient
cbtlab

5.output is displayed

You might also like