org.faktorips.runtime.internal
Class AbstractClassLoadingRuntimeRepository

java.lang.Object
  extended by org.faktorips.runtime.internal.AbstractRuntimeRepository
      extended by org.faktorips.runtime.internal.AbstractCachingRuntimeRepository
          extended by org.faktorips.runtime.internal.AbstractTocBasedRuntimeRepository
              extended by org.faktorips.runtime.internal.AbstractClassLoadingRuntimeRepository
All Implemented Interfaces:
IRuntimeRepository
Direct Known Subclasses:
ClassloaderRuntimeRepository, DetachedContentRuntimeRepository

public abstract class AbstractClassLoadingRuntimeRepository
extends AbstractTocBasedRuntimeRepository

An abstract repository that handles the common stuff between the AbstractTocBasedRuntimeRepository and the concrete runtime repositories. This abstract layer is responsible for loading the classes and instantiates the objects. The content of the objects - the concrete data - is provided by the concrete implementation.

Author:
dirmeier

Constructor Summary
AbstractClassLoadingRuntimeRepository(String name, ICacheFactory cacheFactory, ClassLoader cl)
           
 
Method Summary
protected
<T> T
createCustomObject(CustomTocEntryObject<T> tocEntry)
           
protected
<T> List<T>
createEnumValues(EnumContentTocEntry tocEntry, Class<T> enumClass)
           
protected  IProductComponent createProductCmpt(ProductCmptTocEntry tocEntry)
           
protected  IProductComponentGeneration createProductCmptGeneration(GenerationTocEntry tocEntry)
           
protected  ProductComponentGeneration createProductComponentGenerationInstance(GenerationTocEntry tocEntry, ProductComponent productCmpt)
           
protected  ProductComponent createProductComponentInstance(String implementationClassName, String ipsObjectId, String kindId, String versionId)
           
protected  ITable createTable(TableContentTocEntry tocEntry)
          Creates the table object for the given toc entry.
protected  IpsTestCaseBase createTestCase(TestCaseTocEntry tocEntry, IRuntimeRepository runtimeRepository)
          Creates the test case object for the given toc entry.
protected
<T extends IProductComponent>
void
getAllProductComponentsInternal(Class<T> productCmptClass, List<T> result)
          Override the default implementation for better performance.
 ClassLoader getClassLoader()
          Returns the class loader that is used to load Java classes by this repository.
protected abstract
<T> Element
getDocumentElement(CustomTocEntryObject<T> tocEntry)
          This method returns the xml element of the product component identified by the tocEntry
protected abstract  Element getDocumentElement(GenerationTocEntry tocEntry)
          This method returns the xml element of the product component generation identified by the tocEntry
protected abstract  Element getDocumentElement(ProductCmptTocEntry tocEntry)
          This method returns the xml element of the product component identified by the tocEntry
protected abstract  Element getDocumentElement(TestCaseTocEntry tocEntry)
          This method returns the xml element of the test case identified by the tocEntry
protected abstract  String getProductComponentGenerationImplClass(GenerationTocEntry tocEntry)
          This method returns the name of the product component generation implementation class identified by the tocEntry.
protected  ProductVariantRuntimeHelper getProductVariantHelper()
           
protected abstract  InputStream getXmlAsStream(EnumContentTocEntry tocEntry)
          Returns the XML data for the specified tocEntry as InputStream
protected abstract  InputStream getXmlAsStream(TableContentTocEntry tocEntry)
          Returns the XML data for the specified tocEntry as InputStream
protected
<T> void
initClRepositoryObject(CustomTocEntryObject<T> tocEntry, IClRepositoryObject runtimeObject)
           
 
Methods inherited from class org.faktorips.runtime.internal.AbstractTocBasedRuntimeRepository
createEnumXmlAdapter, getAllIpsTestCases, getAllModelTypeImplementationClasses, getAllProductComponentIds, getAllProductComponents, getAllProductComponents, getAllTables, getClass, getIpsTestCaseInternal, getIpsTestCasesStartingWith, getLatestProductComponentGenerationInternal, getNextProductComponentGenerationInternal, getNotCachedCustomObject, getNotCachedEnumValues, getNotCachedEnumXmlAdapter, getNotCachedProductComponent, getNotCachedProductComponentGeneration, getNotCachedTable, getNumberOfProductComponentGenerationsInternal, getPreviousProductComponentGenerationInternal, getProductComponentGenerationInternal, getProductComponentGenerations, getProductComponentInternal, getTableInternal, getTableOfContents, initialize, 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, getAllReferencedRepositories, getAllTables, 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

AbstractClassLoadingRuntimeRepository

public AbstractClassLoadingRuntimeRepository(String name,
                                             ICacheFactory cacheFactory,
                                             ClassLoader cl)
