Package jetbrains.mps.smodel
Class MPSModuleRepository
- java.lang.Object
 - 
- jetbrains.mps.extapi.module.SRepositoryBase
 - 
- jetbrains.mps.smodel.MPSModuleRepository
 
 
 
- 
- All Implemented Interfaces:
 CoreComponent,SRepositoryExt,ReferenceScopeHelper.Source,SRepository
public class MPSModuleRepository extends SRepositoryBase implements CoreComponent, SRepositoryExt, ReferenceScopeHelper.Source
 
- 
- 
Constructor Summary
Constructors Constructor Description MPSModuleRepository(SRepositoryRegistry repositoryRegistry) 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddispose()static MPSModuleRepositorygetInstance()Deprecated.ModelAccessgetModelAccess()SModulegetModule(SModuleId id)Iterable<SModule>getModules()Returns an unmodifiable collection of modules.Set<SModule>getModules(MPSModuleOwner moduleOwner)Set<MPSModuleOwner>getOwners(SModule module)ReferenceScopeHelpergetReferenceScopeHelper()voidinit()voidinvalidateCaches()<T extends SModule>
TregisterModule(T moduleToRegister, MPSModuleOwner owner)Need register/unregister API for modules because at the moment registration goes through static instance ofMPSModuleRepository.voidsaveAll()voidunregisterModule(SModule module, MPSModuleOwner owner)Unregisters given module only (e.g.voidunregisterModules(Collection<SModule> modules, MPSModuleOwner owner)Deprecated.use of this method is discouraged as it's specific to thisSRepositoryimplementation.- 
Methods inherited from class jetbrains.mps.extapi.module.SRepositoryBase
addRepositoryListener, fireBeforeModuleRemoved, fireCommandFinished, fireCommandStarted, fireModuleAdded, fireModuleRemoved, getParent, getRepositoryAccess, removeRepositoryListener 
- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface org.jetbrains.mps.openapi.module.SRepository
addRepositoryListener, getParent, getRepositoryAccess, removeRepositoryListener 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
MPSModuleRepository
public MPSModuleRepository(SRepositoryRegistry repositoryRegistry)
 
 - 
 
- 
Method Detail
- 
getInstance
@Deprecated public static MPSModuleRepository getInstance()
Deprecated.UseSRepositoryfrom the project whenever it is possibleCurrently the context object is an MPS project class
 
- 
init
public void init()
- Specified by:
 initin interfaceCoreComponent- Overrides:
 initin classSRepositoryBase
 
- 
dispose
public void dispose()
- Specified by:
 disposein interfaceCoreComponent- Overrides:
 disposein classSRepositoryBase
 
- 
registerModule
public <T extends SModule> T registerModule(@NotNull T moduleToRegister, @NotNull MPSModuleOwner owner)
Description copied from interface:SRepositoryExtNeed register/unregister API for modules because at the moment registration goes through static instance ofMPSModuleRepository. Not an API right away due to (a) MPSModuleOwner is not an API; (b) not certain whether we shall have separate 'editable' SRepository interface (like EditableSModel), which sounds rather stupid but it's the way it runs in the rest of MPS, or the API shall become part of SRepository, but this rises a question if the API shall fail in a harsh or silent way for repositories that do not support change (c) I don't like return value for the method, but it's the way MPSModuleRepository have it. I don't quite buy "single module in a repo, with multiple *owners*" story. If it's truly needed, we could accomplish the same with register(getModule(moduleRef), anotherOwner), rather than return value Promise: once returns, module is attached to the repositoryregisterModule(SModule, MPSModuleOwner)- Specified by:
 registerModulein interfaceSRepositoryExt
 
- 
unregisterModules
@Deprecated public void unregisterModules(Collection<SModule> modules, MPSModuleOwner owner)
Deprecated.use of this method is discouraged as it's specific to thisSRepositoryimplementation. It shall not get exposed inSRepositoryExtunless there's thorough justification. The only rationale behind this method was slow 'invalidateCaches()' when multiple modules were un-registered during project close/MPS shutdown. Now, with no-op invalidateCaches(), there's no performance gain in using this method. However, might be reasonable to updateSRepositoryExtAPI to accommodate collection instead of a single object for register/unregister operations. The method left as a reminder. 
- 
unregisterModule
public void unregisterModule(@NotNull SModule module, @NotNull MPSModuleOwner owner)
Description copied from interface:SRepositoryExtUnregisters given module only (e.g. in case of a language, it's not repository responsibility to care about language generators) 
- 
getModelAccess
@NotNull public ModelAccess getModelAccess()
- Specified by:
 getModelAccessin interfaceSRepository- Returns:
 - a special class which yields a control to the objects which comprise the repository. These are namely modules, models, model roots, nodes.
 
 
- 
getModules
public Set<SModule> getModules(MPSModuleOwner moduleOwner)
- Specified by:
 getModulesin interfaceSRepositoryExt
 
- 
getOwners
public Set<MPSModuleOwner> getOwners(SModule module)
- Specified by:
 getOwnersin interfaceSRepositoryExt
 
- 
getModule
public SModule getModule(@NotNull SModuleId id)
- Specified by:
 getModulein interfaceSRepository- Returns:
 - the module which id is equal to the given module id.
 A repository is able to have only one module for a given module id.
 
nullis returned iff there is no such module in the repository 
 
- 
getModules
@NotNull public Iterable<SModule> getModules()
Description copied from interface:SRepositoryReturns an unmodifiable collection of modules.- Specified by:
 getModulesin interfaceSRepository
 
- 
invalidateCaches
public void invalidateCaches()
 
- 
saveAll
public void saveAll()
- Specified by:
 saveAllin interfaceSRepository
 
- 
getReferenceScopeHelper
public ReferenceScopeHelper getReferenceScopeHelper()
- Specified by:
 getReferenceScopeHelperin interfaceReferenceScopeHelper.Source
 
 - 
 
 -