Package org.apache.solr.packagemanager
Class PackageUtils
- java.lang.Object
- 
- org.apache.solr.packagemanager.PackageUtils
 
- 
 public class PackageUtils extends Object 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringBLACKstatic StringBLUEstatic StringCLUSTER_PLUGINS_PATHstatic StringCLUSTERPROPS_PATHstatic StringCYANstatic StringGREENstatic StringLATESTRepresents a version which denotes the latest version available at the moment.static StringPACKAGE_PATHstatic StringPURPLEstatic StringREDstatic StringREPOSITORIES_ZK_PATHstatic StringWHITEstatic StringYELLOW
 - 
Constructor SummaryConstructors Constructor Description PackageUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static SolrPackage.ManifestfetchManifest(org.apache.solr.client.solrj.SolrClient solrClient, String manifestFilePath, String expectedSHA512)Fetches a manifest file from the File Store / Package Store.static StringgetCollectionParamsPath(String collection)static StringgetFileFromJarsAsString(List<Path> jars, String filename)Search through the list of jar files for a given file.static <T> TgetJson(org.apache.solr.client.solrj.SolrClient client, String path, Class<T> klass)Download JSON from a Solr url and deserialize into klass.static StringgetJsonStringFromUrl(org.apache.solr.client.solrj.SolrClient client, String path, org.apache.solr.common.params.SolrParams params)Returns JSON string from a given Solr URLstatic com.fasterxml.jackson.databind.ObjectMappergetMapper()static com.jayway.jsonpath.ConfigurationjsonPathConfiguration()static 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 voidprint(Object message)static voidprint(String color, Object message)static voidprintGreen(Object message)Console print using green colorstatic voidprintRed(Object message)Console print using red colorstatic Stringresolve(String str, Map<String,String> defaults, Map<String,String> overrides, Map<String,String> systemParams)Replace a templatized string with parameter substituted string.static voiduploadKey(byte[] bytes, String path, Path home)static String[]validateCollections(String[] collections)
 
- 
- 
- 
Field Detail- 
LATESTpublic static String LATEST Represents a version which denotes the latest version available at the moment.
 - 
PACKAGE_PATHpublic static String PACKAGE_PATH 
 - 
CLUSTER_PLUGINS_PATHpublic static String CLUSTER_PLUGINS_PATH 
 - 
REPOSITORIES_ZK_PATHpublic static String REPOSITORIES_ZK_PATH 
 - 
CLUSTERPROPS_PATHpublic static String CLUSTERPROPS_PATH 
 - 
BLACKpublic static String BLACK 
 - 
REDpublic static String RED 
 - 
GREENpublic static String GREEN 
 - 
YELLOWpublic static String YELLOW 
 - 
BLUEpublic static String BLUE 
 - 
PURPLEpublic static String PURPLE 
 - 
CYANpublic static String CYAN 
 - 
WHITEpublic static String WHITE 
 
- 
 - 
Method Detail- 
jsonPathConfigurationpublic static com.jayway.jsonpath.Configuration jsonPathConfiguration() 
 - 
getMapperpublic static com.fasterxml.jackson.databind.ObjectMapper getMapper() 
 - 
postFilepublic static void postFile(org.apache.solr.client.solrj.SolrClient client, ByteBuffer buffer, String name, String sig) throws org.apache.solr.client.solrj.SolrServerException, IOExceptionUploads a file to the package store / file store of Solr.- Parameters:
- client- A Solr client
- buffer- File contents
- name- 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.SolrServerException
- IOException
 
 - 
getJsonpublic 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.
 - 
getFileFromJarsAsStringpublic static String getFileFromJarsAsString(List<Path> jars, String filename) 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.
 - 
getJsonStringFromUrlpublic static String getJsonStringFromUrl(org.apache.solr.client.solrj.SolrClient client, String path, org.apache.solr.common.params.SolrParams params) Returns JSON string from a given Solr URL
 - 
fetchManifestpublic 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:
- IOException
- org.apache.solr.client.solrj.SolrServerException
 
 - 
resolvepublic 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.
 - 
printGreenpublic static void printGreen(Object message) Console print using green color
 - 
printRedpublic static void printRed(Object message) Console print using red color
 - 
printpublic static void print(Object message) 
 - 
uploadKeypublic static void uploadKey(byte[] bytes, String path, Path home) throws IOException- Throws:
- IOException
 
 
- 
 
-