This example is based on the code in the ContentLibraryWorkflow.java sample file located in the following vCloud Suite SDK for Java directory: /client/samples/java/com/vmware/vcloud/suite/samples/interop.

For more information about storing the contents of a local library, see Content Library Storage.

...
import com.vmware.content.library.StorageBacking;
import com.vmware.content.library.StorageBacking.Type;

// Create a StorageBacking instance of datastore type. 

     StorageBacking libraryBacking = new StorageBacking();
     libraryBacking.setType(Type.DATASTORE);

/* 
 * Pass the value of the datastore ManagedObjectReference. 
 * See the vSphere Web Services SDK Programming Guide 
 * and the vSphere Web Services SDK samples. In addition, the vCloud Suite SDK for Java provides  
 * the VimUtil utility class in the com.vmware.vcloud.suite.samples.vim.helpers package. 
 * You can use the utility to retrieve the ManagedObjectReference
 * of the datastore entity.
 */
     libraryBacking.setDatastoreId("datastore-123");

// Create a LibraryModel that represents a local library backed on a datastore.

      LibraryModel libraryModel = new LibraryModel();
      libraryModel.setName("AcmeLibrary");
      libraryModel.setStorageBackings(Collections.singletonList(libraryBacking));