Distributed Application Development Guide (CORBA Service ...€¦ · CChapter 10 CORBA Programming...

717
B1WS-1085-03ENZ0(00) April 2014 Windows/Solaris/Linux FUJITSU Software Interstage Application Server Distributed Application Development Guide (CORBA Service Edition)

Transcript of Distributed Application Development Guide (CORBA Service ...€¦ · CChapter 10 CORBA Programming...

  • B1WS-1085-03ENZ0(00)April 2014

    Windows/Solaris/Linux

    FUJITSU SoftwareInterstage Application Server

    Distributed Application Development Guide (CORBA Service Edition)

  • Preface

    Purpose of this DocumentThis document provides information on how to develop applications using Interstage.

    Note

    Throughout this manual Interstage Application Server is referred to as Interstage.

    Intended Readers

    This document is intended for developers of distributed applications.

    It is assumed that readers of this manual have a basic knowledge of:

    - C

    - C++

    - COBOL

    - OOCOBOL

    - Java

    - The Internet

    - Object-oriented technology

    - Distributed object technology (CORBA)

    - Relational databases

    - Basic knowledge of the OS used

    Structure of This Document

    The structure of this manual is as follows:

    Chapter 1 Basic Knowledge for Developing CORBA Applications

    This chapter outlines the development of CORBA applications.

    Chapter 2 Notes on Developing CORBA Applications

    This chapter provides notes on how to develop CORBA applications.

    Chapter 3 CORBA WorkUnits

    This chapter gives directs the user to the location of information on CORBA WorkUnits.

    Chapter 4 C Programming Guide

    This chapter explains how to develop CORBA applications in C.

    Chapter 5 C++ Programming Guide

    This chapter explains how to develop CORBA applications in C++.

    Chapter 6 Java Programming Guide

    This chapter explains how to develop CORBA applications in Java.

    Chapter 7 COBOL Programming Guide

    This chapter explains how to develop CORBA applications in COBOL.

    Chapter 8 Naming Service Programming

    This chapter explains the API (Application Programming Interface) and the programming that the Naming Service provides.

    - i -

  • Chapter 9 Interface Repository Service Programming

    This chapter explains the API (Application Programming Interface) and the programming provided by the Interface Repository Service.

    CChapter 10 CORBA Programming

    This chapter explains the technique of developing the CORBA application.

    Chapter 11 CORBA Interface

    This chapter explains CORBA interface that is used when programming application to handle object dynamically.

    Chapter 12 Obtaining Naming Service Initial References

    This chapter explains how to obtain initial references for the Naming Service.

    Appendix A IDL

    This appendix explains the IDL.

    Appendix B Programs Provided

    This appendix explains the programs that are provided by the CORBA Service.

    Appendix C Importing and Exporting Interface Definition Information

    This appendix explains how to move to the interface repository of the operating server the interface definition information that isrequired when a dynamic activation interface is used.

    Appendix D Collection of Maintenance Information

    This appendix explains how to collect maintenance information that is provided by the CORBA Service.

    Appendix E Sample Programs (Windows®)

    This appendix describes the sample Windows® programs that are provided.

    Appendix F Sample Programs (Solaris(TM) Operating System/Linux)

    This appendix describes the sample Solaris and Linux programs that are provided.

    Appendix G Dynamic Skeleton Interface: DSI

    This appendix explains Dynamic Skeleton Interface (DSI).

    Appendix H COM/CORBA Linkage Programming

    This appendix explains how to develop an application to link a CORBA server to an OLE2 automation controller on a personalcomputer.

    Appendix I Example of Session Management using the Object to Process Bind Function

    This appendix explains how to implement session management for an IDL definition using the Object to Process Bind function.

    Conventions

    Representation of Platform-specific Information

    In the manuals of this product, there are parts containing content that relates to all products that run on the supported platform. In this case,an icon indicating the product platform has been added to these parts if the content varies according to the product. For this reason, referonly to the information that applies to your situation.

    Indicates that this product (32-bit) is running on Windows.

    Indicates that this product (64-bit) is running on Windows.

    Indicates that this product (32/64-bit) is running on Windows.

    Indicates that this product (32-bit) is running on Solaris.

    Indicates that this product (64-bit) is running on Solaris.

    Indicates that this product (32/64-bit) is running on Solaris.

    - ii -

  • Indicates that this product (32-bit) is running on Linux.

    Indicates that this product (64-bit) is running on Linux.

    Indicates that this product (32/64-bit) is running on Linux.

    Abbreviations

    Read occurrences of the following Components as their corresponding Service.

    Service Component

    CORBA Service ObjectDirector

    Component Transaction Service TransactionDirector

    Export Controls

    Exportation/release of this document may require necessary procedures in accordance with the regulations of the Foreign Exchange andForeign Trade Control Law of Japan and/or US export control laws.

    Trademarks

    Trademarks of other companies are used in this documentation only to identify particular products or systems.

    Product Trademarks/Registered Trademarks

    Microsoft, Active Directory, ActiveX, Excel, Internet Explorer, MS-DOS, MSDN, Visual Basic, Visual C++,Visual Studio, Windows, Windows NT, Windows Server, Win32 are either registered trademarks or trademarksof Microsoft Corporation in the United States and/or other countries.

    Oracle and Java are registered trademarks of Oracle and/or its affiliates.

    Other company and product names in this documentation are trademarks or registered trademarks of their respective owners.

    Copyrights

    Copyright 1999-2014 FUJITSU LIMITED

    April 2014 Third Edition

    November 2012 First Edition

    - iii -

  • ContentsChapter 1 Basic Knowledge for Developing CORBA Applications...........................................................................................1

    1.1 Basic Models for CORBA Applications..............................................................................................................................................11.1.1 Two-layered Model.......................................................................................................................................................................11.1.2 Three-layered Model.....................................................................................................................................................................2

    1.2 CORBA Service Operating Mode.......................................................................................................................................................31.2.1 Operating Mode for Clients..........................................................................................................................................................31.2.2 Operating Mode for Servers.........................................................................................................................................................41.2.3 Operating Load Balance...............................................................................................................................................................6

    1.3 Designing CORBA Applications.........................................................................................................................................................71.3.1 Application Development Languages...........................................................................................................................................71.3.2 Server Application Startup Type..................................................................................................................................................71.3.3 Concurrency Control.....................................................................................................................................................................81.3.4 Instance Management System......................................................................................................................................................91.3.5 Client Application Interface..........................................................................................................................................................91.3.6 Server Application Interface.......................................................................................................................................................10

    1.4 CORBA Application Development Procedure..................................................................................................................................10

    Chapter 2 Notes on Developing CORBA Applications...........................................................................................................122.1 Coding................................................................................................................................................................................................12

    2.1.1 Data Area Allocation/Release Processing (C, C++, and COBOL).............................................................................................122.1.2 Signal Processing (C, C++, Java, and COBOL).........................................................................................................................132.1.3 Child Process/Thread Creation Exit Processing (C and C++)....................................................................................................132.1.4 ORB Initialization Processing (C, C++, and COBOL)...............................................................................................................142.1.5 oneway........................................................................................................................................................................................152.1.6 Server Application Exception Processing (C, C++, and COBOL).............................................................................................152.1.7 Server Application Exception Processing (C)............................................................................................................................152.1.8 Simultaneous Implementation of Server and Client Functions..................................................................................................162.1.9 Miscellaneous.............................................................................................................................................................................16

    2.2 Compilation and Linkage...................................................................................................................................................................162.2.1 Thread Mode and Process Mode................................................................................................................................................162.2.2 Common Notes on Creating CORBA Server Applications........................................................................................................172.2.3 Notes on Windows® Applications.............................................................................................................................................182.2.4 Notes on Solaris Applications.....................................................................................................................................................212.2.5 Notes on Linux Applications......................................................................................................................................................212.2.6 Examples of Server Application Compilation and Linkage (Solaris)........................................................................................21

    2.2.6.1 C Server Application (Thread Mode)..................................................................................................................................212.2.6.2 C Server Application (Process Mode).................................................................................................................................222.2.6.3 COBOL Server Application (Using Thread Mode).............................................................................................................222.2.6.4 COBOL Server Application (Using Process Mode)............................................................................................................23

    2.2.7 Compiling Java Applications......................................................................................................................................................23

    Chapter 3 CORBA WorkUnits................................................................................................................................................24

    Chapter 4 C Programming Guide...........................................................................................................................................254.1 Client Application Programming (Static Invocation Interface).........................................................................................................25

    4.1.1 Initialization................................................................................................................................................................................254.1.2 Retrieving a Naming Service Object Reference.........................................................................................................................254.1.3 Retrieving a Server Application Object Reference ....................................................................................................................264.1.4 Invoking a Server Application Method......................................................................................................................................26

    4.2 Client Application Programming (Dynamic Invocation Interface)...................................................................................................264.2.1 Initialization................................................................................................................................................................................274.2.2 Retrieving a Naming Service Object Reference.........................................................................................................................274.2.3 Retrieving Server Application Information from the Interface Repository................................................................................284.2.4 Assembling Parameters...............................................................................................................................................................294.2.5 Creating a Request......................................................................................................................................................................30

    - iv -

  • 4.2.6 Sending a Request.......................................................................................................................................................................314.2.6.1 Synchronous Communication..............................................................................................................................................314.2.6.2 Asynchronous Communication............................................................................................................................................31

    4.2.7 Deleting a Request......................................................................................................................................................................314.3 Client Application Exception Handling.............................................................................................................................................31

    4.3.1 System Exception.......................................................................................................................................................................324.3.2 User Exception............................................................................................................................................................................334.3.3 Obtaining Exception Information...............................................................................................................................................33

    4.4 Server Application Programming (Static Skeleton Interface)...........................................................................................................344.4.1 Initialization................................................................................................................................................................................344.4.2 Activating the Server..................................................................................................................................................................344.4.3 Interface Implementation Function.............................................................................................................................................354.4.4 Deactivating the Server...............................................................................................................................................................36

    4.5 Programming Server Application Exceptions...................................................................................................................................364.6 Registering of a Server Application...................................................................................................................................................38

    4.6.1 Registering in the Implementation Repository...........................................................................................................................384.6.2 Registering in the Naming Service.............................................................................................................................................39

    4.7 Mapping Data Types..........................................................................................................................................................................414.7.1 Basic Data Types........................................................................................................................................................................414.7.2 String Type.................................................................................................................................................................................424.7.3 Wide String Type........................................................................................................................................................................444.7.4 Any Type....................................................................................................................................................................................474.7.5 Sequence Type............................................................................................................................................................................504.7.6 Structure Type.............................................................................................................................................................................534.7.7 Union Type.................................................................................................................................................................................564.7.8 Array...........................................................................................................................................................................................604.7.9 Mapping Attribute Declaration (Attribute).................................................................................................................................634.7.10 Allocating and Releasing Parameter Area Using Dynamic Interface.......................................................................................654.7.11 Passing Parameters to a Server Application.............................................................................................................................66

    4.8 Any Type and Sequence Type Release Flags....................................................................................................................................674.9 Notes on Application Development...................................................................................................................................................67

    Chapter 5 C++ Programming Guide.......................................................................................................................................685.1 Client Application Programming (Static Invocation Interface).........................................................................................................68

    5.1.1 Initialization................................................................................................................................................................................685.1.2 Retrieving a Naming Service Object Reference.........................................................................................................................685.1.3 Retrieving a Server Application Object Reference.....................................................................................................................695.1.4 Invoking a Method Implemented in a Server Application.........................................................................................................69

    5.2 Client Application Programming (Dynamic Invocation Interface)...................................................................................................695.2.1 Initialization................................................................................................................................................................................705.2.2 Retrieving a Naming Service Object Reference.........................................................................................................................705.2.3 Retrieving Server Application Information from the Interface Repository................................................................................715.2.4 Assembling Parameters...............................................................................................................................................................725.2.5 Creating a Request......................................................................................................................................................................735.2.6 Sending a Request.......................................................................................................................................................................74

    5.2.6.1 Synchronous Communication..............................................................................................................................................745.2.7 Deleting a Request......................................................................................................................................................................74

    5.3 Client Application Exception Handling.............................................................................................................................................745.4 Server Application Programming (Static Invocation Interface)........................................................................................................77

    5.4.1 Initialization................................................................................................................................................................................785.4.2 Activating the Server..................................................................................................................................................................785.4.3 Interface Implementation Functions...........................................................................................................................................795.4.4 Deactivating the Server...............................................................................................................................................................82

    5.5 Server Application Exception Handling............................................................................................................................................825.5.1 Obtaining Exception Information...............................................................................................................................................84

    5.6 Registering a Server Application.......................................................................................................................................................845.6.1 Registering in the Implementation Repository...........................................................................................................................84

    - v -

  • 5.6.2 Registering in the Naming Service.............................................................................................................................................855.7 Data Type Mapping...........................................................................................................................................................................87

    5.7.1 Basic Data Types........................................................................................................................................................................875.7.2 String Type.................................................................................................................................................................................885.7.3 Wide String Type........................................................................................................................................................................905.7.4 Any Type....................................................................................................................................................................................925.7.5 Sequence Type..........................................................................................................................................................................1015.7.6 Structure....................................................................................................................................................................................1095.7.7 Union........................................................................................................................................................................................1125.7.8 Array.........................................................................................................................................................................................1175.7.9 Mapping Interface Declaration (Interface)...............................................................................................................................1205.7.10 Mapping Attribute Declaration (Attribute).............................................................................................................................1225.7.11 Allocating and Releasing Parameter Area Using Dynamic Interface.....................................................................................1245.7.12 Passing Parameters to a Server Application...........................................................................................................................132

    5.8 Any Type and Sequence Type Release Flags..................................................................................................................................1335.9 VAR Classes....................................................................................................................................................................................135

    5.9.1 String_var Class........................................................................................................................................................................1365.9.2 WString_var Class....................................................................................................................................................................1395.9.3 Any_var Class...........................................................................................................................................................................1435.9.4 User Defined var Class.............................................................................................................................................................146

    5.10 Notes on Application Development...............................................................................................................................................151

    Chapter 6 Java Programming Guide....................................................................................................................................1526.1 Java Applet Development Procedure...............................................................................................................................................152

    6.1.1 Development Procedure (Pre-installed Library).......................................................................................................................1536.1.1.1 Descriptions of HTML Files..............................................................................................................................................1536.1.1.2 Applet Programming..........................................................................................................................................................1536.1.1.3 IDL Creation Files and Applet Compilation......................................................................................................................1546.1.1.4 Java Class File Archives....................................................................................................................................................154

    6.1.2 Development Procedure (Portable-ORB).................................................................................................................................1556.1.2.1 Descriptions of HTML Files..............................................................................................................................................1556.1.2.2 Applet Programming..........................................................................................................................................................1576.1.2.3 IDL Creation Files and Applet Compilation......................................................................................................................1586.1.2.4 Java Class File Archives....................................................................................................................................................158

    6.1.3 Registering Java Applets with a Web Server............................................................................................................................1596.2 Server Application Development Procedures and Environment Settings.......................................................................................160

    6.2.1 Creating and Compiling IDL Files...........................................................................................................................................1606.2.2 Creating Server Applications....................................................................................................................................................1616.2.3 Compiling Java Files................................................................................................................................................................1616.2.4 Creating Launch Files...............................................................................................................................................................1616.2.5 Registration in Implementation Repositories...........................................................................................................................1626.2.6 Security Manager Settings .......................................................................................................................................................163

    6.3 Execution of CORBA Applications.................................................................................................................................................1636.3.1 ORB (Object Request Broker) Setup........................................................................................................................................163

    6.4 Client Setup (Pre-installed Java Clients).........................................................................................................................................1656.4.1 Description of HTML Files......................................................................................................................................................1656.4.2 Setting Permission for Java Libraries.......................................................................................................................................1666.4.3 Library Settings ........................................................................................................................................................................1676.4.4 Security Manager Settings .......................................................................................................................................................167

    6.5 Client Setup (Portable-ORB)...........................................................................................................................................................1676.5.1 Description of HTML Files......................................................................................................................................................1686.5.2 Setting Permission for Java Libraries.......................................................................................................................................1686.5.3 Setting Signature for Java Libraries..........................................................................................................................................1706.5.4 Library Settings.........................................................................................................................................................................1706.5.5 Portable-ORB Operation Environment File Settings................................................................................................................171

    6.6 Server Setup.....................................................................................................................................................................................1756.7 Digital Signatures in Applets...........................................................................................................................................................175

    - vi -

  • 6.7.1 Digital Signature Overview......................................................................................................................................................1766.7.2 Download Objects and Signature Objects................................................................................................................................1766.7.3 Digital Signature Procedure......................................................................................................................................................1766.7.4 policytool Command Setting (Supplements)............................................................................................................................180

    6.8 Client Application Programming (Static Invocation Interface).......................................................................................................1916.8.1 Initialization..............................................................................................................................................................................1926.8.2 Getting NamingService Object References..............................................................................................................................1936.8.3 Getting Server Application Object References.........................................................................................................................1936.8.4 Invoking Methods.....................................................................................................................................................................193

    6.9 Exception Handling for Client Applications...................................................................................................................................1946.10 Examples of Simple Server Application Creation.........................................................................................................................197

    6.10.1 Work Flow..............................................................................................................................................................................1986.10.2 Creating and Compiling IDL Files.........................................................................................................................................1986.10.3 Creating Server Application Source Files..............................................................................................................................1996.10.4 Creating Client Application Source Files...............................................................................................................................1996.10.5 Compiling Java Files..............................................................................................................................................................1996.10.6 Creating and Registering Def Files.........................................................................................................................................1996.10.7 Creating Launch Files.............................................................................................................................................................2006.10.8 Running Applications.............................................................................................................................................................2006.10.9 Application Execution Results................................................................................................................................................2016.10.10 Deleting Server Application Data.........................................................................................................................................201

    6.11 Instance Control and Application Configuration...........................................................................................................................2026.11.1 Types of Application Configurations.....................................................................................................................................2026.11.2 Configuring Each Application................................................................................................................................................2066.11.3 A Comparison of Application Configurations........................................................................................................................210

    6.12 Server Application Programming POA Overview........................................................................................................................2106.12.1 What is POA?.........................................................................................................................................................................2106.12.2 POA Architecture...................................................................................................................................................................2126.12.3 POA Objects...........................................................................................................................................................................2136.12.4 Creating Object References....................................................................................................................................................2186.12.5 Relating Object References, Object IDs, and Servant Objects...............................................................................................2196.12.6 Object Activation....................................................................................................................................................................2206.12.7 Request Processing.................................................................................................................................................................2216.12.8 Implicit Activation..................................................................................................................................................................2226.12.9 POAManager Objects.............................................................................................................................................................2226.12.10 ServantManager Objects.......................................................................................................................................................2236.12.11 AdapterActivator Objects.....................................................................................................................................................226

    6.13 Relating Server Applications and Environment Settings..............................................................................................................2286.13.1 Relating Implementation Information....................................................................................................................................2286.13.2 Methods for Creating Object References................................................................................................................................2286.13.3 Sample Methods for POA Uses..............................................................................................................................................229

    6.14 Programming Server Applications (Static Skeleton Interface)......................................................................................................2326.14.1 Initialization............................................................................................................................................................................2336.14.2 RootPOA Object Reference Acquisition................................................................................................................................2346.14.3 Descendant POA Creation......................................................................................................................................................2346.14.4 Interface Implementation........................................................................................................................................................2356.14.5 Registration with AOM (Activation)......................................................................................................................................2356.14.6 Registering with NamingService............................................................................................................................................2356.14.7 Object Reference Pre-creation/Registration...........................................................................................................................2366.14.8 POAManager Activation and Termination Standby...............................................................................................................236

    6.15 Server Application Exception Handling........................................................................................................................................2376.16 Server Application Implementation Approaches...........................................................................................................................238

    6.16.1 Inheritance-based and Delegation-based Implementation......................................................................................................2386.16.2 Inheritance-based Method Servant Implementation...............................................................................................................2396.16.3 Delegation-based Method Servant Implementation...............................................................................................................2406.16.4 A Comparison of Inheritance-based and Delegation-based Methods....................................................................................241

    6.17 Instance Analysis at Client Termination........................................................................................................................................241

    - vii -

  • 6.17.1 Constructing a Class to Run Instance Analysis Processing....................................................................................................2426.17.2 Implementing Instance Analysis Processing..........................................................................................................................2426.17.3 Registering Class Instances for Running Instance Analysis Processing................................................................................2426.17.4 Modifying/Deleting Class Instances for Running Instance Analysis Processing...................................................................242

    6.18 Programming Examples of Server Applications...........................................................................................................................2426.18.1 Default Servant (Default Instances Method)..........................................................................................................................2436.18.2 Active Object Map (AOM) Sample Usage (Factory-1 Method)............................................................................................2466.18.3 Servant Activator Sample Usage (Factory-2 Method)...........................................................................................................2506.18.4 Servant Locator Sample Usage (User Instance Control Method)...........................................................................................2556.18.5 Sample AdapterActivator Applications (find_POA)..............................................................................................................2606.18.6 AdapterActivator Sample Usage (Request Reception)...........................................................................................................2686.18.7 Delegation-Based Method Sample Usage (Default Instances)...............................................................................................2726.18.8 Active Object Map (AOM) Sample Usage (Factory-1 Method Instance Analysis)...............................................................276

    6.19 Mapping to Data Types..................................................................................................................................................................2816.19.1 Basic Data Types....................................................................................................................................................................2816.19.2 String Type.............................................................................................................................................................................2826.19.3 Wide String Type....................................................................................................................................................................2856.19.4 Enumerator Type....................................................................................................................................................................2886.19.5 Any Type................................................................................................................................................................................2936.19.6 Sequence Type........................................................................................................................................................................2996.19.7 Structures................................................................................................................................................................................3046.19.8 Unions.....................................................................................................................................................................................3116.19.9 Arrays......................................................................................................................................................................................3196.19.10 Mapping Attribute Declaration (Attribute)...........................................................................................................................3276.19.11 Mapping Constant Declaration (const).................................................................................................................................3296.19.12 Passing Parameters to Server Applications..........................................................................................................................331

    6.20 Notes..............................................................................................................................................................................................3336.20.1 Notes on Application Development........................................................................................................................................3336.20.2 Notes on Applet Operation in the Client Environment...........................................................................................................3336.20.3 Other Precautions....................................................................................................................................................................333

    Chapter 7 COBOL Programming Guide...............................................................................................................................3347.1 Client Application Programming (Static Invocation Interface).......................................................................................................334

    7.1.1 Initialization..............................................................................................................................................................................3347.1.2 Retrieving a Naming Service Object Reference.......................................................................................................................3367.1.3 Retrieving a Server Application Object Reference...................................................................................................................3367.1.4 Invoking a Method....................................................................................................................................................................337

    7.2 Client Application Programming (Dynamic Invocation Interface).................................................................................................3377.2.1 Initialization..............................................................................................................................................................................3387.2.2 Retrieving a Naming Service Object Reference.......................................................................................................................3407.2.3 Retrieving Server Application Information from the Interface Repository..............................................................................3407.2.4 Assembling Parameters.............................................................................................................................................................3427.2.5 Creating a Request....................................................................................................................................................................3437.2.6 Sending a Request.....................................................................................................................................................................3447.2.7 Deleting a Request....................................................................................................................................................................345

    7.3 Client Application Exception Processing........................................................................................................................................3457.4 Server Application Programming (Static Invocation Interface)......................................................................................................347

    7.4.1 Initialization..............................................................................................................................................................................3477.4.2 Activating the Server................................................................................................................................................................3497.4.3 Interface Installation Functions................................................................................................................................................3507.4.4 Deactivating the Server.............................................................................................................................................................353

    7.5 Server Application Exception Handling..........................................................................................................................................3537.6 Registering a Server Application.....................................................................................................................................................356

    7.6.1 Registering in the Implementation Repository.........................................................................................................................3567.6.2 Registering in the Naming Service...........................................................................................................................................357

    7.7 Handling Data Types.......................................................................................................................................................................3617.7.1 String Type...............................................................................................................................................................................362

    - viii -

  • 7.7.2 Wide String Type......................................................................................................................................................................3667.7.3 Any Type..................................................................................................................................................................................3697.7.4 Sequence Type..........................................................................................................................................................................3757.7.5 Structure Type...........................................................................................................................................................................3857.7.6 Union........................................................................................................................................................................................3917.7.7 Fixed-point................................................................................................................................................................................3977.7.8 Array.........................................................................................................................................................................................4047.7.9 Mapping Attribute Declaration (attribute)................................................................................................................................4117.7.10 Sending Parameters to the Server Application.......................................................................................................................417

    7.8 Any Type and Sequence Type Release Flags..................................................................................................................................4197.9 Notes on the Use of COBOL Mapping............................................................................................................................................4217.10 COBOL Library.............................................................................................................................................................................437

    7.10.1 Use Example...........................................................................................................................................................................4377.10.2 Library Texts...........................................................................................................................................................................438

    Chapter 8 Naming Service Programming.............................................................................................................................4488.1 Naming Service Overview...............................................................................................................................................................448

    8.1.1 Naming Service Interfaces........................................................................................................................................................4498.2 Naming Context Interface................................................................................................................................................................452

    8.2.1 Data Types Handled by the Naming Context Interface............................................................................................................4528.2.2 Exceptions Generated when the Naming Context Interface is Invoked...................................................................................4538.2.3 Creating Bindings.....................................................................................................................................................................4548.2.4 Retrieving Bindings..................................................................................................................................................................4558.2.5 Deleting Bindings.....................................................................................................................................................................4558.2.6 Creating Naming Contexts........................................................................................................................................................4568.2.7 Deleting Naming Contexts........................................................................................................................................................4568.2.8 Obtaining Binding Lists............................................................................................................................................................456

    8.3 Binding Iterator Interface.................................................................................................................................................................4568.4 Character String Binding Names.....................................................................................................................................................457

    8.4.1 Basic Notation of Character String Binding Names.................................................................................................................4578.4.2 Escape Function for Character String Binding Names.............................................................................................................458

    8.5 URL Schemas..................................................................................................................................................................................4588.5.1 IOR URL Schema.....................................................................................................................................................................4588.5.2 corbaloc URL Schema..............................................................................................................................................................4588.5.3 corbaname URL Schema..........................................................................................................................................................459

    8.6 Conversion Between Binding Names, URLs, and IORs.................................................................................................................4608.7 Naming Service Programming Examples........................................................................................................................................460

    8.7.1 Retrieving Objects under Contexts...........................................................................................................................................4608.7.2 Registering Objects under Contexts.........................................................................................................................................4678.7.3 Retrieving Object Lists under Contexts....................................................................................................................................475

    Chapter 9 Interface Repository Service Programming.........................................................................................................4859.1 Types of Objects Managed by the Interface Repository Service.....................................................................................................4859.2 Interface Repository Object Relationships (Inclusion/Inheritance).................................................................................................4859.3 Interface Repository Service Interface............................................................................................................................................486

    9.3.1 Interfaces Provided by Interface Repository Service...............................................................................................................4869.3.2 Inheritance Relationships between Interfaces...........................................................................................................................493

    9.4 Interface Repository Service Programming.....................................................................................................................................4959.4.1 Retrieving a Root Repository Object Reference.......................................................................................................................4969.4.2 Searching for an Interface Repository Object...........................................................................................................................4969.4.3 Retrieving Interface Information..............................................................................................................................................4969.4.4 Examples of Interface Repository Service Programming.........................................................................................................496

    9.4.4.1 Example 1: Retrieving OperationDef Object Information................................................................................................4979.4.4.2 Example 2: Retrieving Information on StructDef and AliasDef Objects..........................................................................501

    Chapter 10 CORBA Programming.......................................................................................................................................50810.1 Factory...........................................................................................................................................................................................508

    10.1.1 Server Application Programming...........................................................................................................................................508

    - ix -

  • 10.1.2 Client Application Programming............................................................................................................................................50910.1.3 Implementing Private Area.....................................................................................................................................................51010.1.4 Initializing Private Data for Each Client.................................................................................................................................51110.1.5 Programming for Termination Processing..............................................................................................................................51310.1.6 Registering the Processing Function Used when Disconnecting from a Client.....................................................................514

    10.2 Object to Process Bind Function...................................................................................................................................................51510.2.1 Definition Information............................................................................................................................................................51510.2.2 API Used by Object to Process Bind Function.......................................................................................................................51510.2.3 Object and Instance Relationship...........................................................................................................................................51610.2.4 Request Distribution Method..................................................................................................................................................51610.2.5 Session Timeout Function......................................................................................................................................................51610.2.6 Ending the Process..................................................................................................................................................................516

    10.3 Compiling Multiple IDL Files.......................................................................................................................................................51710.3.1 #include Statement..................................................................................................................................................................51710.3.2 When to Use the -noinclude Function....................................................................................................................................51810.3.3 Using -noinclude.....................................................................................................................................................................51810.3.4 Notes.......................................................................................................................................................................................51910.3.5 Handling Problems.................................................................................................................................................................519

    10.4 Multiple Interface Implementation to One Process.......................................................................................................................51910.4.1 Invoking Different Object Methods within a Program...........................................................................................................52010.4.2 Implementing One Interface in One Process..........................................................................................................................52010.4.3 Implementing Multiple Interfaces in One Process.................................................................................................................521

    10.5 Application Libraries.....................................................................................................................................................................52310.5.1 Creating Libraries...................................................................................................................................................................52310.5.2 Inheritance and Libraries of the Interface...............................................................................................................................52610.5.3 Notes on Creating Libraries....................................................................................................................................................52810.5.4 Example of the Server as a Library........................................................................................................................................529

    10.6 Thread Type and Process Type Applications................................................................................................................................53210.6.1 Creating Thread Type and Process Type Applications..........................................................................................................53210.6.2 Simultaneously Implementing Server and Client...................................................................................................................533

    10.7 Locating Server Applications in Multiple Hosts...........................................................................................................................53410.7.1 Server Application Programming...........................................................................................................................................53410.7.2 Registering the Server Application.........................................................................................................................................53510.7.3 Client Application Programming............................................................................................................................................53510.7.4 Setting up the Environment....................................................................................................................................................536

    10.8 The exit Function...........................................................................................................................................................................53610.8.1 Registering the exit Function..................................................................................................................................................53610.8.2 Monitoring the Maximum Processing Time of the exit Function..........................................................................................53610.8.3 Notes about Using the exit Function.......................................................................................................................................53710.8.4 Exit Function Examples..........................................................................................................................................................537

    10.9 Notes on Application Development...............................................................................................................................................539

    Chapter 11 CORBA Interface...............................................................................................................................................54111.1 TypeCode Object...........................................................................................................................................................................541

    11.1.1 TypeCode Object....................................................................................................................................................................54111.1.2 TypeCode Interface.................................................................................................................................................................542

    11.2 NVList Object................................................................................................................................................................................54411.2.1 NVList Object.........................................................................................................................................................................54411.2.2 NVList Interface.....................................................................................................................................................................544

    11.3 Context Object...............................................................................................................................................................................54511.3.1 Context Object........................................................................................................................................................................54511.3.2 Context Interface.....................................................................................................................................................................54611.3.3 Context Interface Examples....................................................................................................................................................548

    Chapter 12 Obtaining Naming Service Initial References....................................................................................................55212.1 ORBInitRef....................................................................................................................................................................................55212.2 ORBDefaultInitRef........................................................................................................................................................................55212.3 Initial Service Retrieval Order.......................................................................................................................................................552

    - x -

  • 12.4 corbaloc URL Schemas.................................................................................................................................................................55312.4.1 corbaloc URL Schema............................................................................................................................................................55312.4.2 corbaloc:rir URL.....................................................................................................................................................................55412.4.3 corbaloc:iiop URL..................................................................................................................................................................554

    Appendix A IDL.....................................................................................................................................................................556A.1 IDL Format.....................................................................................................................................................................................556

    A.1.1 Comments................................................................................................................................................................................556A.1.2 Identifiers.................................................................................................................................................................................557A.1.3 Constants..................................................................................................................................................................................557A.1.4 Delimiters.................................................................................................................................................................................558A.1.5 Name and Scope......................................................................................................................................................................558A.1.6 Differences to C++...................................................................................................................................................................560A.1.7 Pre-processing..........................................................................................................................................................................560

    A.2 Module Declaration........................................................................................................................................................................562A.3 Interface Declaration.......................................................................................................................................................................562

    A.3.1 Inheritance................................................................................................................................................................................563A.4 Operation Declaration.....................................................................................................................................................................565A.5 Attribute Declaration......................................................................................................................................................................566A.6 Constant Declaration.......................................................................................................................................................................566A.7 Data Types and Type Declaration...................................................................................................................................................568

    A.7.1 IDL-supported Data Types......................................................................................................................................................568A.7.2 Basic Data Types.....................................................................................................................................................................569A.7.3 Sequences.................................................................................................................................................................................570A.7.4 Structures.................................................................................................................................................................................570A.7.5 Unions......................................................................................................................................................................................571A.7.6 Fixed........................................................................................................................................................................................572A.7.7 Object Reference......................................................................................................................................................................573A.7.8 TypeCode.................................................................................................................................................................................573A.7.9 Arrays.......................................................................................................................................................................................573

    A.8 Exception Declaration.....................................................................................................................................................................573A.9 IDL Syntax......................................................................................................................................................................................574A.10 IDL Usage in TD..........................................................................................................................................................................579

    Appendix B Programs Provided...........................................................................................................................................582B.1 Programs Provided by the CORBA Service...................................................................................................................................582

    B.1.1 Include Files.............................................................................................................................................................................582B.1.2 Libraries...................................................................................................................................................................................583

    B.1.2.1 Server Libraries.................................................................................................................................................................584B.1.2.2 Client Libraries..................................................................................................................................................................587

    B.2 Programs Provided by Portable-ORB.............................................................................................................................................588

    Appendix C Importing and Exporting Interface Definition Information..................................................................................589C.1 Registering Interface Definition Information..................................................................................................................................589C.2 The Flow of Procedure from Program Development to Operation.................................................................................................589C.3 Execution Examples........................................................................................................................................................................589

    C.3.1 Exporting the Interface Definition Information.......................................................................................................................589C.3.2 Importing the Interface Definition Information.......................................................................................................................590

    Appendix D Collection of Maintenance Information..............................................................................................................591D.1 Trace Function................................................................................................................................................................................591

    D.1.1 Content and Collection Command of the Trace Information..................................................................................................591D.1.2 Event Type and Collection Timing..........................................................................................................................................592D.1.3 Preparation for Trace Information Collection..........................................................................................................................597D.1.4 Trace Information Collection Procedure.................................................................................................................................599D.1.5 Trace Information in Text Output............................................................................................................................................599D.1.6 Trace Information Analysis.....................................................................................................................................................600

    D.2 Snapshot Function...........................................................................................................................................................................601

    - xi -

  • D.2.1 Function Overview...................................................................................................................................................................602D.2.2 Environment Setup...................................................................................................................................................................602D.2.3 Operations................................................................................................................................................................................602

    D.2.3.1 Collecting Snapshot Information......................................................................................................................................602D.2.3.2 Snapshot Information Output Format...............................................................................................................................603D.2.3.3 Analyzing Snapshot Information......................................................................................................................................604

    D.2.4 CORBA Service Naming Service User Exception Log Collection.........................................................................................606D.2.5 Log Data...................................................................................................................................................................................606D.2.6 Log Collection Environment (nsconfig File)...........................................................................................................................607

    Appendix E Sample Programs (Windows®).........................................................................................................................609E.1 Sample CORBA Service Programs.................................................................................................................................................609

    E.1.1 Types of Sample Programs.......................................................................................................................................................609E.1.2 Execution Procedure of Sample Programs...