How to Use the SAS Java Metadata Interface


Example 3: Get Metadata Types

This is an example of how to list the different metadata types contained within a particular SAS Metadata Repository.

   /**
    * This example lists the metadata types available on the metadata server
    * and their descriptions.
    */
   public void displayMetadataTypes()
   {
      try
      {
         // Get a list of metadata types available on the server.
         System.out.println("\nThe object types contained on this metadata server are: ");
         List nameList = new ArrayList(100);
         List descList = new ArrayList(100);
         _factory.getOMIUtil().getTypes(nameList, descList);
         Iterator iter1 = nameList.iterator();
         Iterator iter2 = descList.iterator();
         while (iter1.hasNext() && iter2.hasNext())
         {
            //print the name and description of each metadata object type
            String name = (String) iter1.next();
            String desc = (String) iter2.next();
            System.out.println("Type: " +
                                name +
                                ", desc: " +
                                desc);
         }
      }
      catch (MdException e)
      {
         e.printStackTrace();
      }
      catch (RemoteException e)
      {
         e.printStackTrace();
      }
   }