Class AvailableModels<M extends IModel>
java.lang.Object
net.ssehub.easy.basics.modelManagement.AvailableModels<M>
- Type Parameters:
M- the specific type of model
Stores information about available models, i.e., the relation between model
names and all available model information objects. This class provides several
methods to query model information objects.
- Author:
- Holger Eichelberger
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAvailableModels(IModelManagementRepository<M> repository) Creates an instance of this class. -
Method Summary
Modifier and TypeMethodDescription(package private) voidclear()Clears all loaded model infos.createTempInfo(M model, URI location) Creates a temporary resolved model information without model loader.(package private) List<VersionedModelInfos<M>> getAvailable(String name) Returns models available for a given modelname.Returns the (visible) information object aturi.Returns a known model object via its URI.Returns a known model object via its URI.getModelInfo(String name) Returns all known model information objects for the specified model.getModelInfo(String name, String version) Returns the model information object for the specified model.getModelInfo(String name, String version, URI uri) Returns a known model information object via its URI.getModelInfo(String name, Version version) Returns the model information objects for the specified model.getModelInfo(String name, Version version, URI uri) Returns a known model information object via its URI.getModelInfo(M model) Returns the model information object for the specified model.getModelInfo(ModelInfo<M> info) Returns the matching available model information instance.intgetModelInfoCount(boolean differURIs) Returns the number of different model information objects known in this class.getModelInfos(M model) Returns the model information objects for the specified model.getModelInfoWith(URI uri) Returns the available model information objects which are located aturi.getResolvedModelInfo(M model) Returns the model information object for the given model by considering resolved models.getResolvedModelInfo(M model, URI uri) Returns the model information object formodelwhile consideringurias location ofmodel.getVisibleModelInfo(String name, URI uri) Returns the available model information objects which are available for and visible from the given URI, i.e.getVisibleModelInfo(String name, Version version, URI uri) Returns the available model information objects which are available for and visible from the given URI, i.e.getVisibleModelInfo(URI uri) Returns the available model information objects which are available for and visible from the given URI, i.e.booleanhasModelInfo(String name) Returns whether there are known model information objects for the specified model.booleanisTempInfo(ModelInfo<M> info) Returns whetherinfois a temporary model.Returns the known model names.(package private) voidputAvailable(String name, List<VersionedModelInfos<M>> infos) Puts available model information objects for a given model name.voidreleaseTempInfo(ModelInfo<M> info) Releases a temporary model information object.(package private) voidremoveAvailable(String name) Removes a model information object for a given model name.(package private) voidremoveAvailable(ModelInfo<M> info) Removes a model information object for a given information object.(package private) booleanupdateAvailableModel(ModelInfo<M> info) Updates the list of available models.Returns all versioned model information objects.
-
Field Details
-
availableModels
-
tmpInfo
-
-
Constructor Details
-
AvailableModels
AvailableModels(IModelManagementRepository<M> repository) Creates an instance of this class.- Parameters:
repository- the underlying repository instance
-
-
Method Details
-
clear
void clear()Clears all loaded model infos. -
versionedModelInfos
Returns all versioned model information objects.- Returns:
- all known versioned model information objects
-
modelNames
Returns the known model names.- Returns:
- the model names
-
updateAvailableModel
Updates the list of available models.- Parameters:
info- the model information to be added/updated- Returns:
truein case of inconsistencies,false
-
getModelInfoCount
public int getModelInfoCount(boolean differURIs) Returns the number of different model information objects known in this class.- Parameters:
differURIs- if the result should count different URIs or just different versions- Returns:
- the number of different model information objects
-
getInfo
Returns the (visible) information object aturi.- Parameters:
uri- the URI to look for- Returns:
- the found information object or null if not found
-
getVisibleModelInfo
Returns the available model information objects which are available for and visible from the given URI, i.e. either same path, containing or contained path.- Parameters:
uri- the URI to match- Returns:
- the available information objects matching
uri
-
getVisibleModelInfo
Returns the available model information objects which are available for and visible from the given URI, i.e. either same path, containing or contained path.- Parameters:
name- the name of the model (may be null but thenversionis ignored and all visible model information objects are returned as done ingetVisibleModelInfo(URI)).version- the version of the model (may be null)uri- the URI to match- Returns:
- the available information objects matching
uri
-
getVisibleModelInfo
Returns the available model information objects which are available for and visible from the given URI, i.e. either same path, containing or contained path.- Parameters:
name- the name of the model (may be null but thenversionis ignored and all visible model information objects are returned as done ingetVisibleModelInfo(URI)).uri- the URI to match- Returns:
- the available information objects matching
uri
-
getModelInfoWith
Returns the available model information objects which are located aturi.- Parameters:
uri- the URI to match- Returns:
- the available information objects matching
uri
-
getResolvedModelInfo
Returns the model information object formodelwhile consideringurias location ofmodel. This method emulates an import.- Parameters:
model- the model to search the info foruri- the URI to consider as starting point- Returns:
- the model information object or null if there is none
-
getResolvedModelInfo
Returns the model information object for the given model by considering resolved models.- Parameters:
model- the model to search an information object for which resolvesmodel- Returns:
- the related model information object or null if there is none
-
getModelInfo
Returns a known model information object via its URI.- 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)
-
getModelInfo
Returns the model information objects for the specified model.- Parameters:
name- the name of the model to search forversion- the version of the model to search for- Returns:
- the model information objects (may have different URLs) or null if unknown
-
getModelInfos
Returns the model information objects for the specified model. However, unless the information objects are not directly tested for a reference tomodel, all those with matching name / version will be returned.- Parameters:
model- the model to search for- Returns:
- the model information objects (may have different URLs) or null if unknown
-
getModelInfo
Returns the model information object for the specified model.- Parameters:
model- the model to search for- Returns:
- the model information pointing to
model, null if unknown
-
getModelInfo
Returns the model information object for the specified model.- Parameters:
name- the name of the model to search forversion- the version of the model to search for- Returns:
- the model information objects (may have different URLs) or null if unknown
- Throws:
VersionFormatException- in case of an erroneous version string
-
hasModelInfo
Returns whether there are known model information objects for the specified model.- Parameters:
name- the name of the model- Returns:
trueif model information is known (at least on model but multiple in different versions may exist),falseelse
-
getModelInfo
Returns all known model information objects for the specified model.- Parameters:
name- the name of the model- Returns:
- the available information objects (may be unmodifiable) or null
-
getModelInfo
Returns the matching available model information instance. This method does not consider the loader. This method is helpful when a model information object is created twice and shall be internalized with respect to the available model information objects.- Parameters:
info- the information object to be internalized- Returns:
- the matching object or null if unknown
-
getModel
Returns a known model object via its URI.- 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 object (or null if not found or not yet resolved)
- Throws:
VersionFormatException- in case thatversionis in wrong format (seeVersion
-
getModel
Returns a known model object via its URI.- 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 object (or null if not found or not yet resolved)
- Throws:
VersionFormatException- in case thatversionis in wrong format (seeVersion
-
getModelInfo
public ModelInfo<M> getModelInfo(String name, String version, URI uri) throws VersionFormatException Returns a known model information object via its URI.- 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)
- Throws:
VersionFormatException- in case thatversionis in wrong format (seeVersion
-
getAvailable
Returns models available for a given modelname.- Parameters:
name- the name to search for- Returns:
- the available models or null
-
putAvailable
Puts available model information objects for a given model name.- Parameters:
name- the name of the modelinfos- the associated model information objects
-
removeAvailable
Removes a model information object for a given model name.- Parameters:
name- the name of the model
-
removeAvailable
Removes a model information object for a given information object.- Parameters:
info- the information object
-
createTempInfo
Creates a temporary resolved model information without model loader. Do not use the result for regular models! CallreleaseTempInfo(ModelInfo)if the model is not used anymore. Affects onlygetInfo(URI).- Parameters:
model- the modellocation- the location- Returns:
- the model information
-
releaseTempInfo
Releases a temporary model information object.- Parameters:
info- the information object to release (may be null, ignored)
-
isTempInfo
Returns whetherinfois a temporary model.- Parameters:
info- the information object to check (may be null)- Returns:
trueif info points to a temporary model,falseelse (also ifinfois null)
-