Management of UDDI node tiers
We can use the UDDI registry administrative interface to set publish tier limits, which control the number of each type of UDDI entity that a publisher can save in the UDDI registry.
A tier has an ID, an administrator-defined name and description, and a set of limits, one for each type of entity. The UddiNode MBean provides the following operations to manage tiers:
- createTier
- getTierDetail
- getTierInfos
- getLimitInfos
- setDefaultTier
- updateTier
- deleteTier
- getUserCount
In the samples for WebSphere Application Server, the ManageTiersSample class in the UDDI registry samples demonstrates these operations.
- createTier
- Creates a new tier, with specified publish limits for each UDDI entity.
- Set the tier name and description in a TierInfo object.
String tierName = "Tier 100"; String tierDescription = "A tier with all limits set to 100."; TierInfo tierInfo = new TierInfo(null, tierName, tierDescription);
- Define Limit objects for each UDDI entity:
List limits = new ArrayList(); Limit businessLimit = new Limit(); businessLimit.setIntegerValue(100); businessLimit.setId(LimitConstants.BUSINESS_LIMIT); Limit serviceLimit = new Limit(); serviceLimit.setIntegerValue(100); serviceLimit.setId(LimitConstants.SERVICE_LIMIT); Limit bindingLimit = new Limit(); bindingLimit.setIntegerValue(100); bindingLimit.setId(LimitConstants.BINDING_LIMIT); Limit tModelLimit = new Limit(); tModelLimit.setIntegerValue(100); tModelLimit.setId(LimitConstants.TMODEL_LIMIT); Limit assertionLimit = new Limit(); assertionLimit.setIntegerValue(100); assertionLimit.setId(LimitConstants.ASSERTION_LIMIT); limits.add(businessLimit); limits.add(serviceLimit); limits.add(bindingLimit); limits.add(tModelLimit); limits.add(assertionLimit);
- Create the Tier object:
- Invoke the createTier operation and retrieve the created tier:
Tier createdTier = uddiNode.createTier(tier);
- Inspect the generated tier ID of the created tier:
tierId = createdTier.getId(); System.out.println("created tier has ID: " + tierId);
- getTierDetail
- Returns the Tier object for the given tier ID. The Tier class has getter methods for the tier ID, tier name and description, as set by the administrator, and the collection of Limit objects, which specify how many of each UDDI entity type UDDI publishers that are allocated to the tier can publish. The isDefault method indicates whether the tier is the default tier, that is, the tier that is allocated to UDDI publishers when auto registration is enabled.
- Invoke the getTierDetail operation:
Tier tier = uddiNode.getTierDetail("2");
- updateTier
- Updates the tier contents with the supplied Tier object.
- Update an existing Tier object, which might be newly instantiated, or returned by the getTierDetail or createTier operations. The following example retains the tier name, description, and all the limit values except the limit that is updated:
modifiedTier.setName(tier.getName()); modifiedTier.setDescription(tier.getDescription()); Limit tModelLimit = new Limit(); tModelLimit.setId(LimitConstants.TMODEL_LIMIT); tModelLimit.setIntegerValue(50); List updatedLimits = new ArrayList(); updatedLimits.add(tModelLimit); modifiedTier.setLimits(updatedLimits);
- Invoke the updateTier operation:
uddiNode.updateTier(modifiedTier);
- getTierInfos
- Returns a collection of lightweight tier descriptor objects (TierInfo) containing the tier ID, tier name, tier description, and whether the tier is the default tier.
- Invoke the getTierInfos operation:
List tierInfos = uddiNode.getTierInfos();
- Output the content of each TierInfo object:
if (tierInfos != null) { for (Iterator iter = tierInfos.iterator(); iter.hasNext();) { TierInfo tierInfo = (TierInfo) iter.next(); System.out.println(tierInfo); } }
- setDefaultTier
- The tier with the given tier ID is the default tier. The default tier is the tier that is allocated to UDDI publishers when auto registration is enabled. Typically, you set this to a tier with low publish limits to stop casual users from publishing too many entities.
- Invoke the setDefaultTier operation:
uddiNode.setDefaultTier("4");
- deleteTier
- Removes the tier with the given tier ID. Tiers can be removed only if they have no UDDI publishers assigned to them, and the tier is not the default tier.
- Invoke the deleteTier operation:
uddiNode.deleteTier("4");
- getUserCount
- Returns the number of UDDI publishers assigned to the tier specified by the tier ID.
- Invoke the getUserCount operation:
Integer userCount = uddiNode.getUserCount("4"); System.out.println("users in tier 4: " + userCount.intValue());
- getLimitInfos
- Returns a collection of Limit objects that represent the limit values for each type of UDDI entity. Limits are used in Tier objects.
getLimitInfos:
Returns collection of Limit objects representing the limit values for each type of UDDI entity. Limits are used in Tier objects.
- Invoke the getLimitInfos operation:
List limits = uddiNode.getLimitInfos();
- Output the ID and limit value for each Limit object:
for (Iterator iter = limits.iterator(); iter.hasNext();) { Limit limit = (Limit) iter.next(); System.out.println("limit ID: " + limit.getId() + ", limit value: " + limit.getIntegerValue()); }
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 policies Management of UDDI publishers Management of UDDI node value sets
Related information:
Samples for WebSphere Application Server