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 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); }
public int getPort(String serverUri) { try { return new URI(serverUri).getPort(); } catch (URISyntaxException e) { throw new ConfigurationException(e.getMessage()); } } }
private String loadFileSystemResource() { try { return new String(Files.readAllBytes(Paths.get(path))); } catch (IOException e){ throw new ConfigurationException(e.getMessage(), e); } }
@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); }
@Override public BulkProcessorObjectFactory build() { if (serverUris == null) { throw new ConfigurationException("No serverUris provided for ElasticsearchBulkProcessor"); } return new BulkProcessorObjectFactory(Arrays.asList(serverUris.split(";")), auth); }
@Override public XPackAuth build() { if (credentials == null) { throw new ConfigurationException("No credentials provided for " + XPackAuth.PLUGIN_NAME); } return new XPackAuth(credentials, certInfo); }
@Override public BulkProcessorObjectFactory build() { if (serverUris == null) { throw new ConfigurationException("No serverUris provided for " + PLUGIN_NAME); } return new BulkProcessorObjectFactory(Arrays.asList(serverUris.split(";")), auth); }
@Override public BulkProcessorObjectFactory build() { if (serverUris == null) { throw new ConfigurationException("No serverUris provided for " + PLUGIN_NAME); } return new BulkProcessorObjectFactory(Arrays.asList(serverUris.split(";")), auth); }
private LayoutComponentBuilder createLayout(final String appenderName, final Properties properties) { final String type = (String) properties.remove(CONFIG_TYPE); if (Strings.isEmpty(type)) { throw new ConfigurationException("No type attribute provided for Layout on Appender " + appenderName); } final LayoutComponentBuilder layoutBuilder = builder.newLayout(type); return processRemainingProperties(layoutBuilder, properties); }
@Override public ConfigurationBuilder<T> add(final RootLoggerComponentBuilder builder) { for (final Component c : loggers.getComponents()) { if (c.getPluginType().equals(LoggerConfig.ROOT)) { throw new ConfigurationException("Root Logger was previously defined"); } } return add(loggers, builder); }
private static <B extends ComponentBuilder<B>> ComponentBuilder<B> createComponent(final ComponentBuilder<?> parent, final String key, final Properties properties) { final String name = (String) properties.remove(CONFIG_NAME); final String type = (String) properties.remove(CONFIG_TYPE); if (Strings.isEmpty(type)) { throw new ConfigurationException("No type attribute provided for component " + key); } final ComponentBuilder<B> componentBuilder = parent.getBuilder().newComponent(name, type); return processRemainingProperties(componentBuilder, properties); }
private void resolveAppender() { if (appenderControl == null) { Appender appender = configuration.getAppender(appenderRef.getRef()); if (appender == null) { throw new ConfigurationException("No failover appender named " + appenderRef.getRef() + " found"); } appenderControl = new AppenderControl(appender, appenderRef.getLevel(), appenderRef.getFilter()); } }