MWT Lecture NOtes Unit 6

Download Report

Transcript MWT Lecture NOtes Unit 6

MIDDLE WARE TECHNOLOGIES
B.TECH III YR II SEMESTER
UNIT 6 PPT SLIDES
TEXT BOOKS:
1.Client/Server programming with Java and
CORBA Robert Orfali and Dan Harkey, John
Wiley & Sons,SPD 2nd Edition
2. Java programming with CORBA 3rd Edition,
G.Brose, A Vogel and K.Duddy, Wileydreamtech, India John wiley and sons
INDEX
S.NO.
TOPIC
UNIT 6 PPT SLIDES
LECTURE NO. PPTSLIDES
1.CORBA initialization protocol
L41
L42
L1.1 TO L1.4
L2.1 TOL 2.4
• 2.CORBA activation services
L43
L3. 1 TO L3.3
• 3. CORBAIDL mapping
• 4. java-to-IDL mapping .
L44
L45
L46
L4. 1 TO L4.3
L5. 1 TO L5.3
L6. 1 TO L6.3
• 5. The introspective
• CORBA/Java object
L47
L48
L49
L7. 1 TO L7.3
L8. 1 TO L8.3
L9. 1 TO L9.4
UNIT6 SYLLABUS
• Existential CORBA: CORBA initialization
protocol, CORBA activation services,
CORBAIDL mapping CORA java-to-IDL
mapping. The introspective CORGA/Java
object.
Lecture 1 slide 1
EXISTENTIAL CORBA
•
•
•
•
•
•
A new service provider will first register its
service with the trader and then provide
An object reference – which can be used by
clients to comment
The service type name – methods,
parameters, ret-type etc
The properties the service – name value pairs
The trader maintains a repositiing of service
types – ex: restaurant.
The Trader stores type descriptions in its
service type repositing.
Lecture 1 slide 1
EXISTENTIAL CORBA
• Federations – Traders groups – electronic
basers.
• The traders service lets you prove a search via
policies, constraints and preferences.
– Policies – Scope of the search. Ex: hop-count to limit
the no.of trader links traversed.
– Constraints – Search criteria – language can be
specified. Ex: <<SQL>.
– Preferences – order in which the matching offers are
returned.
• Ex: first (default), max, min, random, with
constraint layers- <<SQL>>etc
Lecture 1 slide 2
EXISTENTIAL CORBA
•
•
•
•
Prestarting server objects before clients connect to
them, is a costly exercise, since there could be millions
of server objects.
The server side of the ORB has to provide an
automatic startup function. The ORB should be able to
either prestart an object or start it on demand, when
clients invoke it.
It must also cooperate with a persistent service to save
and restore the state of your server objects.
Topics covered: ORB activation and deactivation
policies by BOA; Visibroken for java activation policies,
CORBA 3.0 POA; POA-EOB.
Lecture 1 slide 3
EXISTENTIAL CORBA
• The CORBA::BOA interface:methods: to create or destroy obj.ref., to
query or update the infn. The BOA maintains for an obj.
• Create, change-implementation, get-id, dispose,get-principal,setexception, impl-is-realy,obj-is-ready,deactivate-impl,deactivate-obj.
• Infn to be supplied – a) Interface name
b) Implementation
name
3) Some unique ref data (or ID) persistent ID (PID).
• Activation policies : CORBA 2.0 defines 4 activation policies
• a) shared server
b) unshared server
c) server-per-method
and d) persistent server
• a) BOA shared server:
Lecture 1 slide 4
EXISTENTIAL CORBA
•
•
•
•
BOA activates the server the first time a
request is invoked on any obj. implemented by
that server.
The server initializes itself & notifies the BOA –
impl – is – ready. All subsequent requests are
then diverted to this process.
when the process is ready to terminate, it
notifies BOA – deactivation-impl. All the
objects that are running with in the process are
deactivated automatically.
you can also deactivate an individual object, by
issuing deactivate object.
Lecture 2 slide 1
EXISTENTIAL CORBA
• Threads are used to run multiple objects
concurrently with in the process.
• you can even use multiple threads to
represent the same object to multiple
clients – serialize the access to state (data
base) or treat it as a Java synchronized
method.
• Note: make sure your ORB is thread –
safe visibroker for java is thread-safe.
Lecture 2 slide 2
EXISTENTIAL CORBA
• BOA Unshared server:
• Each object in a differ.server process.
• new server activated first time a request is
invoked the object. It notifies BOA objectis-ready.
• A new server object remains active, until
deactivate object.
• usage – dedicated object to represent
provides, but on a manufacturing line etc.
Lecture 2 slide 3
EXISTENTIAL CORBA
• c) BOA server-per-method:
• New server for each new request.
• Server runs only for the deviation of the particular
method.
• Several server processes for the same object- or even
the same method of the same object-may be
concurrently active.
• No notification to BOA, when an object is activate or
deactivated.
• Most infrequent usage – useful for running objects or
• d) BOA Persistant Server
Lecture 2 slide 4
EXISTENTIAL CORBA
•
•
•
•
•
•
•
Servers are activated by means outside BoA.
impl-is-ready call is used to notify BoA.
Usage : it is just a special case of shared
server
Server activation is not by BoA
DBMS, ODBMS, TPMonitor or web server of
all the time.
So there are good candidate apps. For the
persistent server policy.
Shared server activation scenario
Lecture 3 slide 1
EXISTENTIAL CORBA
• The visibroker Activation Daemon
• CORBA 3.0’s PoA
• CORBA 2.0 – client side portable; but nor server
side; resulting in ORB to look after and diff.
vendors have diff. standards.
• CORBA 3.0 – PoA – June 1995- implemented is
Visibroker for Java3.1 orbix web 3.0, and the
JDK 1.2 version of java IDL.
• BoA & PoA can consist.
• obj. is ready replaced by connect.
• deactivate-obj replaced by disconnect.
Lecture 3 slide 2
EXISTENTIAL CORBA
• PoA :
• Transparent activations of objects, like BoA.
• Like BoA, PoA can start
– server prog. for each method,
– separate prog. for each object,
– thread prog. for all instances of an obj.type.
• Like BoA, PoA supports both IDL-generates static skeletons & DSI.
• PoA supports transient or persistent objects.
• New concepts – servant mangers – call back objects, object maps
etc.
• Server
•
Lecture 3 slide 3
EXISTENTIAL CORBA
•
•
•
•
•
•
•
•
•
•
•
•
•
•
PoA policies
Policy Type
1.
Thread
Default
SINGLE-THREAD-MODEL.
2.
Life span
3.
Obj.id uniqueness
4.
Id.Assignment
5.
Servant Retention
6.
Activation
IMPLICIT ACTIVATION
7.
Request Processing
Policy Desc. & Choices
ORB-CTRL-MODEL-ROOT-PoA
TRANSIENT – default
PERSISTENT
UNIQUE – ID-default; MULTIPLE ID
USER-ID;SYSTEM-ID-default
RETAIN-default; NON-RETAIN
IMPLICIT – ACTIVATION-default; NoUSE-ACTIVE-OBJECT-MAP-ONLY-default,
USE-DEFAULT-SERVANT;
USE-SERVANT-MANAGER
Lecture 4 slide 1
EXISTENTIAL CORBA
•
•
•
•
•
•
•
•
•
•
Different Policies Combinations :
1. RETAIN and USE-ACTIVE-OBJECT-MAP-ONLY
- good for serves that manage finite no.of pre-started objects.
2. RETAIN and USE –SERVANT – MANAGER
- ideal for large no.of persistent objects.
3. RETAIN and USE-DEFAULT-SERVANT
- ideal for situations where one servant is used per method call.
PoA creating object References: can be exported to clients
1. By explicitly invoking the PoA’s factory methods.
- Create-reference and create-reference with id methods.
Lecture 4 slide 2
EXISTENTIAL CORBA
• 2. Explicitly at obj. activation
•
- activate – object and activate-object-with-id
methods.
• 3. Implicitly at obj.activation – policy declaration.
• Object Activation
• 1. Explicitly, is a calls to the PoA.
• 2. On-demand, using a servant manager.
• 3. Implicitly – policy declaration
• PoA interfaces:
• org.omg.CoRBA, servant manager, servant activator,
servant locator, Adapter Activator. PoA interface etc.
Lecture 4 slide 3
EXISTENTIAL CORBA
–
–
•
•
•
•
•
•
•
To support multiplatform and Multilanguage world of distributed
clients and servers, we need IDL-to –Java mapping.
The IDL-to-Java language mapping also defines an interface for
portable stubs and skeletons that CoRBA vendors must support.
The CoRBA IDL to Java Mappings:
CoRBA IDL
Java
General Constructs
1. Module
Package
2. User exceptions
java class – extends
org.omg.CoRBA user
exception, which in twin extends java.long exception
3. System exceptions
Java class –
org.omg.CoRBA.System
Lecture 5 slide 1
EXISTENTIAL CORBA
• Exception-extends java.long.RuntimeException.
• 4. in parameters
normal
java parameters
• 5. out and inout parameters
Java
holder classes (IDL generated and then
• instantiated by client side)
• 6. Type casts (or narrow)
java helper
classes
• 7. Attributes
Java
overloaded accessor and modifier
• methods with the same name as the attribute.
Lecture 5 slide 2
EXISTENTIAL CORBA
•
•
•
•
•
•
•
•
•
•
•
•
CoRBA IDL
Java
Primitive Types
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Const
Boolean, TRUE,FALSE
char, wchar
octet
string, wstring
short, unsigned short
long, unsigned long
long long, unsigned long long
float
double
Public static final field
Boolean. True. False
char
byte
java.long.string
short
int
long
float
double
Lecture 5 slide 3
EXISTENTIAL CORBA
•
•
•
•
•
•
•
•
•
Constructed Types
1. interface
interface
2. sequence
array
3. array
array
4. struct
java class with same name as struct type (includes
instances variables and constructors for each field)
5. enum
java class with same name as enum type.
6. union
java class with same name as union type class with
get/set methods for fields.
7. type def java does not have a type def construct. Mapped to
simple IDL types or user defined IDL types.
8. ary
java class org.omg.CoRBA.ary (the ORB is the factory)
Lecture 6 slide 1
EXISTENTIAL CORBA
• CoRBA IDL
Java
•
•
Server.side Mapp
• 1. Server implementation using write an
implementation class that extends
• inheritance
the IDL-generated-<interfacename>Impl base class.
• 2. Server implementation using
IDLgenerated –tie-<interface.name>class using
delegation (i.e, Tie)
that delegates
calls to the implementation
Lecture 6 slide 2
EXISTENTIAL CORBA
• class you provide. The implementation class
implements one or more IDL-defined interfaces
(each represented by an IDL-generated
<interface-name> operations interface)
• 3. PoA root servant class
java class
org.omg.CoRBA.portable.object
• Impl.pseudo.objects to java classes (only most
frequently used are tested).
Lecture 6 slide 3
EXISTENTIAL CORBA
• 1. CoRBA::ORB
org.umg.CoRBA.ORB
• 2. CoRBA::Object
org.umg.CoRBA.Object
• 3. CoRBA::Named value
org.umg.CoRBA.Named value
• 4. CoRBA::NVList
org.umg.CoRBA.NVList
• 5. CoRBA::Request
org.umg.CoRBA.Request
•
DSI mapping)
•
Lecture 7 slide 1
Java class
Java class
Java class
Java class
Java class
(and
EXISTENTIAL CORBA
• 6. CoRBA::Server Request(and DII)
Java class org.umg.CoRBA.server
request
• 7. CoRBA::Type code
Java class org.umg.CoRBA.Type code
• 8. CoRBA::TCKind
Java class org.umg.CoRBA.TCKind
Lecture 7 slide 2
EXISTENTIAL CORBA
•
•
•
•
•
•
•
•
•
•
•
Feature
Events
1. Add/remove event listeners
yes
2. Event object
yes
3. Event listener
yes
4. Too many listeners
yes
(Multicast/Unicast)
Simple properties
5. get/set single value
yes
6. get/set indexed
yes
7. is/set Boolean
yes
CoRBA comp.
JavaBeans
yes
yes
yes
yes
yes
yes
yes
Lecture 7 slide 3
EXISTENTIAL CORBA
•
•
•
•
•
•
•
•
•
•
Bound properties
8. Property change event
yes
9. Property change listener
yes
10. Property change support
yes
Constrained properties
11. Property change Event
yes
12. Vetuable change listener
yes
13. Vetoable change support
yes
14. Property Vector Exception
yes
15. Asynchronous Veta notification
No
yes
yes
yes
yes
yes
yes
yes
yes
Lecture 8 slide 1
EXISTENTIAL CORBA
• Customization
• 16. Property editor
yes
• 17. Customizer
yes
• 18. HTML help
yes
Lecture 8 slide 2
yes
yes
yes
EXISTENTIAL CORBA
•
•
•
•
•
•
•
•
•
•
MetaData
19. Interface Reposting/IDL
i/o
20. Introspector
yes
21. BeanInfo
yes
22. Feature Descriptor
yes
23. Property Descriptor
yes
24. Method Descriptor
yes
(Derived from the CoRBA IR’s operation Def)
25. Event set Descriptor
yes
26. Vensin Descriptor
No
yes
yes
yes, comp.Info
yes
yes
yes
yes
Lecture 8 slide 3
yes
EXISTENTIAL CORBA
• Packaging
• 27. Serialization
yes
yes
• 28. JARs
yes
yes
• (Called Component Archive or CAR)
Lecture 9 slide 1
EXISTENTIAL CORBA
• 29. Manifest
•
•
•
•
•
•
•
•
yes
yes
30. Deployment Descriptor
yes
31. Installation Support
No
Composition and containment
32. Container
yes, JDK 1.2 Bean
Context
33. Containee
yes, with JDK 1.2
34. Container Listener
yes, with JDK 1.2
35. Multiple Interfaces
Beans.getInstance of
yes
yes
yes
yes
yes
yes, aggregation
Lecture 9 slide 2
yes,
EXISTENTIAL CORBA
• Comp. Life Cycle
• 36. Factories
yes, with EJB
• 37. Activate/deactivate
yes, with EJB
• 38. Persistent object refs
yes, with EJB
• 39. Move
No
• 40. Remove
No
• CoRBA Remote Events:
yes
yes
yes
yes
Lecture 9 slide 3
yes
EXISTENTIAL CORBA
• Like JavaBean, CoRBA listeners must implement on
Event xxx listener that extends the event listener
interface. Similarly add/remove xxx listener.
• Added.adv – CoRBA event objs. Can be transmitted
over the n/w – done by pass-by-value semantics.
• Dist.Event – channel
• CoRBA Containers : Container & containee
• Useful for maintaining comp. hierarachy.
• Ability to assemble components inside a container.
•
Lecture 9 slide 4