Parameters:
name - The name of the runtime repository
cacheFactory - the cache factory used by this runtime repository
cl - the ClassLoader used to load the classes
Method Detail

createProductCmpt

protected IProductComponent createProductCmpt(ProductCmptTocEntry tocEntry)
Specified by:
createProductCmpt in class AbstractTocBasedRuntimeRepository

createProductComponentInstance

protected ProductComponent createProductComponentInstance(String implementationClassName,
                                                          String ipsObjectId,
                                                          String kindId,
                                                          String versionId)

createEnumValues

protected <T> List<T> createEnumValues(EnumContentTocEntry tocEntry,
                                       Class<T> enumClass)
Specified by:
createEnumValues in class AbstractTocBasedRuntimeRepository

createProductCmptGeneration

protected IProductComponentGeneration createProductCmptGeneration(GenerationTocEntry tocEntry)
Specified by:
createProductCmptGeneration in class AbstractTocBasedRuntimeRepository

getProductVariantHelper

protected ProductVariantRuntimeHelper getProductVariantHelper()

createProductComponentGenerationInstance

protected ProductComponentGeneration createProductComponentGenerationInstance(GenerationTocEntry tocEntry,
                                                                              ProductComponent productCmpt)

getAllProductComponentsInternal

protected <T extends IProductComponent> void getAllProductComponentsInternal(Class<T> productCmptClass,
                                                                             List<T> result)
Override the default implementation for better performance. The default implementation instantiates all product component before using the class filter. In this implementation we use the information in the toc to filter the list of product components before instantiation.

Overrides:
getAllProductComponentsInternal in class AbstractRuntimeRepository
Parameters:
productCmptClass - The class you want to search product components for
result - adding the found product components to result list

createTable

protected ITable createTable(TableContentTocEntry tocEntry)
Description copied from class: AbstractTocBasedRuntimeRepository
Creates the table object for the given toc entry.

Specified by:
createTable in class AbstractTocBasedRuntimeRepository

createTestCase

protected IpsTestCaseBase createTestCase(TestCaseTocEntry tocEntry,
                                         IRuntimeRepository runtimeRepository)
Description copied from class: AbstractTocBasedRuntimeRepository
Creates the test case object for the given toc entry.

Specified by:
createTestCase in class AbstractTocBasedRuntimeRepository

getClassLoader

public ClassLoader getClassLoader()
Description copied from class: AbstractRuntimeRepository
Returns the class loader that is used to load Java classes by this repository.

This default implementation returns the class loader with which this repository class has been loaded.

Specified by:
getClassLoader in interface IRuntimeRepository
Overrides:
getClassLoader in class AbstractRuntimeRepository

getDocumentElement

protected abstract Element getDocumentElement(ProductCmptTocEntry tocEntry)
This method returns the xml element of the product component identified by the tocEntry


getDocumentElement

protected abstract Element getDocumentElement(GenerationTocEntry tocEntry)
This method returns the xml element of the product component generation identified by the tocEntry


getDocumentElement

protected abstract Element getDocumentElement(TestCaseTocEntry tocEntry)
This method returns the xml element of the test case identified by the tocEntry


getProductComponentGenerationImplClass

protected abstract String getProductComponentGenerationImplClass(GenerationTocEntry tocEntry)
This method returns the name of the product component generation implementation class identified by the tocEntry. This could either be an implementation class using the formula evaluation or an implementation class containing the compiled formulas.


getXmlAsStream

protected abstract InputStream getXmlAsStream(EnumContentTocEntry tocEntry)
Returns the XML data for the specified tocEntry as InputStream

Parameters:
tocEntry - Specifying the requested EnumContent
Returns:
An InputStream containing the XML data - should not return null!
Throws:
RuntimeException - in case of any exception do not return null but an accurate RuntimeException

getXmlAsStream

protected abstract InputStream getXmlAsStream(TableContentTocEntry tocEntry)
Returns the XML data for the specified tocEntry as InputStream

Parameters:
tocEntry - Specifying the requested TableContent
Returns:
An InputStream containing the XML data - should not return null!
Throws:
RuntimeException - in case of any exception do not return null but an accurate RuntimeException

createCustomObject

protected <T> T createCustomObject(CustomTocEntryObject<T> tocEntry)
Specified by:
createCustomObject in class AbstractTocBasedRuntimeRepository

initClRepositoryObject

protected <T> void initClRepositoryObject(CustomTocEntryObject<T> tocEntry,
                                          IClRepositoryObject runtimeObject)

getDocumentElement

protected abstract <T> Element getDocumentElement(CustomTocEntryObject<T> tocEntry)
This method returns the xml element of the product component identified by the tocEntry



Copyright © 2015. All rights reserved.