520 likes | 714 Views
Distributed Object Computing Using Java and CORBA. 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. CORBA Overview.
E N D
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
Summary • Describe the role of CORBA in developing enterprise applications • Describe the role of the Object Management Group • Describe the CORBA architecture
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
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
Constants Enumerations Unions Structures Type definitions Sequences Arrays NonclassData Types
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
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
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
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
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
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
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
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