Interface IRuntimeRepository
-
- All Known Subinterfaces:
IDetachedContentRuntimeRepository
- All Known Implementing Classes:
AbstractCachingRuntimeRepository,AbstractClassLoadingRuntimeRepository,AbstractRuntimeRepository,AbstractTocBasedRuntimeRepository,ClassloaderRuntimeRepository,DetachedContentRuntimeRepository,InMemoryRuntimeRepository
public interface IRuntimeRepositoryThe runtime repository gives access to the information about products, enums and tables.- Author:
- Jan Ortmann
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaddDirectlyReferencedRepository(IRuntimeRepository repository)Adds a repository this repository depends on because the one to add contains product data that is referenced from this repository.voidaddEnumValueLookupService(IEnumValueLookupService<?> lookupService)Adds the service to lookup enumeration values for the enumeration type specified byIEnumValueLookupService.getEnumTypeClass().java.util.List<java.lang.Class<?>>getAllEnumClasses()Returns all classes for that define enumerations in this repository.java.util.List<IpsTest2>getAllIpsTestCases(IRuntimeRepository runtimeRepository)Returns a list of all test cases stored in the repository and all repositories this one references.java.util.Set<java.lang.String>getAllModelTypeImplementationClasses()Returns a set containing the Java Class names of the implementation classes for all model types available in this repository (either directly or via a referenced repository).java.util.List<java.lang.String>getAllProductComponentIds()Returns a list of the IDs of all product components held by this repository or any dependent repository.java.util.List<IProductComponent>getAllProductComponents()Returns all product components available in this repository.<T extends IProductComponent>
java.util.List<T>getAllProductComponents(java.lang.Class<T> productComponentType)Returns all product components that are instances of the indicated class.java.util.List<IProductComponent>getAllProductComponents(java.lang.String kindId)Returns all product components that belong to the indicated product component kind.java.util.List<IRuntimeRepository>getAllReferencedRepositories()Returns all repositories this one depends on directly or indirectly.java.util.List<ITable<?>>getAllTables()Returns all tables available in this repository.java.lang.ClassLoadergetClassLoader()Returns the class loader that is used to load Java classes by this repository.<T> TgetCustomRuntimeObject(java.lang.Class<T> type, java.lang.String qName)Returns a object of typeT, identified by it's qualified name, ornullif no such object exists in this repository or it's referenced repositories.java.util.List<IRuntimeRepository>getDirectlyReferencedRepositories()Returns the runtime repositories this one directly depends on.<T> TgetEnumValue(java.lang.Class<T> clazz, java.lang.Object id)Returns the enumeration value for the provided enumeration class with the given id.java.lang.ObjectgetEnumValue(java.lang.String uniqueId)Deprecated.This method does only return valid enums if the id attribute of the enum is of typeString.<T> IEnumValueLookupService<T>getEnumValueLookupService(java.lang.Class<T> enumClazz)Returns the lookup service for the given enumeration type.<T> java.util.List<T>getEnumValues(java.lang.Class<T> clazz)Returns the type safeListof enumeration values of the provided Faktor-IPS generated enumeration class.<T> TgetExistingEnumValue(java.lang.Class<T> clazz, java.lang.Object id)Returns the enumeration value for the provided enumeration class with the given id.IProductComponentgetExistingProductComponent(java.lang.String id)Returns the product component identified by the given id.IProductComponentGenerationgetExistingProductComponentGeneration(java.lang.String id, java.util.Calendar effectiveDate)Returns the product component generation identified by the id and the effective date.IFormulaEvaluatorFactorygetFormulaEvaluatorFactory()Getting a formula evaluator factory to create a new formula evaluator.IpsTest2getIpsTest(java.lang.String qName)Returns the test (either test case or suite) for the given qualified name.IpsTest2getIpsTest(java.lang.String qName, IRuntimeRepository runtimeRepository)Returns the test (either test case or suite) for the given qualified name.IpsTestCaseBasegetIpsTestCase(java.lang.String qName)Returns the test case for the given qualified name.IpsTestCaseBasegetIpsTestCase(java.lang.String qName, IRuntimeRepository runtimeRepository)Returns the test case for the given qualified name.java.util.List<IpsTest2>getIpsTestCasesStartingWith(java.lang.String qNamePrefix, IRuntimeRepository runtimeRepository)Returns a list of test cases starting with the given qualified name prefix stored in the repository and all repositories this one references.IpsTestSuitegetIpsTestSuite(java.lang.String qNamePrefix)Returns a test suite that contains all tests that have qualified names starting with the given prefix.IpsTestSuitegetIpsTestSuite(java.lang.String qNamePrefix, IRuntimeRepository runtimeRepository)Returns a test suite that contains all tests that have qualified names starting with the given prefix.IProductComponentGenerationgetLatestProductComponentGeneration(IProductComponent productCmpt)Returns the latest product component generation of the provided product component.TypegetModelType(java.lang.Class<?> modelObjectClass)Deprecated.PolicyCmptTypegetModelType(IModelObject modelObject)Deprecated.ProductCmptTypegetModelType(IProductComponent productComponent)Deprecated.java.lang.StringgetName()Returns the repository's name.IProductComponentGenerationgetNextProductComponentGeneration(IProductComponentGeneration generation)Returns the product component generation that follows the provided generation with respect to its valid from date.intgetNumberOfProductComponentGenerations(IProductComponent productCmpt)Returns the number of product component generations of the provided product component.IProductComponentGenerationgetPreviousProductComponentGeneration(IProductComponentGeneration generation)Returns the product component generation that is prior to the provided generation with respect to its valid from date.IProductComponentgetProductComponent(java.lang.String id)Returns the product component identified by the given id.IProductComponentgetProductComponent(java.lang.String kindId, java.lang.String versionId)Returns the product component identified by the given KindId and versionId.IProductComponentGenerationgetProductComponentGeneration(java.lang.String id, java.util.Calendar effectiveDate)Returns the product component generation identified by the id and the effective date.java.util.List<IProductComponentGeneration>getProductComponentGenerations(IProductComponent productCmpt)Returns all product component generations for the given product component.IRuntimeRepositoryLookupgetRuntimeRepositoryLookup()Returns theIRuntimeRepositoryLookupthat was previously set usingsetRuntimeRepositoryLookup(IRuntimeRepositoryLookup).<T extends ITable<?>>
TgetTable(java.lang.Class<T> tableClass)Returns the table contents for the given table class.ITable<?>getTable(java.lang.String qualifiedTableName)Returns the table contents for the given qualified table name.booleanisModifiable()Returnstrueif the repository's content is modifiable.javax.xml.bind.JAXBContextnewJAXBContext()Creates a new JAXBContext that can marshall / unmarshall all model classes defined in the given repository.voidremoveEnumValueLookupService(IEnumValueLookupService<?> lookupService)Removes the lookup service registered for the given enumeration type.voidsetRuntimeRepositoryLookup(IRuntimeRepositoryLookup repositoryLookup)Setting aIRuntimeRepositoryLookupis needed to enable serialization of policy components.
-
-
-
Method Detail
-
getName
java.lang.String getName()
Returns the repository's name.
-
addDirectlyReferencedRepository
void addDirectlyReferencedRepository(IRuntimeRepository repository)
Adds a repository this repository depends on because the one to add contains product data that is referenced from this repository. Access methods likegetProductComponent(..)include all repositories this one depends on in their search.- Parameters:
repository- The repository to add.- Throws:
java.lang.NullPointerException- if repository isnull.
-
getDirectlyReferencedRepositories
java.util.List<IRuntimeRepository> getDirectlyReferencedRepositories()
Returns the runtime repositories this one directly depends on.
-
getAllReferencedRepositories
java.util.List<IRuntimeRepository> getAllReferencedRepositories()
Returns all repositories this one depends on directly or indirectly. The order is defined by a breadth first search starting with this repository's direct dependencies. Each repository is only included once even if it is referenced from two others. The list is computed lazy on the first request.
-
getProductComponent
IProductComponent getProductComponent(java.lang.String id)
Returns the product component identified by the given id. Returnsnullif the id isnullor no component with the indicated id can be found.Note
How the product component id is structured, is defined as part of the ips project. The definition is called a product component naming (and identification) strategy. The standard strategy is to use the id of the product component kind followed by a separator followed by component's versionId. However it is possible to use completly different strategies for example to create numeric identifiers to reduce the size of indices in a datatbase. In the latter case the product component id can't be derived from the product component kind id and it's version id.
- Parameters:
id- The id of the product component to find.- Returns:
- The product component identified by the id or
null.
-
getExistingProductComponent
IProductComponent getExistingProductComponent(java.lang.String id)
Returns the product component identified by the given id. Same as getProductComponent(String id) but throws an exception if the product component is not found. This method never returns null.- Parameters:
id- The id of the product component to find.- Returns:
- The product component identified by the id
- Throws:
ProductCmptNotFoundException- if no product component with the given id exists.- See Also:
getProductComponent(String)
-
getProductComponent
IProductComponent getProductComponent(java.lang.String kindId, java.lang.String versionId)
Returns the product component identified by the given KindId and versionId. If versionId isnullthe most recent version is returned. Returnsnullif the kindId isnullor no component with the indicated kindId and versionId can be found.- Parameters:
kindId- The product component kind id, e.g. CollisionCoverageversionId- The versionId to find, e.g. 2005-01- Returns:
- The product component identified by the id or
null.
-
getAllProductComponents
java.util.List<IProductComponent> getAllProductComponents(java.lang.String kindId)
Returns all product components that belong to the indicated product component kind. Returns an empty array if either kindId isnullor no component with the indicated kind is found.- Parameters:
kindId- The product component kind id, e.g. CollisionCoverage
-
getEnumValues
<T> java.util.List<T> getEnumValues(java.lang.Class<T> clazz)
Returns the type safeListof enumeration values of the provided Faktor-IPS generated enumeration class. This method is only relevant for Faktor-IPS enumerations whose values are deferred to a content that is held by this repository.- Parameters:
clazz- the enumeration class upon which the list of enumeration values is returned- Returns:
- The UNMODIFIABLE list of enum values.
-
getEnumValue
<T> T getEnumValue(java.lang.Class<T> clazz, java.lang.Object id)Returns the enumeration value for the provided enumeration class with the given id. If no value is found in the enumeration of the provided enumeration classnullwill be returned. If the provided class cannot be recognized as a Faktor-IPS enumeration oridisnull,nullwill be returned. This method is only relevant for Faktor-IPS enumerations whose values are deferred to a content that is held by this repository.- Parameters:
clazz- The enumeration class upon which the enumeration value is returnedid- The enum value's identification- Returns:
- the enumeration value, or
nullif it does not exist - See Also:
getExistingEnumValue(Class, Object)
-
getExistingEnumValue
<T> T getExistingEnumValue(java.lang.Class<T> clazz, java.lang.Object id)Returns the enumeration value for the provided enumeration class with the given id. This method is only relevant for Faktor-IPS enumerations whose values are deferred to a content that is held by this repository. Ifidisnull,nullwill be returned. UnlikegetEnumValue(Class, Object), this method will throw an exception when no enum value matching the parameters is found in the repository.- Parameters:
clazz- The enumeration class upon which the enumeration value is returnedid- The enum value's identification- Returns:
- the enumeration value
- Throws:
java.lang.IllegalArgumentException- if the given id has no corresponding enum value- See Also:
getEnumValue(Class, Object)
-
getEnumValue
@Deprecated java.lang.Object getEnumValue(java.lang.String uniqueId)
Deprecated.This method does only return valid enums if the id attribute of the enum is of typeString. You should never use this method! UsegetEnumValue(Class, Object)instead. This method may be removed in future releases.Returns the enumeration value for the provided unique Id. The unique Id is specified as follows qualifiedClassName'#'valueId.
-
addEnumValueLookupService
void addEnumValueLookupService(IEnumValueLookupService<?> lookupService)
Adds the service to lookup enumeration values for the enumeration type specified byIEnumValueLookupService.getEnumTypeClass(). If a service is already registered for the enumeration type, the new service replaces the old one.- Parameters:
lookupService- The new lookup service.
-
getEnumValueLookupService
<T> IEnumValueLookupService<T> getEnumValueLookupService(java.lang.Class<T> enumClazz)
Returns the lookup service for the given enumeration type. Returnsnullif no service is registered for the given type.
-
removeEnumValueLookupService
void removeEnumValueLookupService(IEnumValueLookupService<?> lookupService)
Removes the lookup service registered for the given enumeration type. Does nothing if no such service has been registered.
-
getAllEnumClasses
java.util.List<java.lang.Class<?>> getAllEnumClasses()
Returns all classes for that define enumerations in this repository. All enums types (with and without separated content) defined by Faktor-IPS are returned for the model project they are defined in. For projects containing enum contents, only the matching structure classes are returned from the product project. Model projects must be referenced withaddDirectlyReferencedRepository(IRuntimeRepository)for their enum structures without content to be found.Returns an empty list if no enum class is available.
-
getProductComponentGeneration
IProductComponentGeneration getProductComponentGeneration(java.lang.String id, java.util.Calendar effectiveDate)
Returns the product component generation identified by the id and the effective date. Returnsnullif either the id isnull, the effectiveDate isnullor no generation with the indicated id can be found or the product component hasn't got a generation that is effective on the given date.- Parameters:
id- The product component's id.effectiveDate- The process' effective date- Returns:
- The product component generation or
null.
-
getExistingProductComponentGeneration
IProductComponentGeneration getExistingProductComponentGeneration(java.lang.String id, java.util.Calendar effectiveDate)
Returns the product component generation identified by the id and the effective date. Same as getProductComponentGeneration(String id, Calendar effectiveDate) but throws an exception if the product component generation is not found. This method never returns null.- Parameters:
id- The product component's id.effectiveDate- The process' effective date- Returns:
- The product component generation
- Throws:
ProductCmptGenerationNotFoundException- if no generation for the given effectiveDate.- See Also:
getProductComponentGeneration(String, Calendar)
-
getAllProductComponents
<T extends IProductComponent> java.util.List<T> getAllProductComponents(java.lang.Class<T> productComponentType)
Returns all product components that are instances of the indicated class. Returns an empty list if no such component exists.
-
getAllProductComponents
java.util.List<IProductComponent> getAllProductComponents()
Returns all product components available in this repository. Returns an empty list if no component is available.Note that this is an expensive operation as all components have to be loaded into memory.
-
getProductComponentGenerations
java.util.List<IProductComponentGeneration> getProductComponentGenerations(IProductComponent productCmpt)
Returns all product component generations for the given product component. Returns an empty list if no generation is available.The generations are ordered by valid from date in reverse order that means the latest generation (latest valid from date) is the first one, the oldest generation is the last one.
- Returns:
- The list of product component generations ordered by the valid from date in reverse order
-
getNumberOfProductComponentGenerations
int getNumberOfProductComponentGenerations(IProductComponent productCmpt)
Returns the number of product component generations of the provided product component.
-
getNextProductComponentGeneration
IProductComponentGeneration getNextProductComponentGeneration(IProductComponentGeneration generation)
Returns the product component generation that follows the provided generation with respect to its valid from date.If there is no further generation this method returns
null.- Returns:
- The next generation with respect to the valid from date.
- Throws:
java.lang.IllegalArgumentException- if the given product component generation could not be found in this repository or in any dependent repository.
-
getPreviousProductComponentGeneration
IProductComponentGeneration getPreviousProductComponentGeneration(IProductComponentGeneration generation)
Returns the product component generation that is prior to the provided generation with respect to its valid from date.If there is no previous generation this method returns
null.- Returns:
- The previous generation with respect to the valid from date.
- Throws:
java.lang.IllegalArgumentException- if the given product component generation could not be found in this repository or in any dependent repository.
-
getLatestProductComponentGeneration
IProductComponentGeneration getLatestProductComponentGeneration(IProductComponent productCmpt)
Returns the latest product component generation of the provided product component.- Returns:
- The generation with the latest valid from date
-
getAllProductComponentIds
java.util.List<java.lang.String> getAllProductComponentIds()
Returns a list of the IDs of all product components held by this repository or any dependent repository.- Returns:
- All valid product component IDs that are accessible by this repository.
-
getAllTables
java.util.List<ITable<?>> getAllTables()
Returns all tables available in this repository. Returns an empty list if no table is available.Note that this is an expensive operation as all tables have to be loaded into memory.
-
getTable
<T extends ITable<?>> T getTable(java.lang.Class<T> tableClass)
Returns the table contents for the given table class.
-
getTable
ITable<?> getTable(java.lang.String qualifiedTableName)
Returns the table contents for the given qualified table name.
-
getAllIpsTestCases
java.util.List<IpsTest2> getAllIpsTestCases(IRuntimeRepository runtimeRepository)
Returns a list of all test cases stored in the repository and all repositories this one references. Returns an empty list if none is found.
-
getIpsTestCasesStartingWith
java.util.List<IpsTest2> getIpsTestCasesStartingWith(java.lang.String qNamePrefix, IRuntimeRepository runtimeRepository)
Returns a list of test cases starting with the given qualified name prefix stored in the repository and all repositories this one references. Returns an empty list if none is found.
-
getIpsTest
IpsTest2 getIpsTest(java.lang.String qName)
Returns the test (either test case or suite) for the given qualified name. If a test is found for the given qualified name, the test is returned. Otherwise a test suite containing all tests that starts with the given qualified name is returned. Returns an empty test suite if no tests are found for the given qualified name.- Throws:
java.lang.NullPointerException- if qName isnull.
-
getIpsTest
IpsTest2 getIpsTest(java.lang.String qName, IRuntimeRepository runtimeRepository)
Returns the test (either test case or suite) for the given qualified name. If a test is found for the given qualified name, the test is returned. Otherwise a test suite containing all tests that starts with the given qualified name is returned. Returns an empty test suite if no tests are found for the given qualified name. The given runtime repository is the repository which will be used to instantiate the test cases.- Throws:
java.lang.NullPointerException- if qName isnull.- See Also:
getIpsTestCase(java.lang.String)
-
getIpsTestCase
IpsTestCaseBase getIpsTestCase(java.lang.String qName)
Returns the test case for the given qualified name.- Throws:
java.lang.NullPointerException- if qName isnull.
-
getIpsTestCase
IpsTestCaseBase getIpsTestCase(java.lang.String qName, IRuntimeRepository runtimeRepository)
Returns the test case for the given qualified name. The given runtimeRepository will be used to instantiate the test case (this repository is used to search for test cases).
Remark this runtime repository which will be used to search for the given test case can differ from the runtime repository which will be used to instantiate the test case during runtime.
Normally the runtime repository contains all repositories which are referenced by the project.- Throws:
java.lang.NullPointerException- if qName isnull.
-
getIpsTestSuite
IpsTestSuite getIpsTestSuite(java.lang.String qNamePrefix)
Returns a test suite that contains all tests that have qualified names starting with the given prefix. Note that if test cases belong to different package fragments the returned test suite contains other testsuites. One suite for each package fragment.- Throws:
java.lang.NullPointerException- if qNamePrefix isnull.
-
getIpsTestSuite
IpsTestSuite getIpsTestSuite(java.lang.String qNamePrefix, IRuntimeRepository runtimeRepository)
Returns a test suite that contains all tests that have qualified names starting with the given prefix. Note that if test cases belong to different package fragments the returned test suite contains other test suites. One suite for each package fragment. The given runtime repository is the repository which will be used to instantiate the test cases.- Throws:
java.lang.NullPointerException- if qNamePrefix isnull.- See Also:
getIpsTestCase(java.lang.String)
-
isModifiable
boolean isModifiable()
Returnstrueif 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.
-
getModelType
@Deprecated Type getModelType(java.lang.Class<?> modelObjectClass)
Deprecated.Returns theIModelTypecontaining the meta information for the given model object class.
-
getModelType
@Deprecated PolicyCmptType getModelType(IModelObject modelObject)
Deprecated.Returns theIModelTypecontaining the meta information for the given model object. This is a convenience method callinggetModelTypewith the model object's class.
-
getModelType
@Deprecated ProductCmptType getModelType(IProductComponent productComponent)
Deprecated.Returns theIModelTypecontaining the meta information for the given product component. This is a convenience method callinggetModelTypewith the product component class.
-
getAllModelTypeImplementationClasses
java.util.Set<java.lang.String> getAllModelTypeImplementationClasses()
Returns a set containing the Java Class names of the implementation classes for all model types available in this repository (either directly or via a referenced repository). For product component types the implementation class for the part that remains unchanged over time is returned. Currently there is no way to get get the implementation class for the product component generation (the part that changed over time).Returns an empty set if no type is available.
-
newJAXBContext
javax.xml.bind.JAXBContext newJAXBContext()
Creates a new JAXBContext that can marshall / unmarshall all model classes defined in the given repository. If the repository references other repositories (directly or indirectly), the context can also handle the classes defined in these other repositories.
-
getFormulaEvaluatorFactory
IFormulaEvaluatorFactory getFormulaEvaluatorFactory()
Getting a formula evaluator factory to create a new formula evaluator. If formula evaluation is not supported, this method should return null.- Returns:
- The configured formula evaluator or null if no evaluation is supported
-
getClassLoader
java.lang.ClassLoader getClassLoader()
Returns the class loader that is used to load Java classes by this repository.
-
getCustomRuntimeObject
<T> T getCustomRuntimeObject(java.lang.Class<T> type, java.lang.String qName)Returns a object of typeT, identified by it's qualified name, ornullif no such object exists in this repository or it's referenced repositories. It is up to extensions to define which types can be found in the repository (e.g. aAbstractTocBasedRuntimeRepositorycould defineCustomTocEntryObjects for new types. If there are no objects of the given type,nullis returned. If theIRuntimeRepositoryimplementation does not allow custom types,nullis returned.- Parameters:
type- a class supported by theIRuntimeRepositoryimplementationqName- the qualified name of the object- Returns:
- the object identified by qName or
null
-
getRuntimeRepositoryLookup
IRuntimeRepositoryLookup getRuntimeRepositoryLookup()
Returns theIRuntimeRepositoryLookupthat was previously set usingsetRuntimeRepositoryLookup(IRuntimeRepositoryLookup). TheIRuntimeRepositoryLookupis used for serialization of policy components especially for theProductConfigurationin configured policy components.- Returns:
- A previously set
IRuntimeRepositoryLookupthat is serialized by aProductConfigurationand used to load the product component and its generation after deserialization. - See Also:
IRuntimeRepositoryLookup,ProductConfiguration
-
setRuntimeRepositoryLookup
void setRuntimeRepositoryLookup(IRuntimeRepositoryLookup repositoryLookup)
Setting aIRuntimeRepositoryLookupis needed to enable serialization of policy components. You need to set aIRuntimeRepositoryLookupbefore you could serialize any product configured policy component.- Parameters:
repositoryLookup- TheIRuntimeRepositoryLookupwill provide an instance of thisIRuntimeRepositorywhen deserializing a policy component.- See Also:
IRuntimeRepositoryLookup
-
-