|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.schemarepo.BaseRepository
org.schemarepo.AbstractBackendRepository
public abstract class AbstractBackendRepository
Parent class of the actual backend (as opposed to decorating) repositories. Each backend repository is expected to cache and validate its subjects.
| Field Summary | |
|---|---|
protected InMemorySubjectCache |
subjectCache
|
protected ValidatorFactory |
validators
|
| Fields inherited from class org.schemarepo.BaseRepository |
|---|
closed, logger |
| Constructor Summary | |
|---|---|
protected |
AbstractBackendRepository(ValidatorFactory validators)
|
| Method Summary | |
|---|---|
protected Subject |
cacheSubject(Subject subject)
Applies validation decorator, and caches subject. |
protected boolean |
checkSubjectExistsInBackend(String subjectName)
Backend-specific check if the subject actually exists. |
protected Subject |
getAndCacheSubject(String subjectName)
Creates, applies validation decorator, and caches subject. |
protected abstract Subject |
getSubjectInstance(String subjectName)
Concrete subclasses must override to return specific implementation of Subject. |
Subject |
lookup(String subjectName)
Returns the subject if it exists, null otherwise. |
Subject |
register(String subjectName,
SubjectConfig config)
Attempt to create a Subject with the given name and validator. |
protected abstract void |
registerSubjectInBackend(String subjectName,
SubjectConfig config)
Backend-specific registration logic. |
Iterable<Subject> |
subjects()
List all subjects. |
| Methods inherited from class org.schemarepo.BaseRepository |
|---|
close, exposeConfiguration, isValid, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final InMemorySubjectCache subjectCache
protected final ValidatorFactory validators
| Constructor Detail |
|---|
protected AbstractBackendRepository(ValidatorFactory validators)
| Method Detail |
|---|
protected abstract Subject getSubjectInstance(String subjectName)
Subject.
Note that this instantiates the "right" subject only, any "side effects" (such as mutating persistent state)
must be implemented in registerSubjectInBackend(String, SubjectConfig)
subjectName - subject name
protected final Subject getAndCacheSubject(String subjectName)
subjectName - subject name
protected final Subject cacheSubject(Subject subject)
subject - subject to cache
public Subject register(String subjectName,
SubjectConfig config)
Repository
subjectName - The name of the subject. Must not be null.config - The subject configuration. May be null.
protected abstract void registerSubjectInBackend(String subjectName,
SubjectConfig config)
subjectName - subject nameconfig - subject configpublic Subject lookup(String subjectName)
Repository
subjectName - the subject name
protected boolean checkSubjectExistsInBackend(String subjectName)
subjectName - subject name
public Iterable<Subject> subjects()
Repository
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||