org.omg.CORBA
Class ORB

java.lang.Object
  |
  +--org.omg.CORBA.ORB
Direct Known Subclasses:
ORB

public abstract class ORB
extends Object

A class providing APIs for the CORBA Object Request Broker features. The ORB class also provides "pluggable ORB implementation" APIs that allow another vendor's ORB implementation to be used.

An ORB makes it possible for CORBA objects to communicate with each other by connecting objects making requests (clients) with objects servicing requests (servers).

The ORB class, which encapsulates generic CORBA functionality, does the following: (Note that items 5 and 6, which include most of the methods in the class ORB, are typically used with the Dynamic Invocation Interface (DII) and the Dynamic Skeleton Interface (DSI). These interfaces may be used by a developer directly, but most commonly they are used by the ORB internally and are not seen by the general programmer.)

  1. initializes the ORB implementation by supplying values for predefined properties and environmental parameters
  2. obtains initial object references to services such as the NameService using the method resolve_initial_references
  3. converts object references to strings and back
  4. connects the ORB to a servant (an instance of a CORBA object implementation) and disconnects the ORB from a servant
  5. creates objects such as
    • TypeCode
    • Any
    • NamedValue
    • Context
    • Environment
    • lists (such as NVList) containing these objects
  6. sends multiple messages in the DII

The ORB class can be used to obtain references to objects implemented anywhere on the network.

An application or applet gains access to the CORBA environment by initializing itself into an ORB using one of three init methods. Two of the three methods use the properties (associations of a name with a value) shown in the table below.
Property Name Property Value
Standard Java CORBA Properties:
org.omg.CORBA.ORBClass class name of an ORB implementation
org.omg.CORBA.ORBSingletonClass class name of the ORB returned by init()

These properties allow a different vendor's ORB implementation to be "plugged in."

When an ORB instance is being created, the class name of the ORB implementation is located using the following standard search order:

  1. check in Applet parameter or application string array, if any
  2. check in properties parameter, if any
  3. check in the System properties
  4. check in the orb.properties file located in the java.home/lib directory
  5. fall back on a hardcoded default behavior (use the Java IDL implementation)

Note that Java IDL provides a default implementation for the fully-functional ORB and for the Singleton ORB. When the method init is given no parameters, the default Singleton ORB is returned. When the method init is given parameters but no ORB class is specified, the Java IDL ORB implementation is returned.

The following code fragment creates an ORB object initialized with the default ORB Singleton. This ORB has a restricted implementation to prevent malicious applets from doing anything beyond creating typecodes. It is called a singleton because there is only one instance for an entire virtual machine.

    ORB orb = ORB.init();
 

The following code fragment creates an ORB object for an application. The parameter args represents the arguments supplied to the application's main method. Since the property specifies the ORB class to be "SomeORBImplementation", the new ORB will be initialized with that ORB implementation. If p had been null, and the arguments had not specified an ORB class, the new ORB would have been initialized with the default Java IDL implementation.

    Properties p = new Properties();
    p.put("org.omg.CORBA.ORBClass", "SomeORBImplementation");
    ORB orb = ORB.init(args, p);
 

The following code fragment creates an ORB object for the applet supplied as the first parameter. If the given applet does not specify an ORB class, the new ORB will be initialized with the default Java IDL implementation.

    ORB orb = ORB.init(myApplet, null);
 

An application or applet can be initialized in one or more ORBs. ORB initialization is a bootstrap call into the CORBA world.

Since:
JDK1.2

Constructor Summary
ORB
copy->  new ORB()
copy->  <ORB var> = new ORB();
 
Method Summary
 void connect(Object obj)
copy->  .connect( )
copy->  <ORB>.connect(<Object obj>);
Connects the given servant object (a Java object that is an instance of the server implementation class) to the ORB. The servant class must extend the ImplBase class corresponding to the interface that is supported by the server. The servant must thus be a CORBA object reference, and inherit from org.omg.CORBA.Object. Servants created by the user can start receiving remote invocations after the method connect has been called. A servant may also be automatically and implicitly connected to the ORB if it is passed as an IDL parameter in an IDL method invocation on a non-local object, that is, if the servant object has to be marshalled and sent outside of the process address space.

