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.AbstractXmlInputStreamRepository
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 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 specifiedEnumContentTocEntryasInputStreamprotected InputStreamgetXmlAsStream(TableContentTocEntry tocEntry) Returns the XML data for the specifiedTableContentTocEntryasInputStreambooleanReturnstrueif the repository's content is modifiable.protected ReadonlyTableOfContentsMethods inherited from class org.faktorips.runtime.internal.AbstractClassLoadingRuntimeRepository
getAllProductComponentsInternal, getClassLoader, getXmlAsStreamMethods inherited from class org.faktorips.runtime.internal.AbstractXmlInputStreamRepository
createCustomObject, createEnumValues, createProductCmpt, createProductCmptGeneration, createProductComponentGenerationInstance, createProductComponentInstance, createTable, createTestCase, getDocumentElement, getDocumentElement, getDocumentElement, getDocumentElement, getProductVariantHelperMethods 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, getEnumDescription, getEnumValuesInternal, getProductComponentGenerationInternal, getProductComponentInternal, getTableInternal, initCachesMethods inherited from class org.faktorips.runtime.internal.AbstractRuntimeRepository
addAllEnumXmlAdapters, 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.
-
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
-
getXmlAsStream
Description copied from class:AbstractXmlInputStreamRepositoryReturns the XML data for the specifiedTableContentTocEntryasInputStream- Specified by:
getXmlAsStreamin classAbstractXmlInputStreamRepository- Parameters:
tocEntry- Specifying the requested TableContent- Returns:
- An InputStream containing the XML data - should not return null!
-
getXmlAsStream
Description copied from class:AbstractXmlInputStreamRepositoryReturns the XML data for the specifiedEnumContentTocEntryasInputStream- Specified by:
getXmlAsStreamin classAbstractXmlInputStreamRepository- 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.
-