Adobe Experience Manager (AEM) LiveCycle Connector を使用し、AEM Web アプリとワークフローから Adobe LiveCycle ES4 Document Services を呼び出すことができます。LiveCycle はリッチクライアント SDK を提供します。これにより、クライアントアプリケーションは Java API を使用して LiveCycle サービスを開始します。AEM LiveCycle Connector は OSGi 環境でこれらの API の使用を簡素化します。
AEM LiveCycle Connector は「AEM Forms アドオンパッケージ」の一部です。AEM Forms アドオンパッケージをインストールしたら、次の手順を実行して、LiveCycle サーバーの詳細を AEM Web Console に追加します。
プロパティは説明がなくても分かりますが、重要なプロパティは次のとおりです。
サーバー URL - LiveCycle Server への URL を指定します。LiveCycle と AEM の間で HTTPS を経由して通信する場合、次の JVM で AEM を起動
argument
-Djavax.net.ssl.trustStore=<<em>path to LC keystore</em>>
option.
ユーザー名 - AEM と LiveCycle 間の通信を確立するのに使用するアカウントのユーザー名を指定します。アカウントは、Document Services の開始を許可されている LiveCycle ユーザーアカウントです。
パスワード - パスワードを指定します。
サービス名 - 「Username」と「Password」フィールドで入力するユーザー資格情報を使用して開始されるサービスを指定します。デフォルトでは、LiveCycle サービスを開始する間に資格情報は渡されません。
クライアントアプリケーションは、Java API、 Web サービス、Remoting、REST を使用して LiveCycle サービスをプログラムで開始することができます。Java クライアントの場合、アプリケーションは LiveCycle SDK を使用できます。LiveCycle SDK は、これらのサービスをリモートで開始する Java API を提供します。例えば、Microsoft Word ドキュメントを PDF に変換するには、クライアントは GeneratePDFService を開始します。呼び出しのフローは次の手順から成ります。
AEM LiveCycle Connector は、標準的な OSGi の方法を使ってアクセスできる OSGi サービスとしてこれらのクライアントインスタンスを公開して、フローを簡素化します。LiveCycle コネクターには、以下の機能が用意されています。
公開されたサービスを AEM の中から開始するには、次の手順を実行します。
Maven 依存性を判定します。maven pom.xml ファイルで、必要なクライアント jar に依存性を追加します。少なくとも adobe-livecycle-client jar および adobe-usermanager-client jar に依存性を追加する必要があります。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-livecycle-client</artifactId>
<version>11.0.0</version>
</dependency>
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-usermanager-client</artifactId>
<version>11.0.0</version>
</dependency>
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-cq-integration-api</artifactId>
<version>11.0.0</version>
</dependency>
サービスを開始するには、サービスに対応する Maven 依存性を追加します。依存性のリストについて詳しくは、「Document Service リスト」を参照してください。例えば、Generate PDF サービスの場合は、次の依存関係を追加します。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-generatepdf-client</artifactId>
<version>11.0.0</version>
</dependency>
サービス参照を取得します。サービスインスタンスへのハンドルを取得します。Java クラスを作成している場合、Declarative Services の注釈を使用できます。
import com.adobe.livecycle.generatepdf.client.GeneratePdfServiceClient;
import com.adobe.livecycle.generatepdf.client.CreatePDFResult;
import com.adobe.idp.Document;
@Reference
GeneratePdfServiceClient generatePDF;
...
Resource r = resourceResolver.getResource("/path/tp/docx");
Document sourceDoc = new Document(r.adaptTo(InputStream.class));
CreatePDFResult result = generatePDF.createPDF2(
sourceDoc,
extension, //inputFileExtension
null, //fileTypeSettings
null, //pdfSettings
null, //securitySettings
settingsDoc, //settingsDoc
null //xmpDoc
);
上記のコードスニペットでは、ドキュメントを PDF に変換するために GeneratePdfServiceClient の createPDF API を開始します。次のコードを使用し、JSP で同じ呼び出しを実行できます。主な違いは、次のコードでは Sling ScriptHelper を使用して GeneratePdfServiceClient にアクセスする点です。
<%@ page import="com.adobe.livecycle.generatepdf.client.GeneratePdfServiceClient" %>
<%@ page import="com.adobe.livecycle.generatepdf.client.CreatePDFResult" %>
<%@ page import="com.adobe.idp.Document" %>
GeneratePdfServiceClient generatePDF = sling.getService(GeneratePdfServiceClient.class);
Document sourceDoc = ...
CreatePDFResult result = generatePDF.createPDF2(
sourceDoc,
extension, //inputFileExtension
null, //fileTypeSettings
null, //pdfSettings
null, //securitySettings
settingsDoc, //settingsDoc
null //xmpDoc
);
ServiceClientFactory クラスが必要になる場合があります。例えば、プロセスを呼び出すには ServiceClientFactory が必要です。
import com.adobe.livecycle.dsc.clientsdk.ServiceClientFactoryProvider;
import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
@Reference
ServiceClientFactoryProvider scfProvider;
...
ServiceClientFactory scf = scfProvider.getDefaultServiceClientFactory();
...
LiveCycle のほとんどの Document Service には認証が必要です。次のオプションのいずれかを使用すると、コードに資格情報を明示的に指定せずにこれらのサービスを開始できます。
LiveCycle Client SDK 設定には、サービス名についての設定が含まれています。この設定は、呼び出しロジックが追加設定なしに管理者資格情報を使用するサービスのリストです。例えば、DirectoryManager サービス(User Management API の一部)をこのリストに追加する場合、すべてのクライアントコードはこのサービスを直接使用することが可能で、呼び出しレイヤーは LiveCycle サーバーに送信された要求の一部として、設定された資格情報を自動的に渡します。
統合の一部として、新しいサービス RunAsManager を提供しています。このサービスにより、LiveCycle サーバーへの呼び出しをする際に、資格情報をプログラムで制御できます。
import com.adobe.livecycle.dsc.clientsdk.security.PasswordCredential;
import com.adobe.livecycle.dsc.clientsdk.security.PrivilegedAction;
import com.adobe.livecycle.dsc.clientsdk.security.RunAsManager;
import com.adobe.idp.dsc.registry.component.ComponentRegistry;
@Reference
private RunAsManager runAsManager;
List<Component> components = runAsManager.doPrivileged(new PrivilegedAction<List<Component>>() {
public List<Component> run() {
return componentRegistry.getComponents();
}
});
assertNotNull(components);
異なる資格情報を渡す場合は、PasswordCredential インスタンスが必要となる、過度に負荷がかかる方法を使用できます。
PasswordCredential credential = new PasswordCredential("administrator","password");
List<Component> components = runAsManager.doPrivileged(new PrivilegedAction<List<Component>>() {
public List<Component> run() {
return componentRegistry.getComponents();
}
},credential);
プロセスを呼び出す場合、または ServiceClientFactory を直接使用して InvocationRequest を作成する場合は、設定済みの資格情報を呼び出しレイヤーが使用する必要があることをプロパティが示すように指定できます。
import com.adobe.idp.dsc.InvocationResponse
import com.adobe.idp.dsc.InvocationRequest
import com.adobe.livecycle.dsc.clientsdk.ServiceClientFactoryProvider
import com.adobe.idp.dsc.clientsdk.ServiceClientFactory
import com.adobe.livecycle.dsc.clientsdk.InvocationProperties
ServiceClientFactoryProvider scfp = sling.getService(ServiceClientFactoryProvider.class)
ServiceClientFactory serviceClientFactory = scfp.getDefaultServiceClientFactory()
InvocationRequest ir = serviceClientFactory.createInvocationRequest("sample/LetterSubmissionProcess", "invoke", new HashMap(), true);
//Here we are invoking the request with system user
ir.setProperty(InvocationProperties.INVOKER_TYPE,InvocationProperties.INVOKER_TYPE_SYSTEM)
InvocationResponse response = serviceClientFactory.getServiceClient().invoke(ir);
次のサービスを使用できます。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-livecycle-client</artifactId>
<version>11.0.0</version>
</dependency>
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-usermanager-client</artifactId>
<version>11.0.0</version>
</dependency>
次のサービスを使用できます。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-livecycle-cq-integration-api</artifactId>
<version>1.1.10</version>
</dependency>
次のサービスを使用できます。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-taskmanager-client</artifactId>
<version>11.0.0</version>
</dependency>
次のサービスを使用できます。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-workflow-client-sdk</artifactId>
<version>11.0.0</version>
</dependency>
次のサービスを使用できます。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-generatepdf-client</artifactId>
<version>11.0.0</version>
</dependency>
次のサービスを使用できます。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-applicationmanager-client-sdk</artifactId>
<version>11.0.0</version>
</dependency>
次のサービスを使用できます。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-assembler-client</artifactId>
<version>11.0.0</version>
</dependency>
次のサービスを使用できます。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-formdataintegration-client</artifactId>
<version>11.0.0</version>
</dependency>
次のサービスを使用できます。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-forms-client</artifactId>
<version>11.0.0</version>
</dependency>
次のサービスを使用できます。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-output-client</artifactId>
<version>11.0.0</version>
</dependency>
次のサービスを使用できます。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-reader-extensions-client</artifactId>
<version>11.0.0</version>
</dependency>
次のサービスを使用できます。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-rightsmanagement-client</artifactId>
<version>11.0.0</version>
</dependency>
次のサービスを使用できます。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-signatures-client</artifactId>
<version>11.0.0</version>
</dependency>
次のサービスを使用できます。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-truststore-client</artifactId>
<version>11.0.0</version>
</dependency>
次のサービスを使用できます。
<dependency>
<groupId>com.adobe.livecycle</groupId>
<artifactId>adobe-repository-client</artifactId>
<version>11.0.0</version>
</dependency>