Package org.apache.solr.packagemanager
Class PackageManager
- java.lang.Object
-
- org.apache.solr.packagemanager.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.
-
-
Constructor Summary
Constructors Constructor Description PackageManager(org.apache.solr.client.solrj.impl.HttpSolrClient solrClient, String solrBaseUrl, String zkHost)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
deploy(String packageName, String version, String[] collections, boolean shouldInstallClusterPlugins, String[] parameters, boolean isUpdate, boolean noprompt)
Deploys a version of a package to a list of collections.List<SolrPackageInstance>
fetchInstalledPackageInstances()
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 bePackageLoader.LATEST
)SolrPackageInstance
getPackageInstance(String packageName, String version)
Get the installed instance of a specific version of a package.Map<String,SolrPackageInstance>
getPackagesDeployed(String collection)
Map<String,SolrPackageInstance>
getPackagesDeployedAsClusterLevelPlugins()
Get a map of packages (key: package name, value: package instance) that have their plugins deployed as cluster level plugins.void
undeploy(String packageName, String[] collections, boolean shouldUndeployClusterPlugins)
Undeploys a package from given collections.void
uninstall(String packageName, String version)
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.
-
-
-
Method Detail
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
fetchInstalledPackageInstances
public List<SolrPackageInstance> fetchInstalledPackageInstances() throws org.apache.solr.common.SolrException
- Throws:
org.apache.solr.common.SolrException
-
getPackagesDeployed
public Map<String,SolrPackageInstance> getPackagesDeployed(String collection)
-
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 org.apache.solr.common.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:
org.apache.solr.common.SolrException
-
undeploy
public void undeploy(String packageName, String[] collections, boolean shouldUndeployClusterPlugins) throws org.apache.solr.common.SolrException
Undeploys a package from given collections.- Throws:
org.apache.solr.common.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 bePackageLoader.LATEST
)
-
-