is new.
java.lang.Objectorg.omg.CORBA.ORB
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.)
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 |
|---|---|
| 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:
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.
| Constructor Summary | |
|---|---|
|
ORB
() |
|
| Method Summary | |
|---|---|
| void |
connect
(
Object
obj) Connects the given servant object (a Java object that is an instance of the server implementation class) to the ORB. |
| TypeCode |
create_abstract_interface_tc
(
String
id,
String
name) Create a TypeCode object for an IDL abstract interface. |
| abstract TypeCode |
create_alias_tc
(
String
id,
String
name,
TypeCode
original_type) Creates a TypeCode object representing an IDL alias (typedef). |
| abstract Any |
create_any
() Creates an IDL Any object initialized to contain a Typecode object whose kind field is set to TCKind.tc_null. |
| abstract TypeCode |
create_array_tc
(int length,
TypeCode
element_type) Creates a TypeCode object representing an IDL array. |
| DynAny |
create_basic_dyn_any
(
TypeCode
Deprecated.
Use
new
DynAnyFactory
|
| abstract ContextList |
create_context_list
() Creates an empty ContextList object. |
| DynAny |
create_dyn_any
(
Any
Deprecated.
Use
new
DynAnyFactory
|
| DynArray |
create_dyn_array
(
TypeCode
Deprecated.
Use
new
DynAnyFactory
|
| DynEnum |
create_dyn_enum
(
TypeCode
Deprecated.
Use
new
DynAnyFactory
|
| DynSequence |
create_dyn_sequence
(
TypeCode
Deprecated.
Use
new
DynAnyFactory
|
| DynStruct |
create_dyn_struct
(
TypeCode
Deprecated.
Use
new
DynAnyFactory
|
| DynUnion |
create_dyn_union
(
TypeCode
Deprecated.
Use
new
DynAnyFactory
|
| abstract TypeCode |
create_enum_tc
(
String
id,
String
name,
String
[] members) Creates a TypeCode object representing an IDL enum. |
| abstract Environment |
create_environment
() Creates an Environment object. |
| abstract ExceptionList |
create_exception_list
() Creates an empty ExceptionList object. |
| abstract TypeCode |
create_exception_tc
(
String
id,
String
name,
StructMember
[] members) Creates a TypeCode object representing an IDL exception. |
| TypeCode |
create_fixed_tc
(short digits, short scale) Create a TypeCode object for an IDL fixed type. |
| abstract TypeCode |
create_interface_tc
(
String
id,
String
name) Creates a TypeCode object representing an IDL interface. |
| abstract NVList |
create_list
(int count) Allocates an NVList with (probably) enough space for the specified number of NamedValue objects. |
| abstract NamedValue |
create_named_value
(
String
s,
Any
any, int flags) Creates a NamedValue object using the given name, value, and argument mode flags. |
| TypeCode |
create_native_tc
(
String
id,
String
name) Create a TypeCode object for an IDL native type. |
| NVList |
create_operation_list
(
Object
oper) Creates an NVList initialized with argument descriptions for the operation described in the given OperationDef object. |
| abstract OutputStream |
create_output_stream
() Creates a new org.omg.CORBA.portable.OutputStream into which IDL method parameters can be marshalled during method invocation. |
| Policy |
create_policy
(int type,
Any
val) Can be invoked to create new instances of policy objects of a specific type with specified initial state. |
| abstract TypeCode |
create_recursive_sequence_tc
(int bound, int offset) Deprecated. Use a combination of create_recursive_tc and create_sequence_tc instead |
| TypeCode |
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. |
| abstract TypeCode |
create_sequence_tc
(int bound,
TypeCode
element_type) Creates a TypeCode object representing an IDL sequence. |
| abstract TypeCode |
create_string_tc
(int bound) Creates a TypeCode object representing a bounded IDL string. |
| abstract TypeCode |
create_struct_tc
(
String
id,
String
name,
StructMember
[] members) Creates a TypeCode object representing an IDL struct. |
| abstract TypeCode |
create_union_tc
(
String
id,
String
name,
TypeCode
discriminator_type,
UnionMember
[] members) Creates a TypeCode object representing an IDL union. |
| TypeCode |
create_value_box_tc
(
String
id,
String
name,
TypeCode
boxed_type) Creates a TypeCode object for an IDL value box. |
| TypeCode |
create_value_tc
(
String
id,
String
name, short type_modifier,
TypeCode
concrete_base,
ValueMember
[] members) Create a TypeCode object for an IDL value type. |
| abstract TypeCode |
create_wstring_tc
(int bound) Creates a TypeCode object representing a bounded IDL wstring (wide string). |
| void |
destroy
() Destroys the ORB so that its resources can be reclaimed. |
| void |
disconnect
(
Object
obj) Disconnects the given servant object from the ORB. |
| Current |
get_current
() Deprecated. use resolve_initial_references. |
| abstract Context |
get_default_context
() Gets the default Context object. |
| abstract Request |
get_next_response
() Gets the next Request instance for which a response has been received. |
| abstract TypeCode |
get_primitive_tc
(
TCKind
tcKind) Retrieves the TypeCode object that represents the given primitive IDL type. |
| boolean |
get_service_information
(short service_type,
ServiceInformationHolder
service_info) Used to obtain information about CORBA facilities and services that are supported by this ORB. |
| static ORB |
init
() Returns the ORB singleton object. |
| static ORB |
init
(
Applet
app,
Properties
props) Creates a new ORB instance for an applet. |
| static ORB |
init
(
String
[] args,
Properties
props) Creates a new ORB instance for a standalone application. |
| abstract String [] |
list_initial_services
() Returns a list of the initially available CORBA object references, such as "NameService" and "InterfaceRepository". |
| abstract String |
object_to_string
(
Object
obj) Converts the given CORBA object reference to a string. |
| void |
perform_work
() Performs an implementation-dependent unit of work if called by the main thread. |
| abstract boolean |
poll_next_response
() Finds out if any of the deferred (asynchronous) invocations have a response yet. |
| abstract Object |
resolve_initial_references
(
String
object_name) Resolves a specific object reference from the set of available initial service names. |
| void |
run
() This operation blocks the current thread until the ORB has completed the shutdown process, initiated when some thread calls shutdown. |
| abstract void |
send_multiple_requests_deferred
(
Request
[] req) Sends multiple dynamic (DII) requests asynchronously. |
| abstract void |
send_multiple_requests_oneway
(
Request
[] req) Sends multiple dynamic (DII) requests asynchronously without expecting any responses. |
| protected abstract void |
set_parameters
(
Applet
app,
Properties
props) Allows the ORB implementation to be initialized with the given applet and parameters. |
| protected abstract void |
set_parameters
(
String
[] args,
Properties
props) Allows the ORB implementation to be initialized with the given parameters and properties. |
| void |
shutdown
(boolean wait_for_completion) Instructs the ORB to shut down, which causes all object adapters to shut down, in preparation for destruction. If the wait_for_completion parameter is true, this operation blocks until all ORB processing (including processing of currently executing requests, object deactivation, and other object adapter operations) has completed. |
| abstract Object |
string_to_object
(
String
str) Converts a string produced by the method object_to_string back to a CORBA object reference. |
| boolean |
work_pending
() Returns true if the ORB needs the main thread to perform some work, and false if the ORB does not need the main thread. |
| Methods inherited from class java.lang. Object |
|---|
| clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
| Constructor Detail |
|---|
public ORB()
| Method Detail |
|---|
public static ORB init()
This no-argument version of the method init is used primarily as a factory for TypeCode objects, which are used by Helper classes to implement the method type. It is also used to create Any objects that are used to describe union labels (as part of creating a TypeCode object for a union).
This method is not intended to be used by applets, and in the event that it is called in an applet environment, the ORB it returns is restricted so that it can be used only as a factory for TypeCode objects. Any TypeCode objects it produces can be safely shared among untrusted applets.
If an ORB is created using this method from an applet, a system exception will be thrown if methods other than those for creating TypeCode objects are invoked.
public static ORB init(String[] args,
Properties props)
public static ORB init(Applet app,
Properties props)
protected abstract void set_parameters(String[] args,
Properties props)
protected abstract void set_parameters(Applet app,
Properties props)
public void connect(Object obj)
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.
public void destroy()
If destroy is called on an ORB that has not been shut down, it will start the shut down process and block until the ORB has shut down before it destroys the ORB.
If an application calls destroy in a thread that is currently servicing an invocation, the BAD_INV_ORDER system exception will be thrown with the OMG minor code 3, since blocking would result in a deadlock.
For maximum portability and to avoid resource leaks, an application should always call shutdown and destroy on all ORB instances before exiting.
public void disconnect(Object obj)
Calling the method disconnect has no effect if the servant is not connected to the ORB.
Deprecated by the OMG in favor of the Portable Object Adapter APIs.
public abstract String[] list_initial_services()
public abstract Object resolve_initial_references(String object_name)
throws InvalidName
public abstract String object_to_string(Object obj)
The resulting String object may be stored or communicated in any way that a String object can be manipulated.
public abstract Object string_to_object(String str)
public abstract NVList create_list(int count)
public NVList create_operation_list(Object oper)
public abstract NamedValue create_named_value(String s,
Any any,
int 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.
public abstract ExceptionList create_exception_list()
public abstract ContextList create_context_list()
public abstract Context get_default_context()
public abstract Environment create_environment()
public abstract OutputStream create_output_stream()
public abstract void send_multiple_requests_oneway(Request[] req)
public abstract void send_multiple_requests_deferred(Request[] req)
public abstract boolean poll_next_response()
public abstract Request get_next_response()
throws WrongTransaction
public abstract TypeCode get_primitive_tc(TCKind tcKind)
public abstract TypeCode create_struct_tc(String id,
String name,
StructMember[] members)
public abstract TypeCode create_union_tc(String id,
String name,
TypeCode discriminator_type,
UnionMember[] members)
public abstract TypeCode create_enum_tc(String id,
String name,
String[] members)
public abstract TypeCode create_alias_tc(String id,
String name,
TypeCode original_type)
public abstract TypeCode create_exception_tc(String id,
String name,
StructMember[] members)
public abstract TypeCode create_interface_tc(String id,
String name)
public abstract TypeCode create_string_tc(int bound)
public abstract TypeCode create_wstring_tc(int bound)
public abstract TypeCode create_sequence_tc(int bound,
TypeCode element_type)
public abstract TypeCode create_recursive_sequence_tc(int bound,
int offset)
For the IDL struct Node in following code fragment, the offset parameter for creating its sequence would be 1:
Struct Node {
long value;
Sequence <Node> subnodes;
};
public abstract TypeCode create_array_tc(int length,
TypeCode element_type)
public TypeCode create_native_tc(String id,
String name)
public TypeCode create_abstract_interface_tc(String id,
String name)
public TypeCode create_fixed_tc(short digits,
short scale)
public TypeCode create_value_tc(String id,
String name,
short type_modifier,
TypeCode concrete_base,
ValueMember[] members)
public TypeCode create_recursive_tc(String id)
For example, the following IDL type declaration contains recursion:
Struct Node {
Sequence<Node> subnodes;
};
To create a TypeCode for struct Node, you would invoke the TypeCode creation operations as shown below:
String nodeID = "IDL:Node:1.0";
TypeCode recursiveSeqTC = orb.create_sequence_tc(0, orb.create_recursive_tc(nodeID));
StructMember[] members = { new StructMember("subnodes", recursiveSeqTC, null) };
TypeCode structNodeTC = orb.create_struct_tc(nodeID, "Node", members);
Also note that the following is an illegal IDL type declaration:
Struct Node {
Node next;
};
Recursive types can only appear within sequences which can be empty. That way marshaling problems, when transmitting the struct in an Any, are avoided.
public TypeCode create_value_box_tc(String id,
String name,
TypeCode boxed_type)
public abstract Any create_any()
public Current get_current()
public void run()
public void shutdown(boolean wait_for_completion)
While the ORB is in the process of shutting down, the ORB operates as normal, servicing incoming and outgoing requests until all requests have been completed. Once an ORB has shutdown, only object reference management operations may be invoked on the ORB or any object reference obtained from it. An application may also invoke the destroy operation on the ORB itself. Invoking any other operation will throw the BAD_INV_ORDER system exception with the OMG minor code 4.
The ORB.run method will return after shutdown has been called.
public boolean work_pending()
public void perform_work()
public boolean get_service_information(short service_type,
ServiceInformationHolder service_info)
public DynAny create_dyn_any(Any value)
Deprecated.
Use the new
DynAnyFactory
API instead
public DynAny create_basic_dyn_any(TypeCode type)
throws InconsistentTypeCode
Deprecated.
Use the new
DynAnyFactory
API instead
public DynStruct create_dyn_struct(TypeCode type)
throws InconsistentTypeCode
Deprecated.
Use the new
DynAnyFactory
API instead
public DynSequence create_dyn_sequence(TypeCode type)
throws InconsistentTypeCode
Deprecated.
Use the new
DynAnyFactory
API instead
public DynArray create_dyn_array(TypeCode type)
throws InconsistentTypeCode
Deprecated.
Use the new
DynAnyFactory
API instead
public DynUnion create_dyn_union(TypeCode type)
throws InconsistentTypeCode
Deprecated.
Use the new
DynAnyFactory
API instead
public DynEnum create_dyn_enum(TypeCode type)
throws InconsistentTypeCode
Deprecated.
Use the new
DynAnyFactory
API instead
public Policy create_policy(int type,
Any val)
throws PolicyError