registerPostgresSchema(getPostgresSchemaManager()); log(Level.INFO, "Validating Liquibase snapshot"); boolean valid; try { valid = validateLiquibaseSnapshot(getPostgresSchemaManager()); } catch (Throwable e) { log(Level.SEVERE, "Failed validating liquibase snapshot: %s", Utils.toString(e)); throw new AssertionError(e); log(Level.INFO, "Starting Liquibase upgrade"); try { liquibaseUpdate(getDataSource()); } catch (Exception e) { log(Level.SEVERE, "Failed Liquibase update: %s", Utils.toString(e)); throw new AssertionError(e); log(Level.INFO, "Successful Liquibase update"); setPeerSynchronizationEnabled(false); setAuthorizationContext(getSystemAuthorizationContext());
@Override protected Service createDefaultDocumentIndexService() { if (!this.enablePostgres) { return super.createDefaultDocumentIndexService(); } setRemotePersistence(true); this.postgresDocumentIndexService = new PostgresDocumentIndexService(this, getDataSource()); return this.postgresDocumentIndexService; }
@Override public void registerForServiceAvailability(Operation.CompletionHandler completion, String nodeSelectorPath, boolean checkReplica, String... servicePaths) { if (this.enablePostgres && checkReplica) { PostgresHostUtils.registerForReplicatedServiceAvailability(this, completion, isStarted() ? getSystemAuthorizationContext() : null, nodeSelectorPath, servicePaths); return; } super.registerForServiceAvailability(completion, nodeSelectorPath, checkReplica, servicePaths); }
log(Level.WARNING, "Failed to retrieve factory paths: %s", ex); return; Service service = this.findService(factoryPath); log(Level.WARNING, "Failed to retrieve factory service '%s'", factoryPath); continue; this.run(() -> { setAuthorizationContext(getSystemAuthorizationContext()); this.nodeGroupChangeManager .handleNodeGroupChangeForPersistencePeriodicFactory(nodeSelectorPath, Service.ServiceOption.PERSISTENCE); Operation dummyOp = Operation.createGet(null).setCompletion(ch); queryServiceUris(options, true, dummyOp);
super.registerPostgresSchema(sm);
super.start();
@Override public void setAuthorizationContext(AuthorizationContext context) { super.setAuthorizationContext(context); }
@Override public AuthorizationContext getSystemAuthorizationContext() { return super.getSystemAuthorizationContext(); }
@Override public boolean handleRequest(Service service, Operation inboundOp) { if (AuthUtil.useAuthConfig(this)) { AuthorizationContext authCtx = inboundOp != null ? inboundOp.getAuthorizationContext() : null; AuthUtils.validateSessionData(this, inboundOp, getGuestAuthorizationContext(), authCtx); } return super.handleRequest(service, inboundOp); }
ServiceHost h = super.initialize(args, baseArgs); h.setProcessOwner(true); validatePeerArgs();
@Override protected void registerPostgresSchema(PostgresSchemaManager sm) { super.registerPostgresSchema(sm); sm.addFactory(TestService.class); sm.addFactory(TestPeriodicService.class); sm.addFactory(TestImmutableService.class); }
@Override public ServiceHost start() throws Throwable { setRejectRemoteRequests(true); super.start(); startDefaultCoreServicesSynchronously(false); startFactory(new TestService()); startFactory(new TestPeriodicService()); startFactory(new TestImmutableService()); scheduleCore(() -> { setRejectRemoteRequests(false); joinPeers(getInitialPeerHosts(), ServiceUriPaths.DEFAULT_NODE_GROUP); }, 1, TimeUnit.SECONDS); return this; }