存储库服务API快速启动

以下快速入门可用于AEM Forms存储库服务。

快速入门(SOAP模式):使用Java API创建文件夹

快速入门(SOAP模式):使用Java API编写资源

快速入门(SOAP模式):使用Java API列出资源

快速入门(SOAP模式):使用Java API读取资源

快速入门(SOAP模式):使用Java API更新资源

快速入门(SOAP模式):使用Java API搜索资源

快速入门(SOAP模式):使用Java API创建资源之间的关系

快速入门(SOAP模式):使用Java API锁定资源

快速入门(SOAP模式):使用Java API管理访问控制列表

快速入门(SOAP模式):使用Java API删除资源

AEM Forms操作可以使用AEM Forms强类型API执行,连接模式应设置为SOAP

应用程序/表单应用程序

大多数AEM Forms存储库服务快速入门都与名为Applications/FormsApplication,的应用程序进行了交互,如下图所示。

文件夹FormsFolder是AEM Forms存储库中的一个位置。 例如,您可以以编程方式将此文件夹添加到Applications/FormsApplication中。 (请参阅快速入门(SOAP模式):使用Java API创建文件夹。)

位于AEM Forms存储库中的资源的路径是:

Applications/Application-name/Application-version/Folder.../Filename

注意

您可以使用Web浏览器浏览AEM Forms存储库。 要浏览存储库,请在Web浏览器中输入以下URL: https://[服务器名称]:[服务器端口]/repository。 您可以使用Web浏览器验证快速启动结果。 例如,如果向AEM Forms存储库添加内容,则可以在Web浏览器中查看该内容。

注意

默认情况下,Applications/FormsApplication不存在。 要跟进快速入门,请使用Workbench创建此应用程序。 有关使用Workbench创建应用程序的信息,请参阅流程设计入门

快速入门(SOAP模式):使用Java API创建文件夹

以下Java代码示例在以下位置/Applications/FormsApplication/1.0/中创建名为​FormsFolder​的文件夹。 (请参阅创建文件夹。)

 /* 
     * This Java Quick Start uses the following JAR files 
     * 1. adobe-repository-client.jar 
     * 2. adobe-livecycle-client.jar 
     * 3. adobe-usermanager-client.jar 
     * 4. adobe-utilities.jar 
     * 5. jboss-client.jar (use a different JAR file if the forms server is not deployed 
     * on JBoss) 
     * 6. commons-code-1.3.jar 
     * 7. jacorb.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 8. jnp-client.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 
     * 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 3 JBoss JAR files in your class path 
     * 
     * These JAR files are located in the following path: 
     * <install directory>/sdk/client-libs/common 
     * 
     * The adobe-utilities.jar file is located in the following path: 
     * <install directory>/sdk/client-libs/jboss 
     * 
     * The jboss-client.jar file is located in the following path: 
     * <install directory>/jboss/bin/client 
     * 
     * If you want to invoke a remote forms 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 AEM Forms 
     * 
     * For complete details about the location of the AEM Forms JAR files,  
     * see "Including AEM Forms Java library files" in Programming  
     * with AEM Forms 
     */ 
 import java.util.*; 
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactory; 
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties; 
 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 quick start creates a folder in the AEM Forms repository 
         //Ensure that you create a AEM Forms application named FormsApplication using Workbench 
         try  
         { 
             //Set connection properties required to invoke AEM Forms                                  
             Properties connectionProps = new Properties(); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://[server]:[port]"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);           
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password"); 
              
             // Create the service client factory 
             ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps); 
              
             // Create a ResourceRepositoryClient object using the service client factory 
             ResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(myFactory); 
  
             // Create a RepositoryInfomodelFactoryBean needed for creating resources 
             RepositoryInfomodelFactoryBean repositoryInfomodelFactory = new RepositoryInfomodelFactoryBean(null); 
              
             // Create a folder in a AEM Forms application named Application/FormsApplication 
             ResourceCollection folder = repositoryInfomodelFactory.newResourceCollection( 
                 new Id(),  
                 new Lid(),  
                 "FormsFolder" 
             ); 
  
             // Set the folder’s description 
             folder.setDescription("A folder to store forms"); 
  
             // Write the folder to the repository 
             Resource newFolder = repositoryClient.writeResource("/Applications/FormsApplication/1.0/", folder); 
  
             // Retrieve the folder’s identifier value 
             String msg = "The identifier value of the new folder is" + newFolder.getId(); 
  
             // Print folder verification message 
             System.out.println(msg); 
  
         } catch (Exception e) { 
                 System.out.println( 
                     "Exception thrown while trying to create the folder" + 
                     e.getMessage() 
                 ); 
           } 
     } 
 }