Calling the method connect has no effect when the servant object is already connected to the ORB.

Deprecated by the OMG in favor of the Portable Object Adapter APIs.

Parameters:
obj - the servant object reference
See Also:
CORBA package comments for unimplemented features
 TypeCode create_abstract_interface_tc(String id, String name)
copy->  .create_abstract_interface_tc(, )
copy->  <TypeCode var>=<ORB>.create_abstract_interface_tc(<String id>, <String name>);
Create a TypeCode object for an IDL abstract interface.
Parameters:
id - the logical id for the abstract interface type.
name - the name of the abstract interface type.
Returns:
the requested TypeCode.
See Also:
CORBA package comments for unimplemented features
abstract  TypeCode create_alias_tc(String id, String name, TypeCode original_type)
copy->  .create_alias_tc(, , )
copy->  <TypeCode var>=<ORB>.create_alias_tc(<String id>, <String name>, <TypeCode original_type>);
Creates a TypeCode object representing an IDL alias (typedef). The TypeCode object is initialized with the given id, name, and original type.
Parameters:
id - the repository id for the alias
name - the name for the alias
original_type - the TypeCode object describing the original type for which this is an alias
Returns:
a newly-created TypeCode object describing an IDL alias
abstract  Any create_any()
copy->  .create_any()
copy->  <Any var>=<ORB>.create_any();
Creates an IDL Any object initialized to contain a Typecode object whose kind field is set to TCKind.tc_null.
Returns:
a newly-created Any object
abstract  TypeCode create_array_tc(int length, TypeCode element_type)
copy->  .create_array_tc(, )
copy->  <TypeCode var>=<ORB>.create_array_tc(<int length>, <TypeCode element_type>);
Creates a TypeCode object representing an IDL array. The TypeCode object is initialized with the given length and element type.
Parameters:
length - the length of the array
element_type - a TypeCode object describing the type of element contained in the array
Returns:
a newly-created TypeCode object describing an IDL array
 DynAny create_basic_dyn_any(TypeCode type)
copy->  .create_basic_dyn_any( )
copy->  <DynAny var>=<ORB>.create_basic_dyn_any(<TypeCode type>);
See package comments regarding unimplemented features.
See Also:
CORBA package comments for unimplemented features
abstract  ContextList create_context_list()
copy->  .create_context_list()
copy->  <ContextList var>=<ORB>.create_context_list();
Creates an empty ContextList object.
Returns:
the newly-created ContextList object
See Also:
ContextList, Context
 DynAny create_dyn_any(Any value)
copy->  .create_dyn_any( )
copy->  <DynAny var>=<ORB>.create_dyn_any(<Any value>);
See package comments regarding unimplemented features.
See Also:
CORBA package comments for unimplemented features
 DynArray create_dyn_array(TypeCode type)
copy->  .create_dyn_array( )
copy->  <DynArray var>=<ORB>.create_dyn_array(<TypeCode type>);
See package comments regarding unimplemented features.
See Also:
CORBA package comments for unimplemented features
 DynEnum create_dyn_enum(TypeCode type)
copy->  .create_dyn_enum( )
copy->  <DynEnum var>=<ORB>.create_dyn_enum(<TypeCode type>);
See package comments regarding unimplemented features.
See Also:
CORBA package comments for unimplemented features
 DynSequence create_dyn_sequence(TypeCode type)
copy->  .create_dyn_sequence( )
copy->  <DynSequence var>=<ORB>.create_dyn_sequence(<TypeCode type>);
See package comments regarding unimplemented features.
See Also:
CORBA package comments for unimplemented features
 DynStruct create_dyn_struct(TypeCode type)
