1.2.1. Services

Nearly everything could be considered as a service. To get a better idea, look at the $PLATFORM_TOMCAT_HOME/lib folder where you find all deployed .jar files. For example, see the services for databases and caching:

Of course, there are many more services, and in fact, a lot of these .jar files are services. To find out, open the .jar file, then look for configuration.xml. If you see a file named configuration.xml, you are sure to have found a service.

There are 2 places containing this configuration file, including:

More details about these containers will be described later.

Interface - Implementation

It is important to get the idea that you separate the interface and implementation for a service. That is a good concept to reduce dependencies on specific implementations. This concept is well known for JDBC. If you use the standard JDBC (=interface), you can connect any database (=implementation) to your application. In a similar way, any service at eXo is defined by a Java interface and may have many different implementations. The service implementation is then injected by a container into the application.

Singleton

Each service has to be implemented as a singleton, which means each service is created only once - in one single instance.

Service = Component

You read about services, and think that a service is a large application that does big things. This is not true because a service may be just a little component that reads or transforms a document. The term "component" is often used instead of "service", so bear in mind that a service and a component can safely be considered to be the same thing.

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