Modifying Service Configuration Values

You can programmatically modify a service’s configuration values. Configuration values typically do not change during the duration of the service; that is, the value is a constant. For example, consider the sample email component that contains three configuration values:

  • smtpHost: The IP address of the SMTP server that sends email messages

  • smtpUser: The user name that is used to connect to the SMTP server

  • smtpPassword: The corresponding password of the user

This topic discusses how to programmatically modify configuration values that belong to the sample email component. For information about creating the sample email component, see Creating Your First Component.

Note: You cannot modify service configuration values by using web services.

Summary of steps

To modify a service’s configuration values, perform the following tasks:

  1. Include project files.

  2. Create a ServiceRegistryClient API object

  3. Reference a service to modify.

  4. Modify the services configuration values.

  5. Verify the configuration values.

Include project files

Include necessary files into your development project. If you are creating a client application by using Java, include the necessary JAR files. If you are using web services, make sure that you include the proxy files.

Create a ServiceRegistryClient API object

Before you can programmatically perform a service registry operation, you must create a ServiceRegistryClient object.

Reference a service to modify

To programmatically deploy a component, reference the component JAR file. When you reference the JAR file, create a com.adobe.idp.Document object that stores the JAR file. (See Passing data to LiveCycle services using the Java API.)

Modify configuration values

To deploy a component, install it first. When it is installed, the component is in a stopped state.

Verify the configuration values

Start a component to invoke its services. After the component is started, its services must be started as well. (See Starting Services.)

Modify a services configuration values using the Java API

Modify a service’s configuration values by using the Java API:

  1. Include project files

    Include client JAR files, such as adobe-livecycle-client.jar, in your Java project’s class path.

  2. Create a ServiceRegistryClient API object

    • Create a ServiceClientFactory object that contains connection properties.

    • Create a ServiceRegistryClient object by using its constructor and passing a ServiceClientFactory object that contains connection properties.

  3. Reference a service to modify

    Reference the service (whose configuration values to modify) by invoking the ServiceRegistryClient object’s getHeadActiveConfiguration method and passing a string value that specifies the name of the service. If multiple service versions exist, the latest version (referred to as the head version) is returned. This method returns a ServiceConfiguration object that represents the service.

  4. Modify configuration values

    • Create a ModifyServiceConfigurationInfo object by using its constructor.

    • Specify the service (whose configuration values are modified) by invoking the ModifyServiceConfigurationInfo object’s setServiceId method and passing a string value that specifies the service identifier value. You can obtain this value by invoking the ServiceConfiguration object’s getServiceId method.

    • Set the major version of the service by invoking the ModifyServiceConfigurationInfo object’s setMajorVersion method and passing an integer value that specifies the major version.

    • For each configuration value to set, invoke the ModifyServiceConfigurationInfo object’s setConfigParameterAsText method and pass the following string values:

      • A string value that specifies the name of the configuration value

      • A string value that specifies the value of the configuration value

    • Invoke the ServiceRegistryClient object’s modifyConfiguration method and pass the ModifyServiceConfigurationInfo object.

  5. Verify the configuration values

    • Invoke the ServiceRegistryClient object’s getServiceConfiguration method and pass the following parameter values:

      • A string value that specifies the name of the service

      • An integer value that specifies the major version of the service

      • An integer value that specifies the minor version of the service

      The getServiceConfiguration method returns a ServiceConfiguration object.

    • Reference the configuration value whose value you want to verify by invoking the ServiceConfiguration object’s getConfigParameter method and passing a string value that specifies the name of the configuration value. This method returns a ConfigParameter object.

    • Get the configuration value by invoking the ConfigParameter object’s getTextValue method. This method returns the configuration value.

// Ethnio survey code removed