copy->  .create_dyn_struct( )
copy->  <DynStruct var>=<ORB>.create_dyn_struct(<TypeCode type>);
See package comments regarding unimplemented features.
See Also:
CORBA package comments for unimplemented features
 DynUnion create_dyn_union(TypeCode type)
copy->  .create_dyn_union( )
copy->  <DynUnion var>=<ORB>.create_dyn_union(<TypeCode type>);
See package comments regarding unimplemented features.
See Also:
CORBA package comments for unimplemented features
abstract  TypeCode create_enum_tc(String id, String name, String[] members)
copy->  .create_enum_tc(, , )
copy->  <TypeCode var>=<ORB>.create_enum_tc(<String id>, <String name>, <String[] members>);
Creates a TypeCode object representing an IDL enum. The TypeCode object is initialized with the given id, name, and members.
Parameters:
id - the repository id for the enum
name - the name for the enum
members - an array describing the members of the enum
Returns:
a newly-created TypeCode object describing an IDL enum
abstract  Environment create_environment()
copy->  .create_environment()
copy->  <Environment var>=<ORB>.create_environment();
Creates an Environment object.
Returns:
the newly-created Environment object
See Also:
Environment
abstract  ExceptionList create_exception_list()
copy->  .create_exception_list()
copy->  <ExceptionList var>=<ORB>.create_exception_list();
Creates an empty ExceptionList object.
Returns:
the newly-created ExceptionList object
abstract  TypeCode create_exception_tc(String id, String name, StructMember[] members)
copy->  .create_exception_tc(, , )
copy->  <TypeCode var>=<ORB>.create_exception_tc(<String id>, <String name>, <StructMember[] members>);
Creates a TypeCode object representing an IDL exception. The TypeCode object is initialized with the given id, name, and members.
Parameters:
id - the repository id for the exception
name - the name for the exception
members - an array describing the members of the exception
Returns:
a newly-created TypeCode object describing an IDL exception
 TypeCode create_fixed_tc(short digits, short scale)
copy->  .create_fixed_tc(, )
copy->  <TypeCode var>=<ORB>.create_fixed_tc(<short digits>, <short scale>);
Create a TypeCode object for an IDL fixed type.
Parameters:
digits - specifies the total number of decimal digits in the number and must be from 1 to 31 inclusive.
scale - specifies the position of the decimal point.
Returns:
the requested TypeCode.
See Also:
CORBA package comments for unimplemented features
abstract  TypeCode create_interface_tc(String id, String name)
copy->  .create_interface_tc(, )
copy->  <TypeCode var>=<ORB>.create_interface_tc(<String id>, <String name>);
Creates a TypeCode object representing an IDL interface. The TypeCode object is initialized with the given id and name.
Parameters:
id - the repository id for the interface
name - the name for the interface
Returns:
a newly-created TypeCode object describing an IDL interface
abstract  NVList create_list(int count)
copy->  .create_list( )
copy->  <NVList var>=<ORB>.create_list(<int count>);
Allocates an NVList with (probably) enough space for the specified number of NamedValue objects. Note that the specified size is only a hint to help with storage allocation and does not imply the maximum size of the list.
Parameters:
count - suggested number of NamedValue objects for which to allocate space
Returns:
the newly-created NVList
See Also:
NVList
abstract  NamedValue create_named_value(String s, Any any, int flags)
copy->  .create_named_value(, , )
copy->  <NamedValue var>=<ORB>.create_named_value(<String s>, <Any any>, <int flags>);
Creates a NamedValue object using the given name, value, and argument mode flags.

A NamedValue object serves as (1) a parameter or return value or (2) a context property. It may be used by itself or as an element in an NVList object.

Parameters:
s - the name of the NamedValue object
any - the Any value to be inserted into the NamedValue object
flags - the argument mode flags for the NamedValue: one of ARG_IN.value, ARG_OUT.value, or ARG_INOUT.value.
Returns:
the newly-created NamedValue object
See Also:
NamedValue
 TypeCode create_native_tc(String id, String name)
