Class MavenAccessor


  • public class MavenAccessor
    extends Object
    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.
    • Field Detail

      • ARTIFACT_ID_PEPPER_FRAMEWORK

        public static final String ARTIFACT_ID_PEPPER_FRAMEWORK
        this String contains the artifactId of pepper-framework.
        See Also:
        Constant Field Values
      • ARTIFACT_ID_PEPPER_PARENT

        public static final String ARTIFACT_ID_PEPPER_PARENT
        this String contains the artifactId of pepper-parentModule.
        See Also:
        Constant Field Values
    • Method Detail

      • update

        public boolean update​(String groupId,
                              String artifactId,
                              String repositoryUrl,
                              boolean isSnapshot,
                              boolean ignoreFrameworkVersion,
                              org.osgi.framework.Bundle installedBundle)
        This method checks the provided pepper plugin for updates and triggers the installation process if a newer version is available
      • getBlacklist

        public String getBlacklist()
      • printDependencies

        public String 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.