快速入门(SOAP模式):使用Java API编写资源

以下Java代码示例在存储库中写入名为​loan.xdp​的资源。 资源将添加到/Applications/FormsApplication/1.0/FormsFolder位置。 (请参阅编写资源。)

 /* 
     * This Java Quick Start uses the following JAR files 
     * 1. adobe-repository-client.jar 
     * 2. adobe-livecycle-client.jar 
     * 3. adobe-usermanager-client.jar 
     * 4. adobe-utilities.jar 
     * 5. jboss-client.jar (use a different JAR file if the forms server is not deployed 
     * on JBoss) 
     * 6. commons-code-1.3.jar 
     * 7. jacorb.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 8. jnp-client.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 
     * 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 3 JBoss JAR files in your class path 
     * 
     * These JAR files are located in the following path: 
     * <install directory>/sdk/client-libs/common 
     * 
     * The adobe-utilities.jar file is located in the following path: 
     * <install directory>/sdk/client-libs/jboss 
     * 
     * The jboss-client.jar file is located in the following path: 
     * <install directory>/jboss/bin/client 
     * 
     * If you want to invoke a remote forms 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 AEM Forms 
     * 
     * For complete details about the location of the AEM Forms JAR files,  
     * see "Including AEM Forms Java library files" in Programming  
     * with AEM Forms 
     */ 
 import java.io.FileInputStream; 
 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.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 WriteFile { 
  
     // This quick start writes Loan.xdp to Applications/FormsApplication/1.0/FormsFolder 
     //Ensure that you create a AEM Forms application named FormsApplication using Workbench 
     public static void main(String[] args) { 
          
         try  
         { 
         //Set connection properties required to invoke AEM Forms                                 
         Properties connectionProps = new Properties(); 
         connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://[server]:[port]"); 
         connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);           
         connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss"); 
         connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator"); 
         connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password"); 
          
         ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps); 
          
         //Create a ResourceRepositoryClient object 
         ResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(myFactory); 
          
         //Specify the parent path 
          String parentResourcePath = "/Applications/FormsApplication/1.0/FormsFolder"; 
          
         //Create a RepositoryInfomodelFactoryBean object 
          RepositoryInfomodelFactoryBean infomodelFactory = new RepositoryInfomodelFactoryBean(null); 
          
         //Create a Resource object to add to the Repository 
          Resource 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 Repository 
         FileInputStream myForm = new FileInputStream("C:\\Adobe\Loan.xdp");  
         Document form = new Document(myForm); 
          
         //Set the description and the MIME type 
         content.setDataDocument(form);  
         content.setMimeType("application/vnd.adobe.xdp+xml"); 
                                          
         //Assign content to the Resource object 
         newResource.setContent(content) ; 
              
         //Set a description of the resource 
         newResource.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 object 
         System.out.println("The description of the new resource is "+addResource.getDescription()); 
          
         //Close the FileStream object 
         myForm.close();  
          
         } catch (Exception e) { 
              
              e.printStackTrace(); 
            } 
         } 
 } 
 

快速入门(SOAP模式):使用Java API列出资源

