The following Java code example adds a form design (an XDP file) to the LiveCycle ES repository by using the Repository service’s Java client library. (See About the Repository Service.)import java.io.FileInputStream;import java.util.Properties;import com.adobe.idp.Document;import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;import com.adobe.repository.bindings.dsc.client.ResourceRepositoryClient;import com.adobe.repository.infomodel.Id;import com.adobe.repository.infomodel.Lid;import com.adobe.repository.infomodel.bean.RepositoryInfomodelFactoryBean;import com.adobe.repository.infomodel.bean.Resource;import com.adobe.repository.infomodel.bean.ResourceContent;public class UploadForm {public static void main(String[] args) {try{//This example will upload an XDP file to the LiveCycle Repository//Set LiveCycle ES service connection propertiesProperties connectionProps = new Properties();connectionProps.setProperty("DSC_DEFAULT_EJB_ENDPOINT", "jnp://localhost:1099");connectionProps.setProperty("DSC_TRANSPORT_PROTOCOL","EJB");connectionProps.setProperty("DSC_SERVER_TYPE", "JBoss");connectionProps.setProperty("DSC_CREDENTIAL_USERNAME", "administrator");connectionProps.setProperty("DSC_CREDENTIAL_PASSWORD", "password");ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);//Create a ResourceRepositoryClient objectResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(myFactory);//Specify the parent pathString parentResourcePath = "/";//Create a RepositoryInfomodelFactoryBean objectRepositoryInfomodelFactoryBean infomodelFactory = new RepositoryInfomodelFactoryBean(null);//Create a Resource object to add to the RepositoryResource newResource = (Resource) infomodelFactory.newImage(new Id(),new Lid(),"Loan.xdp");//Create a ResourceContent object that contains the content (file bytes)ResourceContent content = (ResourceContent) infomodelFactory.newResourceContent();//Create a Document that references an XDP file//to add to the RepositoryFileInputStream myForm = new FileInputStream("C:\\Adobe\\Loan.xdp");Document form = new Document(myForm);//Set the description and the MIME typecontent.setDataDocument(form);content.setMimeType("application/vnd.adobe.xdp+xml");//Assign content to the Resource objectnewResource.setContent(content) ;//Set a description of the resourcenewResource.setDescription("An XDP file");//Commit to repository, and update resource//in memory (by assignment)Resource addResource = repositoryClient.writeResource(parentResourcePath, newResource);//Get the description of the returned Resource objectSystem.out.println("The description of the new resource is "+addResource.getDescription());//Close the FileStream objectmyForm.close();} catch (Exception e) {e.printStackTrace();}}}
| Programming with LiveCycle ES (LiveDocs) |
| Adobe LiveCycle ES Update 1 |
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/000008.html
Comments
No screen name said on Jun 22, 2009 at 4:51 AM :