public ServerConfiguration build() throws IOException { return new ServerConfiguration(finalMap()); }
public static Builder of() { return of(null); }
public synchronized static void main(final String... args) throws Exception { shutdown(); INSTANCE = new ExtractorServer(new ServerConfiguration(args)); INSTANCE.start(); }
private static String findPublicAddress(final String addressPattern, final String listenAddress) throws SocketException { if (StringUtils.isEmpty(addressPattern)) return StringUtils.isEmpty(listenAddress) || DEFAULT_LISTEN_ADDRESS.equals(listenAddress) ? getLocalHostAddress() : listenAddress; final ArrayList<String> list = new ArrayList<>(); findMatchingAddress(addressPattern, list); if (list.isEmpty()) throw new SocketException("Failed in finding a matching public IP address. Pattern: " + addressPattern); if (list.size() > 1) LOGGER.warning(() -> "Several matching IP adresses where found (" + list.size() + ')'); return list.get(0); }
protected static Set<String> buildSet(final String value, final String separatorChars, final boolean trim) { if (value == null || value.isEmpty()) return null; final HashSet<String> set = new HashSet<>(); fillStringListProperty(value, separatorChars, trim, set::add); return Collections.unmodifiableSet(set); }
public static Builder of(Map<String, String> map) { return new Builder(map); }
public ServerConfiguration(final String... args) throws IOException { this(System.getenv(), System.getProperties(), argsToMap(args)); }
@Override final public boolean test(final Path path) { if (!Files.isRegularFile(path)) return false; if (patterns == null || patterns.isEmpty()) return true; final Path fileNamePath = path.getFileName(); if (fileNamePath == null) return false; final String fileName = fileNamePath.toString(); for (Matcher matcher : patterns) if (matcher.match(fileName)) return matcher.result; return noMatchResult; }
ConfigurationFileFilter(final String[] patternArray) { patterns = new ArrayList<>(); if (patternArray == null) { noMatchResult = true; return; } int inclusionCount = 0; for (final String pattern : patternArray) { if (pattern.startsWith("!")) patterns.add(new Matcher(pattern.substring(1), false)); else { patterns.add(new Matcher(pattern, true)); inclusionCount++; } } noMatchResult = inclusionCount == 0; }
private static String findListenAddress(final String addressPattern) { if (StringUtils.isEmpty(addressPattern)) return DEFAULT_LISTEN_ADDRESS; try { final ArrayList<String> list = new ArrayList<>(); findMatchingAddress(addressPattern, list); return list.isEmpty() ? DEFAULT_LISTEN_ADDRESS : list.get(0); } catch (SocketException e) { LOGGER.log(Level.WARNING, e, () -> "Failed in extracting IP informations. Listen address set to default (" + DEFAULT_LISTEN_ADDRESS + ")"); return DEFAULT_LISTEN_ADDRESS; } }
private static Predicate<Path> buildEtcFileFilter(final String etcFilter) { if (StringUtils.isEmpty(etcFilter)) return path -> Files.isRegularFile(path); final String[] array = StringUtils.split(etcFilter, ','); if (array == null || array.length == 0) return path -> Files.isRegularFile(path); return new ConfigurationFileFilter(array); }
public static synchronized void main(final String... args) throws IOException, ReflectiveOperationException, ServletException, JMException { shutdown(); INSTANCE = new ClusterServer(new ServerConfiguration(args)); INSTANCE.start(); }
private static Set<Path> getEtcDirectories(final String value) { final Set<Path> set = new LinkedHashSet<>(); fillStringListProperty(value == null ? "etc" : value, File.pathSeparator, true, part -> { // By design relative path are relative to the working directory final Path etcPath = Paths.get(part); set.add(etcPath); LOGGER.info("Configuration (ETC) directory: " + etcPath.toAbsolutePath()); }); return Collections.unmodifiableSet(set); }
public static synchronized void main(final String... args) throws IOException, ReflectiveOperationException, ServletException, JMException { if (INSTANCE != null) shutdown(); INSTANCE = new ScriptsServer(new ServerConfiguration(args)); INSTANCE.start(); }
public static synchronized void main(final String... args) throws IOException, URISyntaxException, ServletException, ReflectiveOperationException, JMException { shutdown(); INSTANCE = new StoreServer(new ServerConfiguration(args)); INSTANCE.start(); }
public static synchronized void main(final String... args) throws ReflectiveOperationException, IOException, ServletException, JMException, URISyntaxException { shutdown(); INSTANCE = new GraphServer(new ServerConfiguration(args)); INSTANCE.start(); }
public static synchronized void main(final String... args) throws IOException, ServletException, JMException { if (INSTANCE != null) shutdown(); INSTANCE = new TableServer(new ServerConfiguration(args)); INSTANCE.start(); }
public static synchronized void main(final String... args) throws IOException, ReflectiveOperationException, ServletException, JMException { if (INSTANCE != null) shutdown(); INSTANCE = new WebappServer(new ServerConfiguration(args), null); INSTANCE.start(); }
public static synchronized void main(final String... args) throws IOException, ServletException, JMException { shutdown(); INSTANCE = new SearchServer(new ServerConfiguration(args)); INSTANCE.start(); }