copy->  .create_native_tc(, )
copy->  <TypeCode var>=<ORB>.create_native_tc(<String id>, <String name>);
Create a TypeCode object for an IDL native type.
Parameters:
id - the logical id for the native type.
name - the name of the native type.
Returns:
the requested TypeCode.
See Also:
CORBA package comments for unimplemented features
 NVList create_operation_list(Object oper)
copy->  .create_operation_list( )
copy->  <NVList var>=<ORB>.create_operation_list(<Object oper>);
Creates an NVList initialized with argument descriptions for the operation described in the given OperationDef object. This OperationDef object is obtained from an Interface Repository. The arguments in the returned NVList object are in the same order as in the original IDL operation definition, which makes it possible for the list to be used in dynamic invocation requests.
Parameters:
oper - the OperationDef object to use to create the list
Returns:
a newly-created NVList object containing descriptions of the arguments to the method described in the given OperationDef object
See Also:
NVList
abstract  OutputStream create_output_stream()
copy->  .create_output_stream()
copy->  <OutputStream var>=<ORB>.create_output_stream();
Creates a new org.omg.CORBA.portable.OutputStream into which IDL method parameters can be marshalled during method invocation.
Returns:
the newly-created org.omg.CORBA.portable.OutputStream object
 Policy create_policy(int type, Any val)
copy->  .create_policy(, )
copy->  <Policy var>=<ORB>.create_policy(<int type>, <Any val>);
See package comments regarding unimplemented features.
See Also:
CORBA package comments for unimplemented features
abstract  TypeCode create_recursive_sequence_tc(int bound, int offset)
copy->  .create_recursive_sequence_tc(, )
copy->  <TypeCode var>=<ORB>.create_recursive_sequence_tc(<int bound>, <int offset>);
Deprecated.  

Creates a TypeCode object representing a a recursive IDL sequence.

For the IDL struct Foo in following code fragment, the offset parameter for creating its sequence would be 1:

    Struct Foo {
        long value;
        Sequence <Foo> Chain;
    };
 
Parameters:
bound - the bound for the sequence
offset - the index to the enclosing TypeCode object that describes the elements of this sequence
Returns:
a newly-created TypeCode object describing a recursive sequence
 TypeCode create_recursive_tc(String id)
copy->  .create_recursive_tc( )
copy->  <TypeCode var>=<ORB>.create_recursive_tc(<String id>);
Create a recursive TypeCode object which serves as a placeholder for a concrete TypeCode during the process of creating TypeCodes which contain recursion. The id parameter specifies the repository id of the type for which the recursive TypeCode is serving as a placeholder. Once the recursive TypeCode has been properly embedded in the enclosing TypeCode which corresponds to the specified repository id, it will function as a normal TypeCode. Invoking operations on the recursive TypeCode before it has been embedded in the enclosing TypeCode will result in undefined behavior.

For example, the following IDL type declarations contain recursion:

    Struct Foo {
        long value;
        Sequence <Foo> Chain;
    };
    Struct Bar {
        public Bar member;
    };
 

To create a TypeCode for struct Bar, you would invoke the TypeCode creation operations as shown below:

 String barID = "IDL:Bar:1.0";
 TypeCode recursiveTC = orb.create_recursive_tc(barID);
 StructMember[] members = { new StructMember("member", recursiveTC, null) };
 TypeCode structBarTC = orb.create_struct_tc(barID, "Bar", members);
 