以下Java代码示例列出了位于Applications/FormsApplication/1.0/FormsFolder中的资源。 (请参阅列出资源。)

 /* 
     * This Java Quick Start uses the following JAR files 
     * 1. adobe-repository-client.jar 
     * 2. adobe-livecycle-client.jar 
     * 3. adobe-usermanager-client.jar 
     * 4. adobe-utilities.jar 
     * 5. jboss-client.jar (use a different JAR file if the forms server is not deployed 
     * on JBoss) 
     * 6. commons-code-1.3.jar 
     * 7. jacorb.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 8. jnp-client.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 
     * 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 3 JBoss JAR files in your class path 
     * 
     * These JAR files are located in the following path: 
     * <install directory>/sdk/client-libs/common 
     * 
     * The adobe-utilities.jar file is located in the following path: 
     * <install directory>/sdk/client-libs/jboss 
     * 
     * The jboss-client.jar file is located in the following path: 
     * <install directory>/jboss/bin/client 
     * 
     * If you want to invoke a remote forms 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 AEM Forms 
     * 
     * For complete details about the location of the AEM Forms JAR files,  
     * see "Including AEM Forms Java library files" in Programming  
     * with AEM Forms 
     */ 
 import java.util.*; 
  
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactory; 
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties; 
 import com.adobe.repository.bindings.dsc.client.ResourceRepositoryClient; 
 import com.adobe.repository.infomodel.bean.Resource; 
  
 //This quick start lists the content located in Applications/FormsApplication/1.0/FormsFolder 
 //Ensure that you create a AEM Forms application named Applications/FormsApplication using Workbench 
 public class ListFiles { 
  
     public static void main(String[] args) { 
  
         try  
         { 
             //Set connection properties required to invoke AEM Forms                             
             Properties connectionProps = new Properties(); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://[server]:[port]"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);           
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password"); 
              
             // Create the service client factory 
             ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps); 
              
             // Create a ResourceRepositoryClient object using the service client factory 
             ResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(myFactory); 
              
             // List all the files located in the  
             String resourceFolderPath = "/Applications/FormsApplication/1.0/FormsFolder"; 
  
             // Retrieve the list of resources under the folder path 
             List members = repositoryClient.listMembers(resourceFolderPath); 
  
             // Print out the resources that were found 
             System.out.println("The following resources were found:"); 
             for (int i = 0; i < members.size(); i++) { 
                 Resource r = (Resource)(members.get(i)); 
                 System.out.println( 
                     "Resource name: " + 
                     r.getName() + 
                     "  Resource Description: " + 
                     r.getDescription() 
                 ); 
             } 
  
         } catch (Exception e) { 
              e.printStackTrace(); 
           } 
     } 
 }

快速入门(SOAP模式):使用Java API读取资源

以下Java代码示例从存储库中读取名为​Loan.xdp​的资源。 XDP文件位于/Applications/FormsApplication/1.0/FormsFolder/中。 (请参阅读取资源。)

 /* 
     * This Java Quick Start uses the following JAR files 
     * 1. adobe-repository-client.jar 
     * 2. adobe-livecycle-client.jar 
     * 3. adobe-usermanager-client.jar 
     * 4. adobe-utilities.jar 
     * 5. jboss-client.jar (use a different JAR file if the forms server is not deployed 
     * on JBoss) 
     * 6. commons-code-1.3.jar 
     * 7. jacorb.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 8. jnp-client.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 
     * 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 3 JBoss JAR files in your class path 
     * 
     * These JAR files are located in the following path: 
     * <install directory>/sdk/client-libs/common 
     * 
     * The adobe-utilities.jar file is located in the following path: 
     * <install directory>/sdk/client-libs/jboss 
     * 
     * The jboss-client.jar file is located in the following path: 
     * <install directory>/jboss/bin/client 
     * 
     * If you want to invoke a remote forms 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 AEM Forms 
     * 
     * For complete details about the location of the AEM Forms JAR files,  
     * see "Including AEM Forms Java library files" in Programming  
     * with AEM Forms 
     */ 
 import java.util.*; 
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactory; 
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties; 
 import com.adobe.repository.bindings.dsc.client.ResourceRepositoryClient; 
 import com.adobe.repository.infomodel.bean.*; 
  
 //This quick start retrieves Loan.xdp from Applications/FormsApplication/1.0/FormsFolder 
 //Ensure that you create a AEM Forms application named FormsApplication using Workbench 
 public class ReadFile { 
  
      
     public static void main(String[] args) { 
  
         try  
         { 
             //Set connection properties required to invoke AEM Forms                                 
             Properties connectionProps = new Properties(); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://[server]:[port]"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);           
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password"); 
              
             // Create the service client factory 
             ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps); 
              
             // Create a ResourceRepositoryClient object using the service client factory 
             ResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(myFactory); 
  
             // Specify the path to the Loan.xdp 
             String resourceUri =  "/Applications/FormsApplication/1.0/FormsFolder/Loan.xdp"; 
  
             // Retrieve the XDP file  
             Resource r = repositoryClient.readResource(resourceUri); 
  
             // Print the resource verification message 
             System.out.println( 
                 "Resource " +  
                 resourceUri +  
                 " was successfully retrieved." + 
                 "Resource content contains " + 
                 r.getContent().getDataDocument().length() + 
                 " bytes." 
             ); 
  
         } catch (Exception e) { 
             System.out.println( 
                 "Exception thrown while trying to read the file" + 
                 e.getMessage() 
             ); 
         } 
     } 
 } 
 

