Package org.faktorips.runtime.internal
Class AbstractTocBasedRuntimeRepository
- java.lang.Object
-
- org.faktorips.runtime.internal.AbstractRuntimeRepository
-
- org.faktorips.runtime.internal.AbstractCachingRuntimeRepository
-
- org.faktorips.runtime.internal.AbstractTocBasedRuntimeRepository
-
- All Implemented Interfaces:
IRuntimeRepository
- Direct Known Subclasses:
AbstractClassLoadingRuntimeRepository
public abstract class AbstractTocBasedRuntimeRepository extends AbstractCachingRuntimeRepository
Abstract base implementation of runtime repository that uses a table of contents to lazily load the product data. This implementation also manages the caches.- Author:
- Jan Ortmann
-
-
Constructor Summary
Constructors Constructor Description AbstractTocBasedRuntimeRepository(java.lang.String name, ICacheFactory cacheFactory, java.lang.ClassLoader cl)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract <T> TcreateCustomObject(CustomTocEntryObject<T> tocEntry)protected abstract <T> java.util.List<T>createEnumValues(EnumContentTocEntry tocEntry, java.lang.Class<T> clazz)protected javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,?>createEnumXmlAdapter(java.lang.String className, IRuntimeRepository repository)Creates and returns anXmlAdapterinstance for the provided class name.protected abstract IProductComponentcreateProductCmpt(ProductCmptTocEntry tocEntry)protected abstract IProductComponentGenerationcreateProductCmptGeneration(GenerationTocEntry generationTocEntry)protected abstract ITable<?>createTable(TableContentTocEntry tocEntry)Creates the table object for the given toc entry.protected abstract IpsTestCaseBasecreateTestCase(TestCaseTocEntry tocEntry, IRuntimeRepository runtimeRepository)Creates the test case object for the given toc entry.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 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.voidgetAllTables(java.util.List<ITable<?>> result)Same asAbstractRuntimeRepository.getAllTables()but searches only in this repository and not the ones this repository depends on.protected java.lang.Class<?>getClass(java.lang.String className, java.lang.ClassLoader cl)Returns the class for the given qualified class name.protected IpsTestCaseBasegetIpsTestCaseInternal(java.lang.String qName, IRuntimeRepository runtimeRepository)IpsTestCases are created new every time and should not be cached because the test data could change for every test creation.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 <T> TgetNotCachedCustomObject(java.lang.Class<T> type, java.lang.String id)protected <T> java.util.List<T>getNotCachedEnumValues(java.lang.Class<T> clazz)protected java.util.List<javax.xml.bind.annotation.adapters.XmlAdapter<?,?>>getNotCachedEnumXmlAdapter(IRuntimeRepository repository)protected IProductComponentgetNotCachedProductComponent(java.lang.String id)protected IProductComponentGenerationgetNotCachedProductComponentGeneration(GenerationId generationId)protected ITable<?>getNotCachedTable(java.lang.String qualifiedTableName)protected intgetNumberOfProductComponentGenerationsInternal(IProductComponent productCmpt)protected IProductComponentGenerationgetPreviousProductComponentGenerationInternal(IProductComponentGeneration generation)protected IProductComponentGenerationgetProductComponentGenerationInternal(java.lang.String id, 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 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)Same asAbstractRuntimeRepository.getTable(Class)but searches only in this repository and not the ones this repository depends on.protected IReadonlyTableOfContentsgetTableOfContents()protected voidinitialize()Initializes the runtime repository by loading the table of contents.protected abstract IReadonlyTableOfContentsloadTableOfContents()-
Methods inherited from class org.faktorips.runtime.internal.AbstractCachingRuntimeRepository
getAllInternalEnumXmlAdapters, getCustomRuntimeObjectInternal, getEnumValuesInternal, getProductComponentGenerationInternal, getProductComponentInternal, getTableInternal, initCaches
-
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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.faktorips.runtime.IRuntimeRepository
isModifiable
-
-
-
-
Constructor Detail
-
AbstractTocBasedRuntimeRepository
public AbstractTocBasedRuntimeRepository(java.lang.String name, ICacheFactory cacheFactory, java.lang.ClassLoader cl)
-
-
Method Detail
-
loadTableOfContents
protected abstract IReadonlyTableOfContents loadTableOfContents()
-
getTableOfContents
protected IReadonlyTableOfContents getTableOfContents()
-
createEnumValues
protected abstract <T> java.util.List<T> createEnumValues(EnumContentTocEntry tocEntry, java.lang.Class<T> clazz)
-
getProductComponentInternal
protected final 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
-
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
-
getAllEnumClasses
public 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
-
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
-
createProductCmpt
protected abstract IProductComponent createProductCmpt(ProductCmptTocEntry tocEntry)
-
getProductComponentGenerationInternal
protected IProductComponentGeneration getProductComponentGenerationInternal(java.lang.String id, 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
-
getNextProductComponentGenerationInternal
protected IProductComponentGeneration getNextProductComponentGenerationInternal(IProductComponentGeneration generation)
- Specified by:
getNextProductComponentGenerationInternalin classAbstractRuntimeRepository
-
getPreviousProductComponentGenerationInternal
protected IProductComponentGeneration getPreviousProductComponentGenerationInternal(IProductComponentGeneration generation)
- Specified by:
getPreviousProductComponentGenerationInternalin classAbstractRuntimeRepository
-
getLatestProductComponentGenerationInternal
protected IProductComponentGeneration getLatestProductComponentGenerationInternal(IProductComponent productCmpt)
- Specified by:
getLatestProductComponentGenerationInternalin 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
-
getNumberOfProductComponentGenerationsInternal
protected int getNumberOfProductComponentGenerationsInternal(IProductComponent productCmpt)
- Specified by:
getNumberOfProductComponentGenerationsInternalin classAbstractRuntimeRepository
-
getNotCachedProductComponentGeneration
protected IProductComponentGeneration getNotCachedProductComponentGeneration(GenerationId generationId)
- Specified by:
getNotCachedProductComponentGenerationin classAbstractCachingRuntimeRepository
-
createProductCmptGeneration
protected abstract IProductComponentGeneration createProductCmptGeneration(GenerationTocEntry generationTocEntry)
-
getAllTables
public 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)
Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getTable(Class)but searches only in this repository and not the ones this repository depends on.- Specified by:
getTableInternalin classAbstractRuntimeRepository
-
getNotCachedTable
protected ITable<?> getNotCachedTable(java.lang.String qualifiedTableName)
- Specified by:
getNotCachedTablein classAbstractCachingRuntimeRepository
-
createTable
protected abstract ITable<?> createTable(TableContentTocEntry tocEntry)
Creates the table object for the given toc entry.
-
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
-
createTestCase
protected abstract IpsTestCaseBase createTestCase(TestCaseTocEntry tocEntry, IRuntimeRepository runtimeRepository)
Creates the test case object for the given toc entry.
-
initialize
protected void initialize()
Initializes the runtime repository by loading the table of contents. This method have to be called from the constructor after all necessary data is set.
-
getClass
protected java.lang.Class<?> getClass(java.lang.String className, java.lang.ClassLoader cl)Returns the class for the given qualified class name.- Parameters:
className- The qualified class namecl- The classLoader used to load the load.- Throws:
java.lang.RuntimeException- if the class can't be found.
-
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
-
createEnumXmlAdapter
protected javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,?> createEnumXmlAdapter(java.lang.String className, IRuntimeRepository repository) throws java.lang.ExceptionCreates and returns anXmlAdapterinstance for the provided class name.- Throws:
java.lang.Exception- can occur while localizing the xml adapter class and creating the instance
-
getNotCachedProductComponent
protected IProductComponent getNotCachedProductComponent(java.lang.String id)
- Specified by:
getNotCachedProductComponentin classAbstractCachingRuntimeRepository
-
getNotCachedEnumValues
protected <T> java.util.List<T> getNotCachedEnumValues(java.lang.Class<T> clazz)
- Specified by:
getNotCachedEnumValuesin classAbstractCachingRuntimeRepository
-
getNotCachedEnumXmlAdapter
protected java.util.List<javax.xml.bind.annotation.adapters.XmlAdapter<?,?>> getNotCachedEnumXmlAdapter(IRuntimeRepository repository)
- Specified by:
getNotCachedEnumXmlAdapterin classAbstractCachingRuntimeRepository
-
getIpsTestCaseInternal
protected IpsTestCaseBase getIpsTestCaseInternal(java.lang.String qName, IRuntimeRepository runtimeRepository)
IpsTestCases are created new every time and should not be cached because the test data could change for every test creation.- Specified by:
getIpsTestCaseInternalin classAbstractRuntimeRepository
-
getNotCachedCustomObject
protected <T> T getNotCachedCustomObject(java.lang.Class<T> type, java.lang.String id)- Specified by:
getNotCachedCustomObjectin classAbstractCachingRuntimeRepository
-
createCustomObject
protected abstract <T> T createCustomObject(CustomTocEntryObject<T> tocEntry)
-
-