Module SDK

Module generation

A new module can be generated using the maven archetype command. Generated modules follow maven conventions for code and resource file locations.

mvn archetype:generate -DarchetypeGroupId=com.attivio.platform.archetypes -DarchetypeArtifactId=attivio-archetype-module -DarchetypeVersion=5.2.6.6

This interactive command asks for a few parameters to drive the creation of the module:

Building the module

The generated module can be built without any changes. It includes working components and tests. Enter the module directory and run mvn:

mvn clean install

This will create a new jar in the target directory of your module.

Using your new module

Modules can be added to your Attivio installation (in which case the must be installed on every Attivio host) or added to projects which wish to use them. To create a project with your new module without installing it, supply the jar to the createproject command as if it were a module name:

createproject -n project-name -m module-dir/target/module-name-1.0-SNAPSHOT.jar

To add your module to your installation, the module zip from the target directory should be installed by running aie-exec com.attivio.app.config.modules.ModulesManager. This program can list, install, and remove add-on modules. Use of the moduleManager requires 5.2.6 patch level 191 or greater.

Module resources

src/main/resources $ tree
.
├── attivio.module.json
├── module-name
│   ├── beans.xml
│   ├── features.xml
│   ├── module.xml
│   └── module-name.properties
└── webapps
    └── module-name
        └── WEB-INF
            ├── classes
            │   └── templates
            │       └── module-name.vm
            └── web.xml

The attivio.module.json file

The attivio.module.json file is located in a module's src/main/resources directory. This file contains metadata about the module, including a description and declaration of the module's components, executables, and connectors. Module metadata is also used during the module installation process to add and remove files to the Attivio installation. The minimum metadata file is:

{
  "name" : "module-name"
}

Format

Example

attivio.module.json
{
  "name":"cloudera-5.10.1",
  "moduleVersion":"1.0.0",
  "requiredPlatformVersion":">=5.2.6",
  "minimumPatchLevel":0,
  "description":"Replaces default Hadoop libraries with Cloudera 5.10.1 version",
  "filesToDelete":[
    "lib/hadoop-annotations-2.7.2.jar",
    "lib/hadoop-annotations-2.7.3.jar"
  ],
  "newFiles":{
    "lib/hadoop-annotations.jar":"lib/hadoop-annotations-2.6.0-cdh5.10.1.jar"
  }
}

This defines the following module configuration:

  • This module will supply a new version of the hadoop-annotation jar, by creating a softlink from ATTIVIO_HOME/lib/hadoop-annotations.jar to ATTIVIO_HOME/modules/cloudera-5.10.1/lib/hadoop-annotations-2.6.0-cdh5.10.1.jar.

  • Files ATTIVIO_HOME/lib/hadoop-annotations-2.7.2.jar and ATTIVIO_HOME/lib/hadoop-annotations-2.7.3.jar will be moved to a backup directory for later restoration if they exist.

  • This module does not care about patch level, but does require that the Attivio version is 5.2.6 or later.

Last updated