快速入门(SOAP模式):使用Java API更新资源

以下Java代码示例通过修改其描述来更新/Applications/FormsApplication/1.0/FormsFolder。 (请参阅更新资源。)

 /* 
     * This Java Quick Start uses the following JAR files 
     * 1. adobe-repository-client.jar 
     * 2. adobe-livecycle-client.jar 
     * 3. adobe-usermanager-client.jar 
     * 4. adobe-utilities.jar 
     * 5. jboss-client.jar (use a different JAR file if the forms server is not deployed 
     * on JBoss) 
     * 6. commons-code-1.3.jar 
     * 7. jacorb.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 8. jnp-client.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 
     * 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 3 JBoss JAR files in your class path 
     * 
     * These JAR files are located in the following path: 
     * <install directory>/sdk/client-libs/common 
     * 
     * The adobe-utilities.jar file is located in the following path: 
     * <install directory>/sdk/client-libs/jboss 
     * 
     * The jboss-client.jar file is located in the following path: 
     * <install directory>/jboss/bin/client 
     * 
     * If you want to invoke a remote forms 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 AEM Forms 
     * 
     * For complete details about the location of the AEM Forms JAR files,  
     * see "Including AEM Forms Java library files" in Programming  
     * with AEM Forms 
     */ 
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactory; 
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties; 
 import com.adobe.repository.bindings.dsc.client.ResourceRepositoryClient; 
 import com.adobe.repository.infomodel.bean.*; 
 import java.util.*; 
  
 //This quick start updates the description of Applications/FormsApplication/1.0/FormsFolder 
 //Ensure that you create a AEM Forms application named Applications/FormsApplication using Workbench 
 public class UpdateResource { 
  
     public static void main(String[] args) { 
  
         // This example will update a resource in the AEM Forms repository 
         try  
         { 
             //Set connection properties required to invoke AEM Forms                                 
             Properties connectionProps = new Properties(); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://[server]:[port]"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);           
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password"); 
              
             // Create the service client factory 
             ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps); 
              
             // Create a ResourceRepositoryClient object using the service client factory 
             ResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(myFactory); 
  
             // Specify the URI of the resource to update 
             String resourceUri =  "/Applications/FormsApplication/1.0/FormsFolder"; 
  
             // Retrieve the resource  
             Resource resource = repositoryClient.readResource(resourceUri); 
  
             // Update its description  
             resource.setDescription("This folder stores XDP files"); 
  
             // Update the resource in the repository 
             Resource updatedResource = repositoryClient.updateResource( 
                 resourceUri, 
                 resource, 
                 true 
             ); 
  
             // Print the resource verification message 
             System.out.println( 
                 "Resource " +  
                 resourceUri +  
                 "version " +  
                 updatedResource.getMajorVersion() + 
                 "." + 
                 updatedResource.getMinorVersion() + 
                 " was successfully updated." 
             ); 
  
         } catch (Exception e) { 
             System.out.println( 
                 "Exception thrown while trying to update the resource" + 
                 e.getMessage() 
             ); 
         } 
     } 
 } 
 

快速入门(SOAP模式):使用Java API搜索资源

