public TableDescription useStatefulService(Class<? extends StatefulService> serviceType) { try { StatefulService service = serviceType.newInstance(); useStatefulService(service); return this; } catch (InstantiationException | IllegalAccessException e) { throw new IllegalArgumentException("Failed to create a new instance: " + e); } }
public TableDescription useFactoryService(FactoryService factoryService) { if (factoryService.getHost() == null) { factoryService.setHost(this.host); } try { if (getFactoryLink() == null) { setFactoryLink(factoryService.getSelfLink()); } StatefulService childService = (StatefulService) factoryService.createServiceInstance(); useStatefulService(childService); return this; } catch (Throwable e) { throw new IllegalArgumentException(String.format( "Failed to add factory %s", factoryService.getClass().getCanonicalName()), e); } }
/*** * Override to register factory services used by the host. */ protected void registerPostgresSchema(PostgresSchemaManager sm) { sm.addFactory(CheckpointFactoryService.SELF_LINK, CheckpointService.class); sm.addTable(td -> { td.useStatefulService(AuthCredentialsService.class); td.setIndexType("privateKey", "hash"); td.setIndexType("publicKey", "hash"); }); sm.addFactory(RoleService.class); sm.addFactory(TenantService.class); sm.addFactory(UserService.class); sm.addFactory(UserGroupService.class); sm.addFactory(ResourceGroupService.class); sm.addFactory(TransactionFactoryService.SELF_LINK, TransactionService.class); }
public void addFactory(Class<? extends StatefulService> serviceType) { addTable(td -> { td.useStatefulService(serviceType); }); }
public void addFactory(StatefulService service) { addTable(td -> { td.useStatefulService(service); }); }
public void addFactory(String factoryLink, StatefulService childService) { addTable(td -> { td.setFactoryLink(factoryLink); td.useStatefulService(childService); }); }
public void addFactory(String factoryLink, Class<? extends StatefulService> serviceType) { addTable(td -> { td.setFactoryLink(factoryLink); td.useStatefulService(serviceType); }); }