Package org.faktorips.runtime
Class InMemoryRuntimeRepository
- java.lang.Object
-
- org.faktorips.runtime.internal.AbstractRuntimeRepository
-
- org.faktorips.runtime.InMemoryRuntimeRepository
-
- All Implemented Interfaces:
IRuntimeRepository
public class InMemoryRuntimeRepository extends AbstractRuntimeRepository
A runtime repository that keeps its data in memory.
-
-
Constructor Summary
Constructors Constructor Description InMemoryRuntimeRepository()InMemoryRuntimeRepository(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEnumXmlAdapter(javax.xml.bind.annotation.adapters.XmlAdapter<?,?> enumXmlAdapter)Adds anXmlAdapterfor a Faktor-IPS enumeration that defers its content to a enumeration content to this repository.protected voidgetAllEnumClasses(java.util.LinkedHashSet<java.lang.Class<?>> result)Same asAbstractRuntimeRepository.getAllEnumClasses()but searches only in this repository and not the ones this repository depends on.protected java.util.List<javax.xml.bind.annotation.adapters.XmlAdapter<?,?>>getAllInternalEnumXmlAdapters(IRuntimeRepository repository)Returns all enumeration XmlAdapters available in this repository that generated by Faktor-IPS.protected voidgetAllIpsTestCases(java.util.List<IpsTest2> result, IRuntimeRepository runtimeRepository)Same asAbstractRuntimeRepository.getAllIpsTestCases(IRuntimeRepository)but searches only in this repository and not the ones this repository depends on.protected voidgetAllModelTypeImplementationClasses(java.util.Set<java.lang.String> result)Same asAbstractRuntimeRepository.getAllModelTypeImplementationClasses()but searches only in this repository and not the ones this repository depends on.voidgetAllProductComponentIds(java.util.List<java.lang.String> result)Same asAbstractRuntimeRepository.getAllProductComponentIds()but searches only in this repository and not the ones this repository depends on.voidgetAllProductComponents(java.lang.String kindId, java.util.List<IProductComponent> result)Same as getAllProductComponent(String kindId) but searches only in this repository and not the ones this repository depends on.voidgetAllProductComponents(java.util.List<IProductComponent> result)Same as getAllProductComponents() but searches only in this repository and not the ones this repository depends on.protected voidgetAllTables(java.util.List<ITable<?>> result)Same asAbstractRuntimeRepository.getAllTables()but searches only in this repository and not the ones this repository depends on.protected <T> TgetCustomRuntimeObjectInternal(java.lang.Class<T> type, java.lang.String id)Same asAbstractRuntimeRepository.getCustomRuntimeObject(Class, String)but searches only in this repository and not the ones this repository depends on.protected <T> java.util.List<T>getEnumValuesInternal(java.lang.Class<T> clazz)Returns the list of enumeration values of the enumeration type that is identified by its class which is provided to it.protected IpsTestCaseBasegetIpsTestCaseInternal(java.lang.String qName, IRuntimeRepository runtimeRepository)Same asAbstractRuntimeRepository.getIpsTestCase(String, IRuntimeRepository)but searches only in this repository and not the ones this repository depends on.protected voidgetIpsTestCasesStartingWith(java.lang.String qNamePrefix, java.util.List<IpsTest2> result, IRuntimeRepository runtimeRepository)Gets all ips test cases starting with the given qualified name prefix.protected IProductComponentGenerationgetLatestProductComponentGenerationInternal(IProductComponent productCmpt)protected IProductComponentGenerationgetNextProductComponentGenerationInternal(IProductComponentGeneration generation)protected intgetNumberOfProductComponentGenerationsInternal(IProductComponent productCmpt)protected IProductComponentGenerationgetPreviousProductComponentGenerationInternal(IProductComponentGeneration generation)protected IProductComponentGenerationgetProductComponentGenerationInternal(java.lang.String productCmptId, java.util.Calendar effectiveDate)Same as getProductComponentGeneration(String id, Calendar effectiveDate) but searches only in this repository and not the ones this repository depends on.voidgetProductComponentGenerations(IProductComponent productCmpt, java.util.List<IProductComponentGeneration> result)Same as getProductComponentGenerations() but searches only in this repository and not the ones this repository depends on.protected IProductComponentgetProductComponentInternal(java.lang.String id)Same as getProductComponent(String id) but searches only in this repository and not the ones this repository depends on.protected IProductComponentgetProductComponentInternal(java.lang.String kindId, java.lang.String versionId)Same as getProductComponent(String kindId, String versionId) but searches only in this repository and not the ones this repository depends on.protected <T extends ITable<?>>
TgetTableInternal(java.lang.Class<T> tableClass)InMemoryRepository also searches for tables that are instances of subclasses of the given tableClass.protected ITable<?>getTableInternal(java.lang.String qualifiedTableName)Same asAbstractRuntimeRepository.getTable(String)) but searches only in this repository and not the ones this repository depends on.voidinitialize()Nothing to do for the in memory repository.booleanisModifiable()Returnstrueif the repository's content is modifiable.<T extends IRuntimeObject>
voidputCustomRuntimeObject(java.lang.Class<T> type, java.lang.String ipsObjectQualifiedName, T runtimeObject)Puts the runtimeObject into the repository.<T> voidputEnumValues(java.lang.Class<T> enumType, java.util.List<T> enumValues)Puts the given enum values in the repository replacing all existing values for the given enumType.voidputIpsTestCase(IpsTestCaseBase test)Puts the test case into the repository.voidputProductCmptGeneration(IProductComponentGeneration generation)Puts the product component generation and its product component into the repository.voidputProductComponent(IProductComponent productCmpt)Puts the product component into the repository.voidputTable(ITable<?> table)Puts the table into the repository.voidputTable(ITable<?> table, java.lang.String qName)Puts the table with the indicated name into the repository with .-
Methods inherited from class org.faktorips.runtime.internal.AbstractRuntimeRepository
addDirectlyReferencedRepository, addEnumValueLookupService, getAllEnumClasses, getAllIpsTestCases, getAllModelTypeImplementationClasses, getAllProductComponentIds, getAllProductComponents, getAllProductComponents, getAllProductComponents, getAllProductComponentsInternal, getAllReferencedRepositories, getAllTables, getClassLoader, getCustomRuntimeObject, getDirectlyReferencedRepositories, getEnumValue, getEnumValue, getEnumValueLookupService, getEnumValues, getEnumValuesDefinedInType, getExistingEnumValue, getExistingProductComponent, getExistingProductComponentGeneration, getFormulaEvaluatorFactory, getIpsTest, getIpsTest, getIpsTestCase, getIpsTestCase, getIpsTestCasesStartingWith, getIpsTestSuite, getIpsTestSuite, getLatestProductComponentGeneration, getModelType, getModelType, getModelType, getName, getNextProductComponentGeneration, getNumberOfProductComponentGenerations, getPreviousProductComponentGeneration, getProductComponent, getProductComponent, getProductComponentGeneration, getProductComponentGenerations, getRuntimeRepositoryLookup, getTable, getTable, newJAXBContext, newJAXBContext, removeEnumValueLookupService, setFormulaEvaluatorFactory, setRuntimeRepositoryLookup, toString
-
-
-
-
Method Detail
-
getProductComponentInternal
protected IProductComponent getProductComponentInternal(java.lang.String id)
Description copied from class:AbstractRuntimeRepositorySame as getProductComponent(String id) but searches only in this repository and not the ones this repository depends on.- Specified by:
getProductComponentInternalin classAbstractRuntimeRepository
-
getProductComponentInternal
protected IProductComponent getProductComponentInternal(java.lang.String kindId, java.lang.String versionId)
Description copied from class:AbstractRuntimeRepositorySame as getProductComponent(String kindId, String versionId) but searches only in this repository and not the ones this repository depends on.- Specified by:
getProductComponentInternalin classAbstractRuntimeRepository
-
getAllProductComponents
public void getAllProductComponents(java.lang.String kindId, java.util.List<IProductComponent> result)Description copied from class:AbstractRuntimeRepositorySame as getAllProductComponent(String kindId) but searches only in this repository and not the ones this repository depends on. Adds the components found to the given result list.- Specified by:
getAllProductComponentsin classAbstractRuntimeRepository
-
getProductComponentGenerations
public void getProductComponentGenerations(IProductComponent productCmpt, java.util.List<IProductComponentGeneration> result)
Description copied from class:AbstractRuntimeRepositorySame as getProductComponentGenerations() but searches only in this repository and not the ones this repository depends on. Adds the components found to the given result list.- Specified by:
getProductComponentGenerationsin classAbstractRuntimeRepository
-
initialize
public void initialize()
Nothing to do for the in memory repository.
-
getAllTables
protected void getAllTables(java.util.List<ITable<?>> result)
Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getAllTables()but searches only in this repository and not the ones this repository depends on. Adds the tables found to the given result list.- Specified by:
getAllTablesin classAbstractRuntimeRepository
-
getTableInternal
protected <T extends ITable<?>> T getTableInternal(java.lang.Class<T> tableClass)
InMemoryRepository also searches for tables that are instances of subclasses of the given tableClass. This allows to mock a table class for testing purposes.Same as
AbstractRuntimeRepository.getTable(Class)but searches only in this repository and not the ones this repository depends on.- Specified by:
getTableInternalin classAbstractRuntimeRepository
-
putTable
public void putTable(ITable<?> table)
Puts the table into the repository. Replaces any table instance of the same class or any of its superclasses. The latter check is needed to replace tables with mock implementations.- Throws:
java.lang.NullPointerException- if table isnull.
-
putTable
public void putTable(ITable<?> table, java.lang.String qName)
Puts the table with the indicated name into the repository with . Replaces any table instance with the same qualified name.- Throws:
java.lang.NullPointerException- if table or qName isnull.
-
putEnumValues
public <T> void putEnumValues(java.lang.Class<T> enumType, java.util.List<T> enumValues)Puts the given enum values in the repository replacing all existing values for the given enumType.- Parameters:
enumType- The Java class representing the enumeration type.enumValues- The value of the enumeration type as list.
-
getTableInternal
protected ITable<?> getTableInternal(java.lang.String qualifiedTableName)
Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getTable(String)) but searches only in this repository and not the ones this repository depends on.- Specified by:
getTableInternalin classAbstractRuntimeRepository
-
getAllProductComponents
public void getAllProductComponents(java.util.List<IProductComponent> result)
Description copied from class:AbstractRuntimeRepositorySame as getAllProductComponents() but searches only in this repository and not the ones this repository depends on. Adds the components found to the given result list.- Specified by:
getAllProductComponentsin classAbstractRuntimeRepository
-
getAllProductComponentIds
public void getAllProductComponentIds(java.util.List<java.lang.String> result)
Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getAllProductComponentIds()but searches only in this repository and not the ones this repository depends on. Adds the components found to the given result list.- Specified by:
getAllProductComponentIdsin classAbstractRuntimeRepository
-
getAllEnumClasses
protected void getAllEnumClasses(java.util.LinkedHashSet<java.lang.Class<?>> result)
Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getAllEnumClasses()but searches only in this repository and not the ones this repository depends on. Adds the classes found to the given result set.- Specified by:
getAllEnumClassesin classAbstractRuntimeRepository
-
isModifiable
public boolean isModifiable()
Description copied from interface:IRuntimeRepositoryReturnstrueif the repository's content is modifiable. This feature is mainly targeted for writing test cases that need to setup a repository with a test specific content programmatically. Returnsfalseotherwise.
-
putProductComponent
public void putProductComponent(IProductComponent productCmpt)
Puts the product component into the repository. If the repository already contains a component with the same id, the new component replaces the old one.- Throws:
IllegalRepositoryModificationException- if this repository does not allows to modifyjava.lang.NullPointerException- if productCmpt isnullits contents.- See Also:
IRuntimeRepository.isModifiable()
-
getProductComponentGenerationInternal
protected IProductComponentGeneration getProductComponentGenerationInternal(java.lang.String productCmptId, java.util.Calendar effectiveDate)
Description copied from class:AbstractRuntimeRepositorySame as getProductComponentGeneration(String id, Calendar effectiveDate) but searches only in this repository and not the ones this repository depends on.- Specified by:
getProductComponentGenerationInternalin classAbstractRuntimeRepository
-
putProductCmptGeneration
public void putProductCmptGeneration(IProductComponentGeneration generation)
Puts the product component generation and its product component into the repository. If the repository already contains a generation with the same id, the new component replaces the old one. The same applies for the product component.- Throws:
IllegalRepositoryModificationException- if this repository does not allows to modify its contents.java.lang.NullPointerException- if generation isnull- See Also:
IRuntimeRepository.isModifiable()
-
getAllIpsTestCases
protected void getAllIpsTestCases(java.util.List<IpsTest2> result, IRuntimeRepository runtimeRepository)
Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getAllIpsTestCases(IRuntimeRepository)but searches only in this repository and not the ones this repository depends on. Adds the components found to the given result list.- Specified by:
getAllIpsTestCasesin classAbstractRuntimeRepository
-
getIpsTestCasesStartingWith
protected void getIpsTestCasesStartingWith(java.lang.String qNamePrefix, java.util.List<IpsTest2> result, IRuntimeRepository runtimeRepository)Description copied from class:AbstractRuntimeRepositoryGets all ips test cases starting with the given qualified name prefix.- Specified by:
getIpsTestCasesStartingWithin classAbstractRuntimeRepository
-
getIpsTestCaseInternal
protected IpsTestCaseBase getIpsTestCaseInternal(java.lang.String qName, IRuntimeRepository runtimeRepository)
Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getIpsTestCase(String, IRuntimeRepository)but searches only in this repository and not the ones this repository depends on. The given runtimeRepository specifies the repository which will be used to instantiate the test case (e.g. the first repository which contains all dependence repositories).- Specified by:
getIpsTestCaseInternalin classAbstractRuntimeRepository
-
putIpsTestCase
public void putIpsTestCase(IpsTestCaseBase test)
Puts the test case into the repository.
-
getAllModelTypeImplementationClasses
protected void getAllModelTypeImplementationClasses(java.util.Set<java.lang.String> result)
Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getAllModelTypeImplementationClasses()but searches only in this repository and not the ones this repository depends on. Adds the types found to the given result list.- Specified by:
getAllModelTypeImplementationClassesin classAbstractRuntimeRepository
-
getNextProductComponentGenerationInternal
protected IProductComponentGeneration getNextProductComponentGenerationInternal(IProductComponentGeneration generation)
- Specified by:
getNextProductComponentGenerationInternalin classAbstractRuntimeRepository
-
getNumberOfProductComponentGenerationsInternal
protected int getNumberOfProductComponentGenerationsInternal(IProductComponent productCmpt)
- Specified by:
getNumberOfProductComponentGenerationsInternalin classAbstractRuntimeRepository
-
getPreviousProductComponentGenerationInternal
protected IProductComponentGeneration getPreviousProductComponentGenerationInternal(IProductComponentGeneration generation)
- Specified by:
getPreviousProductComponentGenerationInternalin classAbstractRuntimeRepository
-
getLatestProductComponentGenerationInternal
protected IProductComponentGeneration getLatestProductComponentGenerationInternal(IProductComponent productCmpt)
- Specified by:
getLatestProductComponentGenerationInternalin classAbstractRuntimeRepository
-
getEnumValuesInternal
protected <T> java.util.List<T> getEnumValuesInternal(java.lang.Class<T> clazz)
Description copied from class:AbstractRuntimeRepositoryReturns the list of enumeration values of the enumeration type that is identified by its class which is provided to it.- Specified by:
getEnumValuesInternalin classAbstractRuntimeRepository
-
addEnumXmlAdapter
public void addEnumXmlAdapter(javax.xml.bind.annotation.adapters.XmlAdapter<?,?> enumXmlAdapter)
Adds anXmlAdapterfor a Faktor-IPS enumeration that defers its content to a enumeration content to this repository.
-
getAllInternalEnumXmlAdapters
protected java.util.List<javax.xml.bind.annotation.adapters.XmlAdapter<?,?>> getAllInternalEnumXmlAdapters(IRuntimeRepository repository)
Description copied from class:AbstractRuntimeRepositoryReturns all enumeration XmlAdapters available in this repository that generated by Faktor-IPS.- Specified by:
getAllInternalEnumXmlAdaptersin classAbstractRuntimeRepository- Parameters:
repository- the runtime repository that needs to be used by the XmlAdapters that are returned by this method
-
putCustomRuntimeObject
public <T extends IRuntimeObject> void putCustomRuntimeObject(java.lang.Class<T> type, java.lang.String ipsObjectQualifiedName, T runtimeObject)
Puts the runtimeObject into the repository.
-
getCustomRuntimeObjectInternal
protected <T> T getCustomRuntimeObjectInternal(java.lang.Class<T> type, java.lang.String id)Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getCustomRuntimeObject(Class, String)but searches only in this repository and not the ones this repository depends on.- Specified by:
getCustomRuntimeObjectInternalin classAbstractRuntimeRepository
-
-