/** * Adds a port that serves the HTTP requests. If unspecified, cleartext HTTP on port 36462 is used. * * @param port the TCP/IP port number * @param protocol {@link SessionProtocol#HTTP} or {@link SessionProtocol#HTTPS} */ public CentralDogmaBuilder port(int port, SessionProtocol protocol) { return port(new ServerPort(port, protocol)); }
/** * Returns a newly-created {@link CentralDogma} server. */ public CentralDogma build() { return new CentralDogma(buildConfig(), securityConfig); }
/** * Sets the timeout for keeping an idle connection. A connection is automatically closed when it stays idle * without any requests in progress for more than the specified timeout. * <a href="https://line.github.io/armeria/">Armeria</a> default is used if unspecified. */ public CentralDogmaBuilder idleTimeout(Duration idleTimeout) { return idleTimeoutMillis(requireNonNull(idleTimeout, "idleTimeout").toMillis()); }
@Override protected void configure(CentralDogmaBuilder builder) { builder.mirroringEnabled(true); builder.maxNumFilesPerMirror(MAX_NUM_FILES); builder.maxNumBytesPerMirror(MAX_NUM_BYTES); } };
replica1 = new CentralDogmaBuilder(tempDir.newFolder()) .port(port1, SessionProtocol.HTTP) .authProviderFactory(factory) .webAppEnabled(true) .mirroringEnabled(false) .gracefulShutdownTimeout(new GracefulShutdownTimeout(0, 0)) .replication(new ZooKeeperReplicationConfig(1, servers)) .build(); replica2 = new CentralDogmaBuilder(tempDir.newFolder()) .port(port2, SessionProtocol.HTTP) .authProviderFactory(factory) .webAppEnabled(true) .mirroringEnabled(false) .gracefulShutdownTimeout(new GracefulShutdownTimeout(0, 0)) .replication(new ZooKeeperReplicationConfig(2, servers)) .build();
final CentralDogmaBuilder builder = new CentralDogmaBuilder(getRoot()) .port(TEST_PORT, useTls ? SessionProtocol.HTTPS : SessionProtocol.HTTP) .webAppEnabled(false) .mirroringEnabled(false) .gracefulShutdownTimeout(new GracefulShutdownTimeout(0, 0)); builder.tls(new TlsConfig(ssc.certificate(), ssc.privateKey(), null)); } catch (Exception e) { Exceptions.throwUnsafely(e); final com.linecorp.centraldogma.server.CentralDogma dogma = builder.build(); this.dogma = dogma; return dogma.start().thenRun(() -> {
@Override public synchronized void start() throws Exception { switch (state) { case NONE: throw new IllegalStateException("not initialized"); case STARTED: throw new IllegalStateException("started already"); case DESTROYED: throw new IllegalStateException("can't start after destruction"); default: break; } final File configFile = findConfigFile(this.configFile, DEFAULT_CONFIG_FILE); final CentralDogma dogma; if (configFile == null) { dogma = new CentralDogmaBuilder(DEFAULT_DATA_DIR).build(); } else { dogma = CentralDogma.forConfig(configFile); } dogma.start().get(); this.dogma = dogma; state = State.STARTED; }
@Override protected void configure(CentralDogmaBuilder builder) { builder.authProviderFactory(new SamlAuthProviderFactory()); builder.authProviderProperties(PROPERTIES); builder.webAppEnabled(true); } };
@Override protected void configure(CentralDogmaBuilder builder) { builder.authProviderFactory(new ShiroAuthProviderFactory(unused -> { final Ini iniConfig = new Ini(); iniConfig.addSection("users").put(USERNAME, PASSWORD); return iniConfig; })); builder.webAppEnabled(true); } };
/** * Sets the timeout for handling an incoming request. If it takes more than the specified timeout to * handle a request, the server may respond with '503 Service Unavailable' or fail to respond. * <a href="https://line.github.io/armeria/">Armeria</a> default is used if unspecified. */ public CentralDogmaBuilder requestTimeout(Duration requestTimeout) { return requestTimeoutMillis(requireNonNull(requestTimeout, "requestTimeout").toMillis()); }
@Override protected void configure(CentralDogmaBuilder builder) { super.configure(builder); builder.gracefulShutdownTimeout(new GracefulShutdownTimeout(1000, 2000)); } };
@Override public synchronized void start() throws Exception { switch (state) { case NONE: throw new IllegalStateException("not initialized"); case STARTED: throw new IllegalStateException("started already"); case DESTROYED: throw new IllegalStateException("can't start after destruction"); default: break; } final File configFile = findConfigFile(this.configFile, DEFAULT_CONFIG_FILE); final CentralDogma dogma; if (configFile == null) { dogma = new CentralDogmaBuilder(DEFAULT_DATA_DIR).build(); } else { dogma = CentralDogma.forConfig(configFile); } dogma.start().get(); this.dogma = dogma; state = State.STARTED; }
/** * Sets the timeout for handling an incoming request. If it takes more than the specified timeout to * handle a request, the server may respond with '503 Service Unavailable' or fail to respond. * <a href="https://line.github.io/armeria/">Armeria</a> default is used if unspecified. */ public CentralDogmaBuilder requestTimeout(Duration requestTimeout) { return requestTimeoutMillis(requireNonNull(requestTimeout, "requestTimeout").toMillis()); }
@Override public synchronized void start() throws Exception { switch (state) { case NONE: throw new IllegalStateException("not initialized"); case STARTED: throw new IllegalStateException("started already"); case DESTROYED: throw new IllegalStateException("can't start after destruction"); default: break; } final File configFile = findConfigFile(this.configFile, DEFAULT_CONFIG_FILE); final File securityConfigFile = findConfigFile(this.securityConfigFile, DEFAULT_SECURITY_CONFIG_FILE); final Ini securityConfig = securityConfigFile != null ? Ini.fromResourcePath(securityConfigFile.getPath()) : null; final CentralDogma dogma; if (configFile == null) { dogma = new CentralDogmaBuilder(DEFAULT_DATA_DIR).build(); } else { dogma = CentralDogma.forConfig(configFile, securityConfig); } dogma.start().get(); this.dogma = dogma; state = State.STARTED; }
/** * Adds a port that serves the HTTP requests. If unspecified, cleartext HTTP on port 36462 is used. * * @param localAddress the TCP/IP load address to bind * @param protocol {@link SessionProtocol#HTTP} or {@link SessionProtocol#HTTPS} */ public CentralDogmaBuilder port(InetSocketAddress localAddress, SessionProtocol protocol) { return port(new ServerPort(localAddress, protocol)); }
/** * Sets the timeout for keeping an idle connection. A connection is automatically closed when it stays idle * without any requests in progress for more than the specified timeout. * <a href="https://line.github.io/armeria/">Armeria</a> default is used if unspecified. */ public CentralDogmaBuilder idleTimeout(Duration idleTimeout) { return idleTimeoutMillis(requireNonNull(idleTimeout, "idleTimeout").toMillis()); }
/** * Sets the timeout for handling an incoming request. If it takes more than the specified timeout to * handle a request, the server may respond with '503 Service Unavailable' or fail to respond. * <a href="https://line.github.io/armeria/">Armeria</a> default is used if unspecified. */ public CentralDogmaBuilder requestTimeout(Duration requestTimeout) { return requestTimeoutMillis(requireNonNull(requestTimeout, "requestTimeout").toMillis()); }
/** * Returns a newly-created {@link CentralDogma} server. */ public CentralDogma build() { return new CentralDogma(buildConfig()); }
/** * Adds a port that serves the HTTP requests. If unspecified, cleartext HTTP on port 36462 is used. * * @param localAddress the TCP/IP load address to bind * @param protocol {@link SessionProtocol#HTTP} or {@link SessionProtocol#HTTPS} */ public CentralDogmaBuilder port(InetSocketAddress localAddress, SessionProtocol protocol) { return port(new ServerPort(localAddress, protocol)); }
/** * Sets the timeout for keeping an idle connection. A connection is automatically closed when it stays idle * without any requests in progress for more than the specified timeout. * <a href="https://line.github.io/armeria/">Armeria</a> default is used if unspecified. */ public CentralDogmaBuilder idleTimeout(Duration idleTimeout) { return idleTimeoutMillis(requireNonNull(idleTimeout, "idleTimeout").toMillis()); }