Quick Start (EJB mode):Getting the LiveCycle Applications using the Java API

The following Java code example gets the LiveCycle applications using the Java API.
注意: Getting LiveCycle Application API, getApplications(), returns only deployed applications.
/* 
 * This Java Quick Start uses the EJB mode and contains the following JAR files 
 * in the class path: 
 * 1. adobe-livecycle-client.jar 
 * 2. adobe-usermanager-client.jar 
 * 3. adobe-application-remote-client.jar 
 * 4. jbossall-client.jar (use a different JAR file if the LiveCycle Server is not deployed 
 * on JBoss) 
 * 
 * These JAR files are located in the following path: 
 * <install directory>/sdk/client-libs/common 
 *  
 *  The jbossall-client.jar file is located in the following path: 
 * <install directory>/jboss/client 
 *  
 *  The JBoss files must be kept in the jboss\client folder. You can copy the client folder to  
 *  your local development environment and then include the jbossall-client.jar file in your class path. 
 *  This JAR file is reference to other client jars present in the client folder. 
 *   
 *   
 * If you want to invoke a remote LiveCycle Server instance and there is a 
 * firewall between the client application and the server, then it is  
 * recommended that you use the SOAP mode. When using the SOAP mode,  
 * you have to include additional JAR files located in the following  
 * path 
 * <install directory>/sdk/client-libs/thirdparty 
 *  
 * For information about the SOAP  
 * mode and the additional JAR files that need to be included,  
 * see "Setting connection properties" in Programming  
 * with LiveCycle 
 */ 
package com.adobe.idp.dsc.applicationmanager; 
 
import java.io.FileInputStream; 
import java.util.List; 
import java.util.Properties; 
 
import com.adobe.idp.Document; 
import com.adobe.idp.dsc.clientsdk.ServiceClientFactory; 
import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties; 
import com.adobe.livecycle.applicationmanager.client.ApplicationManagerClient; 
import com.adobe.livecycle.applicationmanager.client.ApplicationManagerClientException; 
 
public class GetApplications_EJB { 
 
    public static void main(String[] args) { 
        //Set connection properties required to invoke LiveCycle ES3                                
        Properties connectionProps = new Properties(); 
        connectionProps.setProperty("DSC_DEFAULT_EJB_ENDPOINT", "jnp://lcserver:1099"); 
        connectionProps.setProperty("DSC_TRANSPORT_PROTOCOL", ServiceClientFactoryProperties.DSC_EJB_PROTOCOL);          
        connectionProps.setProperty("DSC_SERVER_TYPE", ServiceClientFactoryProperties.DSC_JBOSS_SERVER_TYPE); 
        connectionProps.setProperty("DSC_CREDENTIAL_USERNAME", "administrator"); 
        connectionProps.setProperty("DSC_CREDENTIAL_PASSWORD", "password"); 
 
        //Create ServiceClientFactory object 
        ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps); 
        //Create ApplicationManagerClient object 
        ApplicationManagerClient appClient = new ApplicationManagerClient(myFactory); 
         
        Document doc = null; 
        try { 
             
            final FileInputStream fileApp = new FileInputStream("C:\\appraisal.lca"); 
            doc = new Document(fileApp); 
             
        } catch (Exception e) { 
            e.printStackTrace(); 
        } 
         
        try { 
         
            //Import the application into the LC server 
            final String resourceID = appClient.importApplication(doc); 
            System.out.println("Import application with resource ID: " + resourceID + " is completed successfully!"); 
         
        } catch (ApplicationManagerClientException e) { 
            e.printStackTrace();     
        } 
 
        try { 
            //Get applications from LC server 
            List appList = appClient.getApplications(); 
            System.out.println("Get applications from LC Server: " + appList.size()); 
 
        } catch (Exception e) { 
            e.printStackTrace(); 
        } 
    } 
}