org.faktorips.runtime.productdataprovider
Class ClassLoaderProductDataProvider

java.lang.Object
  extended by org.faktorips.runtime.productdataprovider.AbstractProductDataProvider
      extended by org.faktorips.runtime.productdataprovider.ClassLoaderProductDataProvider
All Implemented Interfaces:
IProductDataProvider

public class ClassLoaderProductDataProvider
extends AbstractProductDataProvider

The ClassLoaderProductDataProvider is an implementation of IProductDataProvider normally for testing purpose.

It loads data similar as the ClassloaderRuntimeRepository. Modification is checked by checking the modification date of the TOC resource.

Author:
dirmeier

Field Summary
 
Fields inherited from class org.faktorips.runtime.productdataprovider.AbstractProductDataProvider
MODIFIED_EXCEPTION_MESSAGE
 
Constructor Summary
ClassLoaderProductDataProvider(ClassLoaderDataSource dataSource, String tocResourcePath, boolean checkTocModifications)
           
 
Method Summary
 String getBaseVersion()
          Getting the really actual version of the product data.
 InputStream getEnumContentAsStream(EnumContentTocEntry tocEntry)
          Getting the input stream of enum content for given tocEntry.
 Element getProductCmptData(ProductCmptTocEntry tocEntry)
          Getting the product component data element for given tocEntry.
 Element getProductCmptGenerationData(GenerationTocEntry tocEntry)
          Getting the product component generation data element for given tocEntry.
 InputStream getTableContentAsStream(TableContentTocEntry tocEntry)
          Getting the input stream of table content for given tocEntry.
 Element getTestcaseElement(TestCaseTocEntry tocEntry)
          Getting the test case data element for given tocEntry.
 ReadonlyTableOfContents getToc()
          Getting the toc in the product data provider and returns it.
<T> Element
getTocEntryData(CustomTocEntryObject<T> tocEntry)
          Getting the data element for the given tocEntry.
 String getVersion()
          Getting the version of the product data provider.
 
Methods inherited from class org.faktorips.runtime.productdataprovider.AbstractProductDataProvider
getDocumentBuilder, getVersionChecker, isCompatibleToBaseVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassLoaderProductDataProvider

public ClassLoaderProductDataProvider(ClassLoaderDataSource dataSource,
                                      String tocResourcePath,
                                      boolean checkTocModifications)
Method Detail

getBaseVersion

public String getBaseVersion()
Description copied from class: AbstractProductDataProvider
Getting the really actual version of the product data. That means to look in the file, asking your service or your database or what ever is your product data base.

Specified by:
getBaseVersion in class AbstractProductDataProvider
Returns:
the actual version of the product data

getProductCmptData

public Element getProductCmptData(ProductCmptTocEntry tocEntry)
                           throws DataModifiedException
Description copied from interface: IProductDataProvider
Getting the product component data element for given tocEntry. If the toc has been modified this method throws a DataModifiedException. To update the modification time you have to reload the toc.

Parameters:
tocEntry - The toc entry for the product component you want to load
Returns:
the xml element of the requested product component
Throws:
DataModifiedException - when toc data was modified

getTestcaseElement

public Element getTestcaseElement(TestCaseTocEntry tocEntry)
                           throws DataModifiedException
Description copied from interface: IProductDataProvider
Getting the test case data element for given tocEntry. If the toc has been modified this method throws a DataModifiedException. To update the modification time you have to reload the toc.

Parameters:
tocEntry - The toc entry for the test case element you want to load
Returns:
the xml element of the requested test case element
Throws:
DataModifiedException - when toc data was modified

getProductCmptGenerationData

public Element getProductCmptGenerationData(GenerationTocEntry tocEntry)
                                     throws DataModifiedException
Description copied from interface: IProductDataProvider
Getting the product component generation data element for given tocEntry. If the toc has been modified this method throws a DataModifiedException. To update the modification time you have to reload the toc.

Parameters:
tocEntry - The toc entry for the product component generation you want to load
Returns:
the xml element of the requested product component generation
Throws:
DataModifiedException - when toc data was modified

getTableContentAsStream

public InputStream getTableContentAsStream(TableContentTocEntry tocEntry)
                                    throws DataModifiedException
Description copied from interface: IProductDataProvider
Getting the input stream of table content for given tocEntry. If the toc has been modified this method throws a DataModifiedException. To update the modification time you have to reload the toc.

Parameters:
tocEntry - The toc entry for the table content you want to load
Returns:
the input stream of the requested table content
Throws:
DataModifiedException - when toc data was modified

getEnumContentAsStream

public InputStream getEnumContentAsStream(EnumContentTocEntry tocEntry)
                                   throws DataModifiedException
Description copied from interface: IProductDataProvider
Getting the input stream of enum content for given tocEntry. If the toc has been modified this method throws a DataModifiedException. To update the modification time you have to reload the toc.

Parameters:
tocEntry - The toc entry for the enum content you want to load
Returns:
the input stream of the requested enum content
Throws:
DataModifiedException - when toc data was modified

getToc

public ReadonlyTableOfContents getToc()
Description copied from interface: IProductDataProvider
Getting the toc in the product data provider and returns it. Calling the method twice should not reload the table of content.

Returns:
The loaded toc

getVersion

public String getVersion()
Description copied from interface: IProductDataProvider
Getting the version of the product data provider. This is the version of the product data when this IProductDataProvider was created. The version should be final. Once product data has changed this IProductDataProvider getting useless and a new one should be created.

Returns:
the version of the product data provider

getTocEntryData

public <T> Element getTocEntryData(CustomTocEntryObject<T> tocEntry)
                        throws DataModifiedException
Description copied from interface: IProductDataProvider
Getting the data element for the given tocEntry. If the toc has been modified this method throws a DataModifiedException. To update the modification time you have to reload the toc.

Type Parameters:
T - the class of the runtime object you want to load
Parameters:
tocEntry - The toc entry for the runtime object of class T you want to load
Returns:
the xml element of the requested object
Throws:
DataModifiedException - when toc data was modified


Copyright © 2015. All rights reserved.