以下Java代码示例在Applications/FormsApplication/1.0/FormsFolder中搜索Loan.xdp。 (请参阅搜索资源。)

 /* 
     * This Java Quick Start uses the following JAR files 
     * 1. adobe-repository-client.jar 
     * 2. adobe-livecycle-client.jar 
     * 3. adobe-usermanager-client.jar 
     * 4. adobe-utilities.jar 
     * 5. jboss-client.jar (use a different JAR file if the forms server is not deployed 
     * on JBoss) 
     * 6. commons-code-1.3.jar 
     * 7. jacorb.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 8. jnp-client.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 
     * 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 3 JBoss JAR files in your class path 
     * 
     * These JAR files are located in the following path: 
     * <install directory>/sdk/client-libs/common 
     * 
     * The adobe-utilities.jar file is located in the following path: 
     * <install directory>/sdk/client-libs/jboss 
     * 
     * The jboss-client.jar file is located in the following path: 
     * <install directory>/jboss/bin/client 
     * 
     * If you want to invoke a remote forms 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 AEM Forms 
     * 
     * For complete details about the location of the AEM Forms JAR files,  
     * see "Including AEM Forms Java library files" in Programming  
     * with AEM Forms 
     */ 
 import java.util.*; 
  
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactory; 
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties; 
 import com.adobe.repository.bindings.dsc.client.ResourceRepositoryClient; 
 import com.adobe.repository.infomodel.bean.*; 
 import com.adobe.repository.query.*; 
 import com.adobe.repository.query.sort.*; 
  
 //This quick start searches for Loan.xdp in Applications/FormsApplication/1.0/FormsFolder 
 //Ensure that you create a AEM Forms application named FormsApplication using Workbench 
 public class SearchResources { 
      
     public static void main(String[] args) { 
  
         try  
         { 
             //Set connection properties required to invoke AEM Forms                                 
             Properties connectionProps = new Properties(); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://[server]:[port]"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);           
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password"); 
              
             // Create the service client factory 
             ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps); 
              
             // Create a ResourceRepositoryClient object using the service client factory 
             ResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(myFactory); 
  
             // Specify the URI of the target folder  
             String testFolderUri = "/Applications/FormsApplication/1.0/FormsFolder"; 
  
             // Specify the attribute name for which to search 
             String name = "Loan.xdp"; 
  
             // Create a Query used in the search 
             Query query = new Query(); 
             Query.Statement statement = new Query.Statement( 
                 Resource.ATTRIBUTE_NAME,  
                 Query.Statement.OPERATOR_BEGINS_WITH,  
                 name 
             ); 
             statement.setNamespace(ResourceProperty.RESERVED_NAMESPACE_REPOSITORY); 
             query.addStatement(statement); 
  
             // Create the sort order used in the search 
             SortOrder sortOrder = new SortOrder(); 
             SortOrder.Element element = new SortOrder.Element(Resource.ATTRIBUTE_NAME, true); 
             sortOrder.addSortElement(element); 
  
             // Search for the resources 
             List listProperties = repositoryClient.searchProperties( 
                 testFolderUri,  
                 query, 
                 ResourceCollection.DEPTH_INFINITE,  
                 0,  
                 10,  
                 sortOrder 
             ); 
  
             // Display the resources that were found 
             System.out.println("The following resources were found:"); 
             for (int i = 0; i < listProperties.size(); i++) { 
                 Resource r = (Resource)(listProperties.get(i)); 
                 System.out.println(r.getName()); 
             } 
  
         } catch (Exception e) { 
             System.out.println( 
                 "An exception occurred while attempting to search for resources." + 
                 e.getMessage() 
             ); 
         } 
     } 
 }

快速入门(SOAP模式):使用Java API创建资源之间的关系

