Class BundleContextHistoryManager
- java.lang.Object
-
- org.opennms.features.topology.plugins.topo.BundleContextHistoryManager
-
- All Implemented Interfaces:
HistoryManager
public class BundleContextHistoryManager extends Object implements HistoryManager
-
-
Field Summary
Fields Modifier and Type Field Description static String
DATA_FILE_NAME
-
Constructor Summary
Constructors Constructor Description BundleContextHistoryManager(org.osgi.framework.BundleContext bundleContext, ServiceLocator serviceLocator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyHistory(String fragment, GraphContainer container)
Restores the given history represented byfragementId
.void
deleteHistory()
Deletes the history for all users.SavedHistory
getHistoryByFragment(String fragment)
Returns the history object for the providedfragment
.SavedHistory
getHistoryByUserId(String userId)
Returns the history object for the provideduserId
.String
getHistoryFragment(String userId)
void
onBind(HistoryOperation operation)
void
onUnbind(HistoryOperation operation)
protected void
saveHistory(String userId, SavedHistory hist)
String
saveOrUpdateHistory(String userId, GraphContainer graphContainer)
Saves the current state of theGraphContainer
for the currentuserId
.
-
-
-
Field Detail
-
DATA_FILE_NAME
public static final String DATA_FILE_NAME
-
-
Constructor Detail
-
BundleContextHistoryManager
public BundleContextHistoryManager(org.osgi.framework.BundleContext bundleContext, ServiceLocator serviceLocator)
-
-
Method Detail
-
onBind
public void onBind(HistoryOperation operation)
-
onUnbind
public void onUnbind(HistoryOperation operation)
-
applyHistory
public void applyHistory(String fragment, GraphContainer container)
Description copied from interface:HistoryManager
Restores the given history represented byfragementId
. TheGraphContainer
represents the user's state, which does not require the userId.- Specified by:
applyHistory
in interfaceHistoryManager
- Parameters:
fragment
- The history fragment (history hash)container
- TheGraphContainer
needed to actually apply the history.
-
saveOrUpdateHistory
public String saveOrUpdateHistory(String userId, GraphContainer graphContainer)
Description copied from interface:HistoryManager
Saves the current state of theGraphContainer
for the currentuserId
. The returnedString
is the history fragment (hash).- Specified by:
saveOrUpdateHistory
in interfaceHistoryManager
- Parameters:
userId
- The user to save the history forgraphContainer
- The currentGraphContainer
- Returns:
- the history fragment (hash) of the saved history
- See Also:
HistoryManager.getHistoryFragment(String)
-
saveHistory
protected void saveHistory(String userId, SavedHistory hist)
-
getHistoryByFragment
public SavedHistory getHistoryByFragment(String fragment)
Description copied from interface:HistoryManager
Returns the history object for the providedfragment
.- Specified by:
getHistoryByFragment
in interfaceHistoryManager
-
getHistoryByUserId
public SavedHistory getHistoryByUserId(String userId)
Description copied from interface:HistoryManager
Returns the history object for the provideduserId
.- Specified by:
getHistoryByUserId
in interfaceHistoryManager
-
getHistoryFragment
public String getHistoryFragment(String userId)
- Specified by:
getHistoryFragment
in interfaceHistoryManager
-
deleteHistory
public void deleteHistory()
Description copied from interface:HistoryManager
Deletes the history for all users.- Specified by:
deleteHistory
in interfaceHistoryManager
-
-