Factory Configurations

Configurations supporting multiple entries are called factory configurations.

If a service is meant to support factory configurations, its System Settings entry has an ADD button.

Figure 1: If a System Settings entry has an ADD button, its suitable for factory configurations.

Figure 1: If a System Settings entry has an ADD button, it's suitable for factory configurations.

As with single-instance configurations, you can set factory configurations in the System Settings interface (as described in the example above) or via configuration files. Name a standard single-instance configuration file like this:

my.service.ServiceConfiguration.config

If your service supports factory configurations, use the convention of calling the configuration’s first instance -default.config:

my.service.ServiceConfiguration-default.config

The next instance contains a unique subname (something other than default). It’s good practice to use a descriptive name:

my.service.ServiceConfiguration-port9080.config

To follow the CXF Endpoints example described above, if Liferay’s developers had shipped an initial CXF Endpoint .config file with Liferay DXP, it would have been named this:

com.liferay.portal.remote.cxf.common.configuration.CXFEndpointPublisherConfiguration-default.config

If this -default.config configuration specifies a context path for REST web services, and you create another endpoint with a different context path for SOAP web services, your second configuration file could be named:

com.liferay.portal.remote.cxf.common.configuration.CXFEndpointPublisherConfiguration-soap.config

In many cases, configuration files can be used to force a factory configuration scenario, but not all configurations can be used this way. It’s best to stick to the intended use cases. Use System Settings as described above to determine if using factory configurations is a good idea. If not, stick to the single occurrence mode of configuration (specifying only one configuration file for the service).

« Creating Configuration FilesServer Administration »
この記事は役に立ちましたか?
0人中0人がこの記事が役に立ったと言っています