以下Java代码示例在AEM Forms存储库中的两个资源之间创建关系。 (请参阅创建资源关系。)

 /* 
     * This Java Quick Start uses the following JAR files 
     * 1. adobe-repository-client.jar 
     * 2. adobe-livecycle-client.jar 
     * 3. adobe-usermanager-client.jar 
     * 4. adobe-utilities.jar 
     * 5. jboss-client.jar (use a different JAR file if the forms server is not deployed 
     * on JBoss) 
     * 6. commons-code-1.3.jar 
     * 7. jacorb.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 8. jnp-client.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 
     * 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 3 JBoss JAR files in your class path 
     * 
     * These JAR files are located in the following path: 
     * <install directory>/sdk/client-libs/common 
     * 
     * The adobe-utilities.jar file is located in the following path: 
     * <install directory>/sdk/client-libs/jboss 
     * 
     * The jboss-client.jar file is located in the following path: 
     * <install directory>/jboss/bin/client 
     * 
     * If you want to invoke a remote forms 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 AEM Forms 
     * 
     * For complete details about the location of the AEM Forms JAR files,  
     * see "Including AEM Forms Java library files" in Programming  
     * with AEM Forms 
     */ 
 import java.util.*; 
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactory; 
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties; 
 import com.adobe.repository.bindings.dsc.client.ResourceRepositoryClient; 
 import com.adobe.repository.infomodel.*; 
 import com.adobe.repository.infomodel.bean.*; 
  
 public class CreateRelationship { 
  
     public static void main(String[] args) { 
  
         // This example creates a relationship between two resources in the AEM Forms repository. 
         // First, two resources are created. 
         // A dependence relationship between the two resources will then be established and verified. 
         try  
         { 
             //Set connection properties required to invoke AEM Forms                                 
             Properties connectionProps = new Properties(); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://[server]:[port]"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);           
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password"); 
              
             // Create the service client factory 
             ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps); 
              
             // Create a ResourceRepositoryClient object using the service client factory 
             ResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(myFactory); 
  
             // Create a RepositoryInfomodelFactoryBean needed for creating resources 
             RepositoryInfomodelFactoryBean repositoryInfomodelFactory = new RepositoryInfomodelFactoryBean(null); 
  
             // Specify the URI of the target folder for writing the resource 
             String testFolderUri = "/Applications/FormsApplication/1.0/FormsFolder"; 
  
             // Create the resources to be written to the folder 
             Resource testResource1 = repositoryInfomodelFactory.newResource( 
                 new Id(),  
                 new Lid(),  
                 "FormFolderA" 
             ); 
  
             Resource testResource2 = repositoryInfomodelFactory.newResource( 
                 new Id(), 
                 new Lid(), 
                 "FormFolderB" 
             ); 
  
             // Set the resources’ descriptions 
             testResource1.setDescription("test resource1"); 
             testResource2.setDescription("test resource2"); 
  
             // Write the resources to the folder 
             repositoryClient.writeResource(testFolderUri, testResource1); 
             repositoryClient.writeResource(testFolderUri, testResource2); 
  
             // Retrieve the resources’ URIs 
             String resourceUri1 = testFolderUri + "/" + testResource1.getName(); 
             String resourceUri2 = testFolderUri + "/" + testResource2.getName(); 
  
             // Retrieve the resources to verify that they were successfully written 
             Resource r1 = repositoryClient.readResource(resourceUri1); 
             Resource r2 = repositoryClient.readResource(resourceUri2); 
  
             // Create a relationship between the two resources 
             repositoryClient.createRelationship( 
                 resourceUri1,  
                 resourceUri2,  
                 Relation.TYPE_DEPENDANT_OF,  
                 true 
             ); 
  
             // Verify the relationship 
             List relations = repositoryClient.getRelated( 
                 resourceUri1,  
                 true,  
                 Relation.TYPE_DEPENDANT_OF 
             ); 
  
             // Print the relationship 
             for (int i = 0; i < relations.size(); i++) { 
                 Resource r = (Resource)(relations.get(i)); 
                 System.out.println("Related resource: " + r.getName()); 
             } 
  
         } catch (Exception e) { 
             System.out.println( 
                 "Exception thrown while trying to create the relationship" + 
                 e.getMessage() 
             ); 
         } 
     } 
 }

快速入门(SOAP模式):使用Java API锁定资源

