ORB

Inherits From:
NSObject

Declared In:
ADORB/ORB.h

Class Description

Purpose

Instances of the ORB class provide access to the loaded CORBA IDL definitions.
The class itself keeps the list of available services (currently, only NamingService) and also registers local CORBAObjects with their associated implementations.

Principal attributes

The ORB class also has its own rootScope, which keeps the standard IDL definition that are parsed when the ORB class is initialized. If a name cannot be resolved in the instance's root scope then ORB tries to resolve it in the class root scope.

Usually there is only one instance of ORB in a program, which is returned by + defaultORB method. It is also possible to have multiple instances of ORB to avoid name conflicts, for example, to load two different versions of the same IDL definitions.

Class Methods

+ (ORB*) defaultORB

Returns the default ORB object.
When created, the default ORB instance parses the IDL files specified with the run-time parameter -ORBidl.

+ (void) ORBInit

This method does nothing. It can be used to force initialization of ORB.

+ resolveInitialReferences:(NSString*)service

Returns an object reference for the given service. The only service value "NameService" is supported.

+ (NSZone*) zone

Returns the zone ORB uses to allocate objects.

+ (void) run

Runs NSRunLoop. This method never returns.

+ (void) unregisterObject:(CORBAObject*)object

Unregister the object. The object is released. Any call to the unregistered object from a remote client will raise the exception "INV_OBJREF".
See also - registerImplementation:withKey: (CORBAObject).

+ (void) setHandlesRequestsOnMainThread:(BOOL)flag

By default the incoming requests are handled in the separated threads. This method tells ORB whether to serve the incoming requests on the main thread.

+ (BOOL) handlesRequestsOnMainThread

Returns YES if ORB handles incoming requests in the main thread, NO otherwise. By default the incoming requests are handled in the separated threads.

+ (void) postNotification:(NSNotification*)note

Posts notification note to the ORB thread.

+ (ORBNotificationCenter*) notificationCenter

Returns default ORB notification center.

+ (void) setAllowsIndirection:(BOOL)flag

Sets whether to use indirection when marshaling complex TypeCodes. By default ADORB uses indirection when marshaling recursive and repeated TypeCodes. Using indirection allows to avoid encoding the same object twice, a reference to the object's first occurrence is encoded instead.

+ (BOOL) allowsIndirection

Returns whether ORB uses indirection when marshaling recursive and repeated TypeCodes.

+ (BOOL) allowsUndefinedKeys

Returns YES if NSUndefinedKeyException will be ignored during marshaling and un-marshaling of requests/responses. The default is NO. This exception is raised when IDL struct or valuetype defines a member with name for which a corresponding class is not KVC compliant. ORB logs error with IDL typeID, class name and member name. If this method returns NO the exception is raised. This may happen, for example, when a new member is added to IDL struct or valuetype but the client or server code is not changed yet. Setting this value to YES may provide a workaround.
Another way to handle undefined keys is to provide methods valueForUndefinedKey: and setValue:forUndefinedKeys: in your class.

+ (BOOL) setAllowsUndefinedKeys:(BOOL)flag

Sets whether NSUndefinedKeyException will be ignored during marshaling and un-marshaling of requests/responses. The default is NO. This can also be set by setting YES for key ORBAllowsUndefinedKeys in the NSUserDefaults.

Instance Methods

- initWithIDLFiles:(NSArray*)idlFiles searchPaths:(NSArray*)searchPaths

Initializes new ORB. You need to call this method only if you use multiple ORBs. The ORB created with this method parses the idlFiles using search paths searchPaths. The idlFiles and searchPaths both may be nil.

- initWithIDLFiles:(NSArray*)idlFiles

Initializes new ORB. The ORB created with this method parses the idlFiles. This method calls -initWithIDLFiles:searchPaths: with the searchPath nil.

- init

Initializes new ORB. This method calls -initWithIDLFiles:searchPaths: with both idlFiles and searchPath nil.

- (IDLInterface*) interfaceNamed:(NSString*)name

Returns the interface definition for the given name path name. The full path separated by "/" should be passed in name. For example, "CosNaming/NamingContext".

- (IDLDefinition*)definitionWithTypeID:(NSString*)typeID

Returns IDL definition for the given typeId or nil if no one exists.

- (IDLDefinition*)definitionNamed:(NSString*)name

Returns the IDL definition for the given name path name. The full path separated by "/" should be passed in name. For example, "CosNaming/NameComponent".
This method can be used to create values of type any.

- (void) loadFiles:(NSArray*)idlFiles

Parses the idlFiles and loads the IDL definitions from those files. For the defaultORB the IDL files can be specified as a run-time parameter.
See Runtime parameters.

- (void) set

Sets the receiver as the current ORB in the current thread. If an operation returns an object reference then the current ORB is used to locate that object's IDL interface.

- (CORBAObject*) createObjectWithInterface:(IDLInterface*)interface

Creates the local CORBAObject. This method simply sets the receiver as the current ORB, allocates CORBAObject and calls -initWithInterface: method (CORBAObject).
This method should be used only in the case of multiple ORB instances.

- (CORBAObject*) objectWithIOR:(NSString*)iorString

Creates the object reference for given iorString. This method simply sets the receiver as the current ORB and sends +objectWithIOR: to CORBAObject class. The returned object is autoreleased.
This method should be used only in the case of multiple ORB instances.

- (CORBAObject*) objectWithURL:(NSString*)corbaurl

Returns object reference for given corbaurl by setting receiver as the current ORB and sending +objectWithURL: to the CORBAObject class. The returned object is autoreleased.
See CORBAObject class description for details.
This method should be used only in the case of multiple ORB instances.