This section describes the APIs that are available for Python language.
The exported Python interfaces are as follows:
RADInstance – RAD instance base class. All the generated interfaces inherit from the RADInstance class. Thus, the interfaces inherit a set of useful behaviours. All the inherited attributes are prepended with _rad to both prevent name collisions and clearly indicate that these attributes are protected.
RADContainer – Container base class. Represents a container into which the RAD instances are inserted.
RADException – RAD exception base class. Represents an exception, which will be propagated back to the client as a CE_OBJECT exception. If an invocation fails, the error is declared in the ADR. See Example 54, Using RADException.
The following functions must be provided by an implementation module:
rad_reg()
rad_init()
rad_fini()
The following tables provide information about the server module functions and attributes.
|
|
The following tables provide information about the methods and properties for the RAD instance base class, RADInstance.
|
|
The following table provides information about the methods for RADContainer.
|
This section provides an example that shows how to use RADException.
Example 54 Using RADExceptionThe ADR type definition is as follows:
<struct name="pair" stability="private"> <field name="first" type="integer"/> <field name="second" type="integer"/> </struct>
The ADR method definition is as follows:
<method name="raiseError" stability="private"> <doc> Raise an exception to test exception handling. </doc> <error typeref="pair"/> </method>
In the method definition, you are specifying that an exception must be raised when the initialization of the struct "pair" fails.
The implementation is as follows:
def raiseError(self): raise radser.RADException(snake_iface.pair(3, 6))
In this example, you are raising a RADException and providing a payload that matches the definition in the ADR document.
The exceptions that occur as a consequence of "other" errors such as divide by zero are propagated back to the client as a CE_SYSTEM error representing the general RAD failure code for systemic failure.