以下Java代码示例锁定/Applications/FormsApplication/1.0/FormsFolder/Loan.xdp。 (请参阅锁定资源。)

 /* 
     * This Java Quick Start uses the following JAR files 
     * 1. adobe-repository-client.jar 
     * 2. adobe-livecycle-client.jar 
     * 3. adobe-usermanager-client.jar 
     * 4. adobe-utilities.jar 
     * 5. jboss-client.jar (use a different JAR file if the forms server is not deployed 
     * on JBoss) 
     * 6. commons-code-1.3.jar 
     * 7. jacorb.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 8. jnp-client.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 
     * 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 3 JBoss JAR files in your class path 
     * 
     * These JAR files are located in the following path: 
     * <install directory>/sdk/client-libs/common 
     * 
     * The adobe-utilities.jar file is located in the following path: 
     * <install directory>/sdk/client-libs/jboss 
     * 
     * The jboss-client.jar file is located in the following path: 
     * <install directory>/jboss/bin/client 
     * 
     * If you want to invoke a remote forms 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 AEM Forms 
     * 
     * For complete details about the location of the AEM Forms JAR files,  
     * see "Including AEM Forms Java library files" in Programming  
     * with AEM Forms 
     */ 
 import java.util.*; 
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactory; 
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties; 
 import com.adobe.repository.bindings.dsc.client.ResourceRepositoryClient; 
 import com.adobe.repository.infomodel.bean.*; 
  
 public class LockFile { 
  
     public static void main(String[] args) { 
  
         // This example will lock and unlock a resource in the AEM Forms repository. 
         try { 
             //Set connection properties required to invoke AEM Forms                                  
             Properties connectionProps = new Properties(); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://[server]:[port]"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);           
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password"); 
              
             // Create the service client factory 
             ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps); 
  
             // Create a ResourceRepositoryClient object using the service client factory 
             ResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(myFactory); 
  
             // Specify the URI of the resource to lock 
             String resourceUri = "/Applications/FormsApplication/1.0/FormsFolder/Loan.xdp"; 
  
             // Lock the resource 
             repositoryClient.lockResource( 
                 resourceUri, 
                 Lock.SCOPE_EXCLUSIVE, 
                 Lock.DEPTH_ZERO 
             ); 
  
             // Retrieve the locks on the resource 
             List locks = repositoryClient.getLocks(resourceUri); 
  
             // Print out the locks for the resource 
             System.out.println("The following locks now exist for the resource:"); 
             for (int i = 0; i < locks.size(); i++) { 
                 Lock l = (Lock)(locks.get(i)); 
                 System.out.println( 
                     "Lock owner: " + 
                     l.getOwnerUserId() + 
                     "  Lock depth: " + 
                     l.getDepth() + 
                     " Lock scope: " + 
                     l.getType() 
                 ); 
             } 
  
             // Unlock the resource 
             String lockToken = repositoryClient.unlockResource(resourceUri); 
  
         } catch (Exception e) { 
             System.out.println( 
                 "Exception thrown while trying to lock the file" + 
                 e.getMessage() 
             ); 
         } 
     } 
 }

快速入门(SOAP模式):使用Java API管理访问控制列表

以下Java代码示例在存储库中读取并创建访问控制列表(ACL)。

 /* 
     * This Java Quick Start uses the following JAR files 
     * 1. adobe-repository-client.jar 
     * 2. adobe-livecycle-client.jar 
     * 3. adobe-usermanager-client.jar 
     * 4. adobe-utilities.jar 
     * 5. jboss-client.jar (use a different JAR file if the forms server is not deployed 
     * on JBoss) 
     * 6. commons-code-1.3.jar 
     * 7. jacorb.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 8. jnp-client.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 
     * 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 3 JBoss JAR files in your class path 
     * 
     * These JAR files are located in the following path: 
     * <install directory>/sdk/client-libs/common 
     * 
     * The adobe-utilities.jar file is located in the following path: 
     * <install directory>/sdk/client-libs/jboss 
     * 
     * The jboss-client.jar file is located in the following path: 
     * <install directory>/jboss/bin/client 
     * 
     * If you want to invoke a remote forms 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 AEM Forms 
     * 
     * For complete details about the location of the AEM Forms JAR files,  
     * see "Including AEM Forms Java library files" in Programming  
     * with AEM Forms 
     */ 
 import java.util.*; 
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactory; 
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties; 
 import com.adobe.repository.bindings.dsc.client.ResourceRepositoryClient; 
 import com.adobe.repository.infomodel.bean.*; 
  
 public class UseACL { 
  
     public static void main(String[] args) { 
  
         // This example will read and create access control lists for resources in the AEM Forms repository. 
         try { 
             //Set connection properties required to invoke AEM Forms                                 
             Properties connectionProps = new Properties(); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://[server]:[port]"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);           
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password"); 
  
             // Create the service client factory 
             ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps); 
  
             // Create a ResourceRepositoryClient object using the service client factory 
             ResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(myFactory); 
  
             // Specify the URI of the resource to be used 
             String resourceUri = "/Applications/FormsApplication"; 
  
             // Retrieve the access control list for the resource 
             AccessControlList acl = repositoryClient.readAccessControlList(resourceUri); 
  
             // Retrieve a list of the users having access permissions 
             List users = acl.getUsersWithPermissions(); 
  
             // Print out the list of users 
             System.out.println("The following users have permissions:"); 
             for (int i = 0; i < users.size(); i++) { 
                 String user = (String)(users.get(i)); 
                 System.out.println("User identifier: " + user); 
             } 
  
             // Set up a new access control list 
             acl = new AccessControlList(); 
  
             // Retrieve a user identifier to be used in the access control list 
             String userId = (String)(users.get(0)); 
  
             // Create traversal permissions for the user 
             List permissions = new ArrayList(); 
             permissions.add(AccessControlEntry.READ_METADATA_USER_PERM); 
             permissions.add(AccessControlEntry.READ_CONTENT_USER_PERM); 
             acl.setPermissionsForUser(userId, permissions); 
  
             // Set the access control list for the folder 
             repositoryClient.writeAccessControlList(resourceUri, acl, true); 
  
             // Print out confirmation message 
             System.out.println("User " + userId + " has traversal permissions for the folder"); 
  
         } catch (Exception e) { 
             System.out.println( 
                 "Exception thrown while trying to manage access control lists" + 
                 e.getMessage() 
             ); 
         } 
     } 
 }

