Verified Owner
Top Description Fields Constructors Methods
org.jabref.http

public abstract Class AbstractSrvStateManager

extends Object
implements SrvStateManager
Class Inheritance
All Implemented Interfaces
org.jabref.http.SrvStateManager
Known Direct Subclasses
org.jabref.http.JabRefSrvStateManager
Imports
java.util.Map, java.util.concurrent.ConcurrentHashMap, javafx.beans.property.SimpleBooleanProperty, org.jabref.logic.search.NoOpSearchBackend, .SearchContext, org.jabref.model.database.BibDatabaseContext, org.slf4j.Logger, .LoggerFactory

Base SrvStateManager implementation that owns the per-database SearchContext registry.

Both the GUI (org.jabref.gui.JabRefGuiStateManager) and the stand-alone HTTP server (JabRefSrvStateManager) keep one SearchContext per open library, keyed by BibDatabaseContext#getUid(). They only differ in when a context is registered: the GUI registers one lazily when a library tab opens, the server registers all of them up front in its constructor. The lookup itself and the "must be registered before the database is served" invariant are identical, so they live here.

Field Summary

Modifier and TypeField and Description
private static final Logger
private final Map<String, SearchContext>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public SearchContext
public void
removeSearchContext(BibDatabaseContext database)

Removes the SearchContext registered for the given database.

public void
setSearchContext(BibDatabaseContext database, SearchContext searchContext)

Registers the SearchContext for the given database.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGGERback to summary
private static final Logger LOGGER
searchContextsback to summary
private final Map<String, SearchContext> searchContexts

Constructor Detail

AbstractSrvStateManagerback to summary
public AbstractSrvStateManager()

Method Detail

getSearchContextback to summary
public SearchContext getSearchContext(BibDatabaseContext database)

Implements org.jabref.http.SrvStateManager.getSearchContext.

Doc from org.jabref.http.SrvStateManager.getSearchContext.

Returns the SearchContext for the given database. Implementations must register a context before the database is exposed via getOpenDatabases(); callers therefore never need to deal with null or Optional.

Annotations
@Override
removeSearchContextback to summary
public void removeSearchContext(BibDatabaseContext database)

Removes the SearchContext registered for the given database. Callers that replace a BibDatabaseContext (e.g. after a re-parse) should call this with the old context so its entry does not linger in the registry under a uid no caller holds.

setSearchContextback to summary
public void setSearchContext(BibDatabaseContext database, SearchContext searchContext)

Registers the SearchContext for the given database. Must be called before the database is exposed via getOpenDatabases().