Class ModelRepository<M extends IModel>
java.lang.Object
net.ssehub.easy.basics.modelManagement.ModelRepository<M>
- Type Parameters:
M- the specific model type
- All Implemented Interfaces:
IModelManagementRepository<M>,IModelRepository<M>
public abstract class ModelRepository<M extends IModel>
extends Object
implements IModelManagementRepository<M>, IModelRepository<M>
Implements the model repository interface by delegating to
ModelManagement.
However, there are some methods that shall not directly be public in ModelManagement and
are, thus, hidden via delegation.- Author:
- Holger Eichelberger
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedModelRepository(ModelManagement<M> modelMgmt) Creates a model repository. -
Method Summary
Modifier and TypeMethodDescriptionvoidclearLocation(File file, ProgressObserver observer) Removes a file location, i.e.getAvailable(String name) Returns models available for a given modelname.Returns the default library locations.getLocationFor(URI uri) Returns the location foruri.getMatchingModelNames(String name) Returns the matching model names for a potential wildcard name.getModelInfo(String name, Version version, URI uri) Returns a known model information object via its URI.getResolvedModelInfo(M model) Returns the model information object for the given model by considering resolved models.booleanisOutdated(ModelInfo<M> info) Returns whether a model information is outdated.Loads the model related toinfowith a new default import resolver.Loads the model related toinfowith the given import resolver.loaders()Returns the loaders.voidupdateForLoader(IModelLoader<M> loader, ProgressObserver observer) Registers a model loader and updates the model information provided by the loader.voidupdateModelInformation(File file, ProgressObserver observer) Updates the model information infile.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.ssehub.easy.basics.modelManagement.IModelRepository
createModel
-
Field Details
-
modelMgmt
-
-
Constructor Details
-
ModelRepository
Creates a model repository.- Parameters:
modelMgmt- the model management instance to delegate to
-
-
Method Details
-
getAvailable
Description copied from interface:IModelRepositoryReturns models available for a given modelname.- Specified by:
getAvailablein interfaceIModelRepository<M extends IModel>- Parameters:
name- the name to search for- Returns:
- the available model or null
-
isOutdated
Description copied from interface:IModelRepositoryReturns whether a model information is outdated.- Specified by:
isOutdatedin interfaceIModelRepository<M extends IModel>- Parameters:
info- the object to be tested- Returns:
trueif it is outdated,falseelse
-
load
Description copied from interface:IModelRepositoryLoads the model related toinfowith a new default import resolver.- Specified by:
loadin interfaceIModelRepository<M extends IModel>- Parameters:
info- the model info to load the model formessages- the messages collected so far (modified as a side effect)- Returns:
- the loaded model or null
-
load
Description copied from interface:IModelRepositoryLoads the model related toinfowith the given import resolver.- Specified by:
loadin interfaceIModelRepository<M extends IModel>- Parameters:
info- the model info to load the model forresolver- the import resolver to use (null for a new default resolver)messages- the messages collected so far (modified as a side effect)- Returns:
- the loaded model or null
-
getModelInfo
Description copied from interface:IModelRepositoryReturns a known model information object via its URI.- Specified by:
getModelInfoin interfaceIModelRepository<M extends IModel>- Parameters:
name- the name of the model to search forversion- the version of the model to search foruri- the URI to search for- Returns:
- the related model information object (or null if not found)
-
getMatchingModelNames
Description copied from interface:IModelRepositoryReturns the matching model names for a potential wildcard name.- Specified by:
getMatchingModelNamesin interfaceIModelRepository<M extends IModel>- Parameters:
name- the name to return the matches for- Returns:
- if name is a wildcard name, all known matching names; else,
name
-
updateModelInformation
public void updateModelInformation(File file, ProgressObserver observer) throws ModelManagementException Updates the model information infile.- Specified by:
updateModelInformationin interfaceIModelManagementRepository<M extends IModel>- Parameters:
file- the location folder to searchobserver- an optional progress observer (useProgressObserver.NO_OBSERVERbut not null in case that no observation is intended)- Throws:
ModelManagementException- in case that the available information may be come inconsistent due to this update
-
updateForLoader
public void updateForLoader(IModelLoader<M> loader, ProgressObserver observer) throws ModelManagementException Registers a model loader and updates the model information provided by the loader.- Specified by:
updateForLoaderin interfaceIModelManagementRepository<M extends IModel>- Parameters:
loader- the model loader (must not be null)observer- 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
-
getLocationFor
Returns the location foruri.- Specified by:
getLocationForin interfaceIModelRepository<M extends IModel>- Parameters:
uri- the URI to search for- Returns:
- the related location
-
loaders
Returns the loaders.- Specified by:
loadersin interfaceIModelManagementRepository<M extends IModel>- Returns:
- the loaders
-
clearLocation
Removes a file location, i.e. a location from where models can be loaded.- Specified by:
clearLocationin interfaceIModelManagementRepository<M extends IModel>- Parameters:
file- the file location (null is ignored)observer- an optional progress observer (useProgressObserver.NO_OBSERVERbut not null in case that no observation is intended)
-
getResolvedModelInfo
Returns the model information object for the given model by considering resolved models.- Specified by:
getResolvedModelInfoin interfaceIModelManagementRepository<M extends IModel>- Parameters:
model- the model to search an information object for which resolvesmodel- Returns:
- the related model information object or null if there is none
-
getDefaultLibraryLocations
Description copied from interface:IModelRepositoryReturns the default library locations.- Specified by:
getDefaultLibraryLocationsin interfaceIModelRepository<M extends IModel>- Returns:
- the default library locations
-