Package jetbrains.mps.extapi.persistence
Class DataSourceBase
- java.lang.Object
 - 
- jetbrains.mps.extapi.persistence.DataSourceBase
 
 
- 
- All Implemented Interfaces:
 DataSource
- Direct Known Subclasses:
 FileDataSource,FolderDataSource,FolderSetDataSource,SingleStreamSource
public abstract class DataSourceBase extends Object implements DataSource
A base convenience class for data sources with empty implementations for all methods. 
- 
- 
Constructor Summary
Constructors Constructor Description DataSourceBase() 
- 
Method Summary
All Methods Instance Methods Concrete 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.DataSourceTypegetType()Defines a data source type for this kind of data sources.booleanisReadOnly()TODO Makes sense only with API which introduce changes to theDataSource.voidrefresh()voidremoveListener(DataSourceListener listener)StringtoString() 
 - 
 
- 
- 
Method Detail
- 
addListener
public void addListener(@NotNull DataSourceListener listener)
Description copied from interface:DataSourceRegisters 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.- Specified by:
 addListenerin interfaceDataSource
 
- 
removeListener
public void removeListener(@NotNull DataSourceListener listener)
- Specified by:
 removeListenerin interfaceDataSource
 
- 
getType
@Nullable public DataSourceType getType()
Description copied from interface:DataSourceDefines 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.- Specified by:
 getTypein interfaceDataSource- 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.
 
 
- 
getTimestamp
public long getTimestamp()
Description copied from interface:DataSourceRetrieves the last modification timestamp. The timestamp should reliably reflect all external changes to the data source.- Specified by:
 getTimestampin interfaceDataSource- Returns:
 - 0 if timestamp is not supported for the source, or -1 if the source is dead (like when file is deleted)
 
 
- 
refresh
public void refresh()
 
- 
getLocation
@NotNull public String getLocation()
Description copied from interface:DataSourceYields a string representation for the location of the data source (if applicable)- Specified by:
 getLocationin interfaceDataSource
 
- 
isReadOnly
public boolean isReadOnly()
Description copied from interface:DataSourceTODO 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.- Specified by:
 isReadOnlyin interfaceDataSource- Returns:
 - whether this data source can be changed.
 
 
 - 
 
 -