Class ModelLoaders<M extends IModel>
java.lang.Object
net.ssehub.easy.basics.modelManagement.ModelLoaders<M>
- Type Parameters:
M- the specific type of model
Manages the model loaders. This class is not intended to be instantiated directly rather than
being created from
ModelManagement.- Author:
- Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<IModelLoader<M>> private IModelManagementRepository<M> -
Constructor Summary
ConstructorsConstructorDescriptionModelLoaders(IModelManagementRepository<M> repository) Prevents this class from being instantiated from outside this package. -
Method Summary
Modifier and TypeMethodDescriptionReturns the default loader.intReturns 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(File location, ModelInfoHolder<M> holder) Scans all locations for model information objects.voidunregisterLoader(IModelLoader<M> loader, ProgressObserver observer) Unregisters a model loader.
-
Field Details
-
loaders
-
repository
-
-
Constructor Details
-
ModelLoaders
ModelLoaders(IModelManagementRepository<M> repository) Prevents this class from being instantiated from outside this package.- Parameters:
repository- the model management repository for callbacks
-
-
Method Details
-
scanAll
Scans all locations for model information objects.- Parameters:
location- the location to scanholder- the combined information and result collection instance
-
isRegistered
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
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
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)
-