Parameters:
id - the logical id of the referenced type
Returns:
the requested TypeCode
See Also:
CORBA package comments for unimplemented features
abstract  TypeCode create_sequence_tc(int bound, TypeCode element_type)
copy->  .create_sequence_tc(, )
copy->  <TypeCode var>=<ORB>.create_sequence_tc(<int bound>, <TypeCode element_type>);
Creates a TypeCode object representing an IDL sequence. The TypeCode object is initialized with the given bound and element type.
Parameters:
bound - the bound for the sequence
element_type - the TypeCode object describing the elements contained in the sequence
Returns:
a newly-created TypeCode object describing an IDL sequence
abstract  TypeCode create_string_tc(int bound)
copy->  .create_string_tc( )
copy->  <TypeCode var>=<ORB>.create_string_tc(<int bound>);
Creates a TypeCode object representing a bounded IDL string. The TypeCode object is initialized with the given bound, which represents the maximum length of the string. Zero indicates that the string described by this type code is unbounded.
Parameters:
bound - the bound for the string; cannot be negative
Returns:
a newly-created TypeCode object describing a bounded IDL string
Throws:
BAD_PARAM - if bound is a negative value
abstract  TypeCode create_struct_tc(String id, String name, StructMember[] members)
copy->  .create_struct_tc(, , )
copy->  <TypeCode var>=<ORB>.create_struct_tc(<String id>, <String name>, <StructMember[] members>);
Creates a TypeCode object representing an IDL struct. The TypeCode object is initialized with the given id, name, and members.
Parameters:
id - the repository id for the struct
name - the name of the struct
members - an array describing the members of the struct
Returns:
a newly-created TypeCode object describing an IDL struct
abstract  TypeCode create_union_tc(String id, String name, TypeCode discriminator_type, UnionMember[] members)
copy->  .create_union_tc(, , , )
copy->  <TypeCode var>=<ORB>.create_union_tc(<String id>, <String name>, <TypeCode discriminator_type>, <UnionMember[] members>);
Creates a TypeCode object representing an IDL union. The TypeCode object is initialized with the given id, name, discriminator type, and members.
Parameters:
id - the repository id of the union
name - the name of the union
discriminator_type - the type of the union discriminator
members - an array describing the members of the union
Returns:
a newly-created TypeCode object describing an IDL union
 TypeCode create_value_box_tc(String id, String name, TypeCode boxed_type)
copy->  .create_value_box_tc(, , )
copy->  <TypeCode var>=<ORB>.create_value_box_tc(<String id>, <String name>, <TypeCode boxed_type>);
Creates a TypeCode object for an IDL value box.
Parameters:
id - the logical id for the value type
name - the name of the value type
boxed_type - the TypeCode for the type
Returns:
the requested TypeCode
See Also:
CORBA package comments for unimplemented features
 TypeCode create_value_tc(String id, String name, short type_modifier, TypeCode concrete_base, ValueMember[] members)
copy->  .create_value_tc(, , , , )
copy->  <TypeCode var>=<ORB>.create_value_tc(<String id>, <String name>, <short type_modifier>, <TypeCode concrete_base>, <ValueMember[] members>);
Create a TypeCode object for an IDL value type. The concrete_base parameter is the TypeCode for the immediate concrete valuetype base of the valuetype for which the TypeCode is being created. It may be null if the valuetype does not have a concrete base.
Parameters:
id - the logical id for the value type.
name - the name of the value type.
type_modifier - one of the value type modifier constants: VM_NONE, VM_CUSTOM, VM_ABSTRACT or VM_TRUNCATABLE
concrete_base - a TypeCode object describing the concrete valuetype base
members - an array containing the members of the value type
Returns:
the requested TypeCode
See Also:
CORBA package comments for unimplemented features
abstract  TypeCode create_wstring_tc(int bound)
copy->  .create_wstring_tc( )
copy->  <TypeCode var>=<ORB>.create_wstring_tc(<int bound>);
Creates a TypeCode object representing a bounded IDL wstring (wide string). The TypeCode object is initialized with the given bound, which represents the maximum length of the wide string. Zero indicates that the string described by this type code is unbounded.
Parameters:
bound - the bound for the wstring; cannot be negative
Returns:
a newly-created TypeCode object describing a bounded IDL wstring
Throws:
BAD_PARAM - if bound is a negative value
 void destroy()
copy->  .destroy()
copy->  <ORB>.destroy();
Destroys the ORB instance and frees all the resources under an ORB instance. The method is not implemented, The API is provided to conform with the OMG spec.