Management of UDDI node policies
We can use the UDDI registry administrative interface to manage policies that affect the UDDI API.
The UddiNode MBean provides the following operations to manage the policies that affect the behavior of the UDDI API:
- getPolicyGroups
- getPolicyGroup
- getPolicy
- updatePolicy
- updatePolicies
In the samples for WebSphere Application Server, the ManagePoliciesSample class in the UDDI registry samples demonstrates these operations.
- getPolicyGroups
- Returns a collection of all the policy groups as PolicyGroup objects.
- Invoke the getPolicyGroups operation:
List policyGroups = uddiNode.getPolicyGroups();
- Cast each collection member to PolicyGroup:
if (policyGroups != null) { for (Iterator iter = policyGroups.iterator(); iter.hasNext();) { PolicyGroup policyGroup = (PolicyGroup) iter.next(); System.out.println(policyGroup); } }Each policy group has an ID, name, and description key, which we can look up in the messages.properties resource in the sample package. Although the PolicyGroup class does have a getPolicies method, PolicyGroup objects that are returned by the getPolicyGroups operation do not contain any Policy objects. Because of this behavior, clients can determine the known policy groups, and their IDs, without retrieving the entire set of policies in one request. To retrieve the policies in a policy group, use the getPolicyGroup operation.
- getPolicyGroup
- Returns the PolicyGroup object with the supplied ID.
- Convert the policy group ID to a string:
String groupId = Integer.toString(PolicyConstants.REG_APIS_GROUP);
- Invoke the getPolicyGroup operation:
PolicyGroup policyGroup = uddiNode.getPolicyGroup(groupId);
- getPolicy
- Returns the Policy object for the specified ID. As with a configuration property, a Policy object has an ID, name and description keys, type, value, and indicators that specify whether the policy is read-only or required for node initialization.
- Convert the policy ID to a string:
String policyId = Integer.toString( PolicyConstants.REG_AUTHORIZATION_FOR_INQUIRY_API);
- Invoke the getPolicy operation:
Policy policy = uddiNode.getPolicy(policyId);
- updatePolicy
- Updates the value of the Policy object with the specified ID. Available policy IDs are specified in PolicyConstants with descriptions of the purpose of the corresponding policies. Although we can invoke the setter methods in a Policy object, the only value that is updated in the UDDI node is the value. To update a policy, typically, use the following steps:
- Create a Policy object and set its ID:
Policy updatedPolicy = new Policy(); String policyId = Integer.toString(PolicyConstants.REG_SUPPORTS_UUID_KEYS); updatedPolicy.setId(policyId);
- Set the value:
updatedPolicy.setBooleanValue(true);
- Invoke the updatePolicy operation:
uddiNode.updatePolicy(updatedPolicy);
- updatePolicies
- Updates several Policy objects in a single request. Set up the Policy objects in the same way as for the updatePolicy operation.
- Add updated policies to a list:
List updatedPolicies = new ArrayList(); updatedPolicies.add(updatedPolicy1); updatedPolicies.add(updatedPolicy2);
- Invoke the updatePolicies operation:
uddiNode.updatePolicies(updatedPolicies);
Related tasks
Manage the UDDI registry Use the UDDI registry Use administrative programs (JMX)
Management of UDDI node states and attributes Management of UDDI node configuration properties Management of UDDI node tiers Management of UDDI publishers Management of UDDI node value sets
Related information:
Samples for WebSphere Application Server