Management of UDDI publishers
You can use the UDDI registry administrative interface to register UDDI publishers.
Managing UDDI publishers
The UddiNode
MBean
provides the following operations to manage UDDI publishers:
- createUddiUser
- createUddiUsers
- updateUddiUser
- deleteUddiUser
- getUddiUser
- getUserInfos
- getEntitlementInfos
- assignTier
- getUserTier
In the samples for WebSphere® Application Server, the ManagePublishersSample class in the UDDI registry samples demonstrates these operations. An example is provided for each, making use of the UddiNodeProxy client class.
- createUddiUser
- Registers a single UDDI publisher in a specified tier with specified
entitlements. The UddiUser class represents the UDDI publisher, and
is constructed using a user ID, a TierInfo object that specifies the
tier ID to allocate the UDDI publisher to, and a collection of Entitlement
objects that specify what the UDDI publisher is permitted to do.Tip: To allocate the UDDI publisher default entitlements, set the entitlements parameter to null.
- Create the UddiUser
object:
UddiUser user = new UddiUser("user1", new TierInfo("3"), null);
- Invoke the createUddiUser operation:
uddiNode.createUddiUser(user);
- Create the UddiUser
object:
- createUddiUsers
- Registers multiple
UDDI publishers. The following example shows
how to register seven UDDI publishers with default entitlements in
one call.
- Create TierInfo objects for the tiers that the publishers
are
allocated to:
TierInfo tier1 = new TierInfo("1"); TierInfo tier4 = new TierInfo("4");
- Create UddiUser objects for each UDDI publisher,
specifying the
tier for each publisher:
UddiUser publisher1 = new UddiUser("Publisher1", tier4, null); UddiUser publisher2 = new UddiUser("Publisher2", tier4, null); UddiUser publisher3 = new UddiUser("Publisher3", tier4, null); UddiUser publisher4 = new UddiUser("Publisher4", tier1, null); UddiUser publisher5 = new UddiUser("Publisher5", tier1, null); UddiUser cts1 = new UddiUser("cts1", tier4, null); UddiUser cts2 = new UddiUser("cts2", tier4, null);
- Add the UddiUser objects to a list:
List uddiUsers = new ArrayList(); uddiUsers.add(publisher1); uddiUsers.add(publisher2); uddiUsers.add(publisher3); uddiUsers.add(publisher4); uddiUsers.add(publisher5); uddiUsers.add(cts1); uddiUsers.add(cts2);
- Invoke the createUddiUsers operation:
uddiNode.createUddiUsers(uddiUsers);
- Create TierInfo objects for the tiers that the publishers
are
allocated to:
- updateUddiUser
- Updates a
UDDI publisher with the details in the supplied UddiUser
object. Typically, you use this operation to change the tier of one
UDDI publisher or to update the entitlements of a UDDI publisher.
Supply only the entitlements that you want to update; other available
entitlements retain their existing values.
- Create Entitlement
objects with the appropriate permission. The
entitlement IDs are found in EntitlementConstants.
Entitlement publishUuiDKeyGenerator = new Entitlement(PUBLISH_UUID_KEY_GENERATOR, true); Entitlement publishWithUuidKey = new Entitlement(PUBLISH_WITH_UUID_KEY, true);
- Add the Entitlement objects to a list:
List entitlements = new ArrayList(); entitlements.add(publishUuiDKeyGenerator); entitlements.add(publishWithUuidKey);
- Update a UddiUser object with the updated entitlements:
user.setEntitlements(entitlements);
- Invoke the updateUddiUser operation:
uddiNode.updateUddiUser(user);
- Create Entitlement
objects with the appropriate permission. The
entitlement IDs are found in EntitlementConstants.
- getUddiUser
- Retrieves details about
a UDDI publisher in the form of a UddiUser
object. This specifies the UDDI publisher ID, information about the
tier the UDDI publisher is assigned to and the entitlements of the
UDDI publisher.
- Invoke the getUddiUser operation:
UddiUser user1 = uddiNode.getUddiUser("user1");
- Output the contents of the UddiUser object:
System.out.println("retrieved user: " + user1);
- Invoke the getUddiUser operation:
- getUserInfos
- Returns a collection
of UserInfo objects. Each UserInfo object
represents a UDDI publisher that is known to the UDDI node, and the
tier that the UDDI publisher is allocated to. To get more details
about a specific UDDI publisher, including the tier ID and entitlements,
use the getUddiUser operation.
- Invoke the getUserInfos operation:
List registeredUsers = uddiNode.getUserInfos();
- Output the UserInfo objects:
System.out.println("retrieved registered users: "); System.out.println(registeredUsers);
- Invoke the getUserInfos operation:
- getEntitlementInfos
- Returns a collection of Entitlement objects. Each entitlement
is a property that controls whether a UDDI publisher has permission
to undertake a specified action.
- Invoke the getEntitlementInfos
operation:
List entitlementInfos = uddiNode.getEntitlementInfos();
- Specify where to find message resources:
String messages = "com.ibm.uddi.v3.management.messages"; ResourceBundle bundle = ResourceBundle.getBundle(messages, Locale.ENGLISH);
- Iterate through the Entitlement objects, displaying
the ID, name,
and description:
for (Iterator iter = entitlementInfos.iterator(); iter.hasNext();) { Entitlement entitlement = (Entitlement) iter.next(); StringBuffer entitlementOutput = new StringBuffer(); String entitlementId = entitlement.getId(); String entitlementName = bundle.getString(entitlement.getNameKey()); String entitlementDescription = bundle.getString(entitlement.getDescriptionKey()); entitlementOutput.append("Entitlement id: "); entitlementOutput.append(entitlementId); entitlementOutput.append("\n name: "); entitlementOutput.append(entitlementName); entitlementOutput.append("\n description: "); entitlementOutput.append(entitlementDescription); System.out.println(entitlementOutput.toString()); }
- Invoke the getEntitlementInfos
operation:
- deleteUddiUser
- Removes the UDDI publisher with the specified user ID from the
UDDI registry.
- Invoke the deleteUddiUser operation:
uddiNode.deleteUddiUser("user1");
- Invoke the deleteUddiUser operation:
- assignTier
- Assigns the UDDI
publishers with the supplied IDs to the specified
tier. This operationis useful when you want to restrict several UDDI
publishers, for example by assigning them to a tier that does not
allow publishing of any entities.
- Create a list of publisher
IDs:
List uddiUserIds = new ArrayList(); uddiUserIds.add("Publisher1"); uddiUserIds.add("Publisher2"); uddiUserIds.add("Publisher3"); uddiUserIds.add("Publisher4"); uddiUserIds.add("Publisher5"); uddiUserIds.add("cts1"); uddiUserIds.add("cts2");
- Invoke the assignTier operation:
uddiNode.assignTier(uddiUserIds, "0");
- Create a list of publisher
IDs:
- getUserTier
- Returns information
about the tier that a UDDI publisher is assigned
to. The returned TierInfo has getter methods for retrieving the tier
ID, tier name, tier description, and whether the tier is the default
tier.
- Invoke the getUserTier operation:
TierInfo tierInfo = getUserTier("Publisher3");
- Output the contents of the TierInfo object:
System.out.println(tierInfo);
- Invoke the getUserTier operation: