|
|
The following Java code example creates a folder called testFolder in the repository.import java.util.*;import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;import com.adobe.repository.bindings.dsc.client.ResourceRepositoryClient;import com.adobe.repository.infomodel.*;import com.adobe.repository.infomodel.bean.*;public class CreateFolder {public static void main(String[] args) {// This example will create a folder in the LiveCycle ES repositorytry{// Set the LiveCycle ES service connection propertiesProperties connectionProps = new Properties();connectionProps.setProperty("DSC_DEFAULT_SOAP_ENDPOINT", "http://localhost:8080");connectionProps.setProperty("DSC_TRANSPORT_PROTOCOL", "SOAP");connectionProps.setProperty("DSC_SERVER_TYPE", "JBoss");connectionProps.setProperty("DSC_CREDENTIAL_USERNAME", "administrator");connectionProps.setProperty("DSC_CREDENTIAL_PASSWORD", "password");// Create the service client factoryServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);// Create a ResourceRepositoryClient object using the service client factoryResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(myFactory);// Create a RepositoryInfomodelFactoryBean needed for creating resourcesRepositoryInfomodelFactoryBean repositoryInfomodelFactory = new RepositoryInfomodelFactoryBean(null);// Create a folderResourceCollection testFolder = repositoryInfomodelFactory.newResourceCollection(new Id(),new Lid(),"testFolder");// Set the folder’s descriptiontestFolder.setDescription("test folder");// Write the folder to the repositoryrepositoryClient.writeResource("/", testFolder);// Retrieve the folder’s URIString testFolderUri = "/" + testFolder.getName();// Print folder verification messageSystem.out.println("Folder " + testFolderUri + " was successfully created.");} catch (Exception e) {System.out.println("Exception thrown while trying to create the folder" +e.getMessage());}}}
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/quickStarts_Repository.18.2.html