# How to Use the SAS Java Metadata Interface

- Package Description
- Example 1: Server Connection
- Example 2: Get Repositories
- Example 3: Get Metadata Types
- Example 4: Create Objects
- Example 5: Read Objects
- Example 6: Delete Objects
- Example 7: Get all objects of a particular type
- Example 8: Get an existing object
- Sample Program

## 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);
             MetadataUtil.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();
          }
       }