Class RpcDataSourceConnector.RpcDataSource

    • Constructor Detail

      • RpcDataSource

        protected RpcDataSource()
    • Method Detail

      • ensureAvailability

        public void ensureAvailability​(int firstRowIndex,
                                       int numberOfRows)
        Description copied from interface: DataSource
        Informs the data source that data for the given range is needed. A data source only has one active region at a time, so calling this method discards the previously set range.

        This method triggers lazy loading of data if necessary. The change handler registered using DataSource.setDataChangeHandler(DataChangeHandler) is informed when new data has been loaded.

        After any possible lazy loading and updates are done, the change handler is informed that new data is available.

        Specified by:
        ensureAvailability in interface DataSource<JsonObject>
        Overrides:
        ensureAvailability in class AbstractRemoteDataSource<JsonObject>
        Parameters:
        firstRowIndex - the index of the first needed row
        numberOfRows - the number of needed rows
      • getRowKey

        public String getRowKey​(JsonObject row)
        Description copied from class: AbstractRemoteDataSource
        Gets a stable key for the row object.

        This method is a workaround for the fact that there is no means to force proper implementations for Object.hashCode() and Object.equals(Object) methods.

        Since the same row object will be created several times for the same logical data, the DataSource needs a mechanism to be able to compare two objects, and figure out whether or not they represent the same data. Even if all the fields of an entity would be changed, it still could represent the very same thing (say, a person changes all of her names.)

        A very usual and simple example what this could be, is an unique ID for this object that would also be stored in a database.

        Specified by:
        getRowKey in class AbstractRemoteDataSource<JsonObject>
        Parameters:
        row - the row object for which to get the key
        Returns:
        a non-null object that uniquely and consistently represents the row object
      • updateRowData

        protected void updateRowData​(JsonObject row)
        Updates row data based on row key.
        Parameters:
        row - new row object
        Since:
        7.6
      • onDropFromCache

        protected void onDropFromCache​(int rowIndex,
                                       JsonObject row)
        Description copied from class: AbstractRemoteDataSource
        A hook that can be overridden to do something whenever a row has been dropped from the cache. DataSource no longer has anything in the given index.
        Overrides:
        onDropFromCache in class AbstractRemoteDataSource<JsonObject>
        Parameters:
        rowIndex - the index of the dropped row
        row - the removed row object
      • canFetchData

        protected boolean canFetchData()
        Description copied from class: AbstractRemoteDataSource
        Checks if it is possible to currently fetch data from the remote data source.
        Overrides:
        canFetchData in class AbstractRemoteDataSource<JsonObject>
        Returns:
        true if it is ok to try to fetch data, false if it is known that fetching data will fail and should not be tried right now.