properties.load(configStream); } catch (final IOException ioe) { throw new ConfigurationException("Unable to load " + source.toString(), ioe);
protected void validate() { if (serverUris == null) { throw new ConfigurationException("No serverUris provided for JestClientConfig"); } }
@Override public PEMCertInfo build() { if (keyPath == null) { throw new ConfigurationException("No keyPath provided for " + PLUGIN_NAME); } if (clientCertPath == null) { throw new ConfigurationException("No clientCertPath provided for " + PLUGIN_NAME); } if (caPath == null) { throw new ConfigurationException("No caPath provided for " + PLUGIN_NAME); } return new PEMCertInfo(keyPath, keyPassphrase, clientCertPath, caPath); }
@Override public UnlimitedResizePolicy build() { if (resizeFactor <= 0) { throw new ConfigurationException("resizeFactor must be higher than 0"); } if (resizeFactor > 1) { throw new ConfigurationException("resizeFactor must be lower or equal 1"); } return new UnlimitedResizePolicy(resizeFactor); }
public String getHost(String s) { try { return new URI(s).getHost(); } catch (URISyntaxException e) { throw new ConfigurationException(e); } }
public int getPort(String serverUri) { try { return new URI(serverUri).getPort(); } catch (URISyntaxException e) { throw new ConfigurationException(e); } } }
@Override public BasicCredentials build() { if (username == null) { throw new ConfigurationException("No username provided for " + BasicCredentials.PLUGIN_NAME); } if (password == null) { throw new ConfigurationException("No password provided for " + BasicCredentials.PLUGIN_NAME); } return new BasicCredentials(username, password); }
public String getHost(String s) { try { return new URI(s).getHost(); } catch (URISyntaxException e) { throw new ConfigurationException(e); } }
@Override public XPackAuth build() { if (credentials == null) { throw new ConfigurationException("No credentials provided for " + XPackAuth.PLUGIN_NAME); } if (certInfo == null) { throw new ConfigurationException("No certInfo provided for " + XPackAuth.PLUGIN_NAME); } return new XPackAuth(credentials, certInfo); }
@Override public BasicCredentials build() { if (username == null) { throw new ConfigurationException("No username provided for " + BasicCredentials.PLUGIN_NAME); } if (password == null) { throw new ConfigurationException("No password provided for " + BasicCredentials.PLUGIN_NAME); } return new BasicCredentials(username, password); }
@Override public UnlimitedResizePolicy build() { if (resizeFactor <= 0) { throw new ConfigurationException("resizeFactor must be higher than 0"); } if (resizeFactor > 1) { throw new ConfigurationException("resizeFactor must be lower or equal 1"); } return new UnlimitedResizePolicy(resizeFactor); }
public int getPort(String serverUri) { try { return new URI(serverUri).getPort(); } catch (URISyntaxException e) { throw new ConfigurationException(e.getMessage()); } } }
public String getHost(String s) { try { return new URI(s).getHost(); } catch (URISyntaxException e) { throw new ConfigurationException(e.getMessage()); } }
@Override public JKSCertInfo build() { if (keystorePassword == null) { throw new ConfigurationException("No keystorePassword provided for " + PLUGIN_NAME); } if (truststorePassword == null) { throw new ConfigurationException("No truststorePassword provided for " + PLUGIN_NAME); } return new JKSCertInfo(keystorePath, keystorePassword, truststorePath, truststorePassword); }
@Override public BasicCredentials build() { if (username == null) { throw new ConfigurationException("No username provided for " + BasicCredentials.PLUGIN_NAME); } if (password == null) { throw new ConfigurationException("No password provided for " + BasicCredentials.PLUGIN_NAME); } return new BasicCredentials(username, password); }
@Override public ShieldAuth build() { if (credentials == null) { throw new ConfigurationException("No credentials provided for " + ShieldAuth.PLUGIN_NAME); } if (certInfo == null) { throw new ConfigurationException("No certInfo provided for " + ShieldAuth.PLUGIN_NAME); } return new ShieldAuth(credentials, certInfo); }
private String loadFileSystemResource() { try { return new String(Files.readAllBytes(Paths.get(path))); } catch (IOException e){ throw new ConfigurationException(e.getMessage(), e); } }
private Class loadClass(String className, String argName) { if (className == null) { throw new ConfigurationException(String.format("No %s provided for %s", argName, JacksonMixIn.PLUGIN_NAME)); } try { return LoaderUtil.loadClass(className); } catch (ClassNotFoundException e) { throw new ConfigurationException(String.format("Cannot load %s: %s for %s", argName, className, JacksonMixIn.PLUGIN_NAME)); } }
@Override public IndexTemplate build() { if (name == null) { throw new ConfigurationException("No name provided for IndexTemplate"); } if ((path == null && source == null) || (path != null && source != null)) { throw new ConfigurationException("Either path or source have to be provided for IndexTemplate"); } return new IndexTemplate(name, loadSource()); }
@Override public NoopIndexNameFormatter build() { if (indexName == null) { throw new ConfigurationException("No indexName provided for IndexName"); } return new NoopIndexNameFormatter(indexName); }