public ServerConfiguration build() throws IOException { return new ServerConfiguration(finalMap()); }
public static Builder of() { return of(null); }
public ServerConfiguration(final String... args) throws IOException { this(System.getenv(), System.getProperties(), argsToMap(args)); }
private ScriptsServer(final ServerConfiguration configuration) throws IOException { final ExecutorService executorService = Executors.newCachedThreadPool(); final GenericServerBuilder builder = GenericServer.of(configuration, executorService); final Set<String> services = new HashSet<>(); services.add(ClusterServiceInterface.SERVICE_NAME); services.add(ScriptServiceInterface.SERVICE_NAME); services.add(LibraryServiceInterface.SERVICE_NAME); final ApplicationBuilder webServices = ApplicationBuilder.of("/*") .classes(RestApplication.JSON_CLASSES) .singletons(new WelcomeShutdownService()); final ClusterManager clusterManager = new ClusterManager(executorService, configuration).registerProtocolListener(builder, services); webServices.singletons(clusterManager.getService()); final LibraryManager libraryManager = new LibraryManager(configuration.dataDirectory, configuration.getEtcFiles(), null); builder.shutdownListener(server -> libraryManager.close()); final LibraryServiceInterface libraryService = libraryManager.getService(); webServices.singletons(libraryService); final ScriptManager scriptManager = new ScriptManager(executorService, clusterManager, libraryService, configuration.dataDirectory); webServices.singletons(scriptManager.getService()); scriptServiceBuilder = new ScriptServiceBuilder(executorService, clusterManager, scriptManager); builder.getWebServiceContext().jaxrs(webServices); server = builder.build(); }
protected static Map<String, String> argsToMap(final String... args) throws IOException { final Map<String, String> props = argsToMapPrefix("--", args); // Load the QWAZR_PROPERTIES String propertyFile = props.get(QWAZR_PROPERTIES); if (propertyFile == null) propertyFile = System.getProperty(QWAZR_PROPERTIES, System.getenv(QWAZR_PROPERTIES)); if (propertyFile != null) { final Path propFile = Paths.get(propertyFile); LOGGER.info(() -> "Load QWAZR_PROPERTIES file: " + propFile.toAbsolutePath()); final Properties properties = new Properties(); try (final BufferedReader reader = Files.newBufferedReader(propFile, StandardCharsets.UTF_8)) { properties.load(reader); } // Priority to program argument, we only put the value if the key is not present properties.forEach((key, value) -> props.putIfAbsent(key.toString(), value.toString())); } return props; }
new LibraryManager(configuration.dataDirectory, configuration.getEtcFiles()); builder.shutdownListener(server -> libraryManager.close()); webServices.singletons(libraryManager.getService()); .registerDefaultFaviconServlet() .persistSessions(configuration.tempDirectory.resolve(WebappManager.SESSIONS_PERSISTENCE_DIR)) .webappDefinition(configuration.dataDirectory, WebappDefinition.load(configuration.getEtcFiles()));
public synchronized static void main(final String... args) throws Exception { shutdown(); INSTANCE = new ExtractorServer(new ServerConfiguration(args)); INSTANCE.start(); }
public ClusterServer(final Map<String, String> properties) throws IOException { this(ServerConfiguration.of(properties).build()); }
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(); }
public static synchronized void main(final String... args) throws IOException, ReflectiveOperationException, ServletException, JMException { shutdown(); INSTANCE = new ClusterServer(new ServerConfiguration(args)); INSTANCE.start(); }
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(); }