The Common Object Request Broker: Architecture and Specification
Editorial Revision: CORBA 2.4.2: February 2001 Editorial Revision: CORBA 2.4.1: November 2000 Revision 2.4: October 2000
Copyright 1998, 1999, Alcatel Copyright 1997, 1998, 1999 BEA Systems, Inc. Copyright 1995, 1996 BNR Europe Ltd. Copyright 1998, Borland International Copyright 1998, Cooperative Research Centre for Distributed Systems Technology (DSTC Pty Ltd) Copyright 1991, 1992, 1995, 1996, Digital Equipment Corporation Copyright 1995, 1996, 1998, Expersoft Corporation Copyright 1996, 1997 FUJITSU LIMITED Copyright 1996, Genesis Development Corporation Copyright 1989, 1990, 1991, 1992, 1995, 1996, 1998, 1999, Hewlett-Packard Company Copyright 1998, 1999, Highlander Communications, L.C. Copyright 1991, 1992, 1995, 1996 HyperDesk Corporation Copyright 1998, 1999, Inprise Corporation Copyright 1996, 1997, 1998, International Business Machines Corporation Copyright 1995, 1996 ICL, plc Copyright 1998, 1999, Inprise Corporation Copyright 1998, International Computers, Ltd. Copyright 1995, 1996, 1998, 1999, IONA Technologies, Ltd. Copyright 1998, 1999, Lockheed Martin Federal Systems, Inc. Copyright 1998, 1999, Lucent Technologies, Inc. Copyright 1996, 1997 Micro Focus Limited Copyright 1991, 1992, 1995, 1996 NCR Corporation Copyright 1998, NEC Corporation Copyright 1998, Netscape Communications Corporation Copyright 1998, 1999, Nortel Networks Copyright 1998, 1999, Northern Telecom Corporation Copyright 1995, 1996, 1998, Novell USG Copyright 1991, 1992, 1995, 1996 by Object Design, Inc. Copyright 1991- 2001 Object Management Group, Inc. Copyright 1998, 1999, Objective Interface Systems, Inc. Copyright 1998, 1999, Object-Oriented Concepts, Inc. Copyright 1998, Oracle Corporation Copyright 1998, PeerLogic, Inc. Copyright 1996, Siemens Nixdorf Informationssysteme AG Copyright 1991, 1992, 1995, 1996, 1998, 1999, Sun Microsystems, Inc. Copyright 1995, 1996, SunSoft, Inc. Copyright 1996, Sybase, Inc. Copyright 1998, Telefónica Investigación y Desarrollo S.A. Unipersonal Copyright 1998, TIBCO, Inc. Copyright 1998, 1999, Tri-Pacific Software, Inc. Copyright 1996, Visual Edge Software, Ltd.
The companies listed above have granted to the Object Management Group, Inc. (OMG) a nonexclusive, royalty-free, paid up, worldwide license to copy and distribute this document and to modify this document and distribute copies of the modified version. Each of the copyright holders listed above has agreed that no person shall be deemed to have infringed the copyright in the included material of any such copyright holder by reason of having used the specification set forth herein or having conformed any computer software to the specification.
PATENT The attention of adopters is directed to the possibility that compliance with or adoption of OMG specifications may require use of an invention covered by patent rights. OMG shall not be responsible for identifying patents for which a license may be required by any OMG specification, or for conducting legal inquiries into the legal validity or scope of those patents that are brought to its attention. OMG specifications are prospective and advisory only. Prospective users are responsible for protecting themselves against liability for infringement of patents.
NOTICE The information contained in this document is subject to change without notice. The material in this document details an Object Management Group specification in accordance with the license and notices set forth on this page. This document does not represent a commitment to implement any portion of this specification in any company's products. WHILE THE INFORMATION IN THIS PUBLICATION IS BELIEVED TO BE ACCURATE, THE OBJECT MANAGEMENT GROUP AND THE COMPANIES LISTED ABOVE MAKE NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL INCLUDING, BUT NOT LIMITED TO ANY WARRANTY OF TITLE OR OWNERSHIP, IMPLIED WARRANTY OF MERCHANTABILITY OR WARRANTY OF FITNESS FOR PARTICULAR PURPOSE OR USE. In no event shall The Object Management Group or any of the companies listed above be liable for errors contained herein or for indirect, incidental, special, consequential, reliance or cover damages, including loss of profits, revenue, data or use, incurred by any user or any third party. The copyright holders listed above acknowledge that the Object Management Group (acting itself or through its designees) is and shall at all times be the sole entity that may authorize developers, suppliers and sellers of computer software to use certification marks, trademarks or other special designations to indicate compliance with these materials. This document contains information which is protected by copyright. All Rights Reserved. No part of this work covered by copyright herein may be reproduced or used in any form or by any means--graphic, electronic, or mechanical, including photocopying, recording, taping, or information storage and retrieval systems--without permission of the copyright owner. RESTRICTED RIGHTS LEGEND. Use, duplication, or disclosure by government is subject to restrictions as set forth in subdivision (c) (1) (ii) of the Right in Technical Data and Computer Software Clause at DFARS 252.227.7013 OMG®and Object Management are registered trademarks of the Object Management Group, Inc. Object Request Broker, OMG IDL, ORB, CORBA, CORBAfacilities, CORBAservices, COSS, and IIOP are trademarks of the Object Management Group, Inc. X/Open is a trademark of X/Open Company Ltd.
ISSUE REPORTING All OMG specifications are subject to continuous review and improvement. As part of this process we encourage readers to report any ambiguities, inconsistencies, or inaccuracies they may find by completing the issue reporting form at http://www.omg.org/library/issuerpt.htm.
Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
i
1. The Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1-1
1.1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1-1
1.2
Object Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.1 Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.2 Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.3 Object Creation and Destruction. . . . . . . . . . . . 1.2.4 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1-2 1-2 1-3 1-4 1-4
1.2.4.1 Basic types . . . . . . . . . . . . . . . . . . . . . . . . 1.2.4.2 Constructed types . . . . . . . . . . . . . . . . . .
1-4 1-5
Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Value Types . . . . . . . . . . . . . . . . . . . . . . . . . . . Abstract Interfaces . . . . . . . . . . . . . . . . . . . . . . Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1-6 1-6 1-7 1-7
1.2.8.1 Parameters . . . . . . . . . . . . . . . . . . . . . . . . 1.2.8.2 Return Result . . . . . . . . . . . . . . . . . . . . . . 1.2.8.3 Exceptions . . . . . . . . . . . . . . . . . . . . . . . . 1.2.8.4 Contexts . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.8.5 Execution Semantics . . . . . . . . . . . . . . . .
1-8 1-8 1-8 1-8 1-8
Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1-9
1.2.5 1.2.6 1.2.7 1.2.8
1.2.9 1.3
Object Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9 1.3.1 The Execution Model: Performing Services . . . 1-9 1.3.2 The Construction Model . . . . . . . . . . . . . . . . . . 1-10
2. CORBA Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1
CORBA, v2.4.2
Structure of an Object Request Broker . . . . . . . . . . . . . . . . 2.1.1 Object Request Broker . . . . . . . . . . . . . . . . . . .
February 2001
2-1 2-1 2-6
1
Contents 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6
Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Object Implementations . . . . . . . . . . . . . . . . . . Object References. . . . . . . . . . . . . . . . . . . . . . . OMG Interface Definition Language . . . . . . . . Mapping of OMG IDL to Programming Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . Client Stubs . . . . . . . . . . . . . . . . . . . . . . . . . . . Dynamic Invocation Interface. . . . . . . . . . . . . . Implementation Skeleton . . . . . . . . . . . . . . . . . Dynamic Skeleton Interface . . . . . . . . . . . . . . . Object Adapters . . . . . . . . . . . . . . . . . . . . . . . . ORB Interface. . . . . . . . . . . . . . . . . . . . . . . . . . Interface Repository . . . . . . . . . . . . . . . . . . . . . Implementation Repository . . . . . . . . . . . . . . .
2-8 2-9 2-9 2-9 2-10 2-10 2-10 2-11 2-11
2.2
Example ORBs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.1 Client- and Implementation-resident ORB . . . . 2.2.2 Server-based ORB . . . . . . . . . . . . . . . . . . . . . . 2.2.3 System-based ORB. . . . . . . . . . . . . . . . . . . . . . 2.2.4 Library-based ORB . . . . . . . . . . . . . . . . . . . . .
2-11 2-11 2-12 2-12 2-12
2.3
Structure of a Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12
2.4
Structure of an Object Implementation . . . . . . . . . . . . . . . 2-13
2.5
Structure of an Object Adapter. . . . . . . . . . . . . . . . . . . . . . 2-15
2.6
CORBA Required Object Adapter. . . . . . . . . . . . . . . . . . . . 2-17 2.6.1 Portable Object Adapter . . . . . . . . . . . . . . . . . . 2-17
2.7
The Integration of Foreign Object Systems . . . . . . . . . . . . 2-17
2.1.7 2.1.8 2.1.9 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14
3. OMG IDL Syntax and Semantics. . . . . . . . . . . . . . . . . . . . .
3-1
3.1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-2
3.2
Lexical Conventions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.1 Tokens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.2 Comments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.3 Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-3 3-5 3-6 3-6
3.2.3.1 Escaped Identifiers . . . . . . . . . . . . . . . . .
3-6
Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-7 3-8
3.2.5.1 Integer Literals . . . . . . . . . . . . . . . . . . . . 3.2.5.2 Character Literals . . . . . . . . . . . . . . . . . . 3.2.5.3 Floating-point Literals . . . . . . . . . . . . . . . 3.2.5.4 String Literals . . . . . . . . . . . . . . . . . . . . . 3.2.5.5 Fixed-Point Literals . . . . . . . . . . . . . . . . .
3-8 3-9 3-10 3-10 3-11
3.2.4 3.2.5
3.3
2
2-7 2-7 2-8 2-8
CORBA, v2.4.2
Preprocessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11
February 2001
Contents 3.4
OMG IDL Grammar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11
3.5
OMG IDL Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
3.6
Module Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
3.7
Interface Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.7.1 Interface Header . . . . . . . . . . . . . . . . . . . . . . . . 3.7.2 Interface Inheritance Specification . . . . . . . . . . 3.7.3 Interface Body . . . . . . . . . . . . . . . . . . . . . . . . . 3.7.4 Forward Declaration . . . . . . . . . . . . . . . . . . . . . 3.7.5 Interface Inheritance . . . . . . . . . . . . . . . . . . . . .
3.8
Value Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-24 3.8.1 Regular Value Type. . . . . . . . . . . . . . . . . . . . . . 3-24
3.8.2 3.8.3 3.8.4 3.8.5
3-17 3-17 3-17 3-18 3-18 3-19
3.8.1.1 Value Header . . . . . . . . . . . . . . . . . . . . . . 3.8.1.2 Value Element . . . . . . . . . . . . . . . . . . . . . 3.8.1.3 Value Inheritance Specification . . . . . . . 3.8.1.4 State Members . . . . . . . . . . . . . . . . . . . . . 3.8.1.5 Initializers . . . . . . . . . . . . . . . . . . . . . . . . 3.8.1.6 Value Type Example . . . . . . . . . . . . . . . .
3-24 3-24 3-25 3-25 3-25 3-26
Boxed Value Type. . . . . . . . . . . . . . . . . . . . . . . Abstract Value Type . . . . . . . . . . . . . . . . . . . . . Value Forward Declaration . . . . . . . . . . . . . . . . Valuetype Inheritance . . . . . . . . . . . . . . . . . . . .
3-26 3-27 3-27 3-28
3.9
Constant Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-29 3.9.1 Syntax. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-29 3.9.2 Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-30
3.10
Type Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-33 3.10.1 Basic Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-34 3.10.1.1 Integer Types . . . . . . . . . . . . . . . . . . . . . 3.10.1.2 Floating-Point Types . . . . . . . . . . . . . . . 3.10.1.3 Char Type . . . . . . . . . . . . . . . . . . . . . . . . 3.10.1.4 Wide Char Type . . . . . . . . . . . . . . . . . . 3.10.1.5 Boolean Type . . . . . . . . . . . . . . . . . . . . 3.10.1.6 Octet Type . . . . . . . . . . . . . . . . . . . . . . . 3.10.1.7 Any Type . . . . . . . . . . . . . . . . . . . . . . . .
3-35 3-35 3-35 3-36 3-36 3-36 3-36
3.10.2 Constructed Types . . . . . . . . . . . . . . . . . . . . . . 3-36 3.10.2.1 Structures . . . . . . . . . . . . . . . . . . . . . . . . 3.10.2.2 Discriminated Unions . . . . . . . . . . . . . . 3.10.2.3 Enumerations . . . . . . . . . . . . . . . . . . . . .
3-37 3-37 3-38
3.10.3 Template Types . . . . . . . . . . . . . . . . . . . . . . . . . 3-40 3.10.3.1 Sequences . . . . . . . . . . . . . . . . . . . . . . . 3.10.3.2 Strings . . . . . . . . . . . . . . . . . . . . . . . . . . 3.10.3.3 Wstrings . . . . . . . . . . . . . . . . . . . . . . . . . 3.10.3.4 Fixed Type . . . . . . . . . . . . . . . . . . . . . . .
3-41 3-41 3-42 3-42
3.10.4 Complex Declarator . . . . . . . . . . . . . . . . . . . . . 3-42 3.10.4.1 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-42
3.10.5 Native Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-43
CORBA, v2.4.2
February 2001
3
Contents
4.
3.11
Exception Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-46
3.12
Operation Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.12.1 Operation Attribute. . . . . . . . . . . . . . . . . . . . . . 3.12.2 Parameter Declarations . . . . . . . . . . . . . . . . . . . 3.12.3 Raises Expressions . . . . . . . . . . . . . . . . . . . . . . 3.12.4 Context Expressions . . . . . . . . . . . . . . . . . . . . .
3.13
Attribute Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-49
3.14
CORBA Module. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-50
3.15
Names and Scoping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.15.1 Qualified Names . . . . . . . . . . . . . . . . . . . . . . . . 3.15.2 Scoping Rules and Name Resolution . . . . . . . . 3.15.3 Special Scoping Rules for Type Names . . . . . .
3-51 3-51 3-53 3-56
ORB Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-1
4.1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-1
4.2
The ORB Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.1 Converting Object References to Strings . . . . .
4-2 4-7
4.2.1.1 object_to_string . . . . . . . . . . . . . . . . . . . . 4.2.1.2 string_to_object . . . . . . . . . . . . . . . . . . . .
4-7 4-7
Getting Service Information . . . . . . . . . . . . . . .
4-8
4.2.2 4.2.3
4.3
4.2.2.1 get_service_information . . . . . . . . . . . . .
4-8
Thread-Related Operations . . . . . . . . . . . . . . . .
4-8
4.2.3.1 work_pending . . . . . . . . . . . . . . . . . . . . . 4.2.3.2 perform_work . . . . . . . . . . . . . . . . . . . . . 4.2.3.3 run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.3.4 shutdown . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.3.5 destroy . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-9 4-9 4-9 4-10 4-10
Object Reference Operations . . . . . . . . . . . . . . . . . . . . . . . 4-11 4.3.1 Determining the Object Interface . . . . . . . . . . . 4-13 4.3.1.1 get_interface . . . . . . . . . . . . . . . . . . . . . .
4.3.2
4-13 4-13
4.3.3
Nil Object References. . . . . . . . . . . . . . . . . . . . 4-13
4.3.4
Equivalence Checking Operation . . . . . . . . . . . 4-14
4.3.3.1 is_nil . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.4.1 is_a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-13 4-14
4.3.5
Probing for Object Non-Existence . . . . . . . . . . 4-14
4.3.6
Object Reference Identity . . . . . . . . . . . . . . . . . 4-15
4.3.5.1 non_existent . . . . . . . . . . . . . . . . . . . . . . . 4.3.6.1 Hashing Object Identifiers . . . . . . . . . . . . 4.3.6.2 Equivalence Testing . . . . . . . . . . . . . . . .
4.3.7
4-14 4-15 4-16
Getting Policy Associated with the Object . . . . 4-16 4.3.7.1 get_policy . . . . . . . . . . . . . . . . . . . . . . . .
CORBA, v2.4.2
4-13
Duplicating and Releasing Copies of Object References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13 4.3.2.1 duplicate . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.2.2 release . . . . . . . . . . . . . . . . . . . . . . . . . . .
4
3-47 3-47 3-48 3-48 3-49
February 2001
4-16
Contents 4.3.7.2 get_client_policy . . . . . . . . . . . . . . . . . . . 4.3.7.3 get_policy_overrides . . . . . . . . . . . . . . . .
4-17 4-17
4.3.8
Overriding Associated Policies on an Object Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-18
4.3.9
Validating Connection . . . . . . . . . . . . . . . . . . . 4-18
4.3.8.1 set_policy_overrides . . . . . . . . . . . . . . . . 4.3.9.1 validate_connection . . . . . . . . . . . . . . . . .
4-18 4-18
4.3.10 Getting the Domain Managers Associated with the Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-19 4.3.10.1 get_domain_managers . . . . . . . . . . . . . .
4-19
4.4
ValueBase Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-19
4.5
ORB and 4.5.1 4.5.2 4.5.3
4.6
OA Initialization and Initial References . . . . . . . ORB Initialization . . . . . . . . . . . . . . . . . . . . . . Obtaining Initial Object References . . . . . . . . . Configuring Initial Service References. . . . . . .
4-20 4-20 4-22 4-24
4.5.3.1 ORB-specific Configuration . . . . . . . . . . 4.5.3.2 ORBInitRef . . . . . . . . . . . . . . . . . . . . . . . 4.5.3.3 ORBDefaultInitRef . . . . . . . . . . . . . . . . . 4.5.3.4 Configuration Effect on resolve_initial_references . . . . . . . . . . . . . . . . 4.5.3.5 Configuration Effect on list_initial_services . . . . . . . . . . . . . . . . . . . . .
4-24 4-25 4-25 4-26 4-26
Context Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-27 4.6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-27 4.6.2 Context Object Operations . . . . . . . . . . . . . . . . 4-28 4.6.2.1 get_default_context . . . . . . . . . . . . . . . . . 4.6.2.2 set_one_value . . . . . . . . . . . . . . . . . . . . . 4.6.2.3 set_values . . . . . . . . . . . . . . . . . . . . . . . . 4.6.2.4 get_values . . . . . . . . . . . . . . . . . . . . . . . . 4.6.2.5 delete_values . . . . . . . . . . . . . . . . . . . . . . 4.6.2.6 create_child . . . . . . . . . . . . . . . . . . . . . . . 4.6.2.7 delete . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-29 4-29 4-29 4-29 4-30 4-30 4-31
4.7
Current Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-31
4.8
Policy Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-32 4.8.1 Definition of Policy Object. . . . . . . . . . . . . . . . 4-32 4.8.1.1 Copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.1.2 Destroy . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.1.3 Policy_type . . . . . . . . . . . . . . . . . . . . . . .
4.8.2
4.8.3 4.8.4 4.8.5 4.8.6
CORBA, v2.4.2
4-32 4-33 4-33
Creation of Policy Objects . . . . . . . . . . . . . . . . 4-33 4.8.2.1 PolicyErrorCode . . . . . . . . . . . . . . . . . . . 4.8.2.2 PolicyError . . . . . . . . . . . . . . . . . . . . . . . 4.8.2.3 Create_policy . . . . . . . . . . . . . . . . . . . . . .
4-34 4-34 4-34
Usages of Policy Objects . . . . . . . . . . . . . . . . . Policy Associated with the Execution Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . Specification of New Policy Objects . . . . . . . . Standard Policies . . . . . . . . . . . . . . . . . . . . . . .
4-35
February 2001
4-35 4-36 4-38
5
Contents 4.9
4.10
Management of Policies . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.9.1 Client Side Policy Management . . . . . . . . . . . . 4.9.2 Server Side Policy Management . . . . . . . . . . . . 4.9.3 Policy Management Interfaces . . . . . . . . . . . . .
4-41 4-41 4-42 4-42
4.9.3.1 interface PolicyManager . . . . . . . . . . . . . 4.9.3.2 interface PolicyCurrent . . . . . . . . . . . . . .
4-43 4-44
Management of Policy Domains . . . . . . . . . . . . . . . . . . . . 4-44 4.10.1 Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . 4-44 4.10.1.1 Policy Domain . . . . . . . . . . . . . . . . . . . . 4.10.1.2 Policy Domain Manager . . . . . . . . . . . . 4.10.1.3 Policy Objects . . . . . . . . . . . . . . . . . . . . 4.10.1.4 Object Membership of Policy Domains 4.10.1.5 Domains Association at Object Reference Creation . . . . . . . . . . . . . . . . . . . . . 4.10.1.6 Implementor’s View of Object Creation
4-44 4-45 4-45 4-45 4-46 4-46
4.10.2 Domain Management Operations . . . . . . . . . . . 4-47
4.11
6
CORBA, v2.4.2
4.10.2.1 Domain Manager . . . . . . . . . . . . . . . . . . 4.10.2.2 Construction Policy . . . . . . . . . . . . . . . .
4-48 4-49
Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.11.1 Definition of Terms . . . . . . . . . . . . . . . . . . . . . 4.11.2 System Exceptions . . . . . . . . . . . . . . . . . . . . . . 4.11.3 Standard System Exception Definitions . . . . .
4-49 4-50 4-50 4-52
4.11.3.1 UNKNOWN . . . . . . . . . . . . . . . . . . . . . 4.11.3.2 BAD_PARAM . . . . . . . . . . . . . . . . . . . 4.11.3.3 NO_MEMORY . . . . . . . . . . . . . . . . . . . 4.11.3.4 IMP_LIMIT . . . . . . . . . . . . . . . . . . . . . . 4.11.3.5 COMM_FAILURE . . . . . . . . . . . . . . . . 4.11.3.6 INV_OBJREF . . . . . . . . . . . . . . . . . . . . 4.11.3.7 NO_PERMISSION . . . . . . . . . . . . . . . . 4.11.3.8 INTERNAL . . . . . . . . . . . . . . . . . . . . . . 4.11.3.9 MARSHAL . . . . . . . . . . . . . . . . . . . . . . 4.11.3.10 INITIALIZE . . . . . . . . . . . . . . . . . . . . 4.11.3.11 NO_IMPLEMENT . . . . . . . . . . . . . . . 4.11.3.12 BAD_TYPECODE . . . . . . . . . . . . . . . 4.11.3.13 BAD_OPERATION . . . . . . . . . . . . . . 4.11.3.14 NO_RESOURCES . . . . . . . . . . . . . . . 4.11.3.15 NO_RESPONSE . . . . . . . . . . . . . . . . . 4.11.3.16 PERSIST_STORE . . . . . . . . . . . . . . . . 4.11.3.17 BAD_INV_ORDER . . . . . . . . . . . . . . 4.11.3.18 TRANSIENT . . . . . . . . . . . . . . . . . . . . 4.11.3.19 FREE_MEM . . . . . . . . . . . . . . . . . . . . 4.11.3.20 INV_IDENT . . . . . . . . . . . . . . . . . . . . 4.11.3.21 INV_FLAG . . . . . . . . . . . . . . . . . . . . . 4.11.3.22 INTF_REPOS . . . . . . . . . . . . . . . . . . . 4.11.3.23 BAD_CONTEXT . . . . . . . . . . . . . . . . 4.11.3.24 OBJ_ADAPTER . . . . . . . . . . . . . . . . . 4.11.3.25 DATA_CONVERSION . . . . . . . . . . . 4.11.3.26 OBJECT_NOT_EXIST . . . . . . . . . . . . 4.11.3.27 TRANSACTION_REQUIRED . . . . . . 4.11.3.28 TRANSACTION_ROLLEDBACK . . 4.11.3.29 INVALID_TRANSACTION . . . . . . .
4-53 4-54 4-54 4-54 4-54 4-54 4-54 4-54 4-55 4-55 4-55 4-55 4-55 4-55 4-55 4-55 4-56 4-56 4-56 4-56 4-56 4-56 4-56 4-56 4-57 4-57 4-57 4-57 4-57
February 2001
Contents 4.11.3.30 INV_POLICY . . . . . . . . . . . . . . . . . . . 4.11.3.31 CODESET_INCOMPATIBLE . . . . . . 4.11.3.32 REBIND. . . . . . . . . . . . . . . . . . . . . . . 4.11.3.33 TIMEOUT . . . . . . . . . . . . . . . . . . . . . 4.11.3.34 TRANSACTION_UNAVAILABLE . 4.11.3.35 TRANSACTION_MODE . . . . . . . . . . 4.11.3.36 BAD_QOS . . . . . . . . . . . . . . . . . . . . . .
4-57 4-57 4-58 4-58 4-58 4-58 4-58
4.11.4 Standard Minor Exception Codes . . . . . . . . . . . 4-59
5. Value Type Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5-1
5.1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5-1
5.2
Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.1 Abstract Values . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.2 Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.3 Value Type vs. Interfaces . . . . . . . . . . . . . . . . . 5.2.4 Parameter Passing. . . . . . . . . . . . . . . . . . . . . . .
5-2 5-3 5-3 5-4 5-4
5.2.4.1 Value vs. Reference Semantics . . . . . . . . 5.2.4.2 Sharing Semantics . . . . . . . . . . . . . . . . . . 5.2.4.3 Identity Semantics . . . . . . . . . . . . . . . . . . 5.2.4.4 Any parameter type . . . . . . . . . . . . . . . . .
5-4 5-4 5-4 5-5
Substitutability Issues . . . . . . . . . . . . . . . . . . . .
5-5
5.2.5.1 Value instance -> Interface type . . . . . . . 5.2.5.2 Value instance -> Value type . . . . . . . . .
5-5 5-5
Widening/Narrowing . . . . . . . . . . . . . . . . . . . . Value Base Type . . . . . . . . . . . . . . . . . . . . . . . . Life Cycle issues . . . . . . . . . . . . . . . . . . . . . . .
5-6 5-6 5-6
5.2.8.1 Creation and Factories . . . . . . . . . . . . . . .
5-7
Security Considerations . . . . . . . . . . . . . . . . . .
5-7
5.2.9.1 Value as Value . . . . . . . . . . . . . . . . . . . . . 5.2.9.2 Value as Object Reference . . . . . . . . . . .
5-8 5-8
5.3
Standard Value Box Definitions . . . . . . . . . . . . . . . . . . . . .
5-8
5.4
Language Mappings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9 5.4.1 General Requirements . . . . . . . . . . . . . . . . . . . 5-9 5.4.2 Language Specific Marshaling . . . . . . . . . . . . . 5-9 5.4.3 Language Specific Value Factory Requirements 5-9 5.4.4 Value Method Implementation . . . . . . . . . . . . . 5-10
5.5
Custom Marshaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-10 5.5.1 Implementation of Custom Marshaling . . . . . . 5-11 5.5.2 Marshaling Streams . . . . . . . . . . . . . . . . . . . . . 5-11
5.6
Access to the Sending Context Run Time . . . . . . . . . . . . . 5-15
5.2.5
5.2.6 5.2.7 5.2.8 5.2.9
6. Abstract Interface Semantics . . . . . . . . . . . . . . . . . . . . . . . .
6-1
6.1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6-1
6.2
Semantics of Abstract Interfaces . . . . . . . . . . . . . . . . . . . .
6-1
6.3
Usage Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6-3
CORBA, v2.4.2
February 2001
7
Contents 6.4
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6-3
6.5
Security Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5.1 Passing Values to Trusted Domains . . . . . . . . .
6-4 6-4
7. Dynamic Invocation Interface . . . . . . . . . . . . . . . . . . . . . . .
7-1
7.1
Overview 7.1.1 7.1.2 7.1.3
7.2
Request Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 7.2.1 create_request . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5 7.2.2 add_arg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-7 7.2.3 invoke . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 7.2.4 delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 7.2.5 send . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 7.2.6 poll_response . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9 7.2.7 get_response . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9 7.2.8 sendp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9 7.2.9 prepare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10 7.2.10 sendc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10
7.3
ORB Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10 7.3.1 send_multiple_requests . . . . . . . . . . . . . . . . . . 7-10 7.3.2 get_next_response and poll_next_response . . . 7-11
7.4
Polling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12 7.4.1 Abstract Valuetype Pollable . . . . . . . . . . . . . . . . . 7-13
7.4.2 7.4.3
7.5
8
CORBA, v2.4.2
...................................... Common Data Structures . . . . . . . . . . . . . . . . . Memory Usage . . . . . . . . . . . . . . . . . . . . . . . . . Return Status and Exceptions . . . . . . . . . . . . . .
7.4.1.1 is_ready . . . . . . . . . . . . . . . . . . . . . . . . . . 7.4.1.2 create_pollable_set . . . . . . . . . . . . . . . . . Abstract Valuetype DIIPollable . . . . . . . . . . . . . . . . .
7-1 7-2 7-4 7-4
7-13 7-14 7-14
interface PollableSet. . . . . . . . . . . . . . . . . . . . . . 7-14 7.4.3.1 create_dii_pollable . . . . . . . . . . . . . . . . . 7-14 7.4.3.2 add_pollable . . . . . . . . . . . . . . . . . . . . . . 7-14 7.4.3.3 get_ready_pollable . . . . . . . . . . . . . . . . . 7-15 7.4.3.4 remove . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-15 7.4.3.5 number_left . . . . . . . . . . . . . . . . . . . . . . . 7-16
List Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5.1 create_list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5.2 add_item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5.3 free . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5.4 free_memory . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5.5 get_count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5.6 create_operation_list . . . . . . . . . . . . . . . . . . . .
February 2001
7-16 7-16 7-17 7-17 7-17 7-17 7-18
Contents 8.
Dynamic Skeleton Interface. . . . . . . . . . . . . . . . . . . . . . . . .
8-1
8.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8-1
8.2
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8-2
8.3
ServerRequestPseudo-Object . . . . . . . . . . . . . . . . . . . . . . . 8.3.1 ExplicitRequest State: ServerRequestPseudo-Object . . . . . . . . . . . . . .
8-3
8.4
DSI: Language Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.1 ServerRequest’s Handling of Operation Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.2 Registering Dynamic Implementation Routines
9. Dynamic Management of Any Values . . . . . . . . . . . . . . . . . .
8-3 8-4 8-4 8-5
9-1
9.1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2
DynAny API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3 9.2.1 Locality and usage constraints . . . . . . . . . . . . . 9-8 9.2.2 Creating a DynAny object . . . . . . . . . . . . . . . . 9-8 9.2.3 The DynAny interface . . . . . . . . . . . . . . . . . . . 9-10 9.2.3.1 Obtaining the TypeCode associated with a DynAny object . . . . . . . . . . . . . . . . . . . 9.2.3.2 Initializing a DynAny object from another DynAny object . . . . . . . . . . . . . . . . . . 9.2.3.3 Initializing a DynAny object from an any value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.3.4 Generating an any value from a DynAny object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.3.5 Comparing DynAny values . . . . . . . . . . . 9.2.3.6 Destroying a DynAny object . . . . . . . . . . 9.2.3.7 Creating a copy of a DynAny object . . . . 9.2.3.8 Accessing a value of some basic type in a DynAny object . . . . . . . . . . . . . . . . . . . . . 9.2.3.9 Iterating through components of a DynAny . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.4 9.2.5 9.2.6 9.2.7 9.2.8 9.2.9 9.2.10 9.2.11 9.2.12 9.3
The DynFixed Interface . . . . . . . . . . . . . . . . . . The DynEnum interface . . . . . . . . . . . . . . . . . . The DynStruct interface . . . . . . . . . . . . . . . . . . The DynUnion interface . . . . . . . . . . . . . . . . . . The DynSequence interface . . . . . . . . . . . . . . . The DynArray interface . . . . . . . . . . . . . . . . . . The DynValue interface . . . . . . . . . . . . . . . . . . The DynValue interface . . . . . . . . . . . . . . . . . . The DynValueBox interface . . . . . . . . . . . . . . .
9-10 9-11 9-11 9-11 9-11 9-12 9-12 9-12 9-13
9-15 9-15 9-16 9-17 9-20 9-21 9-22 9-22 9-23
Usage in C++ Language . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-24 9.3.1 Dynamic creation of CORBA::Any values . . . . 9-24 9.3.1.1 Creating an any that contains a struct . . .
9.3.2
CORBA, v2.4.2
9-1
9-24
Dynamic interpretation of CORBA::Any values 9-25
February 2001
9
Contents 9.3.2.1 Filtering of events . . . . . . . . . . . . . . . . . .
10.
9-25
The Interface Repository . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-1 10.1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-1
10.2
Scope of an Interface Repository . . . . . . . . . . . . . . . . . . . . 10-2
10.3
Implementation Dependencies . . . . . . . . . . . . . . . . . . . . . . 10-4 10.3.1 Managing Interface Repositories . . . . . . . . . . . 10-4
10.4
Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.4.1 Names and Identifiers . . . . . . . . . . . . . . . . . . . . 10.4.2 Types and TypeCodes . . . . . . . . . . . . . . . . . . . . 10.4.3 Interface Repository Objects . . . . . . . . . . . . . . 10.4.4 Structure and Navigation of the Interface Repository . . . . . . . . . . . . . . . . . . . . .
10.5
10-5 10-6 10-6 10-6 10-7
Interface Repository Interfaces . . . . . . . . . . . . . . . . . . . . . 10-9 10.5.1 Supporting Type Definitions. . . . . . . . . . . . . . . 10-10 10.5.2 IRObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-11 10.5.2.1 Read Interface . . . . . . . . . . . . . . . . . . . . 10-11 10.5.2.2 Write Interface . . . . . . . . . . . . . . . . . . . . 10-11
10.5.3 Contained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-11 10.5.3.1 Read Interface . . . . . . . . . . . . . . . . . . . . 10-12 10.5.3.2 Write Interface . . . . . . . . . . . . . . . . . . . . 10-13
10.5.4 Container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-14 10.5.4.1 Read Interface . . . . . . . . . . . . . . . . . . . . 10-17 10.5.4.2 Write Interface . . . . . . . . . . . . . . . . . . . . 10-18
10.5.5 IDLType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-19 10.5.6 Repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-20 10.5.6.1 Read Interface . . . . . . . . . . . . . . . . . . . . 10-21 10.5.6.2 Write Interface . . . . . . . . . . . . . . . . . . . . 10-21
10.5.7 ModuleDef . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-22 10.5.8 ConstantDef . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-22 10.5.8.1 Read Interface . . . . . . . . . . . . . . . . . . . . 10-22 10.5.8.2 Write Interface . . . . . . . . . . . . . . . . . . . . 10-23
10.5.9 TypedefDef . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-23 10.5.10 StructDef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-23 10.5.10.1 Read Interface . . . . . . . . . . . . . . . . . . . 10-24 10.5.10.2 Write Interface . . . . . . . . . . . . . . . . . . . 10-24
10.5.11 UnionDef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-24 10.5.11.1 Read Interface . . . . . . . . . . . . . . . . . . . 10-24 10.5.11.2 Write Interface . . . . . . . . . . . . . . . . . . . 10-25
10.5.12 EnumDef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-25 10.5.12.1 Read Interface . . . . . . . . . . . . . . . . . . . 10-25 10.5.12.2 Write Interface . . . . . . . . . . . . . . . . . . . 10-25
10.5.13 AliasDef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-25 10.5.13.1 Read Interface . . . . . . . . . . . . . . . . . . . 10-25 10.5.13.2 Write Interface . . . . . . . . . . . . . . . . . . . 10-26
10
CORBA, v2.4.2
February 2001
Contents 10.5.14 10.5.15 10.5.16 10.5.17 10.5.18
PrimitiveDef . . . . . . . . . . . . . . . . . . . . . . . . . . . StringDef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . WstringDef . . . . . . . . . . . . . . . . . . . . . . . . . . . . FixedDef. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . SequenceDef. . . . . . . . . . . . . . . . . . . . . . . . . . .
10-26 10-26 10-27 10-27 10-27
10.5.18.1 Read Interface . . . . . . . . . . . . . . . . . . . 10-28 10.5.18.2 Write Interface . . . . . . . . . . . . . . . . . . . 10-28
10.5.19 ArrayDef. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-28 10.5.19.1 Read Interface . . . . . . . . . . . . . . . . . . . 10-28 10.5.19.2 Write Interface . . . . . . . . . . . . . . . . . . . 10-28
10.5.20 ExceptionDef . . . . . . . . . . . . . . . . . . . . . . . . . . 10-29 10.5.20.1 Read Interface . . . . . . . . . . . . . . . . . . . 10-29 10.5.20.2 Write Interface . . . . . . . . . . . . . . . . . . . 10-29
10.5.21 AttributeDef . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-29 10.5.21.1 Read Interface . . . . . . . . . . . . . . . . . . . 10-30 10.5.21.2 Write Interface . . . . . . . . . . . . . . . . . . . 10-30
10.5.22 OperationDef . . . . . . . . . . . . . . . . . . . . . . . . . . 10-30 10.5.22.1 Read Interface . . . . . . . . . . . . . . . . . . . 10-31 10.5.22.2 Write Interface . . . . . . . . . . . . . . . . . . . 10-32
10.5.23 InterfaceDef . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-32 10.5.23.1 Read Interface . . . . . . . . . . . . . . . . . . . 10-33 10.5.23.2 Write Interface . . . . . . . . . . . . . . . . . . . 10-34
10.5.24 AbstractInterfaceDef . . . . . . . . . . . . . . . . . . . . 10-34 10.5.24.1 Read Interface . . . . . . . . . . . . . . . . . . . 10-34 10.5.24.2 Write Interface . . . . . . . . . . . . . . . . . . . 10-35
10.5.25 LocalInterfaceDef. . . . . . . . . . . . . . . . . . . . . . . 10-35 10.5.25.1 Read Interface . . . . . . . . . . . . . . . . . . . 10-36 10.5.25.2 Write Interface . . . . . . . . . . . . . . . . . . . 10-36
10.5.26 ValueMemberDef . . . . . . . . . . . . . . . . . . . . . . . 10-37 10.5.26.1 Read Interface . . . . . . . . . . . . . . . . . . . 10-37 10.5.26.2 Write Interface . . . . . . . . . . . . . . . . . . . 10-38
10.5.27 ValueDef. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-38 10.5.27.1 Read Interface . . . . . . . . . . . . . . . . . . . 10-40 10.5.27.2 Write Interface . . . . . . . . . . . . . . . . . . . 10-40
10.5.28 ValueBoxDef . . . . . . . . . . . . . . . . . . . . . . . . . . 10-41 10.5.28.1 Read Interface . . . . . . . . . . . . . . . . . . . 10-41 10.5.28.2 Write Interface . . . . . . . . . . . . . . . . . . . 10-41
10.5.29 NativeDef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-41 10.6
RepositoryIds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.6.1 OMG IDL Format. . . . . . . . . . . . . . . . . . . . . . . 10.6.2 RMI Hashed Format . . . . . . . . . . . . . . . . . . . . . 10.6.3 DCE UUID Format. . . . . . . . . . . . . . . . . . . . . . 10.6.4 LOCAL Format . . . . . . . . . . . . . . . . . . . . . . . . 10.6.5 Pragma Directives for RepositoryId . . . . . . . . .
10-42 10-42 10-43 10-44 10-45 10-45
10.6.5.1 The ID Pragma . . . . . . . . . . . . . . . . . . . 10-45 10.6.5.2 The Prefix Pragma . . . . . . . . . . . . . . . . . 10-45 10.6.5.3 The Version Pragma . . . . . . . . . . . . . . . 10-48
CORBA, v2.4.2
February 2001
11
Contents 10.6.5.4 Generation of OMG IDL - Format IDs . 10-49
10.6.6 For More Information . . . . . . . . . . . . . . . . . . . . 10-50 10.6.7 RepositoryIDs for OMG-Specified Types. . . . . 10-50
11.
10.7
TypeCodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.7.1 The TypeCode Interface . . . . . . . . . . . . . . . . . . 10.7.2 TypeCode Constants . . . . . . . . . . . . . . . . . . . . . 10.7.3 Creating TypeCodes . . . . . . . . . . . . . . . . . . . . .
10-51 10-51 10-55 10-56
10.8
OMG IDL for Interface Repository . . . . . . . . . . . . . . . . . . 10-60
The Portable Object Adapter . . . . . . . . . . . . . . . . . . . . . . . 11-1 11.1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-1
11.2
Abstract Model Description . . . . . . . . . . . . . . . . . . . . . . . . 11.2.1 Model Components . . . . . . . . . . . . . . . . . . . . . 11.2.2 Model Architecture. . . . . . . . . . . . . . . . . . . . . . 11.2.3 POA Creation . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2.4 Reference Creation . . . . . . . . . . . . . . . . . . . . . . 11.2.5 Object Activation States . . . . . . . . . . . . . . . . . . 11.2.6 Request Processing . . . . . . . . . . . . . . . . . . . . . . 11.2.7 Implicit Activation . . . . . . . . . . . . . . . . . . . . . . 11.2.8 Multi-threading . . . . . . . . . . . . . . . . . . . . . . . . .
11-2 11-2 11-4 11-6 11-7 11-8 11-9 11-10 11-11
11.2.8.1 POA Threading Models . . . . . . . . . . . . . 11.2.8.2 Using the Single Thread Model . . . . . . . 11.2.8.3 Using the ORB Controlled Model . . . . . 11.2.8.4 Using the Main Thread Model . . . . . . . 11.2.8.5 Limitations When Using Multiple Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11-11 11-11 11-12 11-12 11-12
11.2.9 Dynamic Skeleton Interface . . . . . . . . . . . . . . . 11-12 11.2.10 Location Transparency . . . . . . . . . . . . . . . . . . . 11-13 11.3
Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-14 11.3.1 The Servant IDL Type . . . . . . . . . . . . . . . . . . . 11-14 11.3.2 POAManager Interface . . . . . . . . . . . . . . . . . . . 11-15 11.3.2.1 Processing States . . . . . . . . . . . . . . . . . . 11.3.2.2 Locality Constraints . . . . . . . . . . . . . . . 11.3.2.3 activate . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3.2.4 hold_requests . . . . . . . . . . . . . . . . . . . . . 11.3.2.5 discard_requests . . . . . . . . . . . . . . . . . . 11.3.2.6 deactivate . . . . . . . . . . . . . . . . . . . . . . . . 11.3.2.7 get_state . . . . . . . . . . . . . . . . . . . . . . . . .
11-15 11-18 11-18 11-18 11-19 11-19 11-20
11.3.3 AdapterActivator Interface . . . . . . . . . . . . . . . . 11-20 11.3.3.1 Locality Constraints . . . . . . . . . . . . . . . 11-20 11.3.3.2 unknown_adapter . . . . . . . . . . . . . . . . . 11-20
11.3.4 ServantManager Interface. . . . . . . . . . . . . . . . . 11-22 11.3.4.1 Common Information for Servant Manager Types . . . . . . . . . . . . . . . . . . . . . . . . 11-22 11.3.4.2 Locality Constraints . . . . . . . . . . . . . . . 11-23
12
CORBA, v2.4.2
February 2001
Contents 11.3.5 ServantActivator Interface . . . . . . . . . . . . . . . . 11-23 11.3.5.1 incarnate . . . . . . . . . . . . . . . . . . . . . . . . 11-23 11.3.5.2 etherealize . . . . . . . . . . . . . . . . . . . . . . . 11-24
11.3.6 ServantLocator Interface . . . . . . . . . . . . . . . . . 11-25 11.3.6.1 preinvoke . . . . . . . . . . . . . . . . . . . . . . . . 11-26 11.3.6.2 postinvoke . . . . . . . . . . . . . . . . . . . . . . . 11-27 11.3.6.3 ServantLocator and Location Determination . . . . . . . . . . . . . . . . . . . . . . . . . 11-27
11.3.7 POA Policy Objects . . . . . . . . . . . . . . . . . . . . . 11-28 11.3.7.1 Thread Policy . . . . . . . . . . . . . . . . . . . . 11.3.7.2 Lifespan Policy . . . . . . . . . . . . . . . . . . . 11.3.7.3 Object Id Uniqueness Policy . . . . . . . . . 11.3.7.4 Id Assignment Policy . . . . . . . . . . . . . . 11.3.7.5 Servant Retention Policy . . . . . . . . . . . . 11.3.7.6 Request Processing Policy . . . . . . . . . . . 11.3.7.7 Implicit Activation Policy . . . . . . . . . . .
11-28 11-29 11-29 11-30 11-30 11-30 11-32
11.3.8 POA Interface . . . . . . . . . . . . . . . . . . . . . . . . . . 11-32 11.3.8.1 Locality Constraints . . . . . . . . . . . . . . . 11.3.8.2 create_POA . . . . . . . . . . . . . . . . . . . . . . 11.3.8.3 find_POA . . . . . . . . . . . . . . . . . . . . . . . . 11.3.8.4 destroy . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3.8.5 Policy Creation Operations . . . . . . . . . . 11.3.8.6 the_name . . . . . . . . . . . . . . . . . . . . . . . . 11.3.8.7 the_parent . . . . . . . . . . . . . . . . . . . . . . . 11.3.8.8 the_children . . . . . . . . . . . . . . . . . . . . . . 11.3.8.9 the_POAManager . . . . . . . . . . . . . . . . . 11.3.8.10 the_activator . . . . . . . . . . . . . . . . . . . . 11.3.8.11 get_servant_manager . . . . . . . . . . . . . . 11.3.8.12 set_servant_manager . . . . . . . . . . . . . . 11.3.8.13 get_servant . . . . . . . . . . . . . . . . . . . . . . 11.3.8.14 set_servant . . . . . . . . . . . . . . . . . . . . . . 11.3.8.15 activate_object . . . . . . . . . . . . . . . . . . . 11.3.8.16 activate_object_with_id . . . . . . . . . . . . 11.3.8.17 deactivate_object . . . . . . . . . . . . . . . . . 11.3.8.18 create_reference . . . . . . . . . . . . . . . . . . 11.3.8.19 create_reference_with_id . . . . . . . . . . 11.3.8.20 servant_to_id . . . . . . . . . . . . . . . . . . . . 11.3.8.21 servant_to_reference . . . . . . . . . . . . . . 11.3.8.22 reference_to_servant . . . . . . . . . . . . . . 11.3.8.23 reference_to_id . . . . . . . . . . . . . . . . . . 11.3.8.24 id_to_servant . . . . . . . . . . . . . . . . . . . . 11.3.8.25 id_to_reference . . . . . . . . . . . . . . . . . .
11-32 11-32 11-33 11-34 11-35 11-35 11-35 11-35 11-35 11-36 11-36 11-36 11-36 11-37 11-37 11-37 11-38 11-38 11-39 11-39 11-40 11-40 11-41 11-41 11-41
11.3.9 Current Operations . . . . . . . . . . . . . . . . . . . . . . 11-42 11.3.9.1 get_POA . . . . . . . . . . . . . . . . . . . . . . . . 11.3.9.2 get_object_id . . . . . . . . . . . . . . . . . . . . . 11.3.9.3 get_reference . . . . . . . . . . . . . . . . . . . . . 11.3.9.4 get_servant . . . . . . . . . . . . . . . . . . . . . . .
11-42 11-42 11-42 11-43
11.4
IDL for PortableServer Module . . . . . . . . . . . . . . . . . . . . . 11-43
11.5
UML Description of PortableServer. . . . . . . . . . . . . . . . . . 11-49
11.6
Usage Scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-50 11.6.1 Getting the Root POA. . . . . . . . . . . . . . . . . . . . 11-50
CORBA, v2.4.2
February 2001
13
Contents 11.6.2 Creating a POA. . . . . . . . . . . . . . . . . . . . . . . . . 11.6.3 Explicit Activation with POA-assigned Object Ids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.6.4 Explicit Activation with User-assigned Object Ids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.6.5 Creating References before Activation . . . . . . . 11.6.6 Servant Manager Definition and Creation . . . . 11.6.7 Object Activation on Demand . . . . . . . . . . . . . 11.6.8 Persistent Objects with POA-assigned Ids . . . . 11.6.9 Multiple Object Ids Mapping to a Single Servant. . . . . . . . . . . . . . . . . . . . . . . . . . 11.6.10 One Servant for All Objects . . . . . . . . . . . . . . . 11.6.11 Single Servant, Many Objects and Types, Using DSI . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11-51 11-51 11-52 11-53 11-53 11-55 11-57 11-57 11-57 11-60
12. Interoperability Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 12-1 12.1
Elements of Interoperability . . . . . . . . . . . . . . . . . . . . . . . . 12.1.1 ORB Interoperability Architecture . . . . . . . . . . 12.1.2 Inter-ORB Bridge Support . . . . . . . . . . . . . . . . 12.1.3 General Inter-ORB Protocol (GIOP) . . . . . . . . 12.1.4 Internet Inter-ORB Protocol (IIOP) . . . . . . . . . 12.1.5 Environment-Specific Inter-ORB Protocols (ESIOPs). . . . . . . . . . . . . . . . . . . . . .
12-1 12-2 12-2 12-3 12-3 12-4
12.2
Relationship to Previous Versions of CORBA . . . . . . . . . . 12-4
12.3
Examples of Interoperability Solutions . . . . . . . . . . . . . . . 12.3.1 Example 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.3.2 Example 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.3.3 Example 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.3.4 Interoperability Compliance . . . . . . . . . . . . . . .
12-5 12-5 12-5 12-5 12-5
12.4
Motivating Factors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.4.1 ORB Implementation Diversity . . . . . . . . . . . . 12.4.2 ORB Boundaries. . . . . . . . . . . . . . . . . . . . . . . . 12.4.3 ORBs Vary in Scope, Distance, and Lifetime . .
12-8 12-8 12-8 12-9
12.5
Interoperability Design Goals . . . . . . . . . . . . . . . . . . . . . . 12-9 12.5.1 Non-Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-10
13. ORB Interoperability Architecture . . . . . . . . . . . . . . . . . . . 13-1
14
13.1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-1 13.1.1 Domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2 13.1.2 Bridging Domains . . . . . . . . . . . . . . . . . . . . . . 13-2
13.2
ORBs and ORB Services . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3
CORBA, v2.4.2
February 2001
Contents 13.2.1 The Nature of ORB Services . . . . . . . . . . . . . . 13-3 13.2.2 ORB Services and Object Requests . . . . . . . . . 13-3 13.2.3 Selection of ORB Services . . . . . . . . . . . . . . . . 13-4 13.3
Domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-5 13.3.1 Definition of a Domain . . . . . . . . . . . . . . . . . . . 13-5 13.3.2 Mapping Between Domains: Bridging . . . . . . . 13-6
13.4
Interoperability Between ORBs . . . . . . . . . . . . . . . . . . . . . 13.4.1 ORB Services and Domains . . . . . . . . . . . . . . . 13.4.2 ORBs and Domains . . . . . . . . . . . . . . . . . . . . . 13.4.3 Interoperability Approaches . . . . . . . . . . . . . . .
13-7 13-7 13-7 13-8
13.4.3.1 Mediated Bridging . . . . . . . . . . . . . . . . . 13-8 13.4.3.2 Immediate Bridging . . . . . . . . . . . . . . . . 13-9 13.4.3.3 Location of Inter-Domain Functionality 13-9 13.4.3.4 Bridging Level . . . . . . . . . . . . . . . . . . . . 13-10
13.4.4 Policy-Mediated Bridging . . . . . . . . . . . . . . . . 13-10 13.4.5 Configurations of Bridges in Networks . . . . . . 13-11 13.5
Object Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-11 13.5.1 Domain-relative Object Referencing . . . . . . . . 13-12 13.5.2 Handling of Referencing Between Domains. . . 13-12
13.6
An Information Model for Object References . . . . . . . . . . 13-14 13.6.1 What Information Do Bridges Need? . . . . . . . . 13-14 13.6.2 Interoperable Object References: IORs . . . . . . 13-14 13.6.2.1 The TAG_INTERNET_IOP Profile . . . 13-16 13.6.2.2 The TAG_MULTIPLE_COMPONENTS Profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-16 13.6.2.3 IOR Components . . . . . . . . . . . . . . . . . . 13-17
13.6.3 Standard IOR Components . . . . . . . . . . . . . . . . 13-17 13.6.3.1 TAG_ORB_TYPE Component . . . . . . . 13-18 13.6.3.2 TAG_ALTERNATE_IIOP_ADDRESS Component . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-18 13.6.3.3 Other Components . . . . . . . . . . . . . . . . . 13-19
13.6.4 13.6.5 13.6.6 13.6.7
Profile and Component Composition in IORs . IOR Creation and Scope . . . . . . . . . . . . . . . . . . Stringified Object References. . . . . . . . . . . . . . Object URLs. . . . . . . . . . . . . . . . . . . . . . . . . . .
13-20 13-20 13-20 13-21
13.6.7.1 corbaloc URL . . . . . . . . . . . . . . . . . . . . 13.6.7.2 corbaloc:rir URL . . . . . . . . . . . . . . . . . . 13.6.7.3 corbaloc:iiop URL . . . . . . . . . . . . . . . . 13.6.7.4 corbaloc Server Implementation . . . . . . 13.6.7.5 corbaname URL . . . . . . . . . . . . . . . . . . 13.6.7.6 Future corbaloc URL Protocols . . . . . . . 13.6.7.7 Future URL Schemes . . . . . . . . . . . . . .
13-22 13-24 13-24 13-25 13-25 13-25 13-26
13.6.8 Object Service Context . . . . . . . . . . . . . . . . . . . 13-26 13.7
CORBA, v2.4.2
Code Set Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-30 13.7.1 Character Processing Terminology . . . . . . . . . . 13-30
February 2001
15
Contents 13.7.1.1 Character Set . . . . . . . . . . . . . . . . . . . . . 13-30 13.7.1.2 Coded Character Set, or Code Set . . . . . 13-31 13.7.1.3 Code Set Classifications . . . . . . . . . . . . 13-31 13.7.1.4 Narrow and Wide Characters . . . . . . . . 13-31 13.7.1.5 Char Data and Wchar Data . . . . . . . . . . 13-32 13.7.1.6 Byte-Oriented Code Set . . . . . . . . . . . . . 13-32 13.7.1.7 Multi-Byte Character Strings . . . . . . . . 13-32 13.7.1.8 Non-Byte-Oriented Code Set . . . . . . . . 13-32 13.7.1.9 Char Transmission Code Set (TCS-C) and Wchar Transmission Code Set (TCS-W) . . . . 13-32 13.7.1.10 Process Code Set and File Code Set . . 13-33 13.7.1.11 Native Code Set . . . . . . . . . . . . . . . . . . 13-33 13.7.1.12 Transmission Code Set . . . . . . . . . . . . 13-33 13.7.1.13 Conversion Code Set (CCS) . . . . . . . . 13-33
13.7.2 Code Set Conversion Framework . . . . . . . . . . . 13-34 13.7.2.1 Requirements . . . . . . . . . . . . . . . . . . . . . 13.7.2.2 Overview of the Conversion Framework 13.7.2.3 ORB Databases and Code Set Converters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.7.2.4 CodeSet Component of IOR Multi-Component Profile . . . . . . . . . . . . . . . . 13.7.2.5 GIOP Code Set Service Context . . . . . . 13.7.2.6 Code Set Negotiation . . . . . . . . . . . . . . .
13-34 13-34 13-36 13-36 13-37 13-38
13.7.3 Mapping to Generic Character Environments. . 13-41 13.7.3.1 Describing Generic Interfaces . . . . . . . . 13-42 13.7.3.2 Interoperation . . . . . . . . . . . . . . . . . . . . 13-42
13.8
Example of Generic Environment Mapping . . . . . . . . . . . . 13-43 13.8.1 Generic Mappings . . . . . . . . . . . . . . . . . . . . . . 13-43 13.8.2 Interoperation and Generic Mappings . . . . . . . 13-43
13.9
Relevant OSFM Registry Interfaces . . . . . . . . . . . . . . . . . . 13-43 13.9.1 Character and Code Set Registry . . . . . . . . . . . 13-43 13.9.2 Access Routines . . . . . . . . . . . . . . . . . . . . . . . . 13-44 13.9.2.1 dce_cs_loc_to_rgy . . . . . . . . . . . . . . . . . 13.9.2.2 dce_cs_rgy_to_loc . . . . . . . . . . . . . . . . . 13.9.2.3 rpc_cs_char_set_compat_check . . . . . . 13.9.2.4 rpc_rgy_get_max_bytes . . . . . . . . . . . .
14.
16
13-44 13-46 13-47 13-48
Building Inter-ORB Bridges . . . . . . . . . . . . . . . . . . . . . . . . 14-1 14.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-1
14.2
In-Line and Request-Level Bridging . . . . . . . . . . . . . . . . . 14.2.1 In-line Bridging . . . . . . . . . . . . . . . . . . . . . . . . 14.2.2 Request-level Bridging . . . . . . . . . . . . . . . . . . . 14.2.3 Collocated ORBs . . . . . . . . . . . . . . . . . . . . . . .
14.3
Proxy Creation and Management . . . . . . . . . . . . . . . . . . . . 14-5
14.4
Interface-specific Bridges and Generic Bridges . . . . . . . . . 14-6
14.5
Building Generic Request-Level Bridges . . . . . . . . . . . . . . 14-6
14.6
Bridging Non-Referencing Domains . . . . . . . . . . . . . . . . . 14-7
CORBA, v2.4.2
February 2001
14-2 14-3 14-3 14-4
Contents 14.7
Bootstrapping Bridges . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-7
15. General Inter-ORB Protocol. . . . . . . . . . . . . . . . . . . . . . . . . 15-1 15.1
Goals of the General Inter-ORB Protocol . . . . . . . . . . . . . 15-2
15.2
GIOP Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.2.1 Common Data Representation (CDR) . . . . . . . 15.2.2 GIOP Message Overview . . . . . . . . . . . . . . . . . 15.2.3 GIOP Message Transfer . . . . . . . . . . . . . . . . . .
15.3
CDR Transfer Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-4 15.3.1 Primitive Types . . . . . . . . . . . . . . . . . . . . . . . . . 15-5
15-2 15-3 15-3 15-4
15.3.1.1 Alignment . . . . . . . . . . . . . . . . . . . . . . . 15-5 15.3.1.2 Integer Data Types . . . . . . . . . . . . . . . . 15-6 15.3.1.3 Floating Point Data Types . . . . . . . . . . . 15-7 15.3.1.4 Octet . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-10 15.3.1.5 Boolean . . . . . . . . . . . . . . . . . . . . . . . . . 15-10 15.3.1.6 Character Types . . . . . . . . . . . . . . . . . . . 15-10
15.3.2 OMG IDL Constructed Types. . . . . . . . . . . . . . 15-11 15.3.2.1 Alignment . . . . . . . . . . . . . . . . . . . . . . . 15.3.2.2 Struct . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.3.2.3 Union . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.3.2.4 Array . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.3.2.5 Sequence . . . . . . . . . . . . . . . . . . . . . . . . 15.3.2.6 Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.3.2.7 Strings and Wide Strings . . . . . . . . . . . . 15.3.2.8 Fixed-Point Decimal Type . . . . . . . . . .
15-11 15-11 15-12 15-12 15-12 15-12 15-12 15-13
15.3.3 Encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . 15-14 15.3.4 Value Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-15 15.3.4.1 Partial Type Information and Versioning 15.3.4.2 Example . . . . . . . . . . . . . . . . . . . . . . . . . 15.3.4.3 Scope of the Indirections . . . . . . . . . . . . 15.3.4.4 Null Values . . . . . . . . . . . . . . . . . . . . . . 15.3.4.5 Other Encoding Information . . . . . . . . . 15.3.4.6 Fragmentation . . . . . . . . . . . . . . . . . . . . 15.3.4.7 Notation . . . . . . . . . . . . . . . . . . . . . . . . . 15.3.4.8 The Format . . . . . . . . . . . . . . . . . . . . . .
15-16 15-17 15-19 15-19 15-19 15-19 15-22 15-22
15.3.5 Pseudo-Object Types . . . . . . . . . . . . . . . . . . . . 15-23 15.3.5.1 TypeCode . . . . . . . . . . . . . . . . . . . . . . . 15.3.5.2 Any . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.3.5.3 Principal . . . . . . . . . . . . . . . . . . . . . . . . . 15.3.5.4 Context . . . . . . . . . . . . . . . . . . . . . . . . . 15.3.5.5 Exception . . . . . . . . . . . . . . . . . . . . . . . .
15-23 15-29 15-29 15-29 15-29
15.3.6 Object References. . . . . . . . . . . . . . . . . . . . . . . 15-30 15.3.7 Abstract Interfaces . . . . . . . . . . . . . . . . . . . . . . 15-30 15.4
GIOP Message Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-30 15.4.1 GIOP Message Header . . . . . . . . . . . . . . . . . . . 15-31 15.4.2 Request Message . . . . . . . . . . . . . . . . . . . . . . . 15-33 15.4.2.1 Request Header . . . . . . . . . . . . . . . . . . . 15-33 15.4.2.2 Request Body . . . . . . . . . . . . . . . . . . . . 15-36
CORBA, v2.4.2
February 2001
17
Contents 15.4.3 Reply Message . . . . . . . . . . . . . . . . . . . . . . . . . 15-36 15.4.3.1 Reply Header . . . . . . . . . . . . . . . . . . . . . 15-37 15.4.3.2 Reply Body . . . . . . . . . . . . . . . . . . . . . . 15-38
15.4.4 CancelRequest Message . . . . . . . . . . . . . . . . . . 15-40 15.4.4.1 Cancel Request Header . . . . . . . . . . . . . 15-40
15.4.5 LocateRequest Message . . . . . . . . . . . . . . . . . . 15-40 15.4.5.1 LocateRequest Header. . . . . . . . . . . . . . 15-41
15.4.6 LocateReply Message . . . . . . . . . . . . . . . . . . . . 15-42 15.4.6.1 Locate Reply Header . . . . . . . . . . . . . . . 15-42 15.4.6.2 LocateReply Body . . . . . . . . . . . . . . . . . 15-43 15.4.6.3 Handling ForwardRequest Exception from ServantLocator . . . . . . . . . . . . . . . . . . . . 15-44
15.4.7 CloseConnection Message . . . . . . . . . . . . . . . . 15-44 15.4.8 MessageError Message. . . . . . . . . . . . . . . . . . . 15-44 15.4.9 Fragment Message . . . . . . . . . . . . . . . . . . . . . . 15-44 15.5
GIOP Message Transport . . . . . . . . . . . . . . . . . . . . . . . . . . 15-45 15.5.1 Connection Management . . . . . . . . . . . . . . . . . 15-46 15.5.1.4 Connection Closure . . . . . . . . . . . . . . . . 15-47 15.5.1.5 Multiplexing Connections . . . . . . . . . . . 15-48
15.5.2 Message Ordering. . . . . . . . . . . . . . . . . . . . . . . 15-48 15.6
Object Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-48
15.7
Internet Inter-ORB Protocol (IIOP) . . . . . . . . . . . . . . . . . . 15.7.1 TCP/IP Connection Usage . . . . . . . . . . . . . . . . 15.7.2 IIOP IOR Profiles . . . . . . . . . . . . . . . . . . . . . . . 15.7.3 IIOP IOR Profile Components . . . . . . . . . . . . .
15.8
Bi-Directional GIOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-55 15.8.1 Bi-Directional IIOP . . . . . . . . . . . . . . . . . . . . . 15-57
15-50 15-50 15-51 15-54
15.8.1.1 IIOP/SSL considerations . . . . . . . . . . . . 15-58
15.9
Bi-directional GIOP policy . . . . . . . . . . . . . . . . . . . . . . . . 15-58
15.10 OMG IDL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.10.1 GIOP Module . . . . . . . . . . . . . . . . . . . . . . . . . . 15.10.2 IIOP Module. . . . . . . . . . . . . . . . . . . . . . . . . . . 15.10.3 BiDirPolicy Module . . . . . . . . . . . . . . . . . . . . .
16.
18
15-59 15-59 15-63 15-64
The DCE ESIOP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-1 16.1
Goals of the DCE Common Inter-ORB Protocol . . . . . . . . 16-1
16.2
DCE Common Inter-ORB Protocol Overview . . . . . . . . . . 16.2.1 DCE-CIOP RPC . . . . . . . . . . . . . . . . . . . . . . . . 16.2.2 DCE-CIOP Data Representation . . . . . . . . . . . 16.2.3 DCE-CIOP Messages . . . . . . . . . . . . . . . . . . . . 16.2.4 Interoperable Object Reference (IOR) . . . . . . .
16.3
DCE-CIOP Message Transport . . . . . . . . . . . . . . . . . . . . . 16-5 16.3.1 Pipe-based Interface . . . . . . . . . . . . . . . . . . . . . 16-6
CORBA, v2.4.2
February 2001
16-2 16-2 16-3 16-4 16-5
Contents 16.3.1.1 Invoke . . . . . . . . . . . . . . . . . . . . . . . . . . 16.3.1.2 Locate . . . . . . . . . . . . . . . . . . . . . . . . . .
16-8 16-8
16.3.2 Array-based Interface . . . . . . . . . . . . . . . . . . . . 16-8 16.3.2.1 Invoke . . . . . . . . . . . . . . . . . . . . . . . . . . 16-10 16.3.2.2 Locate . . . . . . . . . . . . . . . . . . . . . . . . . . 16-11
16.4
DCE-CIOP Message Formats. . . . . . . . . . . . . . . . . . . . . . . 16-11 16.4.1 DCE_CIOP Invoke Request Message . . . . . . . . 16-11 16.4.1.1 Invoke request header . . . . . . . . . . . . . . 16-11 16.4.1.2 Invoke request body . . . . . . . . . . . . . . . 16-12
16.4.2 DCE-CIOP Invoke Response Message . . . . . . . 16-12 16.4.2.1 Invoke response header . . . . . . . . . . . . . 16-13 16.4.2.2 Invoke Response Body . . . . . . . . . . . . . 16-13
16.4.3 DCE-CIOP Locate Request Message . . . . . . . . 16-14 16.4.3.1 Locate Request Header . . . . . . . . . . . . . 16-14
16.4.4 DCE-CIOP Locate Response Message . . . . . . . 16-15 16.4.4.1 Locate Response Header . . . . . . . . . . . . 16-15 16.4.4.2 Locate Response Body . . . . . . . . . . . . . 16-16
16.5
DCE-CIOP Object References . . . . . . . . . . . . . . . . . . . . . . 16-16 16.5.1 DCE-CIOP String Binding Component . . . . . . 16-17 16.5.2 DCE-CIOP Binding Name Component . . . . . . 16-18 16.5.2.1 BindingNameComponent . . . . . . . . . . . 16-18
16.5.3 16.5.4 16.5.5 16.5.6 16.6
DCE-CIOP No Pipes Component . . . . . . . . . . . Complete Object Key Component . . . . . . . . . . Endpoint ID Position Component. . . . . . . . . . . Location Policy Component . . . . . . . . . . . . . . .
16-19 16-19 16-20 16-20
DCE-CIOP Object Location. . . . . . . . . . . . . . . . . . . . . . . . 16-21 16.6.1 Location Mechanism Overview . . . . . . . . . . . . 16-22 16.6.2 Activation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-23 16.6.3 Basic Location Algorithm . . . . . . . . . . . . . . . . 16-23 16.6.4 Use of the Location Policy and the Endpoint ID16-24 16.6.4.1 Current location policy . . . . . . . . . . . . . 16-24 16.6.4.2 Original location policy . . . . . . . . . . . . . 16-24 16.6.4.3 Original Endpoint ID . . . . . . . . . . . . . . . 16-24
17.
16.7
OMG IDL for the DCE CIOP Module . . . . . . . . . . . . . . . . 16-25
16.8
References for this Chapter . . . . . . . . . . . . . . . . . . . . . . . . 16-26
Interworking Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . 17-1 17.1
Purpose of the Interworking Architecture . . . . . . . . . . . . . 17-2 17.1.1 Comparing COM Objects to CORBA Objects . 17-2
17.2
Interworking Object Model . . . . . . . . . . . . . . . . . . . . . . . . 17.2.1 Relationship to CORBA Object Model. . . . . . . 17.2.2 Relationship to the OLE/COM Model . . . . . . . 17.2.3 Basic Description of the Interworking Model. .
17.3
Interworking Mapping Issues . . . . . . . . . . . . . . . . . . . . . . . 17-8
CORBA, v2.4.2
February 2001
17-3 17-3 17-4 17-4
19
Contents 17.4
Interface Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.4.1 CORBA/COM . . . . . . . . . . . . . . . . . . . . . . . . . 17.4.2 CORBA/Automation . . . . . . . . . . . . . . . . . . . . 17.4.3 COM/CORBA . . . . . . . . . . . . . . . . . . . . . . . . . 17.4.4 Automation/CORBA . . . . . . . . . . . . . . . . . . . .
17-8 17-9 17-9 17-10 17-10
17.5
Interface Composition Mappings . . . . . . . . . . . . . . . . . . . . 17-11 17.5.1 CORBA/COM . . . . . . . . . . . . . . . . . . . . . . . . . 17-11 17.5.1.1 COM/CORBA . . . . . . . . . . . . . . . . . . . . 17-12 17.5.1.2 CORBA/Automation . . . . . . . . . . . . . . . 17-12 17.5.1.3 Automation/CORBA . . . . . . . . . . . . . . . 17-13
17.5.2 Detailed Mapping Rules . . . . . . . . . . . . . . . . . . 17-13 17.5.2.1 Ordering Rules for the CORBA->MIDL Transformation . . . . . . . . . . 17-13 17.5.2.2 Ordering Rules for the CORBA->Automation Transformation . . . . . 17-13
17.5.3 Example of Applying Ordering Rules . . . . . . . 17-14 17.5.4 Mapping Interface Identity . . . . . . . . . . . . . . . . 17-16 17.5.4.1 Mapping Interface Repository IDs to COM IIDs . . . . . . . . . . . . . . . . . . . . . . . 17-17 17.5.4.2 Mapping COM IIDs to CORBA Interface IDs . . . . . . . . . . . . . . . . . . . . . . . . . . 17-18
17.6
Object Identity, Binding, and Life Cycle . . . . . . . . . . . . . . 17-18 17.6.1 Object Identity Issues . . . . . . . . . . . . . . . . . . . . 17-19 17.6.1.1 CORBA Object Identity and Reference Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-19 17.6.1.2 COM Object Identity and Reference Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-19
17.6.2 Binding and Life Cycle . . . . . . . . . . . . . . . . . . 17-20 17.6.2.1 Lifetime Comparison . . . . . . . . . . . . . . . 17-20 17.6.2.2 Binding Existing CORBA Objects to COM Views . . . . . . . . . . . . . . . . . . . . . . . . 17-21 17.6.2.3 Binding COM Objects to CORBA Views 17-22 17.6.2.4 COM View of CORBA Life Cycle . . . . 17-22 17.6.2.5 CORBA View of COM/Automation Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-23
17.7
Interworking Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.7.1 SimpleFactory Interface . . . . . . . . . . . . . . . . . . 17.7.2 IMonikerProvider Interface and Moniker Use . 17.7.3 ICORBAFactory Interface . . . . . . . . . . . . . . . . 17.7.4 IForeignObject Interface. . . . . . . . . . . . . . . . . . 17.7.5 ICORBAObject Interface . . . . . . . . . . . . . . . . . 17.7.6 ICORBAObject2. . . . . . . . . . . . . . . . . . . . . . . . 17.7.7 IORBObject Interface . . . . . . . . . . . . . . . . . . . . 17.7.8 Naming Conventions for View Components . . .
17-23 17-23 17-23 17-24 17-26 17-27 17-28 17-28 17-30
17.7.8.1 Naming the COM View Interface . . . . . 17-30 17.7.8.2 Tag for the Automation Interface Id . . . 17-30 17.7.8.3 Naming the Automation View
20
CORBA, v2.4.2
February 2001
Contents Dispatch Interface . . . . . . . . . . . . . . . . . . . . . . 17.7.8.4 Naming the Automation View Dual Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.7.8.5 Naming the Program Id for the COM Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.7.8.6 Naming the Class Id for the COM Class
17-30 17-31 17-31 17-32
17.8
Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-32 17.8.1 Bridge Locality . . . . . . . . . . . . . . . . . . . . . . . . . 17-32 17.8.2 Distribution Architecture . . . . . . . . . . . . . . . . . 17-33
17.9
Interworking Targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-34
17.10 Compliance to COM/CORBA Interworking . . . . . . . . . . . 17-34 17.10.1 Products Subject to Compliance . . . . . . . . . . . . 17-34 17.10.1.1 Interworking solutions . . . . . . . . . . . . . 17-34 17.10.1.2 Mapping solutions . . . . . . . . . . . . . . . . 17-35 17.10.1.3 Mapped components . . . . . . . . . . . . . . 17-35
17.10.2 Compliance Points . . . . . . . . . . . . . . . . . . . . . . 17-36
18.
Mapping: COM and CORBA . . . . . . . . . . . . . . . . . . . . . . . 18-1 18.1
Data Type Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-1
18.2
CORBA to COM Data Type Mapping . . . . . . . . . . . . . . . . 18.2.1 Mapping for Basic Data Types . . . . . . . . . . . . . 18.2.2 Mapping for Constants . . . . . . . . . . . . . . . . . . . 18.2.3 Mapping for Enumerators. . . . . . . . . . . . . . . . . 18.2.4 Mapping for String Types . . . . . . . . . . . . . . . . .
18-2 18-2 18-2 18-3 18-4
18.2.4.1 Mapping for Unbounded String Types . 18.2.4.2 Mapping for Bounded String Types . . .
18-4 18-5
18.2.5 Mapping for Struct Types . . . . . . . . . . . . . . . . . 18-5 18.2.6 Mapping for Union Types . . . . . . . . . . . . . . . . . 18-6 18.2.7 Mapping for Sequence Types . . . . . . . . . . . . . . 18-8 18.2.7.1 Mapping for Unbounded Sequence Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.2.7.2 Mapping for Bounded Sequence Types
18-8 18-8
18.2.8 Mapping for Array Types . . . . . . . . . . . . . . . . . 18-9 18.2.9 Mapping for the any Type. . . . . . . . . . . . . . . . . 18-9 18.2.10 Interface Mapping . . . . . . . . . . . . . . . . . . . . . . 18-11 18.2.10.1 Mapping for interface identifiers . . . . . 18.2.10.2 Mapping for exception types . . . . . . . . 18.2.10.3 Mapping for Nested Types . . . . . . . . . 18.2.10.4 Mapping for Operations . . . . . . . . . . . 18.2.10.5 Mapping for Oneway Operations . . . . 18.2.10.6 Mapping for Attributes . . . . . . . . . . . . 18.2.10.7 Indirection Levels for Operation Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18-11 18-11 18-21 18-22 18-24 18-24 18-26
18.2.11 Inheritance Mapping. . . . . . . . . . . . . . . . . . . . . 18-26 18.2.12 Mapping for Pseudo-Objects . . . . . . . . . . . . . . 18-29 18.2.12.1 Mapping for TypeCode pseudo-object 18-29 18.2.12.2 Mapping for context pseudo-object . . . 18-31
CORBA, v2.4.2
February 2001
21
Contents 18.2.12.3 Mapping for principal pseudo-object . 18-32
18.2.13 Interface Repository Mapping . . . . . . . . . . . . . 18-32 18.3
COM to CORBA Data Type Mapping . . . . . . . . . . . . . . . . 18.3.1 Mapping for Basic Data Types . . . . . . . . . . . . . 18.3.2 Mapping for Constants . . . . . . . . . . . . . . . . . . . 18.3.3 Mapping for Enumerators. . . . . . . . . . . . . . . . . 18.3.4 Mapping for String Types . . . . . . . . . . . . . . . . .
18-33 18-33 18-34 18-34 18-35
18.3.4.1 Mapping for unbounded string types . . . 18.3.4.2 Mapping for bounded string types . . . . . 18.3.4.3 Mapping for Unicode Unbounded String Types . . . . . . . . . . . . . . . . . . . . . . . . . . 18.3.4.4 Mapping for unicode bound string types
18-35 18-36 18-36 18-37
18.3.5 Mapping for Structure Types . . . . . . . . . . . . . . 18-37 18.3.6 Mapping for Union Types . . . . . . . . . . . . . . . . . 18-38 18.3.6.1 Mapping for Encapsulated Unions . . . . 18-38 18.3.6.2 Mapping for nonencapsulated unions . . 18-39
18.3.7 Mapping for Array Types . . . . . . . . . . . . . . . . . 18-40 18.3.7.1 Mapping for nonfixed arrays . . . . . . . . . 18-40 18.3.7.2 Mapping for SAFEARRAY . . . . . . . . . 18-40
18.3.8 Mapping for VARIANT . . . . . . . . . . . . . . . . . . 18-41 18.3.9 Mapping for Pointers . . . . . . . . . . . . . . . . . . . . 18-43 18.3.10 Interface Mapping . . . . . . . . . . . . . . . . . . . . . . 18-44 18.3.10.1 Mapping for Interface Identifiers . . . . 18.3.10.2 Mapping for COM Errors . . . . . . . . . . 18.3.10.3 Mapping of Nested Data Types . . . . . . 18.3.10.4 Mapping of Names . . . . . . . . . . . . . . . 18.3.10.5 Mapping for Operations . . . . . . . . . . . 18.3.10.6 Mapping for Properties . . . . . . . . . . . .
18-44 18-44 18-47 18-47 18-47 18-48
18.3.11 Mapping for Read-Only Attributes . . . . . . . . . . 18-49 18.3.12 Mapping for Read-Write Attributes . . . . . . . . . 18-49 18.3.12.1 Inheritance Mapping . . . . . . . . . . . . . . 18-50 18.3.12.2 Type Library Mapping . . . . . . . . . . . . 18-52
19. Mapping: Automation and CORBA. . . . . . . . . . . . . . . . . . . 19-1 19.1
Mapping CORBA Objects to Automation . . . . . . . . . . . . . 19-2 19.1.1 Architectural Overview . . . . . . . . . . . . . . . . . . 19-2 19.1.2 Main Features of the Mapping . . . . . . . . . . . . . 19-3
19.2
Mapping for Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.2.1 Mapping for Attributes and Operations . . . . . . 19.2.2 Mapping for OMG IDL Single Inheritance . . . 19.2.3 Mapping of OMG IDL Multiple Inheritance . .
19.3
Mapping for Basic Data Types . . . . . . . . . . . . . . . . . . . . . . 19-9 19.3.1 Basic Automation Types . . . . . . . . . . . . . . . . . . 19-9 19.3.2 Special Cases of Basic Data Type Mapping . . . 19-10
19-3 19-4 19-5 19-6
19.3.2.1 Converting Automation long to CORBA unsigned long . . . . . . . . . . . . . . . . . . 19-10
22
CORBA, v2.4.2
February 2001
Contents 19.3.2.2 Demoting CORBA unsigned long to Automation long . . . . . . . . . . . . . . . . . . . . . . . 19-11 19.3.2.3 Demoting Automation long to CORBA unsigned short . . . . . . . . . . . . . . . . . . . . . . . . 19-11 19.3.2.4 Converting Automation boolean to CORBA boolean and CORBA boolean to Automation boolean . . . . . . . . . . . . . . . . . . . . 19-11
19.3.3 Mapping for Strings . . . . . . . . . . . . . . . . . . . . . 19-11 19.4
IDL to ODL Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-12 19.4.1 A Complete IDL to ODL Mapping for the Basic Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-12
19.5
Mapping for Object References . . . . . . . . . . . . . . . . . . . . . 19-15 19.5.1 Type Mapping. . . . . . . . . . . . . . . . . . . . . . . . . . 19-15 19.5.2 Object Reference Parameters and IForeignObject . . . . . . . . . . . . . . . . . . . . . . . . . 19-16
19.6
Mapping for Enumerated Types . . . . . . . . . . . . . . . . . . . . . 19-17
19.7
Mapping for Arrays and Sequences . . . . . . . . . . . . . . . . . . 19-18
19.8
Mapping for CORBA Complex Types . . . . . . . . . . . . . . . . 19.8.1 Mapping for Structure Types . . . . . . . . . . . . . . 19.8.2 Mapping for Union Types . . . . . . . . . . . . . . . . . 19.8.3 Mapping for TypeCodes . . . . . . . . . . . . . . . . . . 19.8.4 Mapping for anys . . . . . . . . . . . . . . . . . . . . . . . 19.8.5 Mapping for Typedefs. . . . . . . . . . . . . . . . . . . . 19.8.6 Mapping for Constants . . . . . . . . . . . . . . . . . . . 19.8.7 Getting Initial CORBA Object References . . . . 19.8.8 Creating Initial in Parameters for Complex Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19-19 19-20 19-21 19-22 19-24 19-25 19-25 19-26 19-27
19.8.8.1 ITypeFactory Interface . . . . . . . . . . . . . 19-29 19.8.8.2 DIObjectInfo Interface . . . . . . . . . . . . . 19-29
19.8.9 Mapping CORBA Exceptions to Automation Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-30 19.8.9.1 Overview of Automation Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.8.9.2 CORBA Exceptions . . . . . . . . . . . . . . . 19.8.9.3 CORBA User Exceptions . . . . . . . . . . . 19.8.9.4 Operations that Raise User Exceptions . 19.8.9.5 CORBA System Exceptions . . . . . . . . . 19.8.9.6 Operations that raise system exceptions
19-30 19-30 19-31 19-32 19-33 19-34
19.8.10 Conventions for Naming Components of the Automation View . . . . . . . . . . . . . . . . . . . . . . . 19-36 19.8.11 Naming Conventions for Pseudo-Structs, PseudoUnions, and Pseudo-Exceptions . . . . . . . . . . . . 19-36 19.8.12 Automation View Interface as a Dispatch Interface (Nondual) . . . . . . . . . . . . . . . . . . . . . 19-36 19.8.13 Aggregation of Automation Views . . . . . . . . . . 19-38
CORBA, v2.4.2
February 2001
23
Contents 19.8.14 DII and DSI . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-38 19.9
Mapping Automation Objects as CORBA Objects. . . . . . . 19.9.1 Architectural Overview . . . . . . . . . . . . . . . . . . 19.9.2 Main Features of the Mapping . . . . . . . . . . . . . 19.9.3 Getting Initial Object References . . . . . . . . . . . 19.9.4 Mapping for Interfaces . . . . . . . . . . . . . . . . . . . 19.9.5 Mapping for Inheritance . . . . . . . . . . . . . . . . . . 19.9.6 Mapping for ODL Properties and Methods . . . 19.9.7 Mapping for Automation Basic Data Types . . .
19-38 19-38 19-39 19-40 19-40 19-40 19-41 19-42
19.9.7.1 Basic automation types . . . . . . . . . . . . . 19-42
19.9.8 Conversion Errors . . . . . . . . . . . . . . . . . . . . . . . 19-43 19.9.9 Special Cases of Data Type Conversion . . . . . . 19-43 19.9.9.1 Translating COM::Currency to Automation CURRENCY . . . . . . . . . . . . . . . . 19-43 19.9.9.2 Translating CORBA double to Automation DATE . . . . . . . . . . . . . . . . . . . . . 19-43 19.9.9.3 Translating CORBA boolean to Automation boolean and Automation boolean to CORBA boolean . . . . . . . . . . . . . . 19-43
19.9.10 A Complete OMG IDL to ODL Mapping for the Basic Data Types . . . . . . . . . . . . . . . . . . . . 19.9.11 Mapping for Object References . . . . . . . . . . . . 19.9.12 Mapping for Enumerated Types . . . . . . . . . . . . 19.9.13 Mapping for SafeArrays . . . . . . . . . . . . . . . . . .
19-44 19-46 19-47 19-48
19.9.13.1 Multidimensional SafeArrays . . . . . . . 19-48
19.9.14 Mapping for Typedefs. . . . . . . . . . . . . . . . . . . . 19-48 19.9.15 Mapping for VARIANTs . . . . . . . . . . . . . . . . . 19-48 19.9.16 Mapping Automation Exceptions to CORBA . . 19-49 19.10 Older Automation Controllers . . . . . . . . . . . . . . . . . . . . . . 19-49 19.10.1 Mapping for OMG IDL Arrays and Sequences to Collections . . . . . . . . . . . . . . . . . . . . . . . . . . 19-49 19.11 Example Mappings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.11.1 Mapping the OMG Naming Service to Automation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.11.2 Mapping a COM Service to OMG IDL . . . . . . 19.11.3 Mapping an OMG Object Service to Automation . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19-51 19-51 19-51 19-55
20. Interoperability with non-CORBA Systems . . . . . . . . . . . . 20-1
24
20.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-1 20.1.1 COM/CORBA Part A . . . . . . . . . . . . . . . . . . . . 20-2
20.2
Conformance Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-2 20.2.1 Performance Issues . . . . . . . . . . . . . . . . . . . . . . 20-3
CORBA, v2.4.2
February 2001
Contents 20.2.2 Scalability Issues . . . . . . . . . . . . . . . . . . . . . . . 20-3 20.2.3 CORBA Clients for DCOM Servers . . . . . . . . . 20-3 20.3
Locality of the Bridge . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-4
20.4
Extent Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20.4.1 Marshaling Constraints. . . . . . . . . . . . . . . . . . . 20.4.2 Marshaling Key . . . . . . . . . . . . . . . . . . . . . . . . 20.4.3 Extent Format . . . . . . . . . . . . . . . . . . . . . . . . . .
20-5 20-6 20-6 20-7
20.4.3.1 DVO_EXTENT . . . . . . . . . . . . . . . . . . . 20.4.3.2 DVO_IFACE . . . . . . . . . . . . . . . . . . . . . 20.4.3.3 DVO_IMPLDATA . . . . . . . . . . . . . . . . 20.4.3.4 DVO_BLOB . . . . . . . . . . . . . . . . . . . . .
20-7 20-8 20-8 20-8
20.5
Request/Reply Extent Semantics . . . . . . . . . . . . . . . . . . . . 20-8
20.6
Consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-9 20.6.1 IValueObject . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-10 20.6.2 ISynchronize and DISynchronize . . . . . . . . . . . 20-10 20.6.2.1 Mode Property . . . . . . . . . . . . . . . . . . . . 20-11 20.6.2.2 SyncNow Method . . . . . . . . . . . . . . . . . 20-11 20.6.2.3 ReCopy Method . . . . . . . . . . . . . . . . . . 20-11
20.7
DCOM Value Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-11 20.7.1 Passing Automation Compound Types as DCOM Value Objects . . . . . . . . . . . . . . . . . . . . . . . . . . 20-11 20.7.2 Passing CORBA-Defined Pseudo-Objects as DCOM Value Objects . . . . . . . . . . . . . . . . . . . . . . . . . . 20-11 20.7.3 IForeignObject . . . . . . . . . . . . . . . . . . . . . . . . . 20-12 20.7.4 DIForeignComplexType . . . . . . . . . . . . . . . . . . 20-12 20.7.5 DIForeignException . . . . . . . . . . . . . . . . . . . . . 20-12 20.7.6 DISystemException . . . . . . . . . . . . . . . . . . . . . 20-12 20.7.7 DICORBAUserException . . . . . . . . . . . . . . . . . 20-13 20.7.8 DICORBAStruct. . . . . . . . . . . . . . . . . . . . . . . . 20-13 20.7.9 DICORBAUnion. . . . . . . . . . . . . . . . . . . . . . . . 20-13 20.7.10 DICORBATypeCode and ICORBATypeCode . . 20-13 20.7.11 DICORBAAny . . . . . . . . . . . . . . . . . . . . . . . . . 20-14 20.7.12 ICORBAAny . . . . . . . . . . . . . . . . . . . . . . . . . . 20-14 20.7.13 User Exceptions In COM . . . . . . . . . . . . . . . . . 20-15
20.8
Chain Avoidance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-16 20.8.1 CORBA Chain Avoidance . . . . . . . . . . . . . . . . 20-16 20.8.2 COM Chain Avoidance. . . . . . . . . . . . . . . . . . . 20-17
20.9
Chain Bypass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-19 20.9.1 CORBA Chain Bypass . . . . . . . . . . . . . . . . . . . 20-19 20.9.2 COM Chain Bypass . . . . . . . . . . . . . . . . . . . . . 20-20
20.10 Thread Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-21
CORBA, v2.4.2
February 2001
25
Contents 21. Interceptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-1 21.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-1 21.1.1 ORB Core and ORB Services . . . . . . . . . . . . . . 21-2
21.2
Interceptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2.1 Generic ORB Services and Interceptors . . . . . . 21.2.2 Request-Level Interceptors . . . . . . . . . . . . . . . 21.2.3 Message-Level Interceptors . . . . . . . . . . . . . . . 21.2.4 Selecting Interceptors . . . . . . . . . . . . . . . . . . . .
21.3
Client-Target Binding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-4 21.3.1 Binding Model . . . . . . . . . . . . . . . . . . . . . . . . . 21-4 21.3.2 Establishing the Binding and Interceptors . . . . 21-5
21.4
Using Interceptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-6 21.4.1 Request-Level Interceptors . . . . . . . . . . . . . . . . 21-6 21.4.2 Message-Level Interceptors . . . . . . . . . . . . . . . 21-7
21.5
Interceptor Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-7 21.5.1 Client and Target Invoke . . . . . . . . . . . . . . . . . . 21-8 21.5.2 Send and Receive Message . . . . . . . . . . . . . . . . 21-8
21.6
IDL for Interceptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-9
21-2 21-2 21-3 21-3 21-4
22. CORBA Messaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-1 22.1
Section I - Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-2
22.2
Messaging Quality of Service . . . . . . . . . . . . . . . . . . . . . . 22-2 22.2.1 Rebind Support. . . . . . . . . . . . . . . . . . . . . . . . . 22-4 22.2.1.1 typedef short RebindMode . . . . . . . . . . 22.2.1.2 interface RebindPolicy . . . . . . . . . . . . .
22-4 22-5
22.2.2 Synchronization Scope . . . . . . . . . . . . . . . . . . . 22-6 22.2.2.1 typedef short SyncScope . . . . . . . . . . . . 22.2.2.2 interface SyncScopePolicy . . . . . . . . . .
22-6 22-7
22.2.3 Request and Reply Priority . . . . . . . . . . . . . . . . 22-7 22.2.3.1 struct PriorityRange . . . . . . . . . . . . . . . . 22.2.3.2 interface RequestPriorityPolicy . . . . . . . 22.2.3.3 interface ReplyPriorityPolicy . . . . . . . .
22-7 22-7 22-7
22.2.4 Request and Reply Timeout . . . . . . . . . . . . . . . 22-8 22.2.4.1 interface RequestStartTimePolicy . . . . . 22.2.4.2 interface RequestEndTimePolicy . . . . . 22.2.4.3 interface ReplyStartTimePolicy . . . . . . 22.2.4.4 interface ReplyEndTimePolicy . . . . . . . 22.2.4.5 interface RelativeRequestTimeoutPolicy 22.2.4.6 interface RelativeRoundtripTimeoutPolicy
22-8 22-8 22-8 22-9 22-9 22-9
22.2.5 Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-10 22.2.5.1 typedef short RoutingType . . . . . . . . . . 22.2.5.2 struct RoutingTypeRange . . . . . . . . . . . 22.2.5.3 interface RoutingPolicy . . . . . . . . . . . . . 22.2.5.4 interface MaxHopsPolicy . . . . . . . . . . .
26
CORBA, v2.4.2
February 2001
22-10 22-10 22-10 22-11
Contents 22.2.6 Queue Ordering . . . . . . . . . . . . . . . . . . . . . . . . 22-11 22.2.6.1 typedef short Ordering . . . . . . . . . . . . . . 22-11 22.2.6.2 interface QueueOrderPolicy . . . . . . . . . 22-11
22.3
Propagation of Messaging QoS . . . . . . . . . . . . . . . . . . . . . 22.3.1 Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22.3.2 Messaging QoS Profile Component . . . . . . . . . 22.3.3 Messaging QoS Service Context . . . . . . . . . . .
22-12 22-12 22-12 22-13
22.4
Section II - Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-13
22.5
Running Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-15
22.6
Async Operation Mapping . . . . . . . . . . . . . . . . . . . . . . . . . 22-15 22.6.1 Callback Model Signatures (sendc) . . . . . . . . . 22-16 22.6.1.1 Implied-IDL for Operations . . . . . . . . . 22-16 22.6.1.2 Implied-IDL for Attributes . . . . . . . . . . 22-16 22.6.1.3 Example . . . . . . . . . . . . . . . . . . . . . . . . . 22-17
22.6.2 Polling Model Signatures (sendp). . . . . . . . . . . 22-18 22.6.2.1 Implied-IDL for Operations . . . . . . . . . 22-18 22.6.2.2 Implied-IDL for Attributes . . . . . . . . . . 22-18 22.6.2.3 Example . . . . . . . . . . . . . . . . . . . . . . . . . 22-19
22.7
Exception Delivery in the Callback Model. . . . . . . . . . . . . 22.7.1 Generic ExceptionHolder Value . . . . . . . . . . . . 22.7.2 Type-Specific ExceptionHolder Mapping. . . . . 22.7.3 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22-20 22-20 22-20 22-21
22.8
Type-Specific ReplyHandler Mapping . . . . . . . . . . . . . . . . 22.8.1 ReplyHandler Operations for NO_EXCEPTION Replies . . . . . . . . . . . . . . . . 22.8.2 ReplyHandler Operations for Exceptional Replies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22.8.3 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22-22
22.9
Generic Poller Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22.9.1 operation_target . . . . . . . . . . . . . . . . . . . . . . . . 22.9.2 operation_name . . . . . . . . . . . . . . . . . . . . . . . . 22.9.3 associated_handler . . . . . . . . . . . . . . . . . . . . . . 22.9.4 is_from_poller . . . . . . . . . . . . . . . . . . . . . . . . .
22-23 22-23 22-24 22-25 22-25 22-25 22-25 22-26
22.10 Type-Specific Poller Mapping . . . . . . . . . . . . . . . . . . . . . . 22-26 22.10.1 Basic Type-Specific Poller . . . . . . . . . . . . . . . . 22-26 22.10.1.1 Poller operations for Interface operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-27 22.10.1.2 Poller operations for Interface attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-28
22.10.2 Persistent Type-Specific Poller . . . . . . . . . . . . . 22-29 22.10.3 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-29 22.11 Example Programmer Usage . . . . . . . . . . . . . . . . . . . . . . . 22-30
CORBA, v2.4.2
February 2001
27
Contents 22.11.1 Example Programmer Usage (Examples Mapped to C++) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-30 22.11.2 Client-Side C++ Example for the Asynchronous Method Signatures . . . . . . . . . . . . . . . . . . . . . . 22-30 22.11.3 Client-Side C++ Example of the Callback Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-32 22.11.3.1 C++ Example of Generated ExceptionHolder . . . . . . . . . . . . . . . . . . . . . . . 22.11.3.2 C++ Example of Generated ReplyHandler . . . . . . . . . . . . . . . . . . . . . . . . . 22.11.3.3 C++ Example of User -Implemented ReplyHandler . . . . . . . . . . . . . . . . . . . . . . . . . 22.11.3.4 C++ Example of Callback Client Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22-32 22-32 22-34 22-37
22.11.4 Client-Side C++ Example of the Polling Model 22-39 22.11.4.1 C++ Example of Generated Poller . . . 22-39 22.11.4.2 C++ Example of Polling Client Program 22-40 22.11.4.3 C++ Example of Using PollableSet in a Client Program . . . . . . . . . . . . . . . . . . . . . 22-42
22.11.5 Server Side . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-44 22.12 Section III - Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . 22-45 22.13 Routing Object References. . . . . . . . . . . . . . . . . . . . . . . . . 22-46 22.14 Message Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-46 22.14.1 Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-48 22.14.1.1 MessageBody . . . . . . . . . . . . . . . . . . . 22.14.1.2 RequestMessage . . . . . . . . . . . . . . . . . 22.14.1.3 ReplyDestination . . . . . . . . . . . . . . . . . 22.14.1.4 RequestInfo . . . . . . . . . . . . . . . . . . . . .
22-48 22-48 22-49 22-50
22.14.2 Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-50 22.14.2.1 ReplyHandler . . . . . . . . . . . . . . . . . . . . 22.14.2.2 Router . . . . . . . . . . . . . . . . . . . . . . . . . 22.14.2.3 send_request . . . . . . . . . . . . . . . . . . . . 22.14.2.4 send_multiple_requests . . . . . . . . . . . . 22.14.2.5 UntypedReplyHandler . . . . . . . . . . . . . 22.14.2.6 reply . . . . . . . . . . . . . . . . . . . . . . . . . . . 22.14.2.7 PersistentRequest . . . . . . . . . . . . . . . . . 22.14.2.8 readonly attribute reply_available . . . . 22.14.2.9 get_reply . . . . . . . . . . . . . . . . . . . . . . . 22.14.2.10 attribute associated_handler . . . . . . . 22.14.2.11 PersistentRequestRouter . . . . . . . . . . 22.14.2.12 create_persistent_request . . . . . . . . . .
22-50 22-50 22-51 22-51 22-51 22-51 22-51 22-51 22-52 22-52 22-52 22-52
22.14.3 Routing Protocol. . . . . . . . . . . . . . . . . . . . . . . . 22-53 22.14.3.1 Invoking Client . . . . . . . . . . . . . . . . . . 22.14.3.2 Initial Request Router . . . . . . . . . . . . . 22.14.3.3 Request Routing Algorithm . . . . . . . . 22.14.3.4 Intermediate Request Router . . . . . . . 22.14.3.5 Target Router . . . . . . . . . . . . . . . . . . . . 22.14.3.6 Replying to a Type-specific ReplyHandler . . . . . . . . . . . . . . . . . . . . . . . . . 22.14.3.7 Replying to an UntypedReplyHandler
28
CORBA, v2.4.2
February 2001
22-53 22-54 22-55 22-55 22-55 22-57 22-58
Contents 22.14.3.8 Handling of Service Contexts . . . . . . . 22.14.3.9 Handling LOCATION_FORWARD Replies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22.14.3.10 Routing of Replies . . . . . . . . . . . . . . . 22.14.3.11 UntypedReplyHandler . . . . . . . . . . . .
22-58 22-58 22-58 22-59
22.15 Router Administration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-59 22.15.1 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-63 22.15.1.1 typedef short RegistrationState . . . . . . 22-63
22.15.2 Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-63 22.15.2.1 exception InvalidState . . . . . . . . . . . . . 22-63
22.15.3 Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-63 22.15.3.1 RetryPolicy . . . . . . . . . . . . . . . . . . . . 22.15.3.2 ImmediateSuspend . . . . . . . . . . . . . . . 22.15.3.3 UnlimitedPing . . . . . . . . . . . . . . . . . . . 22.15.3.4 LimitedPing . . . . . . . . . . . . . . . . . . . 22.15.3.5 DecayPolicy . . . . . . . . . . . . . . . . . . . . . 22.15.3.6 ResumePolicy . . . . . . . . . . . . . . . . . . .
22-63 22-63 22-63 22-64 22-64 22-64
22.15.4 Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-64 22.15.4.1 RouterAdmin . . . . . . . . . . . . . . . . . . . . 22.15.4.2 register_destination . . . . . . . . . . . . . . . 22.15.4.3 suspend_destination . . . . . . . . . . . . . . . 22.15.4.4 resume_destination . . . . . . . . . . . . . . . 22.15.4.5 unregister_destination . . . . . . . . . . . . .
22-64 22-65 22-65 22-65 22-65
23. Minimum CORBA. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-1 23.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-2
23.2
IDL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-2
23.3
CORBA Omitted Features . . . . . . . . . . . . . . . . . . . . . . . . . 23-2
23.4
ORB Interface Omissions. . . . . . . . . . . . . . . . . . . . . . . . . . 23.4.1 ORB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.4.2 Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.4.3 ConstructionPolicy . . . . . . . . . . . . . . . . . . . . . .
23.5
Dynamic Invocation Interface . . . . . . . . . . . . . . . . . . . . . . 23-5
23.6
Dynamic Skeleton Interface . . . . . . . . . . . . . . . . . . . . . . . . 23-5
23.7
Dynamic Any . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-5
23.8
Interface Repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-5 23.8.1 TypeCode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-5
23.9
Portable Object Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-6 23.9.1 Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-6 23.9.1.1 POA . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.9.1.2 Current . . . . . . . . . . . . . . . . . . . . . . . . . . 23.9.1.3 Policy interfaces . . . . . . . . . . . . . . . . . . 23.9.1.4 POAManager . . . . . . . . . . . . . . . . . . . . . 23.9.1.5 AdapterActivator . . . . . . . . . . . . . . . . . . 23.9.1.6 ServantManagers . . . . . . . . . . . . . . . . . .
23-3 23-3 23-4 23-4
23-6 23-6 23-7 23-7 23-7 23-7
23.9.2 Policies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-7
CORBA, v2.4.2
February 2001
29
Contents 23.9.2.1 ThreadPolicy . . . . . . . . . . . . . . . . . . . . . 23.9.2.2 LifespanPolicy . . . . . . . . . . . . . . . . . . . . 23.9.2.3 ObjectIdUniquenessPolicy . . . . . . . . . . 23.9.2.4 IdAssignmentPolicy . . . . . . . . . . . . . . . 23.9.2.5 ServantRetentionPolicy . . . . . . . . . . . . . 23.9.2.6 RequestProcessingPolicy . . . . . . . . . . . . 23.9.2.7 ImplicitActivationPolicy . . . . . . . . . . . .
23-7 23-8 23-8 23-8 23-8 23-8 23-9
23.10 Interoperability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-9 23.10.1 DCE Interoperability . . . . . . . . . . . . . . . . . . . . 23-9 23.11 COM/CORBA Interworking . . . . . . . . . . . . . . . . . . . . . . . 23-10 23.12 Interceptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-10 23.13 Language Mappings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23-10 23.13.1 C++ Mapping Specific Issues . . . . . . . . . . . . . . 23-10 23.13.2 Java Mapping Specific Issues . . . . . . . . . . . . . . 23-10 23.14 minimumCORBA OMG IDL . . . . . . . . . . . . . . . . . . . . . . . 23.14.1 ORB Interface. . . . . . . . . . . . . . . . . . . . . . . . . . 23.14.2 Dynamic Invocation Interface. . . . . . . . . . . . . . 23.14.3 Dynamic Skeleton Interface . . . . . . . . . . . . . . . 23.14.4 Dynamic Management of Any Values . . . . . . . 23.14.5 Interface Repository . . . . . . . . . . . . . . . . . . . . . 23.14.6 Portable Object Adapter . . . . . . . . . . . . . . . . . . 23.14.7 Interceptors. . . . . . . . . . . . . . . . . . . . . . . . . . . .
23-11 23-11 23-14 23-14 23-14 23-14 23-22 23-29
24. Real-Time CORBA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-1
30
24.1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-2
24.2
Goals of the Specification . . . . . . . . . . . . . . . . . . . . . . . . . 24-2
24.3
Extending CORBA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-3
24.4
Approach to Real-Time CORBA . . . . . . . . . . . . . . . . . . . . 24.4.1 The Nature of Real-Time . . . . . . . . . . . . . . . . . 24.4.2 Meeting Real-Time Requirements . . . . . . . . . . 24.4.3 Activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24.4.4 End-to-End Predictability . . . . . . . . . . . . . . . . . 24.4.5 Management of Resources . . . . . . . . . . . . . . . .
24-4 24-4 24-4 24-5 24-5 24-6
24.5
Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24.5.1 Interoperability . . . . . . . . . . . . . . . . . . . . . . . . . 24.5.2 Portability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24.5.3 CORBA - Real-Time CORBA Interworking. . .
24-6 24-6 24-7 24-7
24.6
Compliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-8
24.7
Real-Time Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-8 24.7.1 Real-Time CORBA Modules . . . . . . . . . . . . . . 24-9 24.7.2 Real-Time ORB . . . . . . . . . . . . . . . . . . . . . . . . 24-9
CORBA, v2.4.2
February 2001
Contents 24.7.3 Thread Scheduling . . . . . . . . . . . . . . . . . . . . . . 24-9 24.7.3.1 Threads for part of an activity . . . . . . . . 24-10
24.7.4 24.7.5 24.7.6 24.7.7 24.7.8 24.7.9 24.7.10 24.7.11 24.7.12 24.7.13 24.7.14 24.7.15
Real-Time CORBA Priority . . . . . . . . . . . . . . . Native Priority and PriorityMappings. . . . . . . . Real-Time CORBA Current . . . . . . . . . . . . . . . Priority Models. . . . . . . . . . . . . . . . . . . . . . . . . Real-Time CORBA Mutexes and Priority Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . Threadpools . . . . . . . . . . . . . . . . . . . . . . . . . . . Priority Banded Connections . . . . . . . . . . . . . . Non-Multiplexed Connections . . . . . . . . . . . . . Invocation Timeouts . . . . . . . . . . . . . . . . . . . . . Client and Server Protocol Configuration . . . . . Real-Time CORBA Configuration . . . . . . . . . . Scheduling Service . . . . . . . . . . . . . . . . . . . . . .
24-10 24-10 24-10 24-11 24-11 24-11 24-12 24-12 24-12 24-12 24-12 24-13
24.8
Real-Time ORB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-13 24.8.1 Real-Time ORB Initialization. . . . . . . . . . . . . . 24-14 24.8.2 Real-Time CORBA System Exceptions . . . . . . 24-14
24.9
Real-Time POA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-15
24.10 Native Thread Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-16 24.11 CORBA Priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-17 24.12 CORBA Priority Mappings . . . . . . . . . . . . . . . . . . . . . . . . 24.12.1 C Language Binding for PriorityMapping . . . . 24.12.2 C++ Language Binding for PriorityMapping . . 24.12.3 Ada Language Binding for PriorityMapping . . 24.12.4 Java Language Binding for PriorityMapping . . 24.12.5 Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24-17 24-18 24-19 24-19 24-20 24-20
24.13 Real-Time Current . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-21 24.14 Real-Time CORBA Priority Models . . . . . . . . . . . . . . . . . 24.14.1 PriorityModelPolicy . . . . . . . . . . . . . . . . . . . . . 24.14.2 Scope of PriorityModelPolicy . . . . . . . . . . . . . 24.14.3 Client Propagated Priority Model . . . . . . . . . . . 24.14.4 Server Declared Priority Model . . . . . . . . . . . . 24.14.5 Setting Server Priority on a Per-object Reference Basis . . . . . . . . . . . . . . . . . . . . . . . .
24-22 24-22 24-23 24-24 24-24
24.15 Priority Transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24.15.1 C Language Binding for PriorityTransform . . . 24.15.2 C++ Language Binding for PriorityTransform . 24.15.3 Ada Language Binding for PriorityTransform . 24.15.4 Java Language Binding for PriorityTransform .
24-26 24-27 24-28 24-28 24-29
CORBA, v2.4.2
February 2001
24-25
31
Contents 24.15.5 Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-29 24.16 Mutex Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-30 24.17 Threadpools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24.17.1 Creation of Threadpool without Lanes . . . . . . . 24.17.2 Creation of Threadpool with Lanes . . . . . . . . . 24.17.3 Request Buffering. . . . . . . . . . . . . . . . . . . . . . . 24.17.4 Scope of ThreadpoolPolicy. . . . . . . . . . . . . . . .
24-31 24-33 24-33 24-34 24-34
24.18 Implicit and Explicit Binding . . . . . . . . . . . . . . . . . . . . . . . 24-35 24.19 Priority Banded Connections . . . . . . . . . . . . . . . . . . . . . . . 24-35 24.19.1 Scope of PriorityBandedConnectionPolicy. . . . 24-37 24.19.2 Binding of Priority Banded Connection . . . . . . 24-37 24.20 PrivateConnectionPolicy . . . . . . . . . . . . . . . . . . . . . . . . . . 24-39 24.21 Invocation Timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-39 24.22 Protocol Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24.22.1 ServerProtocolPolicy . . . . . . . . . . . . . . . . . . . . 24.22.2 Scope of ServerProtocolPolicy . . . . . . . . . . . . . 24.22.3 ClientProtocolPolicy. . . . . . . . . . . . . . . . . . . . . 24.22.4 Scope of ClientProtocolPolicy . . . . . . . . . . . . . 24.22.5 Protocol Configuration Semantics . . . . . . . . . .
24-40 24-40 24-42 24-42 24-43 24-44
24.23 Consolidated OMG IDL . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-44 24.24 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-50 24.25 OMG IDL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-51 24.26 Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24-52
32
24.27 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24.27.1 Server C++ Example Code . . . . . . . . . . . . . . . . 24.27.2 Client C++ Example Code . . . . . . . . . . . . . . . . 24.27.3 Explanation of Example . . . . . . . . . . . . . . . . . .
24-52 24-53 24-54 24-54
Appendix A - OMG IDL Tags . . . . . . . . . . . . . . . . . . . . . . .
A-1
CORBA, v2.4.2
February 2001
Preface About This Document Under the terms of the collaboration between OMG and X/Open Co Ltd., this document is a candidate for endorsement by X/Open, initially as a Preliminary Specification and later as a full CAE Specification. The collaboration between OMG and X/Open Co Ltd. ensures joint review and cohesive support for emerging objectbased specifications. X/Open Preliminary Specifications undergo close scrutiny through a review process at X/Open before publication and are inherently stable specifications. Upgrade to full CAE Specification, after a reasonable interval, takes place following further review by X/Open. This further review considers the implementation experience of members and the full implications of conformance and branding.
Object Management Group The Object Management Group, Inc. (OMG) is an international organization supported by over 800 members, including information system vendors, software developers and users. Founded in 1989, the OMG promotes the theory and practice of object-oriented technology in software development. The organization's charter includes the establishment of industry guidelines and object management specifications to provide a common framework for application development. Primary goals are the reusability, portability, and interoperability of object-based software in distributed, heterogeneous environments. Conformance to these specifications will make it possible to develop a heterogeneous applications environment across all major hardware platforms and operating systems. OMG's objectives are to foster the growth of object technology and influence its direction by establishing the Object Management Architecture (OMA). The OMA provides the conceptual infrastructure upon which all OMG specifications are based.
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
i
X/Open X/Open is an independent, worldwide, open systems organization supported by most of the world's largest information system suppliers, user organizations and software companies. Its mission is to bring to users greater value from computing, through the practical implementation of open systems. X/Open’s strategy for achieving its mission is to combine existing and emerging standards into a comprehensive, integrated systems environment called the Common Applications Environment (CAE). The components of the CAE are defined in X/Open CAE specifications. These contain, among other things, an evolving portfolio of practical application programming interfaces (APIs), which significantly enhance portability of application programs at the source code level. The APIs also enhance the interoperability of applications by providing definitions of, and references to, protocols and protocol profiles. The X/Open specifications are also supported by an extensive set of conformance tests and by the X/Open trademark (XPG brand), which is licensed by X/Open and is carried only on products that comply with the CAE specifications.
Intended Audience The architecture and specifications described in this manual are aimed at software designers and developers who want to produce applications that comply with OMG standards for the Object Request Broker (ORB). The benefit of compliance is, in general, to be able to produce interoperable applications that are based on distributed, interoperating objects. As defined by the Object Management Group (OMG) in the Object Management Architecture Guide, the ORB provides the mechanisms by which objects transparently make requests and receive responses. Hence, the ORB provides interoperability between applications on different machines in heterogeneous distributed environments and seamlessly interconnects multiple object systems.
Context of CORBA The key to understanding the structure of the CORBA architecture is the Reference Model, which consists of the following components: • Object Request Broker, which enables objects to transparently make and receive requests and responses in a distributed environment. It is the foundation for building applications from distributed objects and for interoperability between applications in hetero- and homogeneous environments. The architecture and specifications of the Object Request Broker are described in this manual. • Object Services, a collection of services (interfaces and objects) that support basic functions for using and implementing objects. Services are necessary to construct any distributed application and are always independent of application domains. For example, the Life Cycle Service defines conventions for creating, deleting, copying, and moving objects; it does not dictate how the objects are implemented in an application. Specifications for Object Services are contained in CORBAservices: Common Object Services Specification.
ii
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
• Common Facilities, a collection of services that many applications may share, but which are not as fundamental as the Object Services. For instance, a system management or electronic mail facility could be classified as a common facility. Information about Common Facilities will be contained in CORBAfacilities: Common Facilities Architecture. • Application Objects, which are products of a single vendor on in-house development group that controls their interfaces. Application Objects correspond to the traditional notion of applications, so they are not standardized by OMG. Instead, Application Objects constitute the uppermost layer of the Reference Model. The Object Request Broker, then, is the core of the Reference Model. It is like a telephone exchange, providing the basic mechanism for making and receiving calls. Combined with the Object Services, it ensures meaningful communication between CORBA-compliant applications.
Associated Documents The CORBA documentation set includes the following books: • Object Management Architecture Guide defines the OMG’s technical objectives and terminology and describes the conceptual models upon which OMG standards are based. It also provides information about the policies and procedures of OMG, such as how standards are proposed, evaluated, and accepted. • CORBA: Common Object Request Broker Architecture and Specification contains the architecture and specifications for the Object Request Broker. • CORBAservices: Common Object Services Specification contains specifications for the Object Services. • CORBAfacilities: Common Facilities Architecture contains the architecture for Common Facilities. OMG collects information for each book in the documentation set by issuing Requests for Information, Requests for Proposals, and Requests for Comment and, with its membership, evaluating the responses. Specifications are adopted as standards only when representatives of the OMG membership accept them as such by vote. To obtain books in the documentation set, or other OMG publications, refer to the enclosed subscription card or contact the Object Management Group, Inc. at: OMG Headquarters 250 First Avenue, Suite 201 Needham, MA 02494 USA Tel: +1-781-444-0404 Fax: +1-781-444-0320
[email protected] http://www.omg.org
CORBA, v2.4.2
Associated Documents
February 2001
iii
Definition of CORBA Compliance The minimum required for a CORBA-compliant system is adherence to the specifications in CORBA Core and one mapping. Each additional language mapping is a separate, optional compliance point. Optional means users aren’t required to implement these points if they are unnecessary at their site, but if implemented, they must adhere to the CORBA specifications to be called CORBA-compliant. For instance, if a vendor supports C++, their ORB must comply with the OMG IDL to C++ binding specified in the C++ Language Mapping Specification. Interoperability and Interworking are separate compliance points. For detailed information about Interworking compliance, refer to “Compliance to COM/CORBA Interworking” on page 17-34. As described in the OMA Guide, the OMG’s Core Object Model consists of a core and components. Likewise, the body of CORBA specifications is divided into core and component-like specifications. The structure of this manual reflects that division. The CORBA core specifications are categorized as follows: CORBA Core, as specified in Chapters 1-11 CORBA Interoperability, as specified in Chapters 12-16 CORBA Interworking, as specified in Chapters 17-21 Note – The CORBA Language Mappings have been separated from the CORBA Core and each language mapping is its own separate book. Refer to CORBA Language Mappings at the OMG Formal Document web area for this information.
Structure of This Manual This manual is divided into the categories of Core, Interoperability, and Interworking. These divisions reflect the compliance points of CORBA. In addition to this preface, CORBA: Common Object Request Broker Architecture and Specification contains the following chapters:
Core Chapter 1 - The Object Model describes the computation model that underlies the CORBA architecture. Chapter 2 - CORBA Overview contains the overall structure of the ORB architecture and includes information about CORBA interfaces and implementations. Chapter 3 - OMG IDL Syntax and Semantics details the OMG interface definition language (OMG IDL), which is the language used to describe the interfaces that client objects call and object implementations provide.
iv
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
Chapter 4 - ORB Interface defines the interface to the ORB functions that do not depend on object adapters: these operations are the same for all ORBs and object implementations. Chapter 5 - Value Type Semantics describes the semantics of passing an object by value, which is similar to that of standard programming languages. Chapter 6 - Abstract Interface Semantics explains an IDL abstract interface, which provides the capability to defer the determination of whether an object is passed by reference or by value until runtime. Chapter 7 - The Dynamic Invocation Interface details the DII, the client’s side of the interface that allows dynamic creation and invocation of request to objects. Chapter 8 -- The Dynamic Skeleton Interface describes the DSI, the server’s-side interface that can deliver requests from an ORB to an object implementation that does not have compile-time knowledge of the type of the object it is implementing. DSI is the server’s analogue of the client’s Dynamic Invocation Interface (DII). Chapter 9 - Dynamic Management of Any Values details the interface for the Dynamic Any type. This interface allows statically-typed programming languages such as C and Java to create or receive values of type Any without compile-time knowledge that the typer contained in the Any. Chapter 10 - Interface Repository explains the component of the ORB that manages and provides access to a collection of object definitions. Chapter 11 - Portable Object Adapter defines a group of IDL interfaces than an implementation uses to access ORB functions.
Interoperability Chapter 12 - Interoperability Overview describes the interoperability architecture and introduces the subjects pertaining to interoperability: inter-ORB bridges; general and Internet inter-ORB protocols (GIOP and IIOP); and environment-specific, interORB protocols (ESIOPs). Chapter 13 - ORB Interoperability Architecture introduces the framework of ORB interoperability, including information about domains; approaches to inter-ORB bridges; what it means to be compliant with ORB interoperability; and ORB Services and Requests. Chapter 14 - Building Inter-ORB Bridges explains how to build bridges for an implementation of interoperating ORBs. Chapter 15 - General Inter-ORB Protocol describes the general inter-ORB protocol (GIOP) and includes information about the GIOP’s goals, syntax, format, transport, and object location. This chapter also includes information about the Internet interORB protocol (IIOP).
CORBA, v2.4.2
Structure of This Manual
February 2001
v
Chapter 16 - DCE ESIOP - Environment-Specific Inter-ORB Protocol (ESIOP) details a protocol for the OSF DCE environment. The protocol is called the DCE Environment Inter-ORB Protocol (DCE ESIOP).
Interworking Chapter 17 - Interworking Architecture describes the architecture for communication between two object management systems: Microsoft’s COM (including OLE) and the OMG’s CORBA. Chapter 18 - Mapping: COM and CORBA explains the data type and interface mapping between COM and CORBA. The mappings are described in the context of both Win16 and Win32 COM. Chapter 19 - Mapping: OLE Automation and CORBA details the two-way mapping between OLE Automation (in ODL) and CORBA (in OMG IDL). Note: Chapter 19 also includes an appendix describing solutions that vendors might implement to support existing and older OLE Automation controllers and an appendix that provides an example of how the Naming Service could be mapped to an OLE Automation interface according to the Interworking specification. Chapter 20 - Interoperability with non-CORBA Systems describes the effective access to CORBA servers through DCOM and the reverse. Chapter 21 - Interceptors defines ORB operations that allow services such as security to be inserted in the invocation path.
Quality of Service (QoS) Chapter 22 - CORBA Messaging includes three general topics: Quality of Service, Asynchronous Method Invocations (to include Time-Independent or “Persistent” Requests), and the specification of interoperable Routing interfaces to support the transport of requests asynchronously from the handling of their replies. Chapter 23 - Minimum CORBA describes minimumCORBA, a subset of CORBA designed for systems with limited resources. Chapter 24 - Real-Time CORBA defines an optional set of extensions to CORBA tailored to equip ORBs to be used as a component of a Real-Time system.
Acknowledgements The following companies submitted and/or supported parts of the specifications that were approved by the Object Management Group to become CORBA: • Alcatel • BEA Systems, Inc. • BNR Europe Ltd. • Borland International, Inc. • Cooperative Research Centre for Distributed Systems Technology (DSTC)
vi
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
Defense Information Systems Agency Digital Equipment Corporation Ericsson Expersoft Corporation France Telecom FUJITSU LIMITED Genesis Development Corporation Gensym Corporation Hewlett-Packard Company Highlander Communications, L.C. Humboldt-University HyperDesk Corporation ICL, Plc. Inprise Corporation International Business Machines Corporation International Computers, Inc. IONA Technologies, Plc. Lockheed Martin Federal Systems, Inc. Lucent Technologies, Inc. Micro Focus Limited MITRE Corporation Motorola, Inc. NCR Corporation NEC Corporation Netscape Communications Corporation Nortel Networks Northern Telecom Corporation Novell, Inc. Object Design, Inc. Objective Interface Systems, Inc. Object-Oriented Concepts, Inc. OC Systems, Inc. Open Group - Open Software Foundation Oracle Corporation PeerLogic, Inc. Siemens Nixdorf Informationssysteme AG SPAWAR Systems Center Sun Microsystems, Inc. SunSoft, Inc. Sybase, Inc. Telefónica Investigación y Desarrollo S.A. Unipersonal TIBCO, Inc.
CORBA, v2.4.2
Acknowledgements
February 2001
vii
• • • •
Tri-Pacific Software, Inc. University of Rhode Island Visual Edge Software, Ltd. Washington University
In addition to the preceding contributors, the OMG would like to acknowledge Mark Linton at Silicon Graphics and Doug Lea at the State University of New York at Oswego for their work on the C++ mapping.
References IDL Type Extensions RFP, March 1995. OMG TC Document 95-1-35. The Common Object Request Broker: Architecture and Specification, Revision 2.2, February 1998. CORBAservices: Common Object Services Specification, Revised Edition, OMG TC Document 95-3-31. COBOL Language Mapping RFP, December 1995. OMG TC document 95-12-10. COBOL 85 ANSI X3.23-1985 / ISO 1989-1985. IEEE Standard for Binary Floating-Point Arithmetic, ANIS/IEEE Std 754-1985. XDR: External Data Representation Standard, RFC1832, R. Srinivasan, Sun Microsystems, August 1995. OSF Character and Code Set Registry, OSF DCE SIG RFC 40.1 (Public Version), S. (Martin) O’Donnell, June 1994. RPC Runtime Support For I18N Characters — Functional Specification, OSF DCE SIG RFC 41.2, M. Romagna, R. Mackey, November 1994. X/Open System Interface Definitions, Issue 4 Version 2, 1995.
viii
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
1
The Object Model
This chapter describes the concrete object model that underlies the CORBA architecture. The model is derived from the abstract Core Object Model defined by the Object Management Group in the Object Management Architecture Guide. (Information about the OMA Guide and other books in the CORBA documentation set is provided in this document’s preface.)
Contents This chapter contains the following sections.
Section Title
Page
“Overview”
1-1
“Object Semantics”
1-2
“Object Implementation”
1-9
1.1 Overview The object model provides an organized presentation of object concepts and terminology. It defines a partial model for computation that embodies the key characteristics of objects as realized by the submitted technologies. The OMG object model is abstract in that it is not directly realized by any particular technology. The model described here is a concrete object model. A concrete object model may differ from the abstract object model in several ways:
•
It may elaborate the abstract object model by making it more specific, for example, by defining the form of request parameters or the language used to specify types.
•
It may populate the model by introducing specific instances of entities defined by the model, for example, specific objects, specific operations, or specific types.
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
1-1
1 •
It may restrict the model by eliminating entities or placing additional restrictions on their use.
An object system is a collection of objects that isolates the requestors of services (clients) from the providers of services by a well-defined encapsulating interface. In particular, clients are isolated from the implementations of services as data representations and executable code. The object model first describes concepts that are meaningful to clients, including such concepts as object creation and identity, requests and operations, types and signatures. It then describes concepts related to object implementations, including such concepts as methods, execution engines, and activation. The object model is most specific and prescriptive in defining concepts meaningful to clients. The discussion of object implementation is more suggestive, with the intent of allowing maximal freedom for different object technologies to provide different ways of implementing objects. There are some other characteristics of object systems that are outside the scope of the object model. Some of these concepts are aspects of application architecture, some are associated with specific domains to which object technology is applied. Such concepts are more properly dealt with in an architectural reference model. Examples of excluded concepts are compound objects, links, copying of objects, change management, and transactions. Also outside the scope of the object model are the details of control structure: the object model does not say whether clients and/or servers are singlethreaded or multi-threaded, and does not specify how event loops are programmed nor how threads are created, destroyed, or synchronized. This object model is an example of a classical object model, where a client sends a message to an object. Conceptually, the object interprets the message to decide what service to perform. In the classical model, a message identifies an object and zero or more actual parameters. As in most classical object models, a distinguished first parameter is required, which identifies the operation to be performed; the interpretation of the message by the object involves selecting a method based on the specified operation. Operationally, of course, method selection could be performed either by the object or the ORB.
1.2 Object Semantics An object system provides services to clients. A client of a service is any entity capable of requesting the service. This section defines the concepts associated with object semantics, that is, the concepts relevant to clients.
1.2.1 Objects An object system includes entities known as objects. An object is an identifiable, encapsulated entity that provides one or more services that can be requested by a client.
1-2
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
1 1.2.2 Requests Clients request services by issuing requests. The term request is broadly used to refer to the entire sequence of causally related events that transpires between a client initiating it and the last event causally associated with that initiation. For example: • the client receives the final response associated with that request from the server, • the server carries out the associated operation in case of a oneway request, or • the sequence of events associated with the request terminates in a failure of some sort. The initiation of a Request is an event. The information associated with a request consists of an operation, a target object, zero or more (actual) parameters, and an optional request context. A request form is a description or pattern that can be evaluated or performed multiple times to cause the issuing of requests. As described in the OMG IDL Syntax and Semantics chapter, request forms are defined by particular language bindings. An alternative request form consists of calls to the dynamic invocation interface to create an invocation structure, add arguments to the invocation structure, and to issue the invocation (refer to the Dynamic Invocation Interface chapter for descriptions of these request forms). A value is anything that may be a legitimate (actual) parameter in a request. More particularly, a value is an instance of an OMG IDL data type. There are non-object values, as well as values that reference objects. An object reference is a value that reliably denotes a particular object. Specifically, an object reference will identify the same object each time the reference is used in a request (subject to certain pragmatic limits of space and time). An object may be denoted by multiple, distinct object references. A request may have parameters that are used to pass data to the target object; it may also have a request context that provides additional information about the request. A request context is a mapping from strings to strings. A request causes a service to be performed on behalf of the client. One possible outcome of performing a service is returning to the client the results, if any, defined for the request. If an abnormal condition occurs during the performance of a request, an exception is returned. The exception may carry additional return parameters particular to that exception. The request parameters are identified by position. A parameter may be an input parameter, an output parameter, or an input-output parameter. A request may also return a single return result value, as well as the results stored into the output and input-output parameters. The following semantics hold for all requests:
•
Any aliasing of parameter values is neither guaranteed removed nor guaranteed to be preserved.
CORBA, v2.4.2
Object Semantics
February 2001
1-3
1 • •
The order in which aliased output parameters are written is not guaranteed. The return result and the values stored into the output and input-output parameters are undefined if an exception is returned.
For descriptions of the values and exceptions that are permitted, see Section 1.2.4, “Types,” on page 1-4 and Section 1.2.8.3, “Exceptions,” on page 1-8.
1.2.3 Object Creation and Destruction Objects can be created and destroyed. From a client’s point of view, there is no special mechanism for creating or destroying an object. Objects are created and destroyed as an outcome of issuing requests. The outcome of object creation is revealed to the client in the form of an object reference that denotes the new object.
1.2.4 Types A type is an identifiable entity with an associated predicate (a single-argument mathematical function with a boolean result) defined over entities. An entity satisfies a type if the predicate is true for that entity. An entity that satisfies a type is called a member of the type. Types are used in signatures to restrict a possible parameter or to characterize a possible result. The extension of a type is the set of entities that satisfy the type at any particular time. An object type is a type whose members are object references. In other words, an object type is satisfied only by object references. Constraints on the data types in this model are shown in this section.
1.2.4.1 Basic types
• •
16-bit, 32-bit, and 64-bit signed and unsigned 2’s complement integers.
• •
Fixed-point decimal numbers of up to 31 significant digits.
• •
A boolean type taking the values TRUE and FALSE.
•
1-4
Single-precision (32-bit), double-precision (64-bit), and double-extended (a mantissa of at least 64 bits, a sign bit and an exponent of at least 15 bits) IEEE floating point numbers.
Characters, as defined in ISO Latin-1 (8859.1) and other single- or multi-byte character sets.
An 8-bit opaque detectable, guaranteed to not undergo any conversion during transfer between systems. Enumerated types consisting of ordered sequences of identifiers.
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
1 •
A string type, which consists of a variable-length array of characters; the length of the string is a non-negative integer, and is available at run-time. The length may have a maximum bound defined.
•
A wide character string type, which consist of a variable-length array of (fixed width) wide characters; the length of the wide string is a non-negative integer, and is available at run-time. The length may have a maximum bound defined.
• • •
A container type “any,” which can represent any possible basic or constructed type. Wide characters that may represent characters from any wide character set. Wide character strings, which consist of a length, available at runtime, and a variable-length array of (fixed width) wide characters.
1.2.4.2 Constructed types
• •
A record type (called struct), which consists of an ordered set of (name,value) pairs.
•
A sequence type, which consists of a variable-length array of a single type; the length of the sequence is available at run-time.
•
An array type, which consists of a fixed-shape multidimensional array of a single type.
•
An interface type, which specifies the set of operations that an instance of that type must support.
•
A value type, which specifies state as well as a set of operations that an instance of that type must support.
A discriminated union type, which consists of a discriminator (whose exact value is always available) followed by an instance of a type appropriate to the discriminator value.
Entities in a request are restricted to values that satisfy these type constraints. The legal entities are shown in . No particular representation for entities is defined.
CORBA, v2.4.2
Object Semantics
February 2001
1-5
1
Object Reference Value Type Abstract Interface Entity
Basic Value
Constructed Values
Figure 1-1
Struct Sequence Union Array
Short Long LongLong UShort Ulong UlongLong Float Double LongDouble Fixed Char Wchar String Wstring Boolean Octet Enum Any
Legal Values
1.2.5 Interfaces An interface is a description of a set of possible operations that a client may request of an object, through that interface. It provides a syntactic description of how a service provided by an object supporting this interface, is accessed via this set of operations. An object satisfies an interface if it provides its service through the operations of the interface according to the specification of the operations (see Section 1.2.8, “Operations,” on page 1-7). The interface type for a given interface is an object type, such that an object reference will satisfy the type, if and only if the referent object also satisfies the interface. Interfaces are specified in OMG IDL. Interface inheritance provides the composition mechanism for permitting an object to support multiple interfaces. The principal interface is simply the most-specific interface that the object supports, and consists of all operations in the transitive closure of the interface inheritance graph. Interfaces satisfy the Liskov substitution principle. If interface A is derived from interface B, then a reference to an object that supports interface A can be used where the formal type of a parameter is declared to be B.
1.2.6 Value Types A value type is an entity, which shares many of the characteristics of interfaces and structs. It is a description of both a set of operations that a client may request and of state that is accessible to a client. Instances of a value type are always local concrete implementations in some programming language.
1-6
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
1 A value type, in addition to the operations and state defined for itself, may also inherit from other value types, and through multiple inheritance support other interfaces. Value types are specified in OMG IDL. An abstract value types describes a value type that is a “pure” bundle of operations with no state.
1.2.7 Abstract Interfaces An abstract interface is an entity, which may at runtime represent either a regular interface (see Section 1.2.5, “Interfaces,” on page 1-6) or a value type (see Section 1.2.6, “Value Types,” on page 1-6). Like an abstract value type, it is a pure bundle of operations with no state. Unlike an abstract value type, it does not imply pass-by-value semantics, and unlike a regular interface type, it does not imply pass-byreference semantics. Instead, the entity's runtime type determines which of these semantics are used.
1.2.8 Operations An operation is an identifiable entity that denotes the indivisible primitive of service provision that can be requested. The act of requesting an operation is referred to as invoking the operation. An operation is identified by an operation identifier. An operation has a signature that describes the legitimate values of request parameters and returned results. In particular, a signature consists of:
• • •
A specification of the parameters required in requests for that operation.
• •
A specification of additional contextual information that may affect the invocation.
A specification of the result of the operation. An identification of the user exceptions that may be raised by an invocation of the operation.
An indication of the execution semantics the client should expect from an invocation of the operation.
Operations are (potentially) generic, meaning that a single operation can be uniformly invoked on objects with different implementations, possibly resulting in observably different behavior. Genericity is achieved in this model via interface inheritance in IDL and the total decoupling of implementation from interface specification. The general form for an operation signature is: [oneway]
(param1, ..., paramL) [raises(except1,...,exceptN)] [context(name1, ..., nameM)] where:
•
The optional oneway keyword indicates that best-effort semantics are expected of requests for this operation; the default semantics are exactly-once if the operation successfully returns results or at-most-once if an exception is returned.
CORBA, v2.4.2
Object Semantics
February 2001
1-7
1 • • •
The is the type of the return result. The provides a name for the operation in the interface. The operation parameters needed for the operation; they are flagged with the modifiers in, out, or inout to indicate the direction in which the information flows (with respect to the object performing the request).
•
The optional raises expression indicates which user-defined exceptions can be signaled to terminate an invocation of this operation; if such an expression is not provided, no user-defined exceptions will be signaled.
•
The optional context expression indicates which request context information will be available to the object implementation; no other contextual information is required to be transported with the request.
1.2.8.1 Parameters A parameter is characterized by its mode and its type. The mode indicates whether the value should be passed from client to server (in), from server to client (out), or both (inout). The parameter’s type constrains the possible value, which may be passed in the directions dictated by the mode.
1.2.8.2 Return Result The return result is a distinguished out parameter.
1.2.8.3 Exceptions An exception is an indication that an operation request was not performed successfully. An exception may be accompanied by additional, exception-specific information. The additional, exception-specific information is a specialized form of record. As a record, it may consist of any of the types described in Section 1.2.4, “Types,” on page 1-4. All signatures implicitly include the system exceptions; the standard system exceptions are described in Section 4.11.2, “System Exceptions,” on page 4-50.
1.2.8.4 Contexts A request context provides additional, operation-specific information that may affect the performance of a request.
1.2.8.5 Execution Semantics Two styles of execution semantics are defined by the object model:
•
1-8
At-most-once: if an operation request returns successfully, it was performed exactly once; if it returns an exception indication, it was performed at-most-once.
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
1 •
Best-effort: a best-effort operation is a request-only operation (i.e., it cannot return any results and the requester never synchronizes with the completion, if any, of the request).
The execution semantics to be expected is associated with an operation. This prevents a client and object implementation from assuming different execution semantics. Note that a client is able to invoke an at-most-once operation in a synchronous or deferred-synchronous manner.
1.2.9 Attributes An interface may have attributes. An attribute is logically equivalent to declaring a pair of accessor functions: one to retrieve the value of the attribute and one to set the value of the attribute. An attribute may be read-only, in which case only the retrieval accessor function is defined.
1.3 Object Implementation This section defines the concepts associated with object implementation (i.e., the concepts relevant to realizing the behavior of objects in a computational system). The implementation of an object system carries out the computational activities needed to effect the behavior of requested services. These activities may include computing the results of the request and updating the system state. In the process, additional requests may be issued. The implementation model consists of two parts: the execution model and the construction model. The execution model describes how services are performed. The construction model describes how services are defined.
1.3.1 The Execution Model: Performing Services A requested service is performed in a computational system by executing code that operates upon some data. The data represents a component of the state of the computational system. The code performs the requested service, which may change the state of the system. Code that is executed to perform a service is called a method. A method is an immutable description of a computation that can be interpreted by an execution engine. A method has an immutable attribute called a method format that defines the set of execution engines that can interpret the method. An execution engine is an abstract machine (not a program) that can interpret methods of certain formats, causing the described computations to be performed. An execution engine defines a dynamic context for the execution of a method. The execution of a method is called a method activation.
CORBA, v2.4.2
Object Implementation
February 2001
1-9
1 When a client issues a request, a method of the target object is called. The input parameters passed by the requestor are passed to the method and the output and inputoutput parameters and return result value (or exception and its parameters) are passed back to the requestor. Performing a requested service causes a method to execute that may operate upon an object’s persistent state. If the persistent form of the method or state is not accessible to the execution engine, it may be necessary to first copy the method or state into an execution context. This process is called activation; the reverse process is called deactivation.
1.3.2 The Construction Model A computational object system must provide mechanisms for realizing behavior of requests. These mechanisms include definitions of object state, definitions of methods, and definitions of how the object infrastructure is to select the methods to execute and to select the relevant portions of object state to be made accessible to the methods. Mechanisms must also be provided to describe the concrete actions associated with object creation, such as association of the new object with appropriate methods. An object implementation—or implementation, for short—is a definition that provides the information needed to create an object and to allow the object to participate in providing an appropriate set of services. An implementation typically includes, among other things, definitions of the methods that operate upon the state of an object. It also typically includes information about the intended types of the object.
1-10
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
2
CORBA Overview
The Common Object Request Broker Architecture (CORBA) is structured to allow integration of a wide variety of object systems. The motivation for some of the features may not be apparent at first, but as we discuss the range of implementations, policies, optimizations, and usages we expect to encompass, the value of the flexibility becomes more clear.
Contents This chapter contains the following sections.
Section Title
Page
“Structure of an Object Request Broker”
2-1
“Example ORBs”
2-11
“Structure of a Client”
2-12
“Structure of an Object Implementation”
2-13
“Structure of an Object Adapter”
2-15
“CORBA Required Object Adapter”
2-17
“The Integration of Foreign Object Systems”
2-17
2.1 Structure of an Object Request Broker Figure 2-1 shows a request being sent by a client to an object implementation. The Client is the entity that wishes to perform an operation on the object and the Object Implementation is the code and data that actually implements the object.
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
2-1
2
Client
Object Implementation
Request ORB Figure 2-1
A Request Being Sent Through the Object Request Broker
The ORB is responsible for all of the mechanisms required to find the object implementation for the request, to prepare the object implementation to receive the request, and to communicate the data making up the request. The interface the client sees is completely independent of where the object is located, what programming language it is implemented in, or any other aspect that is not reflected in the object’s interface. Figure 2-2 on page 2-3 shows the structure of an individual Object Request Broker (ORB). The interfaces to the ORB are shown by striped boxes, and the arrows indicate whether the ORB is called or performs an up-call across the interface.
2-2
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
2
Client
Dynamic Invocation
IDL Stubs
Object Implementation
ORB Interface
Static IDL Skeleton
Dynamic Skeleton
Object Adapter
ORB Core Interface identical for all ORB implementations
Up-call interface
There may be multiple object adapters There are stubs and a skeleton for each object type
Normal call interface
ORB-dependent interface Figure 2-2
The Structure of Object Request Interfaces
To make a request, the Client can use the Dynamic Invocation interface (the same interface independent of the target object’s interface) or an OMG IDL stub (the specific stub depending on the interface of the target object). The Client can also directly interact with the ORB for some functions. The Object Implementation receives a request as an up-call either through the OMG IDL generated skeleton or through a dynamic skeleton. The Object Implementation may call the Object Adapter and the ORB while processing a request or at other times. Definitions of the interfaces to objects can be defined in two ways. Interfaces can be defined statically in an interface definition language, called the OMG Interface Definition Language (OMG IDL). This language defines the types of objects according to the operations that may be performed on them and the parameters to those operations. Alternatively, or in addition, interfaces can be added to an Interface Repository service; this service represents the components of an interface as objects, permitting run-time access to these components. In any ORB implementation, the Interface Definition Language (which may be extended beyond its definition in this document) and the Interface Repository have equivalent expressive power.
CORBA, v2.4.2
Structure of an Object Request Broker
February 2001
2-3
2 The client performs a request by having access to an Object Reference for an object and knowing the type of the object and the desired operation to be performed. The client initiates the request by calling stub routines that are specific to the object or by constructing the request dynamically (see Figure 2-3).
Client
Invocation
Request
Request Dynamic
IDL Stubs
ORB Core Interface identical for all ORB implementations There are stubs and a skeleton for each object type ORB-dependent interface Figure 2-3
A Client Using the Stub or Dynamic Invocation Interface
The dynamic and stub interface for invoking a request satisfy the same request semantics, and the receiver of the message cannot tell how the request was invoked. The ORB locates the appropriate implementation code, transmits parameters, and transfers control to the Object Implementation through an IDL skeleton or a dynamic skeleton (see Figure 2-4 on page 2-5). Skeletons are specific to the interface and the object adapter. In performing the request, the object implementation may obtain some services from the ORB through the Object Adapter. When the request is complete, control and output values are returned to the client.
2-4
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
2
Object Implementation
ORB Interface
Static IDL Skeleton
Dynamic Skeleton
Object Adapter
ORB Core Interface identical for all ORB implementations
Up-call interface
There may be multiple object adapters There are stubs and a skeleton for each object type
Normal call interface
ORB-dependent interface Figure 2-4
An Object Implementation Receiving a Request
The Object Implementation may choose which Object Adapter to use. This decision is based on what kind of services the Object Implementation requires. Figure 2-5 on page 2-6 shows how interface and implementation information is made available to clients and object implementations. The interface is defined in OMG IDL and/or in the Interface Repository; the definition is used to generate the client Stubs and the object implementation Skeletons.
CORBA, v2.4.2
Structure of an Object Request Broker
February 2001
2-5
2
IDL Definitions
Interface Repository
Implementation Installation
Stubs
Client Figure 2-5
Implementation Repository Skeletons
Object Implementation Interface and Implementation Repositories
The object implementation information is provided at installation time and is stored in the Implementation Repository for use during request delivery.
2.1.1 Object Request Broker In the architecture, the ORB is not required to be implemented as a single component, but rather it is defined by its interfaces. Any ORB implementation that provides the appropriate interface is acceptable. The interface is organized into three categories: 1. Operations that are the same for all ORB implementations 2. Operations that are specific to particular types of objects 3. Operations that are specific to particular styles of object implementations Different ORBs may make quite different implementation choices, and, together with the IDL compilers, repositories, and various Object Adapters, provide a set of services to clients and implementations of objects that have different properties and qualities. There may be multiple ORB implementations (also described as multiple ORBs), which have different representations for object references and different means of performing invocations. It may be possible for a client to simultaneously have access to
2-6
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
2 two object references managed by different ORB implementations. When two ORBs are intended to work together, those ORBs must be able to distinguish their object references. It is not the responsibility of the client to do so. The ORB Core is that part of the ORB that provides the basic representation of objects and communication of requests. CORBA is designed to support different object mechanisms, and it does so by structuring the ORB with components above the ORB Core, which provide interfaces that can mask the differences between ORB Cores.
2.1.2 Clients A client of an object has access to an object reference for the object, and invokes operations on the object. A client knows only the logical structure of the object according to its interface and experiences the behavior of the object through invocations. Although we will generally consider a client to be a program or process initiating requests on an object, it is important to recognize that something is a client relative to a particular object. For example, the implementation of one object may be a client of other objects. Clients generally see objects and ORB interfaces through the perspective of a language mapping, bringing the ORB right up to the programmer’s level. Clients are maximally portable and should be able to work without source changes on any ORB that supports the desired language mapping with any object instance that implements the desired interface. Clients have no knowledge of the implementation of the object, which object adapter is used by the implementation, or which ORB is used to access it.
2.1.3 Object Implementations An object implementation provides the semantics of the object, usually by defining data for the object instance and code for the object’s methods. Often the implementation will use other objects or additional software to implement the behavior of the object. In some cases, the primary function of the object is to have side-effects on other things that are not objects. A variety of object implementations can be supported, including separate servers, libraries, a program per method, an encapsulated application, an object-oriented database, etc. Through the use of additional object adapters, it is possible to support virtually any style of object implementation. Generally, object implementations do not depend on the ORB or how the client invokes the object. Object implementations may select interfaces to ORB-dependent services by the choice of Object Adapter.
CORBA, v2.4.2
Structure of an Object Request Broker
February 2001
2-7
2 2.1.4 Object References An Object Reference is the information needed to specify an object within an ORB. Both clients and object implementations have an opaque notion of object references according to the language mapping, and thus are insulated from the actual representation of them. Two ORB implementations may differ in their choice of Object Reference representations. The representation of an object reference handed to a client is only valid for the lifetime of that client. All ORBs must provide the same language mapping to an object reference (usually referred to as an Object) for a particular programming language. This permits a program written in a particular language to access object references independent of the particular ORB. The language mapping may also provide additional ways to access object references in a typed way for the convenience of the programmer. There is a distinguished object reference, guaranteed to be different from all object references, that denotes no object.
2.1.5 OMG Interface Definition Language The OMG Interface Definition Language (OMG IDL) defines the types of objects by specifying their interfaces. An interface consists of a set of named operations and the parameters to those operations. Note that although IDL provides the conceptual framework for describing the objects manipulated by the ORB, it is not necessary for there to be IDL source code available for the ORB to work. As long as the equivalent information is available in the form of stub routines or a run-time interface repository, a particular ORB may be able to function correctly. IDL is the means by which a particular object implementation tells its potential clients what operations are available and how they should be invoked. From the IDL definitions, it is possible to map CORBA objects into particular programming languages or object systems.
2.1.6 Mapping of OMG IDL to Programming Languages Different object-oriented or non-object-oriented programming languages may prefer to access CORBA objects in different ways. For object-oriented languages, it may be desirable to see CORBA objects as programming language objects. Even for nonobject-oriented languages, it is a good idea to hide the exact ORB representation of the object reference, method names, etc. A particular mapping of OMG IDL to a programming language should be the same for all ORB implementations. Language mapping includes definition of the language-specific data types and procedure interfaces to access objects through the ORB. It includes the structure of the client stub interface (not required for object-oriented languages), the dynamic invocation interface, the implementation skeleton, the object adapters, and the direct ORB interface.
2-8
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
2 A language mapping also defines the interaction between object invocations and the threads of control in the client or implementation. The most common mappings provide synchronous calls, in that the routine returns when the object operation completes. Additional mappings may be provided to allow a call to be initiated and control returned to the program. In such cases, additional language-specific routines must be provided to synchronize the program’s threads of control with the object invocation.
2.1.7 Client Stubs For the mapping of a non–object–oriented language, there will be a programming interface to the stubs for each interface type. Generally, the stubs will present access to the OMG IDL-defined operations on an object in a way that is easy for programmers to predict once they are familiar with OMG IDL and the language mapping for the particular programming language. The stubs make calls on the rest of the ORB using interfaces that are private to, and presumably optimized for, the particular ORB Core. If more than one ORB is available, there may be different stubs corresponding to the different ORBs. In this case, it is necessary for the ORB and language mapping to cooperate to associate the correct stubs with the particular object reference. Object-oriented programming languages, such as C++ and Smalltalk, do not require stub interfaces.
2.1.8 Dynamic Invocation Interface An interface is also available that allows the dynamic construction of object invocations, that is, rather than calling a stub routine that is specific to a particular operation on a particular object, a client may specify the object to be invoked, the operation to be performed, and the set of parameters for the operation through a call or sequence of calls. The client code must supply information about the operation to be performed and the types of the parameters being passed (perhaps obtaining it from an Interface Repository or other run-time source). The nature of the dynamic invocation interface may vary substantially from one programming language mapping to another.
2.1.9 Implementation Skeleton For a particular language mapping, and possibly depending on the object adapter, there will be an interface to the methods that implement each type of object. The interface will generally be an up-call interface, in that the object implementation writes routines that conform to the interface and the ORB calls them through the skeleton. The existence of a skeleton does not imply the existence of a corresponding client stub (clients can also make requests via the dynamic invocation interface). It is possible to write an object adapter that does not use skeletons to invoke implementation methods. For example, it may be possible to create implementations dynamically for languages such as Smalltalk.
CORBA, v2.4.2
Structure of an Object Request Broker
February 2001
2-9
2 2.1.10 Dynamic Skeleton Interface An interface is available, which allows dynamic handling of object invocations. That is, rather than being accessed through a skeleton that is specific to a particular operation, an object’s implementation is reached through an interface that provides access to the operation name and parameters in a manner analogous to the client side’s Dynamic Invocation Interface. Purely static knowledge of those parameters may be used, or dynamic knowledge (perhaps determined through an Interface Repository) may be also used, to determine the parameters. The implementation code must provide descriptions of all the operation parameters to the ORB, and the ORB provides the values of any input parameters for use in performing the operation. The implementation code provides the values of any output parameters, or an exception, to the ORB after performing the operation. The nature of the dynamic skeleton interface may vary substantially from one programming language mapping or object adapter to another, but will typically be an up-call interface. Dynamic skeletons may be invoked both through client stubs and through the dynamic invocation interface; either style of client request construction interface provides identical results.
2.1.11 Object Adapters An object adapter is the primary way that an object implementation accesses services provided by the ORB. There are expected to be a few object adapters that will be widely available, with interfaces that are appropriate for specific kinds of objects. Services provided by the ORB through an Object Adapter often include: generation and interpretation of object references, method invocation, security of interactions, object and implementation activation and deactivation, mapping object references to implementations, and registration of implementations. The wide range of object granularities, lifetimes, policies, implementation styles, and other properties make it difficult for the ORB Core to provide a single interface that is convenient and efficient for all objects. Thus, through Object Adapters, it is possible for the ORB to target particular groups of object implementations that have similar requirements with interfaces tailored to them.
2.1.12 ORB Interface The ORB Interface is the interface that goes directly to the ORB, which is the same for all ORBs and does not depend on the object’s interface or object adapter. Because most of the functionality of the ORB is provided through the object adapter, stubs, skeleton, or dynamic invocation, there are only a few operations that are common across all objects. These operations are useful to both clients and implementations of objects.
2-10
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
2 2.1.13 Interface Repository The Interface Repository is a service that provides persistent objects that represent the IDL information in a form available at run-time. The Interface Repository information may be used by the ORB to perform requests. Moreover, using the information in the Interface Repository, it is possible for a program to encounter an object whose interface was not known when the program was compiled, yet, be able to determine what operations are valid on the object and make an invocation on it. In addition to its role in the functioning of the ORB, the Interface Repository is a common place to store additional information associated with interfaces to ORB objects. For example, debugging information, libraries of stubs or skeletons, routines that can format or browse particular kinds of objects might be associated with the Interface Repository.
2.1.14 Implementation Repository The Implementation Repository contains information that allows the ORB to locate and activate implementations of objects. Although most of the information in the Implementation Repository is specific to an ORB or operating environment, the Implementation Repository is the conventional place for recording such information. Ordinarily, installation of implementations and control of policies related to the activation and execution of object implementations is done through operations on the Implementation Repository. In addition to its role in the functioning of the ORB, the Implementation Repository is a common place to store additional information associated with implementations of ORB objects. For example, debugging information, administrative control, resource allocation, security, etc., might be associated with the Implementation Repository.
2.2 Example ORBs There are a wide variety of ORB implementations possible within the Common ORB Architecture. This section will illustrate some of the different options. Note that a particular ORB might support multiple options and protocols for communication.
2.2.1 Client- and Implementation-resident ORB If there is a suitable communication mechanism present, an ORB can be implemented in routines resident in the clients and implementations. The stubs in the client either use a location-transparent IPC mechanism or directly access a location service to establish communication with the implementations. Code linked with the implementation is responsible for setting up appropriate databases for use by clients.
CORBA, v2.4.2
Example ORBs
February 2001
2-11
2 2.2.2 Server-based ORB To centralize the management of the ORB, all clients and implementations can communicate with one or more servers whose job it is to route requests from clients to implementations. The ORB could be a normal program as far as the underlying operating system is concerned, and normal IPC could be used to communicate with the ORB.
2.2.3 System-based ORB To enhance security, robustness, and performance, the ORB could be provided as a basic service of the underlying operating system. Object references could be made unforgeable, reducing the expense of authentication on each request. Because the operating system could know the location and structure of clients and implementations, it would be possible for a variety of optimizations to be implemented, for example, avoiding marshalling when both are on the same machine.
2.2.4 Library-based ORB For objects that are light-weight and whose implementations can be shared, the implementation might actually be in a library. In this case, the stubs could be the actual methods. This assumes that it is possible for a client program to get access to the data for the objects and that the implementation trusts the client not to damage the data.
2.3 Structure of a Client A client of an object has an object reference that refers to that object. An object reference is a token that may be invoked or passed as a parameter to an invocation on a different object. Invocation of an object involves specifying the object to be invoked, the operation to be performed, and parameters to be given to the operation or returned from it. The ORB manages the control transfer and data transfer to the object implementation and back to the client. In the event that the ORB cannot complete the invocation, an exception response is provided. Ordinarily, a client calls a routine in its program that performs the invocation and returns when the operation is complete. Clients access object-type-specific stubs as library routines in their program (see Figure 2-6 on page 2-13). The client program thus sees routines callable in the normal way in its programming language. All implementations will provide a languagespecific data type to use to refer to objects, often an opaque pointer. The client then passes that object reference to the stub routines to initiate an invocation. The stubs
2-12
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
2 have access to the object reference representation and interact with the ORB to perform the invocation. (See the C Language Mapping specification for additional, general information on language mapping of object references.)
Client Program Language-dependent object references
ORB object references
Dynamic Invocation Interface
Figure 2-6
Stubs for Interface A
Stubs for Interface B
The Structure of a Typical Client
An alternative set of library code is available to perform invocations on objects, for example when the object was not defined at compile time. In that case, the client program provides additional information to name the type of the object and the method being invoked, and performs a sequence of calls to specify the parameters and initiate the invocation. Clients most commonly obtain object references by receiving them as output parameters from invocations on other objects for which they have references. When a client is also an implementation, it receives object references as input parameters on invocations to objects it implements. An object reference can also be converted to a string that can be stored in files or preserved or communicated by different means and subsequently turned back into an object reference by the ORB that produced the string.
2.4 Structure of an Object Implementation An object implementation provides the actual state and behavior of an object. The object implementation can be structured in a variety of ways. Besides defining the methods for the operations themselves, an implementation will usually define
CORBA, v2.4.2
Structure of an Object Implementation
February 2001
2-13
2 procedures for activating and deactivating objects and will use other objects or nonobject facilities to make the object state persistent, to control access to the object, as well as to implement the methods. The object implementation (see Figure 2-7) interacts with the ORB in a variety of ways to establish its identity, to create new objects, and to obtain ORB-dependent services. It primarily does this via access to an Object Adapter, which provides an interface to ORB services that is convenient for a particular style of object implementation.
Object Implementation Methods for Interface A
Up-call to
Met
hod
Object data
ORB object references Library br Routines
Skeleton for Interface A
Figure 2-7
Dynamic Skeleton
Object adapter routines
The Structure of a Typical Object Implementation
Because of the range of possible object implementations, it is difficult to be definitive about how an object implementation is structured. See the chapters on the Portable Object Adapter. When an invocation occurs, the ORB Core, object adapter, and skeleton arrange that a call is made to the appropriate method of the implementation. A parameter to that method specifies the object being invoked, which the method can use to locate the data for the object. Additional parameters are supplied according to the skeleton definition. When the method is complete, it returns, causing output parameters or exception results to be transmitted back to the client.
2-14
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
2 When a new object is created, the ORB may be notified so that it knows where to find the implementation for that object. Usually, the implementation also registers itself as implementing objects of a particular interface, and specifies how to start up the implementation if it is not already running. Most object implementations provide their behavior using facilities in addition to the ORB and object adapter. For example, although the Portable Object Adapter provides some persistent data associated with an object (its OID or Object ID), that relatively small amount of data is typically used as an identifier for the actual object data stored in a storage service of the object implementation’s choosing. With this structure, it is not only possible for different object implementations to use the same storage service, it is also possible for objects to choose the service that is most appropriate for them.
2.5 Structure of an Object Adapter An object adapter (see Figure 2-8 on page 2-16) is the primary means for an object implementation to access ORB services such as object reference generation. An object adapter exports a public interface to the object implementation, and a private interface to the skeleton. It is built on a private ORB-dependent interface. Object adapters are responsible for the following functions: • Generation and interpretation of object references • Method invocation • Security of interactions • Object and implementation activation and deactivation • Mapping object references to the corresponding object implementations • Registration of implementations These functions are performed using the ORB Core and any additional components necessary. Often, an object adapter will maintain its own state to accomplish its tasks. It may be possible for a particular object adapter to delegate one or more of its responsibilities to the Core upon which it is constructed.
CORBA, v2.4.2
Structure of an Object Adapter
February 2001
2-15
2
Object Implementation Interface A Methods
Dynamic Skeleton
Interface A Skeleton
Interface B Methods
Interface B Skeleton
Object Adapter Interface
ORB Core Figure 2-8
The Structure of a Typical Object Adapter
As shown in Figure 2-8, the Object Adapter is implicitly involved in invocation of the methods, although the direct interface is through the skeletons. For example, the Object Adapter may be involved in activating the implementation or authenticating the request. The Object Adapter defines most of the services from the ORB that the Object Implementation can depend on. Different ORBs will provide different levels of service and different operating environments may provide some properties implicitly and require others to be added by the Object Adapter. For example, it is common for Object Implementations to want to store certain values in the object reference for easy identification of the object on an invocation. If the Object Adapter allows the implementation to specify such values when a new object is created, it may be able to store them in the object reference for those ORBs that permit it. If the ORB Core does not provide this feature, the Object Adapter would record the value in its own storage and provide it to the implementation on an invocation. With Object Adapters, it is possible for an Object Implementation to have access to a service whether or not it is implemented in the ORB Core—if the ORB Core provides it, the adapter simply provides an interface to it; if not, the adapter must implement it on top of the ORB Core. Every instance of a particular adapter must provide the same interface and service for all the ORBs it is implemented on. It is also not necessary for all Object Adapters to provide the same interface or functionality. Some Object Implementations have special requirements. For example, an object-oriented database system may wish to implicitly register its many thousands of objects without doing individual calls to the Object Adapter. In such a case, it would
2-16
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
2 be impractical and unnecessary for the object adapter to maintain any per-object state. By using an object adapter interface that is tuned towards such object implementations, it is possible to take advantage of particular ORB Core details to provide the most effective access to the ORB.
2.6 CORBA Required Object Adapter There are a variety of possible object adapters; however, since the object adapter interface is something that object implementations depend on, it is desirable that there be as few as practical. Most object adapters are designed to cover a range of object implementations, so only when an implementation requires radically different services or interfaces should a new object adapter be considered. In this section, we briefly describe the object adapter defined in this specification.
2.6.1 Portable Object Adapter This specification defines a Portable Object Adapter that can be used for most ORB objects with conventional implementations. (See the Portable Object Adapter chapter for more information.) The intent of the POA, as its name suggests, is to provide an Object Adapter that can be used with multiple ORBs with a minimum of rewriting needed to deal with different vendors’ implementations. This specification allows several ways of using servers but it does not deal with the administrative issues of starting server programs. Once started, however, there can be a servant started and ended for a single method call, a separate servant for each object, or a shared servant for all instances of the object type. It allows for groups of objects to be associated by means of being registered with different instances of the POA object and allows implementations to specify their own activation techniques. If the implementation is not active when an invocation is performed, the POA will start one. The POA is specified in IDL, so its mapping to languages is largely automatic, following the language mapping rules. (The primary task left for a language mapping is the definition of the Servant type.)
2.7 The Integration of Foreign Object Systems The Common ORB Architecture is designed to allow interoperation with a wide range of object systems (see Figure 2-9 on page 2-18). Because there are many existing object systems, a common desire will be to allow the objects in those systems to be accessible via the ORB. For those object systems that are ORBs themselves, they may be connected to other ORBs through the mechanisms described throughout this manual.
CORBA, v2.4.2
CORBA Required Object Adapter
February 2001
2-17
2
Object system as a POA object implementation
Portable Object Adapter
Object system as an implementation with a special-purpose object adapter Special-purpose Adapter
ORB Core Gateway Figure 2-9
Object system as another ORB interoperating via a gateway
Different Ways to Integrate Foreign Object Systems
For object systems that simply want to map their objects into ORB objects and receive invocations through the ORB, one approach is to have those object systems appear to be implementations of the corresponding ORB objects. The object system would register its objects with the ORB and handle incoming requests, and could act like a client and perform outgoing requests. In some cases, it will be impractical for another object system to act like a POA object implementation. An object adapter could be designed for objects that are created in conjunction with the ORB and that are primarily invoked through the ORB. Another object system may wish to create objects without consulting the ORB, and might expect most invocations to occur within itself rather than through the ORB. In such a case, a more appropriate object adapter might allow objects to be implicitly registered when they are passed through the ORB.
2-18
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
3
OMG IDL Syntax and Semantics
This chapter describes OMG Interface Definition Language (IDL) semantics and gives the syntax for OMG IDL grammatical constructs.
Contents This chapter contains the following sections.
Section Title
Page
“Overview”
3-2
“Lexical Conventions”
3-3
“Preprocessing”
3-11
“OMG IDL Grammar”
3-11
“OMG IDL Specification”
3-16
“Module Declaration”
3-16
“Interface Declaration”
3-17
“Value Declaration”
3-24
“Constant Declaration”
3-29
“Type Declaration”
3-33
“Exception Declaration”
3-46
“Operation Declaration”
3-47
“Attribute Declaration”
3-49
“CORBA Module”
3-50
“Names and Scoping”
3-51
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
3-1
3 3.1 Overview The OMG Interface Definition Language (IDL) is the language used to describe the interfaces that client objects call and object implementations provide. An interface definition written in OMG IDL completely defines the interface and fully specifies each operation’s parameters. An OMG IDL interface provides the information needed to develop clients that use the interface’s operations. Clients are not written in OMG IDL, which is purely a descriptive language, but in languages for which mappings from OMG IDL concepts have been defined. The mapping of an OMG IDL concept to a client language construct will depend on the facilities available in the client language. For example, an OMG IDL exception might be mapped to a structure in a language that has no notion of exception, or to an exception in a language that does. The binding of OMG IDL concepts to several programming languages is described in this manual. The description of OMG IDL’s lexical conventions is presented in Section 3.2, “Lexical Conventions,” on page 3-3. A description of OMG IDL preprocessing is presented in Section 3.3, “Preprocessing,” on page 3-11. The scope rules for identifiers in an OMG IDL specification are described in Section 3.15, “Names and Scoping,” on page 3-51. OMG IDL is a declarative language. The grammar is presented in Section 3.4, “OMG IDL Grammar,” on page 3-11 and associated semantics is described in the rest of this chapter either in place or through references to other sections of this standard. OMG IDL-specific pragmas (those not defined for C++) may appear anywhere in a specification; the textual location of these pragmas may be semantically constrained by a particular implementation. A source file containing interface specifications written in OMG IDL must have an “.idl” extension. The description of OMG IDL grammar uses a syntax notation that is similar to Extended Backus-Naur Format (EBNF). Table 3-1 lists the symbols used in this format and their meaning. Table 3-1 IDL EBNF
3-2
Symbol
Meaning
::=
Is defined to be
|
Alternatively
Nonterminal
“text”
Literal
*
The preceding syntactic unit can be repeated zero or more times
+
The preceding syntactic unit can be repeated one or more times
{}
The enclosed syntactic units are grouped as a single syntactic unit
[]
The enclosed syntactic unit is optional—may occur zero or one time
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
3 3.2 Lexical Conventions This section1 presents the lexical conventions of OMG IDL. It defines tokens in an OMG IDL specification and describes comments, identifiers, keywords, and literals—integer, character, and floating point constants and string literals. An OMG IDL specification logically consists of one or more files. A file is conceptually translated in several phases. The first phase is preprocessing, which performs file inclusion and macro substitution. Preprocessing is controlled by directives introduced by lines having # as the first character other than white space. The result of preprocessing is a sequence of tokens. Such a sequence of tokens, that is, a file after preprocessing, is called a translation unit. OMG IDL uses the ASCII character set, except for string literals and character literals, which use the ISO Latin-1 (8859.1) character set. The ISO Latin-1 character set is divided into alphabetic characters (letters) digits, graphic characters, the space (blank) character, and formatting characters. Table 3-2 shows the ISO Latin-1 alphabetic characters; upper and lower case equivalences are paired. The ASCII alphabetic characters are shown in the left-hand column of Table 3-2. Table 3-2 The 114 Alphabetic Characters (Letters)
Char.
Description
Char.
Description
Aa
Upper/Lower-case A
Àà
Upper/Lower-case A with grave accent
Bb
Upper/Lower-case B
Áá
Upper/Lower-case A with acute accent
Cc
Upper/Lower-case C
Ââ
Upper/Lower-case A with circumflex accent
Dd
Upper/Lower-case D
Ãã
Upper/Lower-case A with tilde
Ee
Upper/Lower-case E
Ää
Upper/Lower-case A with diaeresis
Ff
Upper/Lower-case F
Åå
Upper/Lower-case A with ring above
Gg
Upper/Lower-case G
Ææ
Upper/Lower-case dipthong A with E
Hh
Upper/Lower-case H
Çç
Upper/Lower-case C with cedilla
Ii
Upper/Lower-case I
Èè
Upper/Lower-case E with grave accent
Jj
Upper/Lower-case J
Éé
Upper/Lower-case E with acute accent
Kk
Upper/Lower-case K
Êê
Upper/Lower-case E with circumflex accent
Ll
Upper/Lower-case L
Ëë
Upper/Lower-case E with diaeresis
Mm
Upper/Lower-case M
Ìì
Upper/Lower-case I with grave accent
Nn
Upper/Lower-case N
Íí
Upper/Lower-case I with acute accent
Oo
Upper/Lower-case O
Îî
Upper/Lower-case I with circumflex accent
Pp
Upper/Lower-case P
Ïï
Upper/Lower-case I with diaeresis
Qq
Upper/Lower-case Q
Ññ
Upper/Lower-case N with tilde
Rr
Upper/Lower-case R
Òò
Upper/Lower-case O with grave accent
1. This section is an adaptation of The Annotated C++ Reference Manual, Chapter 2; it differs in the list of legal keywords and punctuation.
CORBA, v2.4.2
Lexical Conventions
February 2001
3-3
3 Table 3-2 The 114 Alphabetic Characters (Letters) (Continued)
Char.
Description
Char.
Description
Ss
Upper/Lower-case S
Óó
Upper/Lower-case O with acute accent
Tt
Upper/Lower-case T
Ôô
Upper/Lower-case O with circumflex accent
Uu
Upper/Lower-case U
Õõ
Upper/Lower-case O with tilde
Vv
Upper/Lower-case V
Öö
Upper/Lower-case O with diaeresis
Ww
Upper/Lower-case W
Øø
Upper/Lower-case O with oblique stroke
Xx
Upper/Lower-case X
Ùù
Upper/Lower-case U with grave accent
Yy
Upper/Lower-case Y
Úú
Upper/Lower-case U with acute accent
Zz
Upper/Lower-case Z
Ûû
Upper/Lower-case U with circumflex accent
Üü
Upper/Lower-case U with diaeresis
ß
Lower-case German sharp S
ÿ
Lower-case Y with diaeresis
Table 3-3 lists the decimal digit characters. Table 3-3 Decimal Digits 0123456789
Table 3-4 shows the graphic characters. Table 3-4 The 65 Graphic Characters
3-4
Char.
Description
Char.
Description
!
exclamation point
¡
inverted exclamation mark
"
double quote
¢
cent sign
#
number sign
£
pound sign
$
dollar sign
¤
currency sign
%
percent sign
¥
yen sign
&
ampersand
’
apostrophe
§
section/paragraph sign
(
left parenthesis
¨
diaeresis
)
right parenthesis
©
copyright sign
*
asterisk
ª
feminine ordinal indicator
+
plus sign
«
left angle quotation mark
,
comma
¬
not sign
-
hyphen, minus sign
.
period, full stop
®
registered trade mark sign
/
solidus
¯
macron
:
colon
°
ring above, degree sign
;
semicolon
±
plus-minus sign
<
less-than sign
2
superscript two
=
equals sign
3
superscript three
broken bar
soft hyphen
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
3 Table 3-4 The 65 Graphic Characters (Continued)
Char.
Description
Char.
Description
>
greater-than sign
´
acute
?
question mark
µ
micro
@
commercial at
¶
pilcrow
[
left square bracket
•
middle dot
\
reverse solidus
¸
cedilla
]
right square bracket
1
superscript one
^
circumflex
º
masculine ordinal indicator
_
low line, underscore
»
right angle quotation mark
‘
grave
vulgar fraction 1/4
{
left curly bracket
vulgar fraction 1/2
|
vertical line
vulgar fraction 3/4
}
right curly bracket
¿
inverted question mark
~
tilde
×
multiplication sign
÷
division sign
The formatting characters are shown in Table 3-5. Table 3-5 The Formatting Characters
Description alert
Abbreviation BEL
ISO 646 Octal Value 007
backspace
BS
010
horizontal tab
HT
011
NL, LF
012
VT
013
form feed
FF
014
carriage return
CR
015
newline vertical tab
3.2.1 Tokens There are five kinds of tokens: identifiers, keywords, literals, operators, and other separators. Blanks, horizontal and vertical tabs, newlines, formfeeds, and comments (collective, “white space”), as described below, are ignored except as they serve to separate tokens. Some white space is required to separate otherwise adjacent identifiers, keywords, and constants. If the input stream has been parsed into tokens up to a given character, the next token is taken to be the longest string of characters that could possibly constitute a token.
CORBA, v2.4.2
Lexical Conventions
February 2001
3-5
3 3.2.2 Comments The characters /* start a comment, which terminates with the characters */. These comments do not nest. The characters // start a comment, which terminates at the end of the line on which they occur. The comment characters //, /*, and */ have no special meaning within a // comment and are treated just like other characters. Similarly, the comment characters // and /* have no special meaning within a /* comment. Comments may contain alphabetic, digit, graphic, space, horizontal tab, vertical tab, form feed, and newline characters.
3.2.3 Identifiers An identifier is an arbitrarily long sequence of ASCII alphabetic, digit, and underscore (“_”) characters. The first character must be an ASCII alphabetic character. All characters are significant. When comparing two identifiers to see if they collide: • Upper- and lower-case letters are treated as the same letter. Table 3-2 on page 3-3 defines the equivalence mapping of upper- and lower-case letters. • All characters are significant. Identifiers that differ only in case collide, and will yield a compilation error under certain circumstances. An identifier for a given definition must be spelled identically (e.g., with respect to case) throughout a specification. There is only one namespace for OMG IDL identifiers in each scope. Using the same identifier for a constant and an interface, for example, produces a compilation error. For example: module M { typedef long Foo; const long thing = 1; interface thing { void doit ( in Foo foo
// error: reuse of identifier // error: Foo and foo collide and refer to different things
); readonly attribute long Attribute; // error: Attribute collides with keyword attribute }; };
3.2.3.1 Escaped Identifiers As IDL evolves, new keywords that are added to the IDL language may inadvertently collide with identifiers used in existing IDL and programs that use that IDL. Fixing these collisions will require not only the IDL to be modified, but programming
3-6
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
3 language code that depends upon that IDL will have to change as well. The language mapping rules for the renamed IDL identifiers will cause the mapped identifier names (e.g., method names) to be changed. To minimize the amount of work, users may lexically “escape” identifiers by prepending an underscore (_) to an identifier. This is a purely lexical convention that ONLY turns off keyword checking. The resulting identifier follows all the other rules for identifier processing. For example, the identifier _AnIdentifier is treated as if it were AnIdentifier. The following is a non-exclusive list of implications of these rules: • The underscore does not appear in the Interface Repository. • The underscore is not used in the DII and DSI. • The underscore is not transmitted over “the wire.” • Case sensitivity rules are applied to the identifier after stripping off the leading underscore. For example: module M { interface thing { attribute boolean abstract; attribute boolean _abstract;
// error: abstract collides with // keyword abstract // ok: abstract is an identifier
}; }; To avoid unnecessary confusion for readers of IDL, it is recommended that interfaces only use the escaped form of identifiers when the unescaped form clashes with a newly introduced IDL keyword. It is also recommended that interface designers avoid defining new identifiers that are known to require escaping. Escaped literals are only recommended for IDL that expresses legacy interface, or for IDL that is mechanically generated.
3.2.4 Keywords The identifiers listed in Table 3-6 are reserved for use as keywords and may not be used otherwise, unless escaped with a leading underscore. Table 3-6 Keywords abstract double
local
raises
typedef
any
exception
long
readonly
unsigned
attribute
enum
module
sequence
union
boolean
factory
native
short
ValueBase
case
FALSE
Object
string
valuetype
char
fixed
octet
struct
void
const
float
oneway
supports
wchar
CORBA, v2.4.2
Lexical Conventions
February 2001
3-7
3 Table 3-6 Keywords context in
out
switch
wstring
custom
inout
private
TRUE
default
interface
public
truncatable
Keywords must be written exactly as shown in the above list. Identifiers that collide with keywords (see Section 3.2.3, “Identifiers,” on page 3-6) are illegal. For example, “boolean” is a valid keyword; “Boolean” and “BOOLEAN” are illegal identifiers. For example: module M { typedef Long Foo; typedef boolean BOOLEAN;
// Error: keyword is long not Long // Error: BOOLEAN collides with // the keyword boolean;
}; OMG IDL specifications use the characters shown in Table 3-7 as punctuation.
;
Table 3-7 Punctuation Characters { } : , =
'
"
\
|
^
&
+
-
(
)
*
/
%
~
<
>
[
]
In addition, the tokens listed in Table 3-8 are used by the preprocessor. Table 3-8 Preprocessor Tokens # ## ! || &&
3.2.5 Literals This • • • • •
section describes the following literals: Integer Character Floating-point String Fixed-point
3.2.5.1 Integer Literals An integer literal consisting of a sequence of digits is taken to be decimal (base ten) unless it begins with 0 (digit zero). A sequence of digits starting with 0 is taken to be an octal integer (base eight). The digits 8 and 9 are not octal digits. A sequence of digits preceded by 0x or 0X is taken to be a hexadecimal integer (base sixteen). The hexadecimal digits include a or A through f or F with decimal values ten through fifteen, respectively. For example, the number twelve can be written 12, 014, or 0XC.
3-8
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
3 3.2.5.2 Character Literals A character literal is one or more characters enclosed in single quotes, as in ’x.’ Character literals have type char. A character is an 8-bit quantity with a numerical value between 0 and 255 (decimal). The value of a space, alphabetic, digit, or graphic character literal is the numerical value of the character as defined in the ISO Latin-1 (8859.1) character set standard (See Table 3-2 on page 3-3, Table 3-3 on page 3-4, and Table 3-4 on page 3-4). The value of a null is 0. The value of a formatting character literal is the numerical value of the character as defined in the ISO 646 standard (see Table 3-5 on page 3-5). The meaning of all other characters is implementation-dependent. Nongraphic characters must be represented using escape sequences as defined below in Table 3-9. Note that escape sequences must be used to represent single quote and backslash characters in character literals. Table 3-9 Escape Sequences
Description
Escape Sequence
newline
\n
horizontal tab
\t
vertical tab
\v
backspace
\b
carriage return
\r
form feed
\f
alert
\a
backslash
\\
question mark
\?
single quote
\'
double quote
\"
octal number
\ooo
hexadecimal number
\xhh
unicode character
\uhhhh
If the character following a backslash is not one of those specified, the behavior is undefined. An escape sequence specifies a single character. The escape \ooo consists of the backslash followed by one, two, or three octal digits that are taken to specify the value of the desired character. The escape \xhh consists of the backslash followed by x followed by one or two hexadecimal digits that are taken to specify the value of the desired character. The escape \uhhhh consists of a backslash followed by the character ‘u’, followed by one, two, three or four hexadecimal digits. This represents a unicode character literal. Thus the literal “\u002E” represents the unicode period ‘.’ character and the literal “\u3BC” represents the unicode greek small letter ‘mu’. The \u escape is valid only with wchar and wstring types. Because a wide string literal is defined as a sequence of
CORBA, v2.4.2
Lexical Conventions
February 2001
3-9
3 wide character literals a sequence of \u literals can be used to define a wide string literal. Attempts to set a char type to a \u defined literal or a string type to a sequence of \u literals result in an error. A sequence of octal or hexadecimal digits is terminated by the first character that is not an octal digit or a hexadecimal digit, respectively. The value of a character constant is implementation dependent if it exceeds that of the largest char. Wide character literals have an L prefix, for example: const wchar C1 = L'X'; Attempts to assign a wide character literal to a non-wide character constant or to assign a non-wide character literal to a wide character constant result in a compile-time diagnostic. Both wide and non-wide character literals must be specified using characters from the ISO 8859-1 character set.
3.2.5.3 Floating-point Literals A floating-point literal consists of an integer part, a decimal point, a fraction part, an e or E, and an optionally signed integer exponent. The integer and fraction parts both consist of a sequence of decimal (base ten) digits. Either the integer part or the fraction part (but not both) may be missing; either the decimal point or the letter e (or E) and the exponent (but not both) may be missing.
3.2.5.4 String Literals A string literal is a sequence of characters (as defined in Section 3.2.5.2, “Character Literals,” on page 3-9) surrounded by double quotes, as in “...”. Adjacent string literals are concatenated. Characters in concatenated strings are kept distinct. For example, "\xA" "B" contains the two characters '\xA' and 'B' after concatenation (and not the single hexadecimal character '\xAB'). The size of a string literal is the number of character literals enclosed by the quotes, after concatenation. Within a string, the double quote character " must be preceded by a \. A string literal may not contain the character ‘\0’. Wide string literals have an L prefix, for example: const wstring S1 = L"Hello"; Attempts to assign a wide string literal to a non-wide string constant or to assign a non-wide string literal to a wide string constant result in a compile-time diagnostic.
3-10
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
3 Both wide and non-wide string literals must be specified using characters from the ISO 8859-1 character set. A wide string literal shall not contain the wide character with value zero.
3.2.5.5 Fixed-Point Literals A fixed-point decimal literal consists of an integer part, a decimal point, a fraction part and a d or D. The integer and fraction parts both consist of a sequence of decimal (base 10) digits. Either the integer part or the fraction part (but not both) may be missing; the decimal point (but not the letter d (or D)) may be missing.
3.3 Preprocessing OMG IDL is preprocessed according to the specification of the preprocessor in "International Organization for Standardization. 1998. ISO/IEC 14882 Standard for the C++ Programming Language. Geneva: International Organization for Standardization." The preprocessor may be implemented as a separate process or built into the IDL compiler. Lines beginning with # (also called “directives”) communicate with this preprocessor. White space may appear before the #. These lines have syntax independent of the rest of OMG IDL; they may appear anywhere and have effects that last (independent of the OMG IDL scoping rules) until the end of the translation unit. The textual location of OMG IDL-specific pragmas may be semantically constrained. A preprocessing directive (or any line) may be continued on the next line in a source file by placing a backslash character (“\”), immediately before the newline at the end of the line to be continued. The preprocessor effects the continuation by deleting the backslash and the newline before the input sequence is divided into tokens. A backslash character may not be the last character in a source file. A preprocessing token is an OMG IDL token (see Section 3.2.1, “Tokens,” on page 3-5), a file name as in a #include directive, or any single character other than white space that does not match another preprocessing token. The primary use of the preprocessing facilities is to include definitions from other OMG IDL specifications. Text in files included with a #include directive is treated as if it appeared in the including file. The #pragma directive that is used to include RepositoryIds is described in Section 10.6, “RepositoryIds,” on page 10-42.
3.4 OMG IDL Grammar (1) (2)
<specification> ::= <definition>+ <definition> ::= “;” | “;” | <except_dcl> “;” | “;” | <module> “;” | “;”
CORBA, v2.4.2
Preprocessing
February 2001
3-11
3 <module> ::= “module” “{“ <definition>+ “}” ::= | (5) ::= “{” “}” (6) ::= [ “abstract” | “local” ] “interface” (7) ::= [ “abstract” | “local” ] “interface” [ ] (8) ::= <export>* (9) <export> ::= “;” | “;” | <except_dcl> “;” | “;” | “;” (10)::=“:” { “,” }* (11) ::= <scoped_name> (12) <scoped_name> ::= | “::” | <scoped_name> “::” (13) ::= ( | | | ) (14) ::= [ “abstract” ] “valuetype” (15) ::= “valuetype” (16) ::= “abstract” “valuetype” [ ] “{“ <export>* “}” (17) ::= “{“ < value_element>* “}” (18) ::= [“custom” ] “valuetype” [ ] (19) ::= [ “:” [ “truncatable” ] { “,” }* ] [ “supports” { “,” }* ] (20) ::= <scoped_name> (21) ::= <export> | < state_member> | (22) <state_member> ::= ( “public” | “private” ) <declarators> “;” (23) ::= “factory” “(“ [ ] “)” “;” (24) ::= { “,” }* (25) ::= <param_type_spec> <simple_declarator> (26) ::= “in” (27) ::= “const” “=” (28) ::= (3) (4)
3-12
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
3
(29) (30)
(31)
<xor_expr>
(32)
(33)
<shift_expr>
(34)
(35)
<mult_expr>
(36)
(37)
(38)
<primary_expr>
(39)
(40)
(41) (42)
<positive_int_const>
CORBA, v2.4.2
| | | | | | | | | ::= ::= | ::= | ::= | ::= | | ::= | | ::= | | | ::= | ::= | | ::= | | ::= | | | | | | | ::= | ::= ::= | |
<wide_char_type> <string_type> <wide_string_type> <scoped_name> <xor_expr> “|” <xor_expr> <xor_expr> “^” <shift_expr> “&” <shift_expr> <shift_expr> “>>” <shift_expr> “<<” <mult_expr> “+” <mult_expr> “-” <mult_expr> <mult_expr> “*” <mult_expr> “/” <mult_expr> “%” <primary_expr> <primary_expr> “-” “+” “~” <scoped_name> “(” “)” <string_literal> <wide_string_literal> <wide_character_literal> “TRUE” “FALSE” “typedef” <struct_type>
OMG IDL Grammar
February 2001
3-13
3
(43) (44)
(45)
<simple_type_spec>
(46)
(47)
(48)
(49) (50)
<declarators> <declarator>
(51) (52) (53)
<simple_declarator>
(54)
(55)
<signed_int>
(56) (57) (58) (59)
<signed_short_int> <signed_long_int> <signed_longlong_int>
(60) (61) (62)
3-14
| | | ::= ::= | ::= | | ::= | | | | | | | | ::= | | | ::= | | ::= ::= | ::= ::= ::= | | ::= | ::= | | ::= ::= ::= ::= | | ::= ::= ::=
<enum_type> “native” <simple_declarator> <declarators> <simple_type_spec> <scoped_name> <wide_char_type> <sequence_type> <string_type> <wide_string_type> <struct_type> <enum_type> <declarator> { “,” <declarator> }∗ <simple_declarator> <array_declarator> “float” “double” “long” “double” <signed_int> <signed_short_int> <signed_long_int> <signed_longlong_int> “short” “long” “long” “long” “unsigned” “short” “unsigned” “long” “unsigned” “long” “long”
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
3 (63) (64) (65) (66) (67) (68) (69) (70) (71) (72)
(73)
<wide_char_type> <struct_type> <member_list> <member>
::= ::= ::= ::= ::= ::= ::= ::= ::= ::=
(77) (78)
<switch_type_spec> ::= | | | | <switch_body> ::= ::= ::= | <element_spec> ::= <enum_type> ::=
(79) (80)
<enumerator> ::= <sequence_type> ::=
(74) (75) (76)
(83) (84) (85)
| <string_type> ::= | <wide_string_type> ::= | <array_declarator> ::= ::= ::=
(86) (87)
<except_dcl> ::= ::=
(88) (89)
::= ::= | <parameter_dcls> ::= |
(81) (82)
(90)
CORBA, v2.4.2
“char” “wchar” “boolean” “octet” “any” “Object” “struct” “{” <member_list> “}” <member>+ <declarators> “;” “union” “switch” “(” <switch_type_spec> “)” “{” <switch_body> “}” <enum_type> <scoped_name> + + <element_spec> “;” “case” “:” “default” “:” <declarator> “enum” “{” <enumerator> { “,” <enumerator> } ∗ “}” “sequence” “<” <simple_type_spec> “,” <positive_int_const> “>” “sequence” “<” <simple_type_spec> “>” “string” “<” <positive_int_const> “>” “string” “wstring” “<” <positive_int_const> “>” “wstring” + “[” <positive_int_const> “]” [ “readonly” ] “attribute” <param_type_spec> <simple_declarator> { “,” <simple_declarator> }* “exception” “{“ <member>* “}” [ ] <parameter_dcls> [ ] [ ] “oneway” <param_type_spec> “void” “(” <param_dcl> { “,” <param_dcl> }∗ “)” “(” “)”
OMG IDL Grammar
February 2001
3-15
3 (91) (92)
(93) (94) (95)
(96) (97) (98) (99)
<param_dcl> ::= <param_attribute> <param_type_spec> <simple_declarator> <param_attribute> ::= “in” | “out” | “inout” ::= “raises” “(” <scoped_name> { “,” <scoped_name> }∗ “)” ::= “context” “(” <string_literal> { “,” <string_literal> }∗ “)” <param_type_spec> ::= | <string_type> | <wide_string_type> | <scoped_name> ::= “fixed” “<“ <positive_int_const> “,” <positive_int_const> “>” ::= “fixed” ::= “ValueBase” ::= “struct” | “union”
3.5 OMG IDL Specification
(1) (2)
An OMG IDL specification consists of one or more type definitions, constant definitions, exception definitions, or module definitions. The syntax is: <specification> ::= <definition>+ <definition> ::= “;” | “;” | <except_dcl> “;” | “;” | <module> “;” | “;” See Section 3.6, “Module Declaration,” on page 3-16, for the specification of <module>. See Section 3.7, “Interface Declaration,” on page 3-17, for the specification of . See Section 3.8, “Value Declaration,” on page 3-24, for the specification of . See Section 3.9, “Constant Declaration,” on page 3-29, Section 3.10, “Type Declaration,” on page 3-33, and Section 3.11, “Exception Declaration,” on page 3-46 respectively for specifications of , , and <except_dcl>.
3.6 Module Declaration (3)
3-16
A module definition satisfies the following syntax: <module> ::= “module” “{“ <definition>+ “}”
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
3 The module construct is used to scope OMG IDL identifiers; see Section 3.14, “CORBA Module,” on page 3-50 for details.
3.7 Interface Declaration (4) (5) (6) (7) (8) (9)
An interface definition satisfies the following syntax: ::= | ::= “{” “}” ::= [ “abstract” | “local” ] “interface” ::= [ “abstract” | “local” ] “interface” [ ] ::= <export>* <export> ::= “;” | “;” | <except_dcl> “;” | “;” | “;”
3.7.1 Interface Header The interface header consists of three elements: 1. An optional modifier specifying if the interface is an abstract interface. 2. The interface name. The name must be preceded by the keyword interface, and consists of an identifier that names the interface. 3. An optional inheritance specification. The inheritance specification is described in the next section. The that names an interface defines a legal type name. Such a type name may be used anywhere an is legal in the grammar, subject to semantic constraints as described in the following sections. Since one can only hold references to an object, the meaning of a parameter or structure member, which is an interface type is as a reference to an object supporting that interface. Each language binding describes how the programmer must represent such interface references. Abstract interfaces have slightly different rules and semantics from “regular” interfaces, as described in Section 6.2, “Semantics of Abstract Interfaces,” on page 6-1. They also follow different language mapping rules.
3.7.2 Interface Inheritance Specification The syntax for inheritance is as follows: (10)::=“:” { “,” }* (11) ::= <scoped_name>
CORBA, v2.4.2
Interface Declaration
February 2001
3-17
3 (12)
<scoped_name> ::= | “::” | <scoped_name> “::” Each <scoped_name> in an must denote a previously defined interface. See Section 3.7.5, “Interface Inheritance,” on page 3-19 for the description of inheritance.
3.7.3 Interface Body The interface body contains the following kinds of declarations: • Constant declarations, which specify the constants that the interface exports; constant declaration syntax is described in Section 3.9, “Constant Declaration,” on page 3-29. • Type declarations, which specify the type definitions that the interface exports; type declaration syntax is described in Section 3.10, “Type Declaration,” on page 3-33. • Exception declarations, which specify the exception structures that the interface exports; exception declaration syntax is described in Section 3.11, “Exception Declaration,” on page 3-46. • Attribute declarations, which specify the associated attributes exported by the interface; attribute declaration syntax is described in Section 3.13, “Attribute Declaration,” on page 3-49. • Operation declarations, which specify the operations that the interface exports and the format of each, including operation name, the type of data returned, the types of all parameters of an operation, legal exceptions that may be returned as a result of an invocation, and contextual information that may affect method dispatch; operation declaration syntax is described in Section 3.12, “Operation Declaration,” on page 3-47. Empty interfaces are permitted (that is, those containing no declarations). Some implementations may require interface-specific pragmas to precede the interface body.
3.7.4 Forward Declaration A forward declaration declares the name of an interface without defining it. This permits the definition of interfaces that refer to each other. The syntax is: optionally the keyword abstract, followed by the keyword interface, followed by an that names the interface. Multiple forward declarations of the same interface name are legal. It is illegal to inherit from a forward-declared interface whose definition has not yet been seen: module Example { interface base;
3-18
// Forward declaration
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
3 // ... interface derived : base {}; interface base {}; interface derived : base {};
// Error // Define base // OK
};
3.7.5 Interface Inheritance An interface can be derived from another interface, which is then called a base interface of the derived interface. A derived interface, like all interfaces, may declare new elements (constants, types, attributes, exceptions, and operations). In addition, unless redefined in the derived interface, the elements of a base interface can be referred to as if they were elements of the derived interface. The name resolution operator (“::”) may be used to refer to a base element explicitly; this permits reference to a name that has been redefined in the derived interface. A derived interface may redefine any of the type, constant, and exception names that have been inherited; the scope rules for such names are described in Section 3.14, “CORBA Module,” on page 3-50. An interface is called a direct base if it is mentioned in the and an indirect base if it is not a direct base but is a base interface of one of the interfaces mentioned in the . An interface may be derived from any number of base interfaces. Such use of more than one direct base interface is often called multiple inheritance. The order of derivation is not significant. An abstract interface may only inherit from other abstract interfaces. An interface may not be specified as a direct base interface of a derived interface more than once; it may be an indirect base interface more than once. Consider the following example: interface A { ... } interface B: A { ... } interface C: A { ... } interface D: B, C { ... } interface E: A, B { ... };
CORBA, v2.4.2
Interface Declaration
// OK
February 2001
3-19
3 The relationships between these interfaces is shown in Figure 3-1. This “diamond” shape is legal, as is the definition of E on the right.
A
A
B
B
C
C
D
D Figure 3-1
E
Legal Multiple Inheritance Example
References to base interface elements must be unambiguous. A Reference to a base interface element is ambiguous if the name is declared as a constant, type, or exception in more than one base interface. Ambiguities can be resolved by qualifying a name with its interface name (that is, using a <scoped_name>). It is illegal to inherit from two interfaces with the same operation or attribute name, or to redefine an operation or attribute name in the derived interface. So for example in: interface A { typedef long L1; short opA(in L1 l_1); }; interface B { typedef short L1; L1 opB(in long l); }; interface C: B, A { typedef L1 L2; typedef A::L1 L3; B::L1 opC(in L3 l_3); };
// Error: L1 ambiguous // A::L1 is OK // all OK no ambiguities
References to constants, types, and exceptions are bound to an interface when it is defined (i.e., replaced with the equivalent global <scoped_name>s). This guarantees that the syntax and semantics of an interface are not changed when the interface is a base interface for a derived interface. Consider the following example: const long L = 3; interface A {
3-20
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
3 typedef float coord[L]: void f (in coord s);
// s has three floats
}; interface B { const long L = 4; }; interface C: B, A { };
// what is C::f()’s signature?
The early binding of constants, types, and exceptions at interface definition guarantees that the signature of operation f in interface C is typedef float coord[3]; void f (in coord s); which is identical to that in interface A. This rule also prevents redefinition of a constant, type, or exception in the derived interface from affecting the operations and attributes inherited from a base interface. Interface inheritance causes all identifiers defined in base interfaces, both direct and indirect, to be visible in the current naming scope. A type name, constant name, enumeration value name, or exception name from an enclosing scope can be redefined in the current scope. An attempt to use an ambiguous name without qualification produces a compilation error. Thus in interface A { typedef string<128> string_t; }; interface B { typedef string<256> string_t; }; interface C: A, B { attribute string_t attribute A::string_t attribute B::string_t };
Title; Name; City;
// Error: string_t ambiguous // OK // OK
Operation and attribute names are used at run-time by both the stub and dynamic interfaces. As a result, all operations attributes that might apply to a particular object must have unique names. This requirement prohibits redefining an operation or attribute name in a derived interface, as well as inheriting two operations or attributes with the same name. interface A { void make_it_so(); }; interface B: A {
CORBA, v2.4.2
Interface Declaration
February 2001
3-21
3 short make_it_so(in long times); // Error: redefinition of make_it_so }; For a complete summary of allowable inheritance and supporting relationships among interfaces and valuetypes see Table 3-10 on page 3-28.
3.7.6 Local Interface 3.7.6.1 Semantics The semantics associated with local types are as follows: • An interface declaration containing the keyword local declares a local interface. An interface declaration not containing the keyword local is referred to as an unconstrained interface. An object implementing a local interfaces is referred to as a local object. • A local interface may inherit from other local or unconstrained interfaces. • An unconstrained interface may not inherit from a local interface. An interface derived from a local interface must be explicitly declared local. • A valuetype may support a local interface. • Any IDL type, including an unconstrained interface, may appear as a parameter, attribute, return type, or exception declaration of a local interface. • A local interface is a local type, as is any non-interface type declaration constructed using a local interface or other local type. For example, a struct, union, or exception with a member that is a local interface is also itself a local type. • A local type may be used as a parameter, attribute, return type, or exception declaration of a local interface or of a valuetype. • A local type may not appear as a parameter, attribute, return type, or exception declaration of an unconstrained interface or as a state member of a valuetype. • Local types cannot be marshaled and references to local objects cannot be converted to strings. Any attempt to marshal a local object, such as via an unconstrained base interface, as an Object, or as the contents of an any, or to pass a local object to ORB::object_to_string , shall result in a MARSHAL system exception with OMG minor code 2. • The usage of client side language mappings for local types shall be identical to those of equivalent unconstrained types. • The DII is not supported on local objects, nor are asynchronous invocation interfaces. • The non_existent, is_equivalent and hash CORBA::Object pseudo-operations shall be supported by references to local objects.
3-22
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
3 • The is_a, get_interface, get_domain_managers, get_policy, get_client_policy, set_policy_overrides, get_policy_overrides, and validate_connection pseudo-operations, and any DII support pseudo-operations, may result in a NO_IMPLEMENT system exception with minor code 3 when invoked on a reference to a local object. • Language mappings shall specify server side mechanisms, including base classes and/or skeletons if necessary, for implementing local objects, so that invocation overhead is minimized. • Invocations on local objects are not ORB mediated. Specifically, parameter copy semantics are not honored, interceptors are not invoked, and the execution context of a local object does not have ORB service Current object contexts that are distinct from those of the caller. Implementations of local interfaces are responsible for providing the parameter copy semantics expected by clients. • Local objects have no inherent identities beyond their implementations’ identities as programming objects. The lifecycle of the implementation is the same as the lifecycle of the reference. • Instances of local objects defined as part of OMG specifications to be supplied by ORB products or object service products shall be exposed through the ORB::resolve_initial_references operation or through some other local object obtained from resolve_initial_references.
3.7.6.2 LocalObject Local interfaces are implemented by using CORBA::LocalObject to provide implementations of Object pseudo operations and any other ORB specific support mechanisms that are appropriate for such objects. Object implementation techniques are inherently language mapping specific. Therefore, the LocalObject type is not defined in IDL, but is specified by each language mapping. The LocalObject type provides implementations of the following Object pseudooperations that raise the NO_IMPLEMENT system exception: • is_a • get_interface • get_domain_managers • get_policy • get_client_policy • set_policy_overrides • get_policy_overrides • validate_connection Additionally, it provides implementations of the following pseudo-operations: • non_existent - always returns false. • hash - returns a hash value that is consistent for the lifetime of the object.
CORBA, v2.4.2
Interface Declaration
February 2001
3-23
3 • is_equivalent - returns true if the references refer to the same LocalObject implementation. Attempting to use a LocalObject to create a DII request results in a NO_IMPLEMENT system exception with standard minor code 4. Attempting to marshal or stringify a LocalObject results in a MARSHAL system exception with standard minor code 4. Narrowing and widening of references to LocalObjects must work as for regular object references. For a complete summary of allowable inheritance and supporting relationships among interfaces and valuetypes see Table 3-10 on page 3-28.
3.8 Value Declaration There are several kinds of value type declarations: “regular” value types, boxed value types, abstract value types, and forward declarations. A value declaration satisfies the following syntax: (13) ::= ( | | | )
3.8.1 Regular Value Type A regular value type satisfies the following syntax: (17) ::= “{“ < value_element>* “}” (18) ::= [“custom” ] “valuetype” [ ] (21) ::= <export> | < state_member> | |
3.8.1.1 Value Header The value header consists of two elements: 1. The value type’s name and optional modifier specifying whether the value type uses custom marshaling. 2. An optional value inheritance specification. The value inheritance specification is described in the next section.
3.8.1.2 Value Element A value can contain all the elements that an interface can as well as the definition of state members, and initializers for that state.
3-24
Common Object Request Broker Architecture (CORBA), v2.4.2
February 2001
3 3.8.1.3 Value Inheritance Specification (19) ::= [ “:” [ “truncatable” ] { “,” }* ] [ “supports” { “,” }* ] (20) ::= <scoped_name> Each and in a must denote previously defined value type or interface. See Section 3.8.5, “Valuetype Inheritance,” on page 3-28 for the description of value type inheritance. The truncatable modifier may not be used if the value type being defined is a custom value.
3.8.1.4 State Members (22)
<state_member> ::= ( “public” | “private” ) <declarators> “;” Each <state_member> defines an element of the state, which is marshaled and sent to the receiver when the value type is passed as a parameter. A state member is either public or private. The annotation directs the language mapping to hide or expose the different parts of the state to the clients of the value type. The private part of the state is only accessible to the implementation code and the marshaling routines. Note that certain programming languages may not have the built in facilities needed to distinguish between the public and private members. In these cases, the language mapping specifies the rules that programmers are responsible for following.