WAS v8.5 > Reference > Developer detailed usage information

Management of UDDI publishers

We can use the UDDI registry administrative interface to register UDDI publishers.


Manage UDDI publishers

The UddiNode MBean provides the following operations to manage UDDI publishers:

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.

To allocate the UDDI publisher default entitlements, set the entitlements parameter to null.

  1. Create the UddiUser object:

      UddiUser user = new UddiUser("user1", new TierInfo("3"), null);
  2. Invoke the createUddiUser operation:

      uddiNode.createUddiUser(user);

createUddiUsers

Registers multiple UDDI publishers. The following example shows how to register seven UDDI publishers with default entitlements in one call.

  1. Create TierInfo objects for the tiers the publishers are allocated to:
    TierInfo tier1 = new TierInfo("1");
    TierInfo tier4 = new TierInfo("4");

  2. 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);

  3. 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);
  4. Invoke the createUddiUsers operation:

      uddiNode.createUddiUsers(uddiUsers);

updateUddiUser

Updates a UDDI publisher with the details in the supplied UddiUser object.

Typically, we use this operation to change the tier of one UDDI publisher or to update the entitlements of a UDDI publisher. Supply only the entitlements to update; other available entitlements retain their existing values.

  1. 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);

  2. Add the Entitlement objects to a list:
    List entitlements = new ArrayList();
    entitlements.add(publishUuiDKeyGenerator);
    entitlements.add(publishWithUuidKey);
  3. Update a UddiUser object with the updated entitlements:

      user.setEntitlements(entitlements);
  4. Invoke the updateUddiUser operation:

      uddiNode.updateUddiUser(user);

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.

  1. Invoke the getUddiUser operation:

      UddiUser user1 = uddiNode.getUddiUser("user1");
  2. Output the contents of the UddiUser object:

      System.out.println("retrieved user: " + user1);

getUserInfos

Returns a collection of UserInfo objects. Each UserInfo object represents a UDDI publisher that is known to the UDDI node, and the tier 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.

  1. Invoke the getUserInfos operation:

      List registeredUsers = uddiNode.getUserInfos();
  2. Output the UserInfo objects:
    System.out.println("retrieved registered users: ");
    System.out.println(registeredUsers);

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.

  1. Invoke the getEntitlementInfos operation:

      List entitlementInfos = uddiNode.getEntitlementInfos();

  2. Specify where to find message resources:
    String messages = "com.ibm.uddi.v3.management.messages";
    ResourceBundle bundle = ResourceBundle.getBundle(messages, Locale.ENGLISH);
  3. 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());}

deleteUddiUser

Removes the UDDI publisher with the specified user ID from the UDDI registry.

  • Invoke the deleteUddiUser operation:

      uddiNode.deleteUddiUser("user1");

assignTier

Assigns the UDDI publishers with the supplied IDs to the specified tier. This operationis useful when we want to restrict several UDDI publishers, for example by assigning them to a tier that does not allow publishing of any entities.

  1. 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");
  2. Invoke the assignTier operation:

      uddiNode.assignTier(uddiUserIds, "0");

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.

  1. Invoke the getUserTier operation:

      TierInfo tierInfo = getUserTier("Publisher3");
  2. Output the contents of the TierInfo object:

      System.out.println(tierInfo);


Related


Manage the UDDI registry
Use the UDDI registry
Use administrative programs (JMX)


Reference:

Management of UDDI node states and attributes
Management of UDDI node configuration properties
Management of UDDI node policies
Management of UDDI node tiers
Management of UDDI node value sets


Related information:

Samples for WAS


+

Search Tips   |   Advanced Search