org.faktorips.runtime.internal
Class AbstractTocBasedRuntimeRepository

java.lang.Object
  extended by org.faktorips.runtime.internal.AbstractRuntimeRepository
      extended by org.faktorips.runtime.internal.AbstractCachingRuntimeRepository
          extended by 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
AbstractTocBasedRuntimeRepository(String name, ICacheFactory cacheFactory, ClassLoader cl)
           
 
Method Summary
protected abstract
<T> T
createCustomObject(CustomTocEntryObject<T> tocEntry)
           
protected abstract
<T> List<T>
createEnumValues(EnumContentTocEntry tocEntry, Class<T> clazz)
           
protected  XmlAdapter<String,?> createEnumXmlAdapter(String className, IRuntimeRepository repository)
          Creates and returns an XmlAdapter instance for the provided class name.
protected abstract  IProductComponent createProductCmpt(ProductCmptTocEntry tocEntry)
           
protected abstract  IProductComponentGeneration createProductCmptGeneration(GenerationTocEntry generationTocEntry)
           
protected abstract  ITable createTable(TableContentTocEntry tocEntry)
          Creates the table object for the given toc entry.
protected abstract  IpsTestCaseBase createTestCase(TestCaseTocEntry tocEntry, IRuntimeRepository runtimeRepository)
          Creates the test case object for the given toc entry.
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.
 void getAllTables(List<ITable> result)
          Same as getAllTables() but searches only in this repository and not the ones, this repository depends on.
protected  Class<?> getClass(String className, ClassLoader cl)
          Returns the class for the given qualified class name.
protected  IpsTestCaseBase getIpsTestCaseInternal(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  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
<T> T
getNotCachedCustomObject(Class<T> type, String id)
           
protected
<T> List<T>
getNotCachedEnumValues(Class<T> clazz)
           
protected  List<XmlAdapter<?,?>> getNotCachedEnumXmlAdapter(IRuntimeRepository repository)
           
protected  IProductComponent getNotCachedProductComponent(String id)
           
protected  IProductComponentGeneration getNotCachedProductComponentGeneration(GenerationId generationId)
           
protected  ITable getNotCachedTable(String qualifiedTableName)
           
protected  int getNumberOfProductComponentGenerationsInternal(IProductComponent productCmpt)
           
protected  IProductComponentGeneration getPreviousProductComponentGenerationInternal(IProductComponentGeneration generation)
           
protected  IProductComponentGeneration getProductComponentGenerationInternal(String id, 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 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)
          Same as AbstractRuntimeRepository.getTable(Class) but searches only in this repository and not the ones, this repository depends on.
protected  IReadonlyTableOfContents getTableOfContents()
           
protected  void initialize()
          Initializes the runtime repository by loading the table of contents.
protected abstract  IReadonlyTableOfContents loadTableOfContents()
           
 
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, 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
 
Methods inherited from interface org.faktorips.runtime.IRuntimeRepository
isModifiable
 

Constructor Detail

AbstractTocBasedRuntimeRepository

public AbstractTocBasedRuntimeRepository(String name,
                                         ICacheFactory cacheFactory,
                                         ClassLoader cl)
Method Detail

loadTableOfContents

protected abstract IReadonlyTableOfContents loadTableOfContents()

getTableOfContents

protected IReadonlyTableOfContents getTableOfContents()

createEnumValues

protected abstract <T> List<T> createEnumValues(EnumContentTocEntry tocEntry,
                                                Class<T> clazz)

getProductComponentInternal

protected final 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

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

createProductCmpt

protected abstract IProductComponent createProductCmpt(ProductCmptTocEntry tocEntry)

getProductComponentGenerationInternal

protected IProductComponentGeneration getProductComponentGenerationInternal(String id,
                                                                            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

getNextProductComponentGenerationInternal

protected IProductComponentGeneration getNextProductComponentGenerationInternal(IProductComponentGeneration generation)
Specified by:
getNextProductComponentGenerationInternal 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

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

getNumberOfProductComponentGenerationsInternal

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

getNotCachedProductComponentGeneration

protected IProductComponentGeneration getNotCachedProductComponentGeneration(GenerationId generationId)
Specified by:
getNotCachedProductComponentGeneration in class AbstractCachingRuntimeRepository

createProductCmptGeneration

protected abstract IProductComponentGeneration createProductCmptGeneration(GenerationTocEntry generationTocEntry)

getAllTables

public 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)
Description copied from class: AbstractRuntimeRepository
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

getNotCachedTable

protected ITable getNotCachedTable(String qualifiedTableName)
Specified by:
getNotCachedTable in class AbstractCachingRuntimeRepository

createTable

protected abstract ITable createTable(TableContentTocEntry tocEntry)
Creates the table object for the given toc entry.


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

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 Class<?> getClass(String className,
                            ClassLoader cl)
Returns the class for the given qualified class name.

Parameters:
className - The qualified class name
cl - The classLoader used to load the load.
Throws:
RuntimeException - if the class can't be found.

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

createEnumXmlAdapter

protected XmlAdapter<String,?> createEnumXmlAdapter(String className,
                                                    IRuntimeRepository repository)
                                             throws Exception
Creates and returns an XmlAdapter instance for the provided class name.

Throws:
Exception - can occur while localizing the xml adapter class and creating the instance

getNotCachedProductComponent

protected IProductComponent getNotCachedProductComponent(String id)
Specified by:
getNotCachedProductComponent in class AbstractCachingRuntimeRepository

getNotCachedEnumValues

protected <T> List<T> getNotCachedEnumValues(Class<T> clazz)
Specified by:
getNotCachedEnumValues in class AbstractCachingRuntimeRepository

getNotCachedEnumXmlAdapter

protected List<XmlAdapter<?,?>> getNotCachedEnumXmlAdapter(IRuntimeRepository repository)
Specified by:
getNotCachedEnumXmlAdapter in class AbstractCachingRuntimeRepository

getIpsTestCaseInternal

protected IpsTestCaseBase getIpsTestCaseInternal(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:
getIpsTestCaseInternal in class AbstractRuntimeRepository

getNotCachedCustomObject

protected <T> T getNotCachedCustomObject(Class<T> type,
                                         String id)
Specified by:
getNotCachedCustomObject in class AbstractCachingRuntimeRepository

createCustomObject

protected abstract <T> T createCustomObject(CustomTocEntryObject<T> tocEntry)


Copyright © 2015. All rights reserved.