Skip to content
Jasper Nalbach edited this page Jul 14, 2017 · 4 revisions

las2peer runs services isolated from each other, which has some benefits:

  • services can use different versions of a library on the same node
  • services do not have access to other services and sensible data on the node
  • compatibility is guaranteed

This allows dynamic service plugging and unplugging. To make use of this feature, service developers have to regard a few points.

Library management in las2peer

las2peer differs between two types of libraries: Platform libraries (Java, las2peer Core, WebConnector, REST-Mapper and dependencies) and service bundles. A service bundle is a fat jar containing the service itself and all libraries used by the service.

To make service bundles 100% compatible with the core, classes are first loaded from the platform libraries (contained in the lib folder). If this fails, las2peer loads classes from a Repository (which is currently a file system repository using the service folder).

Service classes are always overridden by the Platform. As consequence, make sure that no service class is contained in the platform's classpath as this will bypass las2peer's class loading mechanism.

Please note that service bundles are completely isolated from each other. A service cannot access another service bundle's class. In particular static classes cannot be shared between bundles, because each bundle loads each class using the bundle's class loader. Service-to-service communication can only be realized using Remote Method Invocation.

Maintaining the file system repository

All services in the service folder should follow the naming scheme service.package-major.minor.sub-build where minor, sub and build are optional.

Configuring the build script

The Template Project's build script puts the platform into the lib folder and additional service dependencies into the servicebundle folder. To add new service dependencies, open the etc/ivy/ivy.xml and add a dependency as follows:

<dependency org="org.apache.commons" name="commons-dbcp2" rev="2.0" conf="bundle->default" />

Each dependency having bundle->default as configuration attribute will be downloaded into the service folder; also its dependencies configured for the default configuration will be downloaded into the same directory as well.

Building a fat jar

The Templace Project's build script will build the service and bundle all dependencies specified as bundle dependency into the jar.

Please note that las2peer allows only one service per jar file.

Adding dependencies in Eclipse

After running ant get_deps, refresh your project in Eclipse and go to the lib/servicebundle folder right click on a library and choose Build Path -> Add to Build Path. Only add the platform and service dependencies here, do not add other services!

Clone this wiki locally