This example shows how to create an empty library item that stores an ISO image file.

This example uses the steps that are described in the Create an Empty Library Item procedure.

...
import java.util.UUID;
import com.vmware.content.library.Item;
import com.vmware.content.library.ItemModel;
...
 
// Create an instance of the ItemModel class and specify the item settings.
ItemModel libItemSpec = new ItemModel();
libItemSpec.setName("ESXi ISO image");
libItemSpec.setDescription("ISO image with the latest security patches for ESXi 5.5 as of 2/3/2015");
libItemSpec.setType("iso");
 
// Associate the item with an existing content library. 
libItemSpec.setLibraryId("<content_library_ID>");
 
// Create the new Item instance, using the specified model.
Item libItemService = serviceManager.getVapiService(Item.class);
String itemID = UUID.randomUUID().toString();
String newItem = libItemService.create(itemID, libItemSpec);