快速入门(SOAP模式):使用Java API删除资源

以下Java代码示例从Applications/FormsApplication/1.0/FormsFolder中删除Loan.xdp。 如果此XDP文件不在此文件夹中,则会引发异常。 (请参阅删除资源。)

 /* 
     * This Java Quick Start uses the following JAR files 
     * 1. adobe-repository-client.jar 
     * 2. adobe-livecycle-client.jar 
     * 3. adobe-usermanager-client.jar 
     * 4. adobe-utilities.jar 
     * 5. jboss-client.jar (use a different JAR file if the forms server is not deployed 
     * on JBoss) 
     * 6. commons-code-1.3.jar 
     * 7. jacorb.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 8. jnp-client.jar (use a different JAR file if the forms server is not deployed on JBoss) 
     * 
     * 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 3 JBoss JAR files in your class path 
     * 
     * These JAR files are located in the following path: 
     * <install directory>/sdk/client-libs/common 
     * 
     * The adobe-utilities.jar file is located in the following path: 
     * <install directory>/sdk/client-libs/jboss 
     * 
     * The jboss-client.jar file is located in the following path: 
     * <install directory>/jboss/bin/client 
     * 
     * If you want to invoke a remote forms 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 AEM Forms 
     * 
     * For complete details about the location of the AEM Forms JAR files,  
     * see "Including AEM Forms Java library files" in Programming  
     * with AEM Forms 
     */ 
 import java.util.*; 
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactory; 
 import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties; 
 import com.adobe.repository.bindings.dsc.client.ResourceRepositoryClient; 
 import com.adobe.repository.infomodel.*; 
 import com.adobe.repository.infomodel.bean.*; 
 import com.adobe.repository.RepositoryException; 
 import com.adobe.idp.Document; 
  
  
 // This quick start deletes Loan.xdp from Applications/FormsApplication/1.0/FormsFolder 
 //If this XDP is not located in this folder, an exception is thrown 
 //Ensure that you create a AEM Forms application named FormsApplication using Workbench 
 public class DeleteResource { 
  
     public static void main(String[] args) { 
  
         try  
         { 
             //Set connection properties required to invoke AEM Forms                                 
             Properties connectionProps = new Properties(); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "https://[server]:[port]"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);           
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator"); 
             connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password"); 
                          
             // Create the service client factory 
             ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps); 
              
             // Create a ResourceRepositoryClient object using the service client factory 
             ResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(myFactory); 
  
             // Create a RepositoryInfomodelFactoryBean needed for creating resources 
             RepositoryInfomodelFactoryBean repositoryInfomodelFactory = new RepositoryInfomodelFactoryBean(null); 
  
             // Specify the URI of the target folder from which the resource is deleted 
             String testFolderUri = "/Applications/FormsApplication/1.0/FormsFolder"; 
  
             // Create the resource to be written to the folder 
             Resource testResource = repositoryInfomodelFactory.newResource( 
                 new Id(),  
                 new Lid(),  
                 "Loan.xdp" 
             ); 
  
             // Retrieve the resource’s URI 
             String resourceUri = testFolderUri + "/" + testResource.getName(); 
  
             // Retrieve the resource to verify that it exists 
             Resource r = repositoryClient.readResource(resourceUri); 
  
             // Print the resource verification message 
             System.out.println(r.getName() +" is about to be deleted"); 
  
             // Delete the resource 
             repositoryClient.deleteResource(resourceUri); 
  
         } catch (Exception e) { 
             System.out.println( 
                 "Exception thrown while trying to delete the resource" + 
                 e.getMessage() 
             ); 
         } 
     } 
 } 
  
 

在此页面上