Previous Table of Contents Next


4.8.2 Creation of Policy Objects


   A generic ORB operation for creating new instances of Policy objects is provided as described in this section.

   module CORBA {

   typedef short PolicyErrorCode;const PolicyErrorCode BAD_POLICY = 0;const PolicyErrorCode UNSUPPORTED_POLICY = 1;const PolicyErrorCode BAD_POLICY_TYPE = 2;const PolicyErrorCode BAD_POLICY_VALUE = 3;const PolicyErrorCode UNSUPPORTED_POLICY_VALUE = 4;

   exception PolicyError {PolicyErrorCode reason;};

   interface ORB {

   .....

   Policy create_policy( in PolicyType type, in any val

   ) raises(PolicyError);

   };};

   4.8.2.1 PolicyErrorCode

   A request to create a Policy may be invalid for the following reasons:

   BAD_POLICY - the requested Policy is not understood by the ORB.

   UNSUPPORTED_POLICY - the requested Policy is understood to be valid by the ORB, but is not currently supported.

   BAD_POLICY_TYPE -The type of the value requested for the Policy is not valid for that PolicyType.

   BAD_POLICY_VALUE - The value requested for the Policy is of a valid type but is not within the valid range for that type.

   UNSUPPORTED_POLICY_VALUE - The value requested for the Policy is of a valid type and within the valid range for that type, but this valid value is not currently supported.

   4.8.2.2 PolicyError

   exception PolicyError {PolicyErrorCode reason;};

   PolicyError exception is raised to indicate problems with parameter values passed to the ORB::create_policy operation. Possible reasons are described above.

   4.8.2.3 Create_policy

   The ORB operation create_policy can be invoked to create new instances of policy objects of a specific type with specified initial state. If create_policy fails to instantiate a new Policy object due to its inability to interpret the requested type and content of the policy, it raises the PolicyError exception with the appropriate reason as described in Section 4.8.2.1, “PolicyErrorCode? on page 4-40.

   Policy create_policy(in PolicyType type, in any val

   ) raises(PolicyError);

   Parameter(s)

   type - the PolicyType of the policy object to be created.val - the value that will be used to set the initial state of the Policy object that is created.

   ReturnValue

   Reference to a newly created Policy object of type specified by the type parameter and initialized to a state specified by the val parameter.

   Exception(s)

   PolicyError -raised when the requested policy is not supported or a requested initial state for the policy is not supported.

   When new policy types are added to CORBA or CORBA Services specification, it is expected that the IDL type and the valid values that can be passed to create_policy also be specified.