The following Java code example starts a service named
SendEmailService
.
package com.adobe.sample.servicemanager;
/**
* This Java Quick Start uses the following JAR files:
* 1. adobe-livecycle-client.jar
* 2. adobe-usermanager-client.jar
* 3. adobe-workflow-client-sdk.jar
* 4. adobe-utilities.jar
* 5. jboss-client.jar (use a different JAR file if AEM Forms is not deployed on Jboss)
* 6. jacorb.jar (use a different JAR file if the forms server is not deployed on JBoss)
* 7. jnp-client.jar (use a different JAR file if the forms server is not deployed on JBoss)
*/
import java.util.*;
import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
import com.adobe.idp.dsc.registry.infomodel.ServiceConfiguration;
import com.adobe.idp.dsc.registry.service.client.ServiceRegistryClient;
public class StartService {
public static void main(String[] args) {
try{
//Set connection properties required to invoke AEM Forms
Properties ConnectionProps = new Properties();
ConnectionProps.setProperty("DSC_DEFAULT_SOAP_ENDPOINT", "jnp://[server]:[port]");
ConnectionProps.setProperty("DSC_TRANSPORT_PROTOCOL","SOAP");
ConnectionProps.setProperty("DSC_SERVER_TYPE", "JBoss");
ConnectionProps.setProperty("DSC_CREDENTIAL_USERNAME", "administrator");
ConnectionProps.setProperty("DSC_CREDENTIAL_PASSWORD", "password");
//Create a ServiceClientFactory object
ServiceClientFactory myFactory = ServiceClientFactory.createInstance(ConnectionProps);
//Create a ServiceRegistryClient object
ServiceRegistryClient serviceReg = new ServiceRegistryClient(myFactory);
//Reference the SendEmailService
ServiceConfiguration myServiceConfig = serviceReg.getHeadActiveConfiguration("SendEmailService");
//Start the SendEmailService
serviceReg.start(myServiceConfig);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
|
|
|