public class StateManager extends Object implements PlatformAdmin, Runnable
Clients may extend this class.
Modifier and Type | Field and Description |
---|---|
static boolean |
DEBUG
General debug flag
|
static boolean |
DEBUG_PLATFORM_ADMIN
PlatformAdmin debug flag
|
static boolean |
DEBUG_PLATFORM_ADMIN_RESOLVER
PlatformAdmin resolver debug flag
|
static boolean |
DEBUG_READER
Reader debug flag
|
static boolean |
MONITOR_PLATFORM_ADMIN
Monitor PlatformAdmin debug flag
|
static String |
PROP_LAZY_UNLOADING_TIME
System property used to specify to amount time before lazy data can be flushed from memory
|
static String |
PROP_NO_LAZY_LOADING
System property used to disable lazy state loading
|
Constructor and Description |
---|
StateManager(File stateFile,
File lazyFile,
BundleContext context)
Constructs a StateManager using the specified files and context
|
StateManager(File stateFile,
File lazyFile,
BundleContext context,
long expectedTimeStamp)
Constructs a StateManager using the specified files and context
|
Modifier and Type | Method and Description |
---|---|
void |
addDisabledInfo(DisabledInfo disabledInfo)
Adds the disabled info to the state managed by this platform admin.
|
void |
commit(State state)
Commit the differences between the current state and the given state.
|
Resolver |
createResolver()
|
State |
createSystemState()
Creates a new State used by the system.
|
long |
getCachedTimeStamp()
Returns the cached time stamp of the system State.
|
StateObjectFactory |
getFactory()
Returns a factory that knows how to create state objects, such as bundle
descriptions and the different types of version constraints.
|
Resolver |
getResolver()
Deprecated.
|
State |
getState()
Returns a mutable state representing the current system.
|
State |
getState(boolean mutable)
Returns a state representing the current system.
|
StateHelper |
getStateHelper()
Returns a state helper object.
|
State |
getSystemState()
Returns the State used by the system.
|
State |
readSystemState()
Reads the State used by the system.
|
void |
removeDisabledInfo(DisabledInfo disabledInfo)
Removes the disabled info from the state managed by this platform admin.
|
void |
run() |
boolean |
saveNeeded() |
void |
shutdown(File saveStateFile,
File saveLazyFile)
Shutsdown the state manager.
|
void |
stopDataManager()
Stops the active data manager thread which is used to unload unused
state objects from memory.
|
void |
update(File updateStateFile,
File updateLazyFile)
Update the given target files with the state data in memory.
|
public static boolean DEBUG
public static boolean DEBUG_READER
public static boolean DEBUG_PLATFORM_ADMIN
public static boolean DEBUG_PLATFORM_ADMIN_RESOLVER
public static boolean MONITOR_PLATFORM_ADMIN
public static String PROP_NO_LAZY_LOADING
public static String PROP_LAZY_UNLOADING_TIME
public StateManager(File stateFile, File lazyFile, BundleContext context)
stateFile
- a file with the data required to persist in memorylazyFile
- a file with the data that may be lazy loaded and can be flushed from memorycontext
- the bundle context of the system bundlepublic StateManager(File stateFile, File lazyFile, BundleContext context, long expectedTimeStamp)
stateFile
- a file with the data required to persist in memorylazyFile
- a file with the data that may be lazy loaded and can be flushed from memorycontext
- the bundle context of the system bundleexpectedTimeStamp
- the expected timestamp of the persisted system state. A negative
value indicates that no timestamp checking is donepublic void shutdown(File saveStateFile, File saveLazyFile) throws IOException
saveStateFile
- saveLazyFile
- IOException
public void update(File updateStateFile, File updateLazyFile) throws IOException
updateStateFile
- updateLazyFile
- IOException
public void stopDataManager()
public State createSystemState()
public State readSystemState()
null
is returned.null
if the State
could not be read from a cache.public State getSystemState()
null
is returned.null
if one
does not exist.public long getCachedTimeStamp()
State.getTimeStamp()
public boolean saveNeeded()
public State getState(boolean mutable)
PlatformAdmin
java.lang.UnsupportedOperationException
.
If a mutable state is requested, the resulting state will not be resolved and the user objects from the system state bundle descriptions will not be copied.
getState
in interface PlatformAdmin
mutable
- whether the returned state should mutablePlatformAdmin.getState(boolean)
public State getState()
PlatformAdmin
This is a convenience method, fully equivalent to
getState(true)
.
getState
in interface PlatformAdmin
PlatformAdmin.getState()
public StateObjectFactory getFactory()
PlatformAdmin
getFactory
in interface PlatformAdmin
PlatformAdmin.getFactory()
public void commit(State state) throws BundleException
PlatformAdmin
commit
in interface PlatformAdmin
state
- the future state of the frameworkBundleException
PlatformAdmin.commit(State)
public Resolver getResolver()
PlatformAdmin
getResolver
in interface PlatformAdmin
PlatformAdmin.getResolver()
public Resolver createResolver()
PlatformAdmin
createResolver
in interface PlatformAdmin
Resolver
.PlatformAdmin.createResolver()
public StateHelper getStateHelper()
PlatformAdmin
A possible implementation for this method would provide the same single StateHelper instance to all clients.
getStateHelper
in interface PlatformAdmin
PlatformAdmin.getStateHelper()
public void addDisabledInfo(DisabledInfo disabledInfo)
PlatformAdmin
addDisabledInfo
in interface PlatformAdmin
disabledInfo
- the disabled info to add.public void removeDisabledInfo(DisabledInfo disabledInfo)
PlatformAdmin
removeDisabledInfo
in interface PlatformAdmin
disabledInfo
- the disabled info to removeCopyright © 2007–2018 The Apache Software Foundation. All rights reserved.