rvasa / jseat

Automatically exported from code.google.com/p/jseat
0 stars 0 forks source link

Move to a smarter/lighter data loading framework #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Background:
With the changes made to the persistence framework 
[http://code.google.com/p/jseat/issues/detail?id=15] it is now possible to 
read a specific type of metric data on a per version basis due to the 
individual persistence changes.

A new data loading framwork could be used to dynamically load the 
requested data as it is needed. It should make it easy for loading up the 
different types of data, eg. class metrics, method metrics and 
dependencies. Ideally, this operation would be fairly transparent to the 
usage of the model data iteself.

Proposed Change:
Have the HistoryMetricData use a DataLoadingStrategy which will provide 
the interface for loading Versions.

public interface DataLoadingStrategy
{
   public VersionMetricData getVersion(int rsn);
}

Internally this will allow a HistoryMetricData to change the way it loads 
data, but will continue to provide the same accessor interface to clients 
thus not breaking the way we currently request versions.

A DataLoaderFactory could be used to configure and return the correct 
DataLoadingStrategy for a HistoryMetricData, based on the loading type. 
Additionally, teh concrete data loading strategy can set implement its own 
form of caching of previously loaded data. This caching feature, however 
cna be added later.

Original issue reported on code.google.com by jtha...@gmail.com on 28 Aug 2007 at 5:02

GoogleCodeExporter commented 9 years ago
Fixed:
A new LoadType was added to define supported data loading variations. Currently 
supported are:

LoadType.MINIMAL, // Only class data
LoadType.MAXIMAL; // Same as minimal but with method and dependency data

Thus, a MinimalDataLoadingStrategy and MaximalDataLoadingStrategy were 
implemented 
that act according to the aforementioned description. The 
MinimalDataLoadingStrategy 
will ensure it always loads VersionMetricData with only its class data 
populated. A 
MaximalDataLoadingStrategy will ensure it always loads VersionMetricData with 
all 
its class, method and dependency data.

Other loading strategies could be added in future to cope with different/new 
situations.

DataLoadingFactory
-------------------
The DataLoadingFactory uses the LoadType to return the appropriate 
DataLoadingStrategy.

Usage Scenario:
The DataLoadingStrategy used to return VersionMetricData from a History can be 
configured when constructing a history.

Map<Integer, String[]> versions = //...a mapping of all the files for this 
version 
set.
HistoryMetricData hmd = new HistoryMetricData("Groovy", versions, 
LoadType.MAXIMAL);
VersionMetricData vmd = hmd.getVersion(3); // Returns RSN 3 fully popluated.

Original comment by jtha...@gmail.com on 28 Aug 2007 at 7:51

GoogleCodeExporter commented 9 years ago
Added the ability to manually set the data loading type to change the data 
loading 
behavioiur of a History once it has already been created.

Usage Scenario:
hmd.setLoadType(LoadType.MINIMAL); // All VersionmetricData loaded from now on 
will 
be minimally populated.

Original comment by jtha...@gmail.com on 28 Aug 2007 at 8:11