Package org.faktorips.runtime
Class ClassloaderRuntimeRepository
java.lang.Object
org.faktorips.runtime.internal.AbstractRuntimeRepository
org.faktorips.runtime.internal.AbstractCachingRuntimeRepository
org.faktorips.runtime.internal.AbstractTocBasedRuntimeRepository
org.faktorips.runtime.internal.AbstractClassLoadingRuntimeRepository
org.faktorips.runtime.ClassloaderRuntimeRepository
- All Implemented Interfaces:
IRuntimeRepository
A runtime repository that loads the resources by calling
ClassLoader.getResourceAsStream(String)- Author:
- Jan Ortmann
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionClassloaderRuntimeRepository(ClassLoader cl, String basePackage) Creates a new repository that loads its contents from the given classloader and the given package.ClassloaderRuntimeRepository(ClassLoader cl, String basePackage, String pathToToc) Creates a new repository that loads its contents from the given classloader and the given package and toc resource using the default document builder.ClassloaderRuntimeRepository(ClassLoader cl, String basePackage, String pathToToc, ICacheFactory cacheFactory) Creates a new repository that loads its contents from the given classloader and the given package using the given xml document builder. -
Method Summary
Modifier and TypeMethodDescriptionstatic final ClassloaderRuntimeRepositoryCreates a new repository that loads it's contents from the given toc resource using this class' classloader and the default xml document builder to parse the xml data.static final ClassloaderRuntimeRepositorycreate(String tocResource, ClassLoader cl) Creates a new repository that loads it's contents from the given toc resource and classloader using the default document builder to parse the xml data.static final ClassloaderRuntimeRepositorycreate(String tocResource, ClassLoader cl, ICacheFactory cacheFactory) Creates a new repository that loads it's contents from the given toc resource and classloader using the default document builder to parse the xml data.static final ClassloaderRuntimeRepositorycreate(String tocResource, ICacheFactory cacheFactory) Creates a new repository that loads it's contents from the given toc resource using this class' classloader and the default xml document builder to parse the xml data.protected DocumentBuilderprotected <T> ElementgetDocumentElement(CustomTocEntryObject<T> tocEntry) This method returns the xml element of the product component identified by the tocEntryprotected ElementgetDocumentElement(GenerationTocEntry tocEntry) This method returns the xml element of the product component generation identified by the tocEntryprotected ElementgetDocumentElement(ProductCmptTocEntry tocEntry) This method returns the xml element of the product component identified by the tocEntryprotected ElementgetDocumentElement(TestCaseTocEntry tocEntry) This method returns the xml element of the test case identified by the tocEntryprotected StringThis method returns the name of the product component generation implementation class identified by the tocEntry.protected InputStreamgetXmlAsStream(EnumContentTocEntry tocEntry) Returns the XML data for the specified tocEntry asInputStreamprotected InputStreamgetXmlAsStream(TableContentTocEntry tocEntry) Returns the XML data for the specified tocEntry asInputStreambooleanReturnstrueif the repository's content is modifiable.protected ReadonlyTableOfContentsMethods inherited from class org.faktorips.runtime.internal.AbstractClassLoadingRuntimeRepository
createCustomObject, createEnumValues, createProductCmpt, createProductCmptGeneration, createProductComponentGenerationInstance, createProductComponentInstance, createTable, createTestCase, getAllProductComponentsInternal, getClassLoader, getProductVariantHelper, initClRepositoryObjectMethods inherited from class org.faktorips.runtime.internal.AbstractTocBasedRuntimeRepository
createEnumXmlAdapter, getAllEnumClasses, getAllIpsTestCases, getAllModelTypeImplementationClasses, getAllProductComponentIds, getAllProductComponents, getAllProductComponents, getAllTables, getClass, getIpsTestCaseInternal, getIpsTestCasesStartingWith, getLatestProductComponentGenerationInternal, getNextProductComponentGenerationInternal, getNotCachedCustomObject, getNotCachedEnumValues, getNotCachedEnumXmlAdapter, getNotCachedProductComponent, getNotCachedProductComponentGeneration, getNotCachedTable, getNumberOfProductComponentGenerationsInternal, getPreviousProductComponentGenerationInternal, getProductComponentGenerationInternal, getProductComponentGenerations, getProductComponentInternal, getTableInternal, getTableOfContents, initializeMethods inherited from class org.faktorips.runtime.internal.AbstractCachingRuntimeRepository
getAllInternalEnumXmlAdapters, getCustomRuntimeObjectInternal, getEnumValuesInternal, getProductComponentGenerationInternal, getProductComponentInternal, getTableInternal, initCachesMethods inherited from class org.faktorips.runtime.internal.AbstractRuntimeRepository
addDirectlyReferencedRepository, addEnumValueLookupService, getAllEnumClasses, getAllIpsTestCases, getAllModelTypeImplementationClasses, getAllProductComponentIds, getAllProductComponents, getAllProductComponents, getAllProductComponents, getAllReferencedRepositories, getAllTables, 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
-
Field Details
-
REPOSITORY_XML_ELEMENT
Name of the xml element representing the product component registry.- See Also:
-
TABLE_OF_CONTENTS_FILE
The default name of the file describing the registry's contents.- See Also:
-
-
Constructor Details
-
ClassloaderRuntimeRepository
Creates a new repository that loads its contents from the given classloader and the given package. Uses the default toc resource name. Uses the default document builder available viaDocumentBuilderFactory.newInstance()to parse the xml files.- Throws:
NullPointerException- if cl or basePackage arenull.IllegalArgumentException- if the basePackage does not contain the table of contents file.RuntimeException- if the registry's table of contents file can't be read.- See Also:
-
ClassloaderRuntimeRepository
Creates a new repository that loads its contents from the given classloader and the given package and toc resource using the default document builder.- Parameters:
cl- The classloader to use.basePackage- The name of the base package that contains the data.pathToToc- Path from the base package to the resource containing the toc, e.g. "faktorips-repository-toc.xml" or "motor/motor-repository-toc.xml"- Throws:
NullPointerException- if any argument isnull.IllegalArgumentException- if the basePackage does not contain the table of contents file.RuntimeException- if the registry's table of contents file can't be read.
-
ClassloaderRuntimeRepository
public ClassloaderRuntimeRepository(ClassLoader cl, String basePackage, String pathToToc, ICacheFactory cacheFactory) Creates a new repository that loads its contents from the given classloader and the given package using the given xml document builder.- Parameters:
cl- The classloader to use.basePackage- The name of the base package that contains the data.pathToToc- Path from the base package to the resource containing the toc, e.g. "faktorips-repository-toc.xml" or "motor/motor-repository-toc.xml"- Throws:
NullPointerException- if any argument isnull.IllegalArgumentException- if the basePackage does not contain the table of contents file.RuntimeException- if the registry's table of contents file can't be read.
-
-
Method Details
-
create
Creates a new repository that loads it's contents from the given toc resource using this class' classloader and the default xml document builder to parse the xml data.- Parameters:
tocResource- Path to the resource containing the toc file. E.g. "org/faktorips/sample/internal/faktorips-repository-toc.xml"- Throws:
NullPointerException- if any argument isnull.RuntimeException- if the registry's table of contents file can't be read.
-
create
public static final ClassloaderRuntimeRepository create(String tocResource, ICacheFactory cacheFactory) Creates a new repository that loads it's contents from the given toc resource using this class' classloader and the default xml document builder to parse the xml data.- Parameters:
tocResource- Path to the resource containing the toc file. E.g. "org/faktorips/sample/internal/faktorips-repository-toc.xml"cacheFactory- The CacheFactory used to create the cache objects in the repository- Throws:
NullPointerException- if any argument isnull.RuntimeException- if the registry's table of contents file can't be read.
-
create
Creates a new repository that loads it's contents from the given toc resource and classloader using the default document builder to parse the xml data.- Parameters:
tocResource- Path to the resource containing the toc file. E.g. "org/faktorips/sample/internal/faktorips-repository-toc.xml"cl- The classloader to use.- Throws:
NullPointerException- if any argument isnull.RuntimeException- if the registry's table of contents file can't be read.
-
create
public static final ClassloaderRuntimeRepository create(String tocResource, ClassLoader cl, ICacheFactory cacheFactory) Creates a new repository that loads it's contents from the given toc resource and classloader using the default document builder to parse the xml data.- Parameters:
tocResource- Path to the resource containing the toc file. E.g. "org/faktorips/sample/internal/faktorips-repository-toc.xml"cl- The classloader to use.cacheFactory- The CacheFactory used to create the cache objects in the repository- Throws:
NullPointerException- if any argument isnull.RuntimeException- if the registry's table of contents file can't be read.
-
getDocumentBuilder
-
loadTableOfContents
- Specified by:
loadTableOfContentsin classAbstractTocBasedRuntimeRepository
-
getProductComponentGenerationImplClass
Description copied from class:AbstractClassLoadingRuntimeRepositoryThis 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.- Specified by:
getProductComponentGenerationImplClassin classAbstractClassLoadingRuntimeRepository
-
getDocumentElement
Description copied from class:AbstractClassLoadingRuntimeRepositoryThis method returns the xml element of the product component identified by the tocEntry- Specified by:
getDocumentElementin classAbstractClassLoadingRuntimeRepository
-
getDocumentElement
Description copied from class:AbstractClassLoadingRuntimeRepositoryThis method returns the xml element of the product component generation identified by the tocEntry- Specified by:
getDocumentElementin classAbstractClassLoadingRuntimeRepository
-
getDocumentElement
Description copied from class:AbstractClassLoadingRuntimeRepositoryThis method returns the xml element of the test case identified by the tocEntry- Specified by:
getDocumentElementin classAbstractClassLoadingRuntimeRepository
-
getXmlAsStream
Description copied from class:AbstractClassLoadingRuntimeRepositoryReturns the XML data for the specified tocEntry asInputStream- Specified by:
getXmlAsStreamin classAbstractClassLoadingRuntimeRepository- Parameters:
tocEntry- Specifying the requested EnumContent- Returns:
- An InputStream containing the XML data - should not return null!
-
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. -
getXmlAsStream
Description copied from class:AbstractClassLoadingRuntimeRepositoryReturns the XML data for the specified tocEntry asInputStream- Specified by:
getXmlAsStreamin classAbstractClassLoadingRuntimeRepository- Parameters:
tocEntry- Specifying the requested TableContent- Returns:
- An InputStream containing the XML data - should not return null!
-
getDocumentElement
Description copied from class:AbstractClassLoadingRuntimeRepositoryThis method returns the xml element of the product component identified by the tocEntry- Specified by:
getDocumentElementin classAbstractClassLoadingRuntimeRepository
-