0 Replies Latest reply: Dec 14, 2012 8:18 AM by stan_rsm RSS

    Create a LCA file using JAVA API

    stan_rsm Community Member

      Can anyone please help me in creating a LCA file of the whole application from ADEP server?  The sample provided in help at this link http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/quickStarts_Applications .23.4.html

      creates a LCA of the process in an application.  But i wanted to create a LCA of the whole application instead of its individual components?  Listing below the code from the link which backsup the process only.  Please help.

       

      //Set connection properties

                     Properties 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");
                     
                     //Create local String variables
                     String catId = "";
                     String catDesc = "";
                     
                     //Create a ServiceClientFactory object
                     ServiceClientFactory myFactory = ServiceClientFactory.createInstance(ConnectionProps);
       
                     //Create an ApplicationManager object
                     ApplicationManager appManager = new ApplicationManager(myFactory); 
                     
                     //Create a ServiceRegistryClient object
                     ServiceRegistryClient serviceReg = new ServiceRegistryClient(myFactory);
                     
                     //Specify the application to export
                     ServiceConfiguration configuration = serviceReg.getServiceConfiguration("MortgageApplication", 1, 0 );
                     String archiveDescription = configuration.getDescription();
                     
                     //Get the identifer value of the service configuration
                     String archiveName = configuration.getServiceId();
                     archiveName += "-";
                     SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy-kkmm");
                     String s = sdf.format(new Date(System.currentTimeMillis()));
                     archiveName += s;
                     
                     //Create a Service object
                     Service service = serviceReg.getService("MortgageApplication");
                     catId = service.getCategoryId();
                     ServiceCategory category = serviceReg.getServiceCategory(catId);
                     catDesc = category.getDescription();
                     
                     //Create an ApplicationDocument object and set configuration values 
                     //required to export an application
                     ApplicationDocument appXBean = ApplicationDocument.Factory.newInstance();
                     appXBean.addNewApplication();
                     
                     //Create an ApplicationDocument.Application.Orchestrations 
                     //instance and set its values with 
                     //service configuration values
                     ApplicationDocument.Application.Orchestrations orchestrations = ApplicationDocument.Application.Orchestrations.Factory.newInstance();
                     orchestrations.addNewOrchestration();
                     Orchestration orchestration = orchestrations.getOrchestrationArray(0);
                     orchestration.setMajorVersion(configuration.getMajorVersion());
                     orchestration.setMinorVersion(configuration.getMinorVersion());
                               
                     //Create a ProcessTemplateDocument object 
                     ProcessTemplateDocument processTemplateDocument = ProcessTemplateDocumentFactory.parseProcessTemplate(configuration.getDescriptor());
                     orchestration.setDescription(processTemplateDocument.getDescription());
                     orchestration.setId(processTemplateDocument.getName());
                     orchestration.setCategoryId(catId);
                     orchestration.setCategoryDescription(catDesc);
                     
                     //Create an ApplicationDocument.Application object
                     ApplicationDocument.Application applicationDescriptor = appXBean.getApplication();
                     applicationDescriptor.setName(archiveName);
                     applicationDescriptor.setDescription(archiveDescription);
                     applicationDescriptor.setOrchestrations(orchestrations);
                     
                     
                     //Export the application by invoking the 
                     //ApplicationManager object’s exportApplicationArchive method
                     ApplicationStatus result = appManager.exportApplicationArchive(appXBean); 
                     Document applicationArchiveDocument = result.getArchiveDocument();
       
                     //Create a File object to store the exported application
                     File exportedFile = new File("C:\\ExportedApplication.lca");
                     applicationArchiveDocument.copyToFile(exportedFile );