Class ModelLoaders<M extends IModel>
- java.lang.Object
-
- net.ssehub.easy.basics.modelManagement.ModelLoaders<M>
-
- Type Parameters:
M- the specific type of model
public class ModelLoaders<M extends IModel> extends java.lang.ObjectManages the model loaders. This class is not intended to be instantiated directly rather than being created fromModelManagement.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<IModelLoader<M>>loadersprivate IModelManagementRepository<M>repository
-
Constructor Summary
Constructors Constructor Description ModelLoaders(IModelManagementRepository<M> repository)Prevents this class from being instantiated from outside this package.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IModelLoader<M>getDefaultLoader()Returns the default loader.intgetLoaderCount()Returns the number of loaders configured.booleanisRegistered(IModelLoader<M> loader)Returns whether the givenloaderis already registered.voidregisterLoader(IModelLoader<M> loader, ProgressObserver observer)Registers a model loader and updates the model information provided by the loader.(package private) voidscanAll(java.io.File location, ModelInfoHolder<M> holder)Scans all locations for model information objects.voidunregisterLoader(IModelLoader<M> loader, ProgressObserver observer)Unregisters a model loader.
-
-
-
Field Detail
-
loaders
private java.util.List<IModelLoader<M extends IModel>> loaders
-
repository
private IModelManagementRepository<M extends IModel> repository
-
-
Constructor Detail
-
ModelLoaders
ModelLoaders(IModelManagementRepository<M> repository)
Prevents this class from being instantiated from outside this package.- Parameters:
repository- the model management repository for callbacks
-
-
Method Detail
-
scanAll
void scanAll(java.io.File location, ModelInfoHolder<M> holder)Scans all locations for model information objects.- Parameters:
location- the location to scanholder- the combined information and result collection instance
-
isRegistered
public boolean isRegistered(IModelLoader<M> loader)
Returns whether the givenloaderis already registered.- Parameters:
loader- the loader to check for- Returns:
trueif the loader is registered,falseelse
-
registerLoader
public void registerLoader(IModelLoader<M> loader, ProgressObserver observer) throws ModelManagementException
Registers a model loader and updates the model information provided by the loader.- Parameters:
loader- the model loaderobserver- an optional progress observer (useProgressObserver.NO_OBSERVERbut not null in case that no observation is intended)- Throws:
ModelManagementException- in case that theloaderaims at loading inconsistent information
-
unregisterLoader
public void unregisterLoader(IModelLoader<M> loader, ProgressObserver observer)
Unregisters a model loader.- Parameters:
loader- the model loaderobserver- an optional progress observer (useProgressObserver.NO_OBSERVERbut not null in case that no observation is intended)
-
getLoaderCount
public int getLoaderCount()
Returns the number of loaders configured.- Returns:
- the number of loaders
-
getDefaultLoader
public IModelLoader<M> getDefaultLoader()
Returns the default loader. This shall be used in case that a model information (for some reason) does not declear a specific loader.- Returns:
- the default loader (may be null if there is none)
-
-