Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and...

Post on 11-Jan-2016

217 views 3 download

Transcript of Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and...

Copyright © 2003 ProsoftTraining. All rights reserved.

Distributed Object Computing Using Java and CORBA

Copyright © 2003 ProsoftTraining. All rights reserved.

Lesson 1:Introduction to CORBA

Objectives

• Describe the role of CORBA in developing enterprise applications

• Describe the role of the Object Management Group

• Describe the CORBA architecture

CORBAOverview

• Common Object Request Broker Architecture• Object-oriented development• Distributed-object computing

The ObjectManagement Group

• Controls the CORBA standard• Provides a specification for CORBA

CORBAArchitecture

• Object Management Architecture– Object Request Broker– Object services– Common facilities– Application objects– Internet InterORB Protocol– Interface Definition Language– Object adapters– CORBA Services

ObjectRequest Broker

Client Process

Object Reference

ORB

Server Process

ObjectImplementation

InternetInterORB Protocol

Client Process

Object Reference

ORB

Server Process

ObjectImplementation

ORB

IIOP

InterfaceDefinition Language

Client Process

Object Reference

ORB

Server Process

ObjectImplementation

ORB

IIOP

IDL StubsORB

Interface

IDLSkeleton

ObjectAdapter

Summary

Describe the role of CORBA in developing enterprise applications

Describe the role of the Object Management Group

Describe the CORBA architecture

Copyright © 2003 ProsoftTraining. All rights reserved.

Lesson 2:Interface Definition Language

Objectives

• Use the IDL to define the interface to CORBA objects

• Describe the mapping of IDL nonclass data types into Java

• Describe the purpose of IDL parameter-passing modes

• Model inheritance using IDL• Define CORBA exceptions using IDL

Introduction to IDL

• IDL files• IDL compilers• Mapping IDL to Java

Basicsof IDL

• IDL constructs– Modules– Interfaces– Attributes– Operations

IDLPrimitives

IDL Javaboolean boolean

char, wchar char

octet byte

string, wstring java.lang.String

short, unsigned short short

long, unsigned long int

long long, unsigned long long long

float float

double double

Inheritance and IDL

• Java no multiple inheritance support• Java class can inherit from only one other

class• IDL can be used to define an interface that

inherits from multiple super-interfaces

NonclassData Types

• Constants• Enumerations• Unions• Structures

• Type definitions• Sequences• Arrays

Parameter-PassingModes and Exceptions

• Parameter-passing modes– in– out– inout

• Exceptions– Use-defined exceptions inherit indirectly

from java.lang.Exception– IDL operations must declare their ability to

raise an exception

Summary

Use the IDL to define the interface to CORBA objects

Describe the mapping of IDL nonclass data types into Java

Describe the purpose of IDL parameter-passing modes

Model inheritance using IDL Define CORBA exceptions using IDL

Copyright © 2003 ProsoftTraining. All rights reserved.

Lesson 3:Building CORBA Clients

Objectives

• Use the IDL compiler to generate client stubs• Initialize the ORB• Use the naming service to obtain an object

reference• Invoke remote methods• Use out and inout parameters to invoke

remote methods

Client IDL Stubs

• Used to create client applications• IDL-to-Java compiler named idlj

– Used to compile IDL files to generate client stubs and server skeletons

Initializing the ORB

• The ORB class– Is used to initialize the ORB– Is not instantiated using its public

constructor– Provides a static method named init that

initializes the ORB and returns an instance of the ORB class

Using theNaming Service

• Connecting to the naming service• Using the naming service to obtain an object

reference– Obtaining the initial naming context– Retrieving an object reference

Example ofNamespace

InvokingRemote Methods

• Remote methods are invoked in the same way that local methods are invoked

Using Out andInout Parameters

• Out parameters– Used exclusively to return data from the

server to the client• Inout parameters

– Passed both from the client to the server and, following any changes, from the server back to the client

Summary

Use the IDL compiler to generate client stubs Initialize the ORB Use the naming service to obtain an object

reference Invoke remote methods Use out and inout parameters to invoke

remote methods

Copyright © 2003 ProsoftTraining. All rights reserved.

Lesson 4:Building

CORBA Servers

Objectives

• Use the IDL compiler to generate server skeletons

• Implement CORBA objects• Initialize the ORB and wait for clients• Use the naming service to publish an object

reference• Use out and inout parameters

ServerIDL Skeletons

• A server skeleton provides a framework for the implementation of a CORBA object

ImplementingCORBA Objects

Server-side implementation

Using theNaming Service

• Instantiating a CORBA object• Creating additional naming contexts

Example ofNaming Service

Waitingfor Invocation

• The wait method– Called to pause the main thread of

execution– Part of Java’s built-in threading facilities

Using Out andInout Parameters

• Out parameters– Used exclusively to return data from the

server to the client• Inout parameters

– Passed both from the client to the server and, following any changes, from the server back to the client

Summary

Use the IDL compiler to generate server skeletons

Implement CORBA objects Initialize the ORB and wait for clients Use the naming service to publish an object

reference Use out and inout parameters

Copyright © 2003 ProsoftTraining. All rights reserved.

Lesson 5:Factory and

Callback Objects

Objectives

• Describe the purpose of factory objects• Use factory objects to obtain object

references• Describe the purpose of callback objects• Develop applications that use callback objects

FactoryObjects

• Types include:– Generic– Specific– In-process– Out-process

• FactoryFinder• Using factory objects• Designing factory objects

CallbackObjects

• Using callback objects• Designing callback objects

Summary

Describe the purpose of factory objects Use factory objects to obtain object

references Describe the purpose of callback objects Develop applications that use callback objects

Copyright © 2003 ProsoftTraining. All rights reserved.

Lesson 6:CORBA Exceptions

Objectives

• Describe the purpose of CORBA exceptions• Define an exception using IDL• Develop CORBA objects that throw exceptions

Introduction to CORBA Exceptions

• Throwing CORBA exceptions• Catching CORBA exceptions

Summary

Describe the purpose of CORBA exceptions Define an exception using IDL Develop CORBA objects that throw exceptions

Copyright © 2003 ProsoftTraining. All rights reserved.

Lesson 7:Dynamic

Invocation Interface

Objectives

• Describe the purpose of the interface repository

• Describe the Dynamic Invocation Interface• Construct an argument list for use in dynamic

invocation• Invoke a request using the DII• Extract a return value following dynamic

invocation

Dynamic InvocationInterface Introduction

• DII allows a client to access any CORBA object even though it may not have a client stub to provide a compile-time definition of an object’s interface

Invoking a RemoteMethod Using DII

• Construct a list of arguments• Prepare a place to hold a return value• Invoke the remote method• Extract the return value

Summary

Describe the purpose of the interface repository

Describe the Dynamic Invocation Interface Construct an argument list for use in dynamic

invocation Invoke a request using the DII Extract a return value following dynamic

invocation

Distributed Object Computing Using Java and CORBA

Introduction to CORBA Interface Definition Language Building CORBA Clients Building CORBA Servers Factory and Callback Objects CORBA Exceptions Dynamic Invocation Interface