Package cz.o2.proxima.core.repository
Class ConfigRepository
- java.lang.Object
-
- cz.o2.proxima.core.repository.Repository
-
- cz.o2.proxima.core.repository.ConfigRepository
-
- All Implemented Interfaces:
java.io.Serializable
public final class ConfigRepository extends Repository
Repository of all entities configured in the system.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConfigRepository.Builder
Builder for the repository.-
Nested classes/interfaces inherited from class cz.o2.proxima.core.repository.Repository
Repository.Validate
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addedDataOperator(DataOperator op)
Called when newDataOperator
is created.void
drop()
Drop theRepository
and let it recreate from scratch using factory.boolean
equals(java.lang.Object o)
java.util.Optional<EntityDescriptor>
findEntity(java.lang.String name)
Find entity descriptor based on entity name.java.util.Optional<AttributeFamilyDescriptor>
findFamilyByName(java.lang.String name)
Retrieve attribute family by name.java.util.stream.Stream<EntityDescriptor>
getAllEntities()
Retrieve stream of all entities.java.util.stream.Stream<AttributeFamilyDescriptor>
getAllFamilies(boolean includeSystem)
List all unique attribute families, possibly including system attribute families.java.util.Set<AttributeFamilyDescriptor>
getFamiliesForAttribute(AttributeDescriptor<?> attr)
Retrieve list of attribute families for attribute.AttributeFamilyDescriptor
getPrimaryFamilyFor(AttributeDescriptor<?> attr)
java.util.Map<java.lang.String,TransformationDescriptor>
getTransformations()
Retrieve all transformers.java.util.Optional<ValueSerializerFactory>
getValueSerializerFactory(java.lang.String scheme)
Retrieve value serializer for given scheme.int
hashCode()
boolean
isEmpty()
Check if this repository is empty.boolean
isShouldValidate(Repository.Validate what)
Check if thisRepository
should eagerly validate various settings.static Repository
of(cz.o2.proxima.typesafe.config.Config config)
Create config from /Config
.static Repository
ofTest(cz.o2.proxima.typesafe.config.Config config, Repository.Validate... validates)
Construct default repository from the config.void
reloadConfig(boolean loadFamilies, cz.o2.proxima.typesafe.config.Config conf)
java.lang.String
toString()
-
Methods inherited from class cz.o2.proxima.core.repository.Repository
asFactory, getAllFamilies, getEntity, getFamilyByName, getOrCreateOperator, hasOperator
-
-
-
-
Method Detail
-
of
public static Repository of(cz.o2.proxima.typesafe.config.Config config)
Create config from /Config
.- Parameters:
config
- the config to createRepository
from- Returns:
- new
Repository
-
ofTest
public static Repository ofTest(cz.o2.proxima.typesafe.config.Config config, Repository.Validate... validates)
Construct default repository from the config.- Parameters:
config
- configuration to usevalidates
- which validations to perform- Returns:
- constructed repository
-
reloadConfig
public void reloadConfig(boolean loadFamilies, cz.o2.proxima.typesafe.config.Config conf)
-
findEntity
public java.util.Optional<EntityDescriptor> findEntity(java.lang.String name)
Description copied from class:Repository
Find entity descriptor based on entity name.- Specified by:
findEntity
in classRepository
- Parameters:
name
- name of the entity to search for- Returns:
- optional
EntityDescriptor
found by name
-
getValueSerializerFactory
public java.util.Optional<ValueSerializerFactory> getValueSerializerFactory(java.lang.String scheme)
Description copied from class:Repository
Retrieve value serializer for given scheme.- Specified by:
getValueSerializerFactory
in classRepository
- Parameters:
scheme
- scheme of theValueSerializerFactory
- Returns:
- optional
ValueSerializerFactory
for the scheme
-
isShouldValidate
public boolean isShouldValidate(Repository.Validate what)
Description copied from class:Repository
Check if thisRepository
should eagerly validate various settings.- Specified by:
isShouldValidate
in classRepository
- Parameters:
what
- validation flag- Returns:
true
if this Repository should validate settings before usage (typically production settings, while test settings can be less strict).
-
drop
public void drop()
Description copied from class:Repository
Drop theRepository
and let it recreate from scratch using factory. This is intended for use in tests mostly to prevent influence between two test cases.- Specified by:
drop
in classRepository
-
getAllFamilies
public java.util.stream.Stream<AttributeFamilyDescriptor> getAllFamilies(boolean includeSystem)
Description copied from class:Repository
List all unique attribute families, possibly including system attribute families.- Specified by:
getAllFamilies
in classRepository
- Parameters:
includeSystem
-true
if system families should be included
-
findFamilyByName
public java.util.Optional<AttributeFamilyDescriptor> findFamilyByName(java.lang.String name)
Description copied from class:Repository
Retrieve attribute family by name.Note that this searched all families that were specified in configuration. It might include families not listed in
Repository.getAllFamilies()
, because some families might be removed for various reasons (e.g. when proxying attributes).- Specified by:
findFamilyByName
in classRepository
- Parameters:
name
- name of the family- Returns:
Optional
AttributeFamilyDescriptor
if family exists
-
getFamiliesForAttribute
public java.util.Set<AttributeFamilyDescriptor> getFamiliesForAttribute(AttributeDescriptor<?> attr)
Description copied from class:Repository
Retrieve list of attribute families for attribute.- Specified by:
getFamiliesForAttribute
in classRepository
- Parameters:
attr
- attribute descriptor- Returns:
- all families of given attribute
-
getPrimaryFamilyFor
public AttributeFamilyDescriptor getPrimaryFamilyFor(AttributeDescriptor<?> attr)
-
getAllEntities
public java.util.stream.Stream<EntityDescriptor> getAllEntities()
Description copied from class:Repository
Retrieve stream of all entities.- Specified by:
getAllEntities
in classRepository
- Returns:
Stream
of all entities specified in this repository
-
getTransformations
public java.util.Map<java.lang.String,TransformationDescriptor> getTransformations()
Description copied from class:Repository
Retrieve all transformers.- Specified by:
getTransformations
in classRepository
- Returns:
- all transformations by name
-
isEmpty
public boolean isEmpty()
Check if this repository is empty.- Specified by:
isEmpty
in classRepository
- Returns:
true
if this repository is empty
-
addedDataOperator
protected void addedDataOperator(DataOperator op)
Description copied from class:Repository
Called when newDataOperator
is created.- Overrides:
addedDataOperator
in classRepository
- Parameters:
op
- the operator that was created
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-