@Override public Subject add(Subject entry) { return subjects.add(Subject.cacheWith(entry, entryCacheFactory.createSchemaEntryCache())); }
@Override public synchronized SchemaEntry lookupById(String id) { isValid(); String schema = readSchemaForIdOrNull(id); if (schema != null) { return new SchemaEntry(id, schema); } return null; }
@Override protected CacheRepository createRepository() { return new CacheRepository(new InMemoryRepository(new ValidatorFactory.Builder().build()), new InMemoryCache()); } }
@Override public synchronized SchemaEntry register(String schema) throws SchemaValidationException { isValid(); RepositoryUtil.validateSchemaOrSubject(schema); SchemaEntry entry = lookupBySchema(schema); if (entry == null) { entry = createNewSchemaFile(schema); appendLineToFile(idFile, entry.getId()); latest = entry; } return entry; }
@Override public SchemaEntry register(String schema) throws SchemaValidationException { SchemaEntry entry = cache.lookupBySchema(schema); if (entry == null) { return cache.add(super.register(schema)); } return entry; }
@Override public SchemaEntry lookupBySchema(String schema) { SchemaEntry entry = cache.lookupBySchema(schema); if (entry == null) { return cache.add(super.lookupBySchema(schema)); } return entry; }
@Override public Iterable<SchemaEntry> allEntries() { Iterable<SchemaEntry> all = super.allEntries(); for (SchemaEntry entry : all) { cache.add(entry); } return all; } }
@Override public SchemaEntry registerIfLatest(String schema, SchemaEntry latest) throws SchemaValidationException { return cache.add(super.registerIfLatest(schema, latest)); }
@Override public synchronized SchemaEntry register(String schema) throws SchemaValidationException { isValid(); RepositoryUtil.validateSchemaOrSubject(schema); SchemaEntry entry = lookupBySchema(schema); if (entry == null) { entry = createNewSchemaFile(schema); appendLineToFile(idFile, entry.getId()); latest = entry; } return entry; }
@Override public synchronized SchemaEntry lookupById(String id) { isValid(); String schema = readSchemaForIdOrNull(id); if (schema != null) { return new SchemaEntry(id, schema); } return null; }
@Override public Subject add(Subject entry) { return subjects.add(Subject.cacheWith(entry, entryCacheFactory.createSchemaEntryCache())); }
@Override public SchemaEntry register(String schema) throws SchemaValidationException { SchemaEntry entry = cache.lookupBySchema(schema); if (entry == null) { return cache.add(super.register(schema)); } return entry; }