Appropiate contents of packages for Vine services

It is not obvious how to organize codes of new Vine Toolkit services. Here are some hints. :)

1. Structure for Vine project services

Root package - /vine/projects/myproject/src/main/java/org/vinetoolkit/myproject/mypackage

Resource Manager interface - /vine/projects/myproject/src/main/java/org/vinetoolkit/myproject/mypackage/MyServiceResourceManager.java

Module interface - /vine/projects/myproject/src/main/java/org/vinetoolkit/myproject/mypackage/spi/MyServiceModule.java

Resource interface - /vine/projects/myproject/src/main/java/org/vinetoolkit/myproject/mypackage/spi/impl/MyServiceResource.java
Base resource implementation - /vine/projects/myproject/src/main/java/org/vinetoolkit/myproject/mypackage/spi/impl/BaseMyServiceResource.java

Module implementation - /vine/projects/myproject/src/main/java/org/vinetoolkit/myproject/mypackage/spi/impl/app/MyServiceModuleImpl.java
Resource manager implementation - /vine/projects/myproject/src/main/java/org/vinetoolkit/myproject/mypackage/spi/impl/app/MyServiceResourceManagerImpl.java

2. Structure for core Vine services

Root package - /vine/src/main/java/org/vinetoolkit/mypackage

Resource interface - /vine/src/main/java/org/vinetoolkit/mypackage/MyServiceResource.java
Resource Manager interface - /vine/src/main/java/org/vinetoolkit/mypackage/MyServiceResourceManager.java

Module interface - /vine/src/main/java/org/vinetoolkit/mypackage/spi/MyServiceModule.java

Base resource implementation - /vine/src/main/java/org/vinetoolkit/mypackage/spi/impl/BaseMyServiceResource.java

Module implementation - /vine/src/main/java/org/vinetoolkit/mypackage/spi/impl/app/MyServiceModuleImpl.java
Resource manager implementation - /vine/src/main/java/org/vinetoolkit/mypackage/spi/impl/app/MyServiceResourceManagerImpl.java

3. New mappings should be added to configuration files
ResourceTypes.xml
Resource.hbm.xml
DomainRegistry.xml

4. Registration of services in file
services.txt

5. There are some mappings that should be added to code files. They should appear in implementation files for service resource module and resource manager. The examples presented below assume that MyServiceModuleImpl extends BaseResourceModule and MyServiceResourceManagerImpl extends AbstractService, but obviously it is not obligatory.


@ServiceMapping(key = "MyServiceModule")
public class MyServiceModuleImpl extends BaseResourceModule implements MyServiceModule {
...
}


@ServiceMapping(key="MyServiceResourceManager")
public class MyServiceResourceManagerImpl extends AbstractService implements MyServiceResourceManager {
...
}

Comments

ServiceMapping annotation

Is ServiceMapping annotation neccessary?

ServiceMapping annotation

Its perfectly true. Mappings are necessary. The document has just been updated.

Gosia