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

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

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

Page 1: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Copyright © 2003 ProsoftTraining. All rights reserved.

Distributed Object Computing Using Java and CORBA

Page 2: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Copyright © 2003 ProsoftTraining. All rights reserved.

Lesson 1:Introduction to CORBA

Page 3: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Objectives

• Describe the role of CORBA in developing enterprise applications

• Describe the role of the Object Management Group

• Describe the CORBA architecture

Page 4: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

CORBAOverview

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

Page 5: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

The ObjectManagement Group

• Controls the CORBA standard• Provides a specification for CORBA

Page 6: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

CORBAArchitecture

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

Page 7: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

ObjectRequest Broker

Client Process

Object Reference

ORB

Server Process

ObjectImplementation

Page 8: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

InternetInterORB Protocol

Client Process

Object Reference

ORB

Server Process

ObjectImplementation

ORB

IIOP

Page 9: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

InterfaceDefinition Language

Client Process

Object Reference

ORB

Server Process

ObjectImplementation

ORB

IIOP

IDL StubsORB

Interface

IDLSkeleton

ObjectAdapter

Page 10: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Summary

Describe the role of CORBA in developing enterprise applications

Describe the role of the Object Management Group

Describe the CORBA architecture

Page 11: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Copyright © 2003 ProsoftTraining. All rights reserved.

Lesson 2:Interface Definition Language

Page 12: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 13: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Introduction to IDL

• IDL files• IDL compilers• Mapping IDL to Java

Page 14: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Basicsof IDL

• IDL constructs– Modules– Interfaces– Attributes– Operations

Page 15: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 16: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 17: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

NonclassData Types

• Constants• Enumerations• Unions• Structures

• Type definitions• Sequences• Arrays

Page 18: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 19: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 20: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Copyright © 2003 ProsoftTraining. All rights reserved.

Lesson 3:Building CORBA Clients

Page 21: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 22: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 23: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 24: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 25: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Example ofNamespace

Page 26: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

InvokingRemote Methods

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

Page 27: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 28: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 29: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Copyright © 2003 ProsoftTraining. All rights reserved.

Lesson 4:Building

CORBA Servers

Page 30: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 31: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

ServerIDL Skeletons

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

Page 32: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

ImplementingCORBA Objects

Server-side implementation

Page 33: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Using theNaming Service

• Instantiating a CORBA object• Creating additional naming contexts

Page 34: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Example ofNaming Service

Page 35: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Waitingfor Invocation

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

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

Page 36: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 37: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 38: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Copyright © 2003 ProsoftTraining. All rights reserved.

Lesson 5:Factory and

Callback Objects

Page 39: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 40: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

FactoryObjects

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

• FactoryFinder• Using factory objects• Designing factory objects

Page 41: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

CallbackObjects

• Using callback objects• Designing callback objects

Page 42: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 43: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Copyright © 2003 ProsoftTraining. All rights reserved.

Lesson 6:CORBA Exceptions

Page 44: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Objectives

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

Page 45: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Introduction to CORBA Exceptions

• Throwing CORBA exceptions• Catching CORBA exceptions

Page 46: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Summary

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

Page 47: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

Copyright © 2003 ProsoftTraining. All rights reserved.

Lesson 7:Dynamic

Invocation Interface

Page 48: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 49: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 50: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 51: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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

Page 52: Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.

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