1.2.2. Configuration file

The Jar file of a service should contain a default configuration, you find this configuration in the configuration.xml file which comes with the Jar. A configuration file can specify several services, as well as there can be several services in one Jar file.

For example, open the exo.kernel.component.cache-x.x.x.jar file. Inside this Jar, open /conf/portal/configuration.xml. You will see:


Here you will note that a service is specified between the <component> tags. Each service has got a key, which defines the kind of service. As you imagine the content of the <key> tag matches the qualified Java interface name (org.exoplatform.services.cache.CacheService) of the service. The specific implementation class of the CacheService is defined in the <type> tag.

Parameters You have already opened some configuration files and seen that there are more than just <key> and <type> tags. You can provide your service with init parameters. The parameters can be simple parameters, properties, or object-params. There are also plugins and they are special because the container calls the setters of your service in order to inject your plugin in your service (called setter injection) see Service configuration in detail. In general your service is free to use init parameters, they are not required.

If you ever need to create your own service, the minimum is to create an empty interface, an empty class and a constructor for your class - that's all. Ok, you also should put your class and the interface in a Jar file and add a default configuration file.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus