org.faktorips.runtime
Class InMemoryRuntimeRepository

java.lang.Object
  extended by org.faktorips.runtime.internal.AbstractRuntimeRepository
      extended by org.faktorips.runtime.InMemoryRuntimeRepository
All Implemented Interfaces:
IRuntimeRepository

public class InMemoryRuntimeRepository
extends AbstractRuntimeRepository

A runtime repository that keeps it's data in memory.


Constructor Summary
InMemoryRuntimeRepository()
           
InMemoryRuntimeRepository(String name)
           
 
Method Summary
 void addEnumXmlAdapter(XmlAdapter<?,?> enumXmlAdapter)
          Adds an XmlAdapter for a Faktor-IPS enumeration that defers its content to a enumeration content to this repository.
protected  List<XmlAdapter<?,?>> getAllInternalEnumXmlAdapters(IRuntimeRepository repository)
          Returns all enumeration XmlAdapters available in this repository that generated by Faktor-IPS.
protected  void getAllIpsTestCases(List<IpsTest2> result, IRuntimeRepository runtimeRepository)
          Same as AbstractRuntimeRepository.getAllIpsTestCases(IRuntimeRepository) but searches only in this repository and not the ones, this repository depends on.
protected  void getAllModelTypeImplementationClasses(Set<String> result)
          Same as getAllModelTypeImplementationClasses() but searches only in this repository and not the ones, this repository depends on.
 void getAllProductComponentIds(List<String> result)
          Same as getAllProductComponentIds() but searches only in this repository and not the ones, this repository depends on.
 void getAllProductComponents(List<IProductComponent> result)
          Same as getAllProductComponents() but searches only in this repository and not the ones, this repository depends on.
 void getAllProductComponents(String kindId, List<IProductComponent> result)
          Same as getAllProductComponent(String kindId) but searches only in this repository and not the ones, this repository depends on.
protected  void getAllTables(List<ITable> result)
          Same as getAllTables() but searches only in this repository and not the ones, this repository depends on.
protected
<T> T
getCustomRuntimeObjectInternal(Class<T> type, String id)
          Same as getCustomRuntimeObject(Class type, String id) but searches only in this repository and not the ones this repository depends on.
protected
<T> List<T>
getEnumValuesInternal(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  IpsTestCaseBase getIpsTestCaseInternal(String qName, IRuntimeRepository runtimeRepository)
          Same as AbstractRuntimeRepository.getIpsTestCase(String, IRuntimeRepository) but searches only in this repository and not the ones, this repository depends on.
protected  void getIpsTestCasesStartingWith(String qNamePrefix, List<IpsTest2> result, IRuntimeRepository runtimeRepository)
          Gets all ips test cases starting with the given qualified name prefix.
protected  IProductComponentGeneration getLatestProductComponentGenerationInternal(IProductComponent productCmpt)
           
protected  IProductComponentGeneration getNextProductComponentGenerationInternal(IProductComponentGeneration generation)
           
protected  int getNumberOfProductComponentGenerationsInternal(IProductComponent productCmpt)
           
protected  IProductComponentGeneration getPreviousProductComponentGenerationInternal(IProductComponentGeneration generation)
           
protected  IProductComponentGeneration getProductComponentGenerationInternal(String productCmptId, Calendar effectiveDate)
          Same as getProductComponentGeneration(String id, Calendar effectiveDate) but searches only in this repository and not the ones, this repository depends on.
 void getProductComponentGenerations(IProductComponent productCmpt, List<IProductComponentGeneration> result)
          Same as getProductComponentGenerations() but searches only in this repository and not the ones, this repository depends on.
protected  IProductComponent getProductComponentInternal(String id)
          Same as getProductComponent(String id) but searches only in this repository and not the ones, this repository depends on.
protected  IProductComponent getProductComponentInternal(String kindId, 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>
T
getTableInternal(Class<T> tableClass)
          InMemoryRepository also searches for tables that are instances of subclasses of the given tableClass.
protected  ITable getTableInternal(String qualifiedTableName)
          Same as AbstractRuntimeRepository.getTable(String)) but searches only in this repository and not the ones, this repository depends on.
 void initialize()
          Nothing to do for the in memory repository.
 boolean isModifiable()
          Returns true if the repository's content is modifiable.
<T extends IRuntimeObject>
void
putCustomRuntimeObject(Class<T> type, String ipsObjectQualifiedName, T runtimeObject)
          Puts the runtimeObject into the repository.
<T> void
putEnumValues(Class<T> enumType, List<T> enumValues)
          Puts the given enum values in the repository replacing all existing values for the given enumType.
 void putIpsTestCase(IpsTestCaseBase test)
          Puts the test case into the repository.
 void putProductCmptGeneration(IProductComponentGeneration generation)
          Puts the product component generation and it's product componet into the repository.
 void putProductComponent(IProductComponent productCmpt)
          Puts the product component into the repository.
 void putTable(ITable table)
          Puts the table into the repository.
 void putTable(ITable table, String qName)
          Puts the table with the indicated name into the repository with .
 
Methods inherited from class org.faktorips.runtime.internal.AbstractRuntimeRepository
addDirectlyReferencedRepository, addEnumValueLookupService, getAllIpsTestCases, getAllModelTypeImplementationClasses, getAllProductComponentIds, getAllProductComponents, getAllProductComponents, getAllProductComponents, getAllProductComponentsInternal, getAllReferencedRepositories, getAllTables, getClassLoader, getCustomRuntimeObject, getDirectlyReferencedRepositories, getEnumValue, getEnumValue, getEnumValueLookupService, getEnumValues, getEnumValuesDefinedInType, getExistingProductComponent, getExistingProductComponentGeneration, getFormulaEvaluatorFactory, getIpsTest, getIpsTest, getIpsTestCase, getIpsTestCase, getIpsTestCasesStartingWith, getIpsTestSuite, getIpsTestSuite, getLatestProductComponentGeneration, getModelType, getModelType, getModelType, getModelType, getName, getNextProductComponentGeneration, getNumberOfProductComponentGenerations, getPreviousProductComponentGeneration, getProductComponent, getProductComponent, getProductComponentGeneration, getProductComponentGenerations, getRuntimeRepositoryLookup, getTable, getTable, newJAXBContext, newJAXBContext, removeEnumValueLookupService, setFormulaEvaluatorFactory, setRuntimeRepositoryLookup, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InMemoryRuntimeRepository

public InMemoryRuntimeRepository()

InMemoryRuntimeRepository

public InMemoryRuntimeRepository(String name)
Method Detail

getProductComponentInternal

protected IProductComponent getProductComponentInternal(String id)
Description copied from class: AbstractRuntimeRepository
Same as getProductComponent(String id) but searches only in this repository and not the ones, this repository depends on.

Specified by:
getProductComponentInternal in class AbstractRuntimeRepository

getProductComponentInternal

protected IProductComponent getProductComponentInternal(String kindId,
                                                        String versionId)
Description copied from class: AbstractRuntimeRepository
Same as getProductComponent(String kindId, String versionId) but searches only in this repository and not the ones, this repository depends on.

Specified by:
getProductComponentInternal in class AbstractRuntimeRepository

getAllProductComponents

public void getAllProductComponents(String kindId,
                                    List<IProductComponent> result)
Description copied from class: AbstractRuntimeRepository
Same 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:
getAllProductComponents in class AbstractRuntimeRepository

getProductComponentGenerations

public void getProductComponentGenerations(IProductComponent productCmpt,
                                           List<IProductComponentGeneration> result)
Description copied from class: AbstractRuntimeRepository
Same 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:
getProductComponentGenerations in class AbstractRuntimeRepository

initialize

public void initialize()
Nothing to do for the in memory repository.


getAllTables

protected void getAllTables(List<ITable> result)
Description copied from class: AbstractRuntimeRepository
Same as 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:
getAllTables in class AbstractRuntimeRepository

getTableInternal

protected <T extends ITable> T getTableInternal(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:
getTableInternal in class AbstractRuntimeRepository

putTable

public void putTable(ITable table)
Puts the table into the repository. Replaces any table instance of the same class or any of it's superclasses. The latter check is needed to replace tables with mock implementations.

Throws:
NullPointerException - if table is null.

putTable

public void putTable(ITable table,
                     String qName)
Puts the table with the indicated name into the repository with . Replaces any table instance with the same qualified name.

Throws:
NullPointerException - if table or qName is null.

putEnumValues

public <T> void putEnumValues(Class<T> enumType,
                              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(String qualifiedTableName)
Description copied from class: AbstractRuntimeRepository
Same as AbstractRuntimeRepository.getTable(String)) but searches only in this repository and not the ones, this repository depends on.

Specified by:
getTableInternal in class AbstractRuntimeRepository

getAllProductComponents

public void getAllProductComponents(List<IProductComponent> result)
Description copied from class: AbstractRuntimeRepository
Same 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:
getAllProductComponents in class AbstractRuntimeRepository

getAllProductComponentIds

public void getAllProductComponentIds(List<String> result)
Description copied from class: AbstractRuntimeRepository
Same as 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:
getAllProductComponentIds in class AbstractRuntimeRepository

isModifiable

public boolean isModifiable()
Description copied from interface: IRuntimeRepository
Returns true if 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 programatically. Returns false otherwise.


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 modify
NullPointerException - if cmpt is null it's contents.
See Also:
IRuntimeRepository.isModifiable()

getProductComponentGenerationInternal

protected IProductComponentGeneration getProductComponentGenerationInternal(String productCmptId,
                                                                            Calendar effectiveDate)
Description copied from class: AbstractRuntimeRepository
Same as getProductComponentGeneration(String id, Calendar effectiveDate) but searches only in this repository and not the ones, this repository depends on.

Specified by:
getProductComponentGenerationInternal in class AbstractRuntimeRepository

putProductCmptGeneration

public void putProductCmptGeneration(IProductComponentGeneration generation)
Puts the product component generation and it's product componet 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 it's contents.
NullPointerException - if generation is null
See Also:
IRuntimeRepository.isModifiable()

getAllIpsTestCases

protected void getAllIpsTestCases(List<IpsTest2> result,
                                  IRuntimeRepository runtimeRepository)
Description copied from class: AbstractRuntimeRepository
Same as AbstractRuntimeRepository.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:
getAllIpsTestCases in class AbstractRuntimeRepository

getIpsTestCasesStartingWith

protected void getIpsTestCasesStartingWith(String qNamePrefix,
                                           List<IpsTest2> result,
                                           IRuntimeRepository runtimeRepository)
Description copied from class: AbstractRuntimeRepository
Gets all ips test cases starting with the given qualified name prefix.

Specified by:
getIpsTestCasesStartingWith in class AbstractRuntimeRepository

getIpsTestCaseInternal

protected IpsTestCaseBase getIpsTestCaseInternal(String qName,
                                                 IRuntimeRepository runtimeRepository)
Description copied from class: AbstractRuntimeRepository
Same as AbstractRuntimeRepository.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:
getIpsTestCaseInternal in class AbstractRuntimeRepository

putIpsTestCase

public void putIpsTestCase(IpsTestCaseBase test)
Puts the test case into the repository.


getAllModelTypeImplementationClasses

protected void getAllModelTypeImplementationClasses(Set<String> result)
Description copied from class: AbstractRuntimeRepository
Same as 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:
getAllModelTypeImplementationClasses in class AbstractRuntimeRepository

getNextProductComponentGenerationInternal

protected IProductComponentGeneration getNextProductComponentGenerationInternal(IProductComponentGeneration generation)
Specified by:
getNextProductComponentGenerationInternal in class AbstractRuntimeRepository

getNumberOfProductComponentGenerationsInternal

protected int getNumberOfProductComponentGenerationsInternal(IProductComponent productCmpt)
Specified by:
getNumberOfProductComponentGenerationsInternal in class AbstractRuntimeRepository

getPreviousProductComponentGenerationInternal

protected IProductComponentGeneration getPreviousProductComponentGenerationInternal(IProductComponentGeneration generation)
Specified by:
getPreviousProductComponentGenerationInternal in class AbstractRuntimeRepository

getLatestProductComponentGenerationInternal

protected IProductComponentGeneration getLatestProductComponentGenerationInternal(IProductComponent productCmpt)
Specified by:
getLatestProductComponentGenerationInternal in class AbstractRuntimeRepository

getEnumValuesInternal

protected <T> List<T> getEnumValuesInternal(Class<T> clazz)
Description copied from class: AbstractRuntimeRepository
Returns the list of enumeration values of the enumeration type that is identified by its class which is provided to it.

Specified by:
getEnumValuesInternal in class AbstractRuntimeRepository

addEnumXmlAdapter

public void addEnumXmlAdapter(XmlAdapter<?,?> enumXmlAdapter)
Adds an XmlAdapter for a Faktor-IPS enumeration that defers its content to a enumeration content to this repository.


getAllInternalEnumXmlAdapters

protected List<XmlAdapter<?,?>> getAllInternalEnumXmlAdapters(IRuntimeRepository repository)
Description copied from class: AbstractRuntimeRepository
Returns all enumeration XmlAdapters available in this repository that generated by Faktor-IPS.

Specified by:
getAllInternalEnumXmlAdapters in class AbstractRuntimeRepository
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(Class<T> type,
                                                              String ipsObjectQualifiedName,
                                                              T runtimeObject)
Puts the runtimeObject into the repository.


getCustomRuntimeObjectInternal

protected <T> T getCustomRuntimeObjectInternal(Class<T> type,
                                               String id)
Description copied from class: AbstractRuntimeRepository
Same as getCustomRuntimeObject(Class type, String id) but searches only in this repository and not the ones this repository depends on.

Specified by:
getCustomRuntimeObjectInternal in class AbstractRuntimeRepository


Copyright © 2015. All rights reserved.