M - the specific model typepublic abstract class ImportResolver<M extends IModel>
extends java.lang.Object
ModelManagement. Further, this class enables deferred loading, i.e., (cyclic) models that
perform processing of declarations first and then require later subsequent resolution of model elements.| Modifier and Type | Field and Description |
|---|---|
private java.util.List<IDeferredModelLoader<M>> |
deferredLoaders |
private IModelProcessingListener<M> |
processingListener |
private boolean |
transitiveLoading |
| Constructor and Description |
|---|
ImportResolver() |
| Modifier and Type | Method and Description |
|---|---|
void |
addDeferredLoader(IDeferredModelLoader<M> loader)
Adds a deferred loader.
|
void |
clear()
Clears this instance for reuse.
|
IModelProcessingListener<M> |
getProcessingListener()
Returns the processing listener.
|
boolean |
isTransitiveLoadingEnabled()
Returns whether transitive loading is enabled.
|
protected void |
notifyProcessing(ModelInfo<M> info,
IModelProcessingListener.Type type,
boolean started)
Notifies the processing listener if defined.
|
abstract M |
resolve(java.lang.String modelName,
IVersionRestriction restriction,
java.net.URI baseUri,
IModelRepository<M> repository,
IRestrictionEvaluationContext evaluationContext)
Resolves the denoted model considering the given
restrictions. |
abstract java.util.List<IMessage> |
resolveImports(M model,
java.net.URI uri,
java.util.List<ModelInfo<M>> inProgress,
IModelRepository<M> repository,
IRestrictionEvaluationContext evaluationContext)
Resolves the imports of the given
model and returns
messages on failures. |
IModelProcessingListener<M> |
setProcessingListener(IModelProcessingListener<M> processingListener)
Defines the actual processing listener.
|
boolean |
setTransitiveLoading(boolean transitiveLoading)
Enables or disables transitive loading.
|
private boolean transitiveLoading
private IModelProcessingListener<M extends IModel> processingListener
private java.util.List<IDeferredModelLoader<M extends IModel>> deferredLoaders
public IModelProcessingListener<M> setProcessingListener(IModelProcessingListener<M> processingListener)
processingListener - the listener (may be null for none)public IModelProcessingListener<M> getProcessingListener()
protected void notifyProcessing(ModelInfo<M> info, IModelProcessingListener.Type type, boolean started)
info - the information object the operation is performed ontype - the processing typestarted - whether the operation started or endedpublic void clear()
public abstract java.util.List<IMessage> resolveImports(M model, java.net.URI uri, java.util.List<ModelInfo<M>> inProgress, IModelRepository<M> repository, IRestrictionEvaluationContext evaluationContext)
model and returns
messages on failures. Exceptions might be appropriate here but the
caller shall be able to decide how to handle the level of detail, i.e.
whether the first message shall be emitted or all. May modify model
as a side effect.model - the model to be resolveduri - the URI of the model to resolve (in order to find the closest
model, may be null)inProgress - the model information objects of the models currently being
processed at once (may be null)repository - the model repositoryevaluationContext - the context for evaluating import restrictions (variable definitions...
interpreted locally)public abstract M resolve(java.lang.String modelName, IVersionRestriction restriction, java.net.URI baseUri, IModelRepository<M> repository, IRestrictionEvaluationContext evaluationContext) throws ModelManagementException
restrictions.modelName - the name of the modelrestriction - the version restriction (may be null if there is none)baseUri - the URI to start resolving from (may be the URI of a model)repository - the model repositoryevaluationContext - the context for evaluating import restrictions (variable definitions...
interpreted locally)ModelManagementException - in case of resolution failurespublic boolean setTransitiveLoading(boolean transitiveLoading)
transitiveLoading - whether transitive loading is enabledpublic boolean isTransitiveLoadingEnabled()
true if transitive loading is enabled, false elsepublic void addDeferredLoader(IDeferredModelLoader<M> loader)
loader - the loaderCopyright © 2009 - 2018 SSE. All Rights Reserved.