Class PackageManager

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class PackageManager
    extends Object
    implements Closeable
    Handles most of the management of packages that are already installed in Solr.
    • Method Detail

      • uninstall

        public void uninstall​(String packageName,
                              String version)
      • getPackagesDeployedAsClusterLevelPlugins

        public Map<String,​SolrPackageInstance> getPackagesDeployedAsClusterLevelPlugins()
        Get a map of packages (key: package name, value: package instance) that have their plugins deployed as cluster level plugins. The returned packages also contain the "pluginMeta" from "clusterprops.json" as custom data.
      • verify

        public boolean verify​(SolrPackageInstance pkg,
                              List<String> collections,
                              boolean shouldDeployClusterPlugins,
                              String[] overrides)
        Given a package and list of collections, verify if the package is installed in those collections. It uses the verify command of every plugin in the package (if defined).
        Parameters:
        overrides - are needed only when shouldDeployClusterPlugins is true, since collection level plugins will get their overrides from ZK (collection params API)
      • getPackageInstance

        public SolrPackageInstance getPackageInstance​(String packageName,
                                                      String version)
        Get the installed instance of a specific version of a package. If version is null, PackageUtils.LATEST or PackagePluginHolder.LATEST, then it returns the highest version available in the system for the package.
      • deploy

        public void deploy​(String packageName,
                           String version,
                           String[] collections,
                           boolean shouldInstallClusterPlugins,
                           String[] parameters,
                           boolean isUpdate,
                           boolean noprompt)
                    throws SolrException
        Deploys a version of a package to a list of collections.
        Parameters:
        version - If null, the most recent version is deployed. EXPERT FEATURE: If version is PackageUtils.LATEST, this collection will be auto updated whenever a newer version of this package is installed.
        isUpdate - Is this a fresh deployment or is it an update (i.e. there is already a version of this package deployed on this collection)
        noprompt - If true, don't prompt before executing setup commands.
        Throws:
        SolrException
      • undeploy

        public void undeploy​(String packageName,
                             String[] collections,
                             boolean shouldUndeployClusterPlugins)
                      throws SolrException
        Undeploys a package from given collections.
        Throws:
        SolrException
      • getDeployedCollections

        public Map<String,​String> getDeployedCollections​(String packageName)
        Given a package, return a map of collections where this package is installed to the installed version (which can be PackageLoader.LATEST)