com.streamsets.systemexplorer.api.ExplorerData Maven / Gradle / Ivy
/*
* Copyright 2017 StreamSets Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.streamsets.systemexplorer.api;
/**
*
* {@code ExplorerLoader} produces {@code ExplorerData} that is used by
* {@code ExplorerSearcher}.
*
*
* The loader and searcher have to agree on data payload.
*
*
* The searcher may alter the data payload.
*
*
* The loader may provide its own subclass of {@code ExplorerData}
*
*
* Every time the loader is invoked, the data returned by the loader
* fully replaces the existing data.
*
*
* The engine caches the data providing the same data to the searcher
* between searches. But the data may be evicted from the cache, so the
* searcher must handle that scenario (even to the point that it could have
* to internally do a re-load of data).
*
*/
public class ExplorerData {
private final T data;
public ExplorerData(T data) {
this.data = data;
}
public T getData() {
return data;
}
/**
*
* Called when the instance is being discarded to it can clean up
* and free any resources it may have.
*
*/
public void discard() {}
}