Pepper  3.6.0
A highly extensible plattform for conversion and manipulationoflinguisticdata.
org.corpus_tools.pepper.connectors.impl.MavenAccessor Class Reference

How does this class work? One elementary part is the dependency blacklist. More...

Public Member Functions

 MavenAccessor (PepperOSGiConnector pepperOSGiConnector)
 
boolean update (String groupId, String artifactId, String repositoryUrl, boolean isSnapshot, boolean ignoreFrameworkVersion, Bundle installedBundle)
 This method checks the provided pepper plugin for updates and triggers the installation process if a newer version is available.
 
String getBlacklist ()
 
String printDependencies (String groupId, String artifactId, String version, String repositoryUrl)
 This method starts invokes the computation of the dependency tree. More...
 

Static Public Attributes

static final String ARTIFACT_ID_PEPPER_FRAMEWORK = "pepper-framework"
 this String contains the artifactId of pepper-framework.
 
static final String ARTIFACT_ID_PEPPER_PARENT = "pepper-parentModule"
 this String contains the artifactId of pepper-parentModule.
 
static final String KORPLING_MAVEN_REPO = "https://korpling.german.hu-berlin.de/maven2/"
 path to korpling maven repo
 
static final String CENTRAL_REPO = "https://repo1.maven.org/maven2/"
 path to maven central
 
static final String GROUP_ID_PEPPER = "org.corpus_tools.pepper"
 group-id of pepper-framework artifact
 

Protected Member Functions

String printDependencies (Bundle bundle)
 This method tries to determine maven project coordinates from a bundle id to invoke printDependencies(String, String, String, String).
 

Detailed Description

How does this class work? One elementary part is the dependency blacklist.

It stores maven artifact strings in this scheme:

groupId:artifactId:extension:version:STATUS

The status can be either FINAL or OVERRIDABLE. FINAL are only dependencies of pepper framework. These dependencies cannot be overriden by newer versions, whilest dependencies with STATUS OVERRIDABLE can. Dependencies of pepper plugins will be OVERRIDABLE, more details follow. *

On the first run of pepper, the dependency blacklist is initialized with all dependencies of pepper-parent (includes dependencies of pepper-framework) with STATUS FINAL, since there is no dependency black list file yet (and it HAS to be like that – another option would be an empty black list file – but the assembly should never be allowed to include blacklist.cfg).

The dependency blacklist itself contains all dependencies, which are not supposed to be installed (e.g. dependencies with scope "provided" and already installed dependencies). When update() terminates, this list is saved to the blacklist.cfg, which is loaded on every start-up of pepper.

The core functionality of this class is to perform an update for a specified pepper plugin, when update() is called. The update method uses two elementary methods: getAllDependencies() and cleanDependencies(). First of all, getAllDependencies() returns a list of all dependencies of the provided artifact recursively and breadth first. Only dependencies with scope "test" and dependencies found on the blacklist are fully skipped, dependencies with scope "provided" are written to the blacklist (OVERRIDABLE), because another plugin might be interested in installing it. But since another plugin already "knows", that this dependency is provided, there is no need to install it (it can be even dangerous). All Salt dependencies (salt-saltX itself) are dropped itself and their children. Pepper-framework is put on the dependency list, but it's children are dropped. This is necessary to ensure we can determine the pepper version the plugin was developed for. After having collected all dependencies, they have to be cleaned, because we still have dependencies which are provided (but scope="compile") by the system (e.g. OSGi and EMF dependencies). These are actually dependencies of pepper-Parent which are inherited as direct dependencies. To deal with that, cleanDependencies() collects all dependencies of pepper-Parent (version determined with pepper-framework dependency) and strikes them off the list. One little detail: getAllDependencies() is version sensitive. cleanDependencies() doesn't have to be.

Member Function Documentation

◆ getBlacklist()

String org.corpus_tools.pepper.connectors.impl.MavenAccessor.getBlacklist ( )
Returns
the Blacklist of already installed or forbidden dependencies

◆ printDependencies()

String org.corpus_tools.pepper.connectors.impl.MavenAccessor.printDependencies ( String  groupId,
String  artifactId,
String  version,
String  repositoryUrl 
)

This method starts invokes the computation of the dependency tree.

If no version is provided, the highest version in the specified maven repository is used. If no repository is provided, maven central and the korpling maven repository are used for trial.