@Override public boolean configure(final StaplerRequest req, final JSONObject json) throws FormException { JSONObject selectedJson = json.getJSONObject("searchBackend"); if (selectedJson.containsKey(SOLR_URL)) { String solrUrl = selectedJson.getString(SOLR_URL); ensureNotError(doCheckSolrUrl(solrUrl), SOLR_URL); try { setSolrUrl(makeSolrUrl(solrUrl)); } catch (IOException e) { // Really shouldn't be possible, but this is the correct action, should it ever happen throw new FormException("Incorrect freetext config", SOLR_URL); } } if (selectedJson.containsKey(SOLR_COLLECTION)) { String solrCollection = selectedJson.getString(SOLR_COLLECTION); ensureNotError(doCheckSolrCollection(solrCollection, getSolrUrl()), SOLR_COLLECTION); setSolrCollection(solrCollection); } if (selectedJson.containsKey(LUCENE_PATH)) { String lucenePath = selectedJson.getString(LUCENE_PATH); ensureNotError(doCheckLucenePath(lucenePath), LUCENE_PATH); setLucenePath(new File(lucenePath)); } if (json.containsKey(USE_SECURITY)) { setUseSecurity(json.getBoolean(USE_SECURITY)); } setSearchBackend(SearchBackendEngine.valueOf(json.get("").toString())); reconfigure(); return super.configure(req, json); }
@DataBoundConstructor public SearchBackendConfiguration( final String solrUrl, final String lucenePath, final String searchBackend, final String solrCollection, boolean useSecurity) { this( URI.create(solrUrl), new File(lucenePath), SearchBackendEngine.valueOf(searchBackend), solrCollection); }