Java Example of Publishing an Existing Content Library

This example is based on the code in the
LibraryPublishSubscribe.java
sample file.
This example uses the steps that are described in the Publish an Existing Content Library procedure.
For a complete and up-to-date version of the sample code, see the vSphere Automation SDK Java samples at GitHub.
... // Access the LocalLibrary service. LocalLibrary localLibraryService = this.vapiAuthHelper.getStubFactory().createStub(LocalLibrary.class, sessionStubconfig); // Retrieve an existing local library. LibraryModel libraryModel = localLibraryService.get(libraryId); PublishInfo publishInfo = new PublishInfo(); // Configure how the local library is published by using BASIC authentication. publishInfo.setUserName("vcsp"); publishInfo.setPassword("password".toCharArray()); publishInfo.setAuthenticationMethod(AuthenticationMethod.BASIC); // Set the local library to published and update the library instance. publishInfo.setPublished(true); libraryModel.setPublishInfo(publishInfo); localLibraryService.update(libraryModel.getId(), libraryModel);