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.
注意: You cannot modify service configuration values
by using web services.
Summary of stepsTo modify a service’s configuration values, perform the
following tasks:
Include project files.
Create a ServiceRegistryClient API object
Reference a service to modify.
Modify the services configuration values.
Verify the configuration values.
Include project filesInclude 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 objectBefore you can programmatically
perform a service registry operation, you must create a ServiceRegistryClient object.
Reference a service to modifyTo 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 valuesTo deploy a component, install it
first. When it is installed, the component is in a stopped state.
Verify the configuration valuesStart 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 APIModify a service’s configuration values by using the Java
API:
Include project files
Include client JAR files,
such as adobe-livecycle-client.jar, in your Java project’s class
path.
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.
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.
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:
Invoke the ServiceRegistryClient object’s modifyConfiguration method
and pass the ModifyServiceConfigurationInfo object.
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.
|
|
|