Class PersistenceFacade
- java.lang.Object
- 
- org.jetbrains.mps.openapi.persistence.PersistenceFacade
 
- 
 public abstract class PersistenceFacade extends Object Represents a singleton registry of model and model root factories.
- 
- 
Field SummaryFields Modifier and Type Field Description protected static PersistenceFacadeINSTANCE
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedPersistenceFacade()
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract voidaddFindUsagesParticipant(FindUsagesParticipant participant)Deprecated.add/remove methods shall move to PersistenceRegistry (implementation class), instead, as components that perform registration may access PersistenceRegistry instance directly.abstract voidaddNavigationParticipant(NavigationParticipant participant)Deprecated.seeaddFindUsagesParticipant(FindUsagesParticipant)for reasonsabstract StringasString(SModelId modelId)Serialize counterpart forcreateModelId(String), persistence-ready presentation of a model identifier.abstract StringasString(SModelReference modelRef)Serialize counterpart forcreateModelReference(String), persistence-ready presentation of a model referenceabstract StringasString(SNodeReference nodeRef)Serialize counterpart forcreateNodeReference(String), persistence-ready presentation of a node reference.abstract StringasString(SModuleId moduleId)abstract StringasString(SModuleReference reference)Serialize counterpart forcreateModuleReference(String).abstract SModelIdcreateModelId(String text)Creates an SModelId from a given text identifier.abstract SModelReferencecreateModelReference(String text)Creates an SModelReference from a given text identifier.abstract SModelReferencecreateModelReference(SModuleReference module, SModelId modelId, String modelName)Creates an SModelReference in a module with a given model id and model name.abstract SModuleIdcreateModuleId(String text)abstract SModuleReferencecreateModuleReference(String text)abstract SModuleReferencecreateModuleReference(SModuleId moduleId, String moduleName)abstract SNodeIdcreateNodeId(String text)Creates an SNodeId from a given text identifier.abstract SNodeReferencecreateNodeReference(String text)abstract ModelFactorygetDefaultModelFactory()Deprecated.unclear contract, useModelFactoryRegistry#getDefault(DataSourceType)seejetbrains.mps.extapi.persistence.ModelFactoryServiceseejetbrains.mps.extapi.persistence.datasource.DataSourceFactoryRuleServiceabstract Set<FindUsagesParticipant>getFindUsagesParticipants()Find usages participants speed-up usages search by indexing the content.static PersistenceFacadegetInstance()abstract ModelFactorygetModelFactory(String extension)Deprecated.useModelFactoryRegistry#getDefault(DataSourceType)seejetbrains.mps.extapi.persistence.ModelFactoryServiceseejetbrains.mps.extapi.persistence.datasource.DataSourceFactoryRuleServiceabstract Set<String>getModelFactoryExtensions()Deprecated.the model factories are separated from the type of location (while file extension as a key clearly violates this idea).abstract ModelRootFactorygetModelRootFactory(String type)Retrieves the factory associated with the given typeabstract Set<NavigationParticipant>getNavigationParticipants()Navigation participants speed-up building Go to lists by indexing the available targets.abstract Iterable<String>getTypeIds()Retrieves all registered types of model roots FIXME shall rename to smth more meaningful (to reflect it's about model roots)abstract voidremoveFindUsagesParticipant(FindUsagesParticipant participant)Deprecated.seeaddFindUsagesParticipant(FindUsagesParticipant)for reasonsabstract voidremoveNavigationParticipant(NavigationParticipant participant)Deprecated.seeaddFindUsagesParticipant(FindUsagesParticipant)for reasonsabstract voidsetModelFactory(String extension, ModelFactory factory)Deprecated.ModelFactory notion is isolated from the location byDataSource.abstract voidsetModelIdFactory(String type, SModelIdFactory factory)Registers the factory with the model id type, overwriting potential earlier registration.abstract voidsetModelRootFactory(String type, ModelRootFactory factory)Registers the factory with the given type, overwriting potential earlier registration.abstract voidsetNodeIdFactory(String type, SNodeIdFactory factory)Registers the factory with the node id type, overwriting potential earlier registration.
 
