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 Summary
Fields Modifier and Type Field Description protected static PersistenceFacade
INSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description protected
PersistenceFacade()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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.abstract void
addNavigationParticipant(NavigationParticipant participant)
Deprecated.seeaddFindUsagesParticipant(FindUsagesParticipant)
for reasonsabstract String
asString(SModelId modelId)
Serialize counterpart forcreateModelId(String)
, persistence-ready presentation of a model identifier.abstract String
asString(SModelReference modelRef)
Serialize counterpart forcreateModelReference(String)
, persistence-ready presentation of a model referenceabstract String
asString(SNodeReference nodeRef)
Serialize counterpart forcreateNodeReference(String)
, persistence-ready presentation of a node reference.abstract String
asString(SModuleId moduleId)
abstract String
asString(SModuleReference reference)
Serialize counterpart forcreateModuleReference(String)
.abstract SModelId
createModelId(String text)
Creates an SModelId from a given text identifier.abstract SModelReference
createModelReference(String text)
Creates an SModelReference from a given text identifier.abstract SModelReference
createModelReference(SModuleReference module, SModelId modelId, String modelName)
Creates an SModelReference in a module with a given model id and model name.abstract SModuleId
createModuleId(String text)
abstract SModuleReference
createModuleReference(String text)
abstract SModuleReference
createModuleReference(SModuleId moduleId, String moduleName)
abstract SNodeId
createNodeId(String text)
Creates an SNodeId from a given text identifier.abstract SNodeReference
createNodeReference(String text)
abstract ModelFactory
getDefaultModelFactory()
Deprecated.unclear contract, useModelFactoryRegistry#getDefault(DataSourceType)
seejetbrains.mps.extapi.persistence.ModelFactoryService
seejetbrains.mps.extapi.persistence.datasource.DataSourceFactoryRuleService
abstract Set<FindUsagesParticipant>
getFindUsagesParticipants()
Find usages participants speed-up usages search by indexing the content.static PersistenceFacade
getInstance()
abstract ModelFactory
getModelFactory(String extension)
Deprecated.useModelFactoryRegistry#getDefault(DataSourceType)
seejetbrains.mps.extapi.persistence.ModelFactoryService
seejetbrains.mps.extapi.persistence.datasource.DataSourceFactoryRuleService
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).abstract ModelRootFactory
getModelRootFactory(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 void
removeFindUsagesParticipant(FindUsagesParticipant participant)
Deprecated.seeaddFindUsagesParticipant(FindUsagesParticipant)
for reasonsabstract void
removeNavigationParticipant(NavigationParticipant participant)
Deprecated.seeaddFindUsagesParticipant(FindUsagesParticipant)
for reasonsabstract void
setModelFactory(String extension, ModelFactory factory)
Deprecated.ModelFactory notion is isolated from the location byDataSource
.abstract void
setModelIdFactory(String type, SModelIdFactory factory)
Registers the factory with the model id type, overwriting potential earlier registration.abstract void
setModelRootFactory(String type, ModelRootFactory factory)
Registers the factory with the given type, overwriting potential earlier registration.abstract void
setNodeIdFactory(String type, SNodeIdFactory factory)
Registers the factory with the node id type, overwriting potential earlier registration.
-
-
-
Field Detail
-
INSTANCE
protected static PersistenceFacade INSTANCE
-
-
Method Detail
-
getInstance
public static PersistenceFacade getInstance()
-
getTypeIds
public 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)
-
getModelRootFactory
public abstract ModelRootFactory getModelRootFactory(String type)
Retrieves the factory associated with the given type
-
setModelRootFactory
public 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.ModelFactoryService
seejetbrains.mps.extapi.persistence.datasource.DataSourceFactoryRuleService
Retrieves the factory associated with the given file extension.
-
getDefaultModelFactory
@Deprecated public abstract ModelFactory getDefaultModelFactory()
Deprecated.unclear contract, useModelFactoryRegistry#getDefault(DataSourceType)
seejetbrains.mps.extapi.persistence.ModelFactoryService
seejetbrains.mps.extapi.persistence.datasource.DataSourceFactoryRuleService
Retrieves 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#register
instead. seejetbrains.mps.extapi.persistence.ModelFactoryService
seejetbrains.mps.extapi.persistence.datasource.DataSourceFactoryRuleService
Registers 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.DataSourceFactoryService
which can be used to register your one custom data source factories.jetbrains.mps.extapi.persistence.ModelFactoryService
is 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
-
asString
public 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
-
createModuleReference
public abstract SModuleReference createModuleReference(@NotNull String text)
-
createModuleReference
public abstract SModuleReference createModuleReference(@NotNull SModuleId moduleId, String moduleName)
- Returns:
- module identity constructed from the fragments supplied
- Since:
- 3.3
-
createModelId
public 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 parsableSModelId
.- See Also:
asString(org.jetbrains.mps.openapi.model.SModelId)
-
asString
public 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
-
createModelReference
public abstract SModelReference createModelReference(String text)
Creates an SModelReference from a given text identifier.- Throws:
IllegalArgumentException
- if the text does not contain a parsableSModelReference
.
-
asString
public 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
-
createModelReference
public 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)
-
setModelIdFactory
public 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.
-
createNodeId
public 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 parsableSNodeId
.
-
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
-
createNodeReference
public abstract SNodeReference createNodeReference(String text)
-
setNodeIdFactory
public 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.
-
getFindUsagesParticipants
public 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
-
getNavigationParticipants
public 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
-
-