Interface DataSource
- 
- All Known Subinterfaces:
- MultiStreamDataSource,- StreamDataSource
 - All Known Implementing Classes:
- NullDataSource
 
 public interface DataSourceRepresents a location of the model data sources to build models. For example it can be based on files, internet content, database content, etc. NB: Must not contain any information on the storage format specifics -- all that belongs to theModelFactory. For implementation consider extendingjetbrains.mps.extapi.persistence.DataSourceBase.
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddListener(DataSourceListener listener)Registers listeners who need to be notified about changes in the underlying data source.StringgetLocation()Yields a string representation for the location of the data source (if applicable)longgetTimestamp()Retrieves the last modification timestamp.default DataSourceTypegetType()Defines a data source type for this kind of data sources.booleanisReadOnly()TODO Makes sense only with API which introduce changes to theDataSource.voidremoveListener(DataSourceListener listener)
 
- 
- 
- 
Method Detail- 
getLocation@NotNull String getLocation() Yields a string representation for the location of the data source (if applicable)
 - 
addListenervoid addListener(@NotNull DataSourceListener listener) Registers listeners who need to be notified about changes in the underlying data source. It is the responsibility of the DataSource to detect such updates and notify the listeners.
 - 
removeListenervoid removeListener(@NotNull DataSourceListener listener) 
 - 
getTimestamplong getTimestamp() Retrieves the last modification timestamp. The timestamp should reliably reflect all external changes to the data source.- Returns:
- 0 if timestamp is not supported for the source, or -1 if the source is dead (like when file is deleted)
 
 - 
isReadOnlyboolean isReadOnly() TODO Makes sense only with API which introduce changes to theDataSource. Currently it is incomplete. Usually there is a possibility to editDataSource. For examples please seeStreamDataSource.- Returns:
- whether this data source can be changed.
 
 - 
getType@Nullable default DataSourceType getType() Defines a data source type for this kind of data sources. The data source type notion is strongly associated with the possibility to provideDataSourceFactoryandModelFactorycustom mappings. SeeDataSourceFactoryRuleServiceandModelFactoryServicefor the implementation details.- Returns:
- the unique data source type for this instance of data source if the developer wants others to be able to change the default behavior of this data source (register with the same key) or if he desires to associate this data source with some specific model factory.
 
 
- 
 
-