- 
- 
- 
Field Detail- 
INSTANCEprotected static PersistenceFacade INSTANCE 
 
- 
 - 
Method Detail- 
getInstancepublic static PersistenceFacade getInstance() 
 - 
getTypeIdspublic abstract Iterable<String> getTypeIds() Retrieves all registered types of model roots FIXME shall rename to smth more meaningful (to reflect it's about model roots)
 - 
getModelRootFactorypublic abstract ModelRootFactory getModelRootFactory(String type) Retrieves the factory associated with the given type
 - 
setModelRootFactorypublic abstract void setModelRootFactory(String type, ModelRootFactory factory) Registers the factory with the given type, overwriting potential earlier registration.- Parameters:
- factory- The factory to register, null to clear the registration for the given type.
 
 - 
getModelFactory@Deprecated public abstract ModelFactory getModelFactory(@Nullable String extension) Deprecated.useModelFactoryRegistry#getDefault(DataSourceType)seejetbrains.mps.extapi.persistence.ModelFactoryServiceseejetbrains.mps.extapi.persistence.datasource.DataSourceFactoryRuleServiceRetrieves the factory associated with the given file extension.
 - 
getDefaultModelFactory@Deprecated public abstract ModelFactory getDefaultModelFactory() Deprecated.unclear contract, useModelFactoryRegistry#getDefault(DataSourceType)seejetbrains.mps.extapi.persistence.ModelFactoryServiceseejetbrains.mps.extapi.persistence.datasource.DataSourceFactoryRuleServiceRetrieves the factory for default MPS storage format (xml-based).
 - 
setModelFactory@Deprecated public abstract void setModelFactory(@Nullable String extension, ModelFactory factory) Deprecated.ModelFactory notion is isolated from the location byDataSource. UseModelFactoryRegistry#registerinstead. seejetbrains.mps.extapi.persistence.ModelFactoryServiceseejetbrains.mps.extapi.persistence.datasource.DataSourceFactoryRuleServiceRegisters the factory with the file extension, overwriting the potential earlier registration.- Parameters:
- factory- The factory to register, null to clear the registration for the given type.
 
 - 
getModelFactoryExtensions@Deprecated public abstract Set<String> getModelFactoryExtensions() Deprecated.the model factories are separated from the type of location (while file extension as a key clearly violates this idea). Thus one might to look at thejetbrains.mps.extapi.persistence.datasource.DataSourceFactoryServicewhich can be used to register your one custom data source factories.jetbrains.mps.extapi.persistence.ModelFactoryServiceis an extension point to register your custom model factory implementation and associate it (if needed) with some specific data source type.Retrieves registered storage formats extensions.
 - 
createModuleId@NotNull public abstract SModuleId createModuleId(@NotNull String text) - Returns:
- module identity object created from persistence text
- Throws:
- IllegalArgumentException- if the text could not be parsed
- Since:
- 3.3
 
 - 
asString@NotNull public abstract String asString(@NotNull SModuleId moduleId) - Returns:
- textual representation of the identifier ready for persistence
- Since:
- 3.3
 
 - 
asStringpublic abstract String asString(@NotNull SModuleReference reference) Serialize counterpart forcreateModuleReference(String).- Parameters:
- reference- module reference to serialize
- Returns:
- persistence-ready presentation of a module identifier
- Since:
- 3.3
 
 - 
createModuleReferencepublic abstract SModuleReference createModuleReference(@NotNull String text) 
 - 
createModuleReferencepublic abstract SModuleReference createModuleReference(@NotNull SModuleId moduleId, String moduleName) - Returns:
- module identity constructed from the fragments supplied
- Since:
- 3.3
 
 - 
createModelIdpublic abstract SModelId createModelId(String text) Creates an SModelId from a given text identifier. Allows implementations to provide their own version of SModelId.- Parameters:
- text- A text that the custom implementation of SModelIdFactory could use to build its own SModelId. The text comes in the following format: "type:restInterpretedByTheConcreteTypeProvider" The actual type of the model id is followed by implementation-specific text.
- Throws:
- IllegalArgumentException- if the text does not contain a parsable- SModelId.
- See Also:
- asString(org.jetbrains.mps.openapi.model.SModelId)
 
 - 
asStringpublic abstract String asString(@NotNull SModelId modelId) Serialize counterpart forcreateModelId(String), persistence-ready presentation of a model identifier.- Parameters:
- modelId- model identity
- Returns:
- textual representation of a model identifier ready for persistence
 
 - 
createModelReferencepublic abstract SModelReference createModelReference(String text) Creates an SModelReference from a given text identifier.- Throws:
- IllegalArgumentException- if the text does not contain a parsable- SModelReference.
 
 - 
asStringpublic abstract String asString(@NotNull SModelReference modelRef) Serialize counterpart forcreateModelReference(String), persistence-ready presentation of a model reference- Parameters:
- modelRef- model reference to serialize
- Returns:
- textual representation of a model reference
 
 - 
createModelReferencepublic abstract SModelReference createModelReference(SModuleReference module, @NotNull SModelId modelId, @NotNull String modelName) Creates an SModelReference in a module with a given model id and model name.- Parameters:
- module- can be null only if modelId is globally unique (i.e. can be resolved without a module)
 
 - 
setModelIdFactorypublic abstract void setModelIdFactory(String type, SModelIdFactory factory) Registers the factory with the model id type, overwriting potential earlier registration.- Parameters:
- factory- The factory to register, null to clear the registration for the given type.
 
 - 
createNodeIdpublic abstract SNodeId createNodeId(String text) Creates an SNodeId from a given text identifier. Allows implementations to provide their own version of SNodeId.- Parameters:
- text- A text that the custom implementation of SNodeIdFactory could use to build its own SNodeId. The text comes in the following format: "type:restInterpretedByTheConcreteTypeProvider" The actual type of the node id is followed by implementation-specific text.
- Throws:
- IllegalArgumentException- if the text does not contain a parsable- SNodeId.
 
 - 
asString@NotNull public abstract String asString(@NotNull SNodeReference nodeRef) Serialize counterpart forcreateNodeReference(String), persistence-ready presentation of a node reference.- Parameters:
- nodeRef- node reference to serialize
- Returns:
- textual representation of node reference
 
 - 
createNodeReferencepublic abstract SNodeReference createNodeReference(String text) 
 - 
setNodeIdFactorypublic abstract void setNodeIdFactory(String type, SNodeIdFactory factory) Registers the factory with the node id type, overwriting potential earlier registration.- Parameters:
- factory- The factory to register, null to clear the registration for the given type.
 
 - 
getFindUsagesParticipantspublic abstract Set<FindUsagesParticipant> getFindUsagesParticipants() Find usages participants speed-up usages search by indexing the content. seeFindUsagesParticipant
 - 
addFindUsagesParticipant@Deprecated public abstract void addFindUsagesParticipant(FindUsagesParticipant participant) Deprecated.add/remove methods shall move to PersistenceRegistry (implementation class), instead, as components that perform registration may access PersistenceRegistry instance directly. I don't see a need to add/remove participants dynamically.
 - 
removeFindUsagesParticipant@Deprecated public abstract void removeFindUsagesParticipant(FindUsagesParticipant participant) Deprecated.seeaddFindUsagesParticipant(FindUsagesParticipant)for reasons
 - 
getNavigationParticipantspublic abstract Set<NavigationParticipant> getNavigationParticipants() Navigation participants speed-up building Go to lists by indexing the available targets. seeNavigationParticipant
 - 
addNavigationParticipant@Deprecated public abstract void addNavigationParticipant(NavigationParticipant participant) Deprecated.seeaddFindUsagesParticipant(FindUsagesParticipant)for reasons
 - 
removeNavigationParticipant@Deprecated public abstract void removeNavigationParticipant(NavigationParticipant participant) Deprecated.seeaddFindUsagesParticipant(FindUsagesParticipant)for reasons
 
- 
 
-