CORBAObject objects implement communication between CORBA clients and servers. A CORBAObject instance can be created as a local object or as a remote object reference. When a CORBAObject receives a message it forwards it to a CORBA server in the case it is the remote object reference, or to its associated implementation object if it is a local object.
CORBAObject class creates a unique instance of a remote object reference per local object, i.e. if a method call returns a CORBAObject and an instance of CORBAObject corresponding to the same local object already exists then the existing instance will be returned. On the server side, if a local CORBAObject is vended to a client and then the client passes the corresponding remote object reference back to the server then the existing local object will be received in the server as the argument of the method call.
A remote object reference can be created using an IOR string or can be received from a method call to a CORBA server, for example, to a CORBA Naming Service.
NSString* iorString; // Assuming it is initialized CORBAObject* object; CORBAObject* otherObject; CORBAObject* namingService; ... object = [[CORBAObject objectWithIOR:iorString]retain]; ... namingService = [ORB resoveInitialReferences:@"NameService"]; ... otherObject = [[namingService resolve:nameArray]retain];
A local object is created by specifying its IDL interface. To be accessible it should register its implementation in ORB. A local CORBAObject is created also implicitly when a portable object is activated.
NSString* namePath; //Assume this exists NSString* key; //Assume this exists id implementation; // Assume this exists ... // Locate the interface object id interface = [[ORB defaultORB]interfaceNamed:namePath]; // Create the local CORBAObject CORBAObject* object = [[CORBAObject alloc]initWithInterface:interface]; ... // Register implementation in ORB [object registerImplementation:implementation withKey:key]; ... // Bind the 'object' in Naming Service or save the object's IOR in a file ...
Creates and returns remote object reference for the given iorString. There is unique CORBAObject per remote object. If the object reference for the remote object encoded in iorString already exists, the existing object is returned, otherwise new CORBAObject is created.
You don't need to narrow the returned object to an interface - the object is fully initialized, if the corresponding IDL interface object exists. If the required IDL interface cannot be found then the object's interface is set to nil.
See also: objectWithIOR: (ORB).
Creates and returns remote object reference for the given corbaurl.
The corbaurl may be one of:
See also: objectWithURL: (ORB).
Return the default reply timeout.
Sets the default reply timeout.
Return the default connect timeout.
Sets the default connect timeout.
Initializes the newly allocated CORBAObject as a local object that implements the operations defined in the IDL interface interface.
The method -registerImplementation:withKey: should be called to associate the implementation object with the receiver and to register it in ORB.
Return the receiver's interface.
Sets the receiver's interface to interface and sets the receiver's typeID to the interface's typeID. This method can be used after +objectWithURL: when url is 'corbaloc:' since the 'corbaloc:' url does not give any information about object's interface or typeID.
Normally, you don't need to call this method.
This method locates an IDL interface using the receiver's typeId and sets the receiver's interface to that IDL interface, if found.
If the interface's version does not match the version in the receiver's typeId this method raises the IDLDefinitionException. This can happen if the server and the client use different versions of the IDL files.
Returns whether the receiver's IDL interface has name equal to name or is inherited from an IDL interface with the name equal to name.
Invokes the operation operationName if the receiver is a remote object reference. The arguments dictionary should contain entries argumentName = argumentValue for all in and inout arguments. The returned dictionary contains entries for all the arguments and the return value. The key for the return value is
@"$return". The operationName and the argumentName strings should be specified as they are defined in the IDL definition. The values should be of the proper class to be marshaled.
You rarely need to call this method - CORBAObject dynamically creates invocations for Objective C method calls. See Objective C mappings.
Returns the remote object's attribute value for the attribute name if the receiver is a remote object reference and receiver's interface has an attribute named name. Otherwise raises an exception.
Sets the value of the remote object's attribute with name name to value if the receiver's interface has an attribute named name and that attribute is not a read only attribute. Otherwise raises an exception.
Returns YES if the selector selector is mapped by the receiver's IDL interface, if the receiver is a remote object reference. For the local objects the method returns YES if the receiver's associated implementation object responds to selector.
See Objective C mappings for how the IDL operations are mapped to Objective C selectors.
Returns the receiver's objectID.
Returns the receiver's profiles. The only profile with ProfileId
TAG_INTERNET_IOP is supported.
Returns the profile with tag. The only tag = 0 (
TAG_INTERNET_IOP) is supported.
Return the object's GIOP version, which is an instance of IDLGIOPVersion class.
Returns stringified receiver, i.e. its IOR.
Returns whether the receiver is local. The CORBAObject is local if its implementation is not nil.
Returns receiver's implementation if it is local, or nil for a remote object reference.
Register the receiver's implementation impl in ORB with the key. The string key is converted to NSData. The terminating '0' is not included.
Register the receiver's implementation impl in ORB with the objectID.
Returns YES if connection to the remote ORB is established.
If not connected, CORBAObject establishes connection implicitly when a remote operation is called. If it fails to connect the CORBATimeoutException exception is raised.
For local CORBAObject this method always returns NO.
Returns receiver's connection creating it if necessary.
Returns nil if the connection cannot be established. The method lastError can be used to get the error.
The exception CORBACommunicationException will be raised if the method connectInBackgroundAndNotify: was called before which did not finish yet by posting notification CORBAObjectDidConnect or CORBAObjectDidNotConnect.
If this method is called implicitly as a part of a remote method call and the connection cannot be established the exception CORBATimeoutException will be raised.
Connects to the remote object in background and posts notification CORBAObjectDidConnect if connected
or CORBAObjectDidNotConnect otherwise.
Returns YES if the connect has started, otherwise the method returns NO and the error by-reference in error.
Looks for IDL exception definition with the name name in the receiver's IDL interface, its parent modules and parent interfaces, if any. If the IDL definition is found then this method creates an instance of the CORBAException class with the name "CORBAUserException" and the reason set to the IDL exception's typeID. If the IDL definition for the exception contains any entries the value for those entries can be set using the method -setValue:forKey:.
The name can specify a single name or a name path (separated by '/').
Returns the value of the enumeration item named key in the IDL enumeration name. The name should specify the full path so the IDL definition for the enumeration can be found.
Since ADORB parses IDL definitions at the run-time this method will return correct value after the IDL enumeration is modified without recompiling the program.
Returns the reply timeout value.
Sets the reply timeout value. The default value is 300 seconds. If set to 0 or to a negative value the call will not get timed out. If a method call is timed out then the exception
CORBATimeoutException is raised.
Returns the connect timeout value.
Sets the connect timeout value. The default value is 75 seconds.
Returns the error that invalidated the receiver.
Returns the receiver's hostname, i.e. remote host name for a reference object, local host name for a local object.
Returns the receiver's delegate object.
Sets the receiver's delegate to aDelegate.
Returns the receiver's tagged components.
Returns the receiver's tagged component with tag, if any, or nil otherwise.
If there are several tagged components with this tag the first one is returned.
Adds the tagged component component to the receiver's tagged components.
On the client, any method that is defined in the receiver's associated interface is forwarded to the corresponding CORBA server. The returned values, i.e. return value, out and inout arguments, if they are objects, are autoreleased. The memory for the returned out and inout values which are not objects, is allocated in an internal object that is autoreleased too, so these values must be copied before the autorelease pool is released.
On the server, when the remote method call is passed to the object's implementation all the arguments that are objects, are autoreleased too. The method implementation should autorelease the returned values, if they are not persistent.
An exception will be raised when calling a remote method if the object is not connected and connection fails. The userInfo contains NSError object for key @"error".
This method is called when the object's connection is invalidated, if implemented by the delegate.
This method is called when the server returns
The newObject is a new CORBAObject the message will be forwarded to.
The newObject is autoreleased.
The delegate can cancel forwarding invocation by returning NO.
In this case the method that caused the exception will return nil (if it is not void). Other arguments are unchanged.
The delegate can change the return value (if of type id) by sending
-setObjectReturnValue: to invocation.
If this method returns YES or the delegate does not implement this method or there is no delegate
the invocation is forwarded to newObject. The newObject and its connection will be released.
This notification is posted when the CORBAObject's connection is invalidated. The notification's object is the object which connection is invalidated. Usually, it means that a corresponding remote object is inaccessible, and the owner of the invalidated object should release this object. The userInfo dictionary contains an NSError object for key @"error".
If a message is sent to an invalidated object that requires forwarding to the server the CORBAObject will raise an exception.
This notification is posted after a CORBAObject is connected in background. The notification's object is the connected CORBAObject.
This notification is posted when a CORBAObject is failed to connect in background. The notification's object is the CORBAObject. The userInfo contains NSError object for key @"error".
IDLUnionDescriptorKey- is equal to
IDLUnionDataKey- is equal to