Package org.apache.solr.packagemanager
Class PackageUtils
java.lang.Object
org.apache.solr.packagemanager.PackageUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SolrPackage.ManifestfetchManifest(org.apache.solr.client.solrj.SolrClient solrClient, String manifestFilePath, String expectedSHA512) Fetches a manifest file from the File Store / Package Store.static voidformat(StringBuilder sb, Object message) static voidformat(StringBuilder sb, String color, Object message) static voidformatGreen(StringBuilder sb, Object message) Console print using green colorstatic StringgetCollectionParamsPath(String collection) static StringgetFileFromJarsAsString(List<Path> jars, String filename) Search through the list of jar files for a given file.static <T> TDownload JSON from a Solr url and deserialize into klass.static StringgetJsonStringFromCollectionApi(org.apache.solr.client.solrj.SolrClient client, String path, org.apache.solr.common.params.SolrParams params) Returns the response of a collection or core API call as string-ified JSONstatic StringgetJsonStringFromNonCollectionApi(org.apache.solr.client.solrj.SolrClient client, String path, org.apache.solr.common.params.SolrParams params) Returns the response of a collection-agnostic API call as string-ified JSONstatic com.fasterxml.jackson.databind.ObjectMapperstatic com.jayway.jsonpath.Configurationstatic voidpostFile(org.apache.solr.client.solrj.SolrClient client, ByteBuffer buffer, String name, String sig) Uploads a file to the package store / file store of Solr.static voidstatic Stringresolve(String str, Map<String, String> defaults, Map<String, String> overrides, Map<String, String> systemParams) Replace a templatized string with parameter substituted string.static voidstatic String[]validateCollections(String[] collections)
-
Field Details
-
LATEST
Represents a version which denotes the latest version available at the moment. -
PACKAGE_PATH
-
CLUSTER_PLUGINS_PATH
-
REPOSITORIES_ZK_PATH
-
CLUSTERPROPS_PATH
-
-
Constructor Details
-
PackageUtils
public PackageUtils()
-
-
Method Details
-
jsonPathConfiguration
public static com.jayway.jsonpath.Configuration jsonPathConfiguration() -
getMapper
public static com.fasterxml.jackson.databind.ObjectMapper getMapper() -
postFile
public static void postFile(org.apache.solr.client.solrj.SolrClient client, ByteBuffer buffer, String name, String sig) throws org.apache.solr.client.solrj.SolrServerException, IOException Uploads a file to the package store / file store of Solr.- Parameters:
client- A Solr clientbuffer- File contentsname- Name of the file as it will appear in the file store (can be hierarchical)sig- Signature digest (public key should be separately uploaded to ZK)- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
getJson
public static <T> T getJson(org.apache.solr.client.solrj.SolrClient client, String path, Class<T> klass) Download JSON from a Solr url and deserialize into klass. -
getFileFromJarsAsString
Search through the list of jar files for a given file. Returns string of the file contents or null if file wasn't found. This is suitable for looking for manifest or property files within pre-downloaded jar files. Please note that the first instance of the file found is returned. -
getJsonStringFromCollectionApi
public static String getJsonStringFromCollectionApi(org.apache.solr.client.solrj.SolrClient client, String path, org.apache.solr.common.params.SolrParams params) Returns the response of a collection or core API call as string-ified JSON- Parameters:
client- the SolrClient used to make the requestpath- the HTTP path of the Solr API to hit, starting after the collection or core name (i.e. omitting '/solr/techproducts')params- query parameters to include when making the request
-
getJsonStringFromNonCollectionApi
public static String getJsonStringFromNonCollectionApi(org.apache.solr.client.solrj.SolrClient client, String path, org.apache.solr.common.params.SolrParams params) Returns the response of a collection-agnostic API call as string-ified JSON- Parameters:
client- the SolrClient used to make the requestpath- the HTTP path of the Solr API to hit, starting after '/solr' (or '/api' for v2 requests)params- query parameters to include when making the request
-
fetchManifest
public static SolrPackage.Manifest fetchManifest(org.apache.solr.client.solrj.SolrClient solrClient, String manifestFilePath, String expectedSHA512) throws IOException, org.apache.solr.client.solrj.SolrServerException Fetches a manifest file from the File Store / Package Store. A SHA512 check is enforced after fetching.- Throws:
IOExceptionorg.apache.solr.client.solrj.SolrServerException
-
resolve
public static String resolve(String str, Map<String, String> defaults, Map<String, String> overrides, Map<String, String> systemParams) Replace a templatized string with parameter substituted string. First applies the overrides, then defaults and then systemParams. -
formatGreen
Console print using green color -
format
-
print
-
format
-
validateCollections
-
getCollectionParamsPath
-
uploadKey
- Throws:
IOException
-