- All Known Subinterfaces:
DataRaw,DataStructure,DataTable,DataText
- All Known Implementing Classes:
DataRawImpl,DataSourceImpl,DataStructureImpl,DataTableImpl,DataTextImpl
The actual data is only queried when required and is not cached. Therefore, the queried data is always up-to-date at the point of calling a method that queries the data.
As soon a data source reference is created, the data source is locked
within X-Pipe to prevent concurrent modification and the problems that can arise from it.
By default, the lock is held until the calling program terminates and prevents
other applications from modifying the data source in any way.
To unlock the data source earlier, you can make use the unlock() method.
-
Method Summary
Modifier and TypeMethodDescriptionvoidappendTo(DataSource target) default DataRawasRaw()Attempts to cast this object to aDataRaw.default DataStructureAttempts to cast this object to aDataStructure.default DataTableasTable()Attempts to cast this object to aDataTable.default DataTextasText()Attempts to cast this object to aDataText.static DataSourcecreate(io.xpipe.core.source.DataSourceId id, io.xpipe.core.source.DataSource<?> source) Creates a new data source from an input stream.static DataSourceCreates a new data source from an input stream.static DataSourcecreate(io.xpipe.core.source.DataSourceId id, String type, InputStream in) Creates a new data source from an input stream.static DataSourceWrapper forcreate(DataSourceId, String, InputStream).static DataSourceWrapper forcreate(DataSourceId, String, InputStream).static DataSourcecreateAnonymous(String type, InputStream in) Wrapper forcreate(DataSourceId, String, InputStream)that creates an anonymous data source.static DataSourcecreateAnonymous(String type, URL url) Wrapper forcreate(DataSourceId, String, InputStream)that creates an anonymous data source.static DataSourcecreateAnonymous(String type, Path path) Wrapper forcreate(DataSourceId, String, InputStream)that creates an anonymous data source.static DataSourcedrain()NOT YET IMPLEMENTED!voidforwardTo(DataSource target) static DataSourceget(io.xpipe.core.source.DataSourceReference ref) Retrieves the data source for a given reference.static DataSourceWrapper forget(DataSourceReference).static DataSourceWrapper forget(DataSourceReference)using a name reference.io.xpipe.core.source.DataSourceIdgetId()Returns the id of this data source.io.xpipe.core.source.DataSource<?>static DataSourceWrapper forget(DataSourceReference)using the latest reference.io.xpipe.core.source.DataSourceTypegetType()Returns the type of this data source.static DataSourcesink()NOT YET IMPLEMENTED!static voidunlock()Releases the lock held by this program for this data source such that other applications can modify the data source again.
-
Method Details
-
drain
NOT YET IMPLEMENTED!Creates a new supplier data source that will be interpreted as the generated data source. In case this program should be a data source generator, this method has to be called at least once to register that it actually generates a data source.
All content that is written to this data source until the generator program terminates is will be available later on when the data source is used as a supplier later on.
In case this method is called multiple times, the same data source is returned.
- Returns:
- the generator data source
-
sink
NOT YET IMPLEMENTED!Creates a data source sink that will block with any read operations until an external data producer routes the output into this sink.
-
getById
Wrapper forget(DataSourceReference).- Throws:
IllegalArgumentException- ifidis not a valid data source id
-
getLatest
Wrapper forget(DataSourceReference)using the latest reference. -
getByName
Wrapper forget(DataSourceReference)using a name reference. -
get
Retrieves the data source for a given reference.- Parameters:
ref- the data source reference
-
unlock
static void unlock()Releases the lock held by this program for this data source such that other applications can modify the data source again. -
createAnonymous
Wrapper forcreate(DataSourceId, String, InputStream)that creates an anonymous data source. -
create
Wrapper forcreate(DataSourceId, String, InputStream). -
createAnonymous
Wrapper forcreate(DataSourceId, String, InputStream)that creates an anonymous data source. -
create
Wrapper forcreate(DataSourceId, String, InputStream). -
createAnonymous
Wrapper forcreate(DataSourceId, String, InputStream)that creates an anonymous data source. -
create
Creates a new data source from an input stream.- Parameters:
id- the data source idtype- the data source typein- the input stream to read- Returns:
- a
DataSourceinstances that can be used to access the underlying data
-
create
static DataSource create(io.xpipe.core.source.DataSourceId id, io.xpipe.core.source.DataSource<?> source) Creates a new data source from an input stream.- Parameters:
id- the data source id- Returns:
- a
DataSourceinstances that can be used to access the underlying data
-
create
static DataSource create(io.xpipe.core.source.DataSourceId id, String type, io.xpipe.core.store.DataStore in) Creates a new data source from an input stream. 1- Parameters:
id- the data source idtype- the data source typein- the data store to add- Returns:
- a
DataSourceinstances that can be used to access the underlying data
-
forwardTo
-
appendTo
-
getInternalSource
io.xpipe.core.source.DataSource<?> getInternalSource() -
getId
io.xpipe.core.source.DataSourceId getId()Returns the id of this data source. -
getType
io.xpipe.core.source.DataSourceType getType()Returns the type of this data source. -
getConfig
DataSourceConfig getConfig() -
asTable
Attempts to cast this object to aDataTable.- Throws:
UnsupportedOperationException- if the data source is not a table
-
asStructure
Attempts to cast this object to aDataStructure.- Throws:
UnsupportedOperationException- if the data source is not a structure
-
asText
Attempts to cast this object to aDataText.- Throws:
UnsupportedOperationException- if the data source is not a text
-
asRaw
Attempts to cast this object to aDataRaw.- Throws:
UnsupportedOperationException- if the data source is not raw
-