1.2.2. Configuration file

Warning

You are looking at documentation for an older release. Not what you want? See the current release documentation.

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, then open /conf/portal/configuration.xml inside this jar. You will see:


<component>
<key>org.exoplatform.services.cache.CacheService</key> 
<type>org.exoplatform.services.cache.impl.CacheServiceImpl</type> 
...

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. 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