public interface StorageHook extends KeyedElement
A StorageHook extends KeyedElement
, the key used for the element must be the
fully qualified string name of the StorageHook implementation class.
BaseData.getStorageHook(String)
Modifier and Type | Method and Description |
---|---|
void |
copy(StorageHook storageHook)
Copies the data from the specified storage hook into this storage hook.
|
StorageHook |
create(BaseData bundledata)
Creates an uninitialized storage hook for the specified bundledata.
|
boolean |
forgetStartLevelChange(int startlevel)
Gets called by a base data during
BundleData.setStartLevel(int) . |
boolean |
forgetStatusChange(int status)
Gets called by a base data during
BundleData.setStatus(int) . |
Dictionary<String,String> |
getManifest(boolean firstLoad)
Returns the manifest for the data in this storage hook, or null if this hook does
not provide the manifest.
|
int |
getStorageVersion()
Returns the storage version of this storage hook.
|
void |
initialize(Dictionary<String,String> manifest)
Initializes this storage hook with the content of the specified bundle manifest.
|
StorageHook |
load(BaseData bundledata,
DataInputStream is)
Creates a new storage hook and loads the data from the specified
input stream into the storage hook.
|
void |
save(DataOutputStream os)
Saves the data from this storage hook into the specified output stream.
|
void |
validate()
Validates the data in this storage hook, if the data is invalid then an illegal state
exception is thrown
|
compare, getKey, getKeyHashCode
int getStorageVersion()
StorageHook create(BaseData bundledata) throws BundleException
initialize(Dictionary)
method called to initialize the storage hook.bundledata
- a base data the created storage hook will be associated withBundleException
- if any error occursvoid initialize(Dictionary<String,String> manifest) throws BundleException
manifest
- the bundle manifest to load into this storage hookBundleException
- if any error occurscreate(BaseData)
,
copy(StorageHook)
StorageHook load(BaseData bundledata, DataInputStream is) throws IOException
It is important that this method and the save(DataOutputStream)
method
stay in sync. This method must be able to successfully read the data saved by the
save(DataOutputStream)
method.
bundledata
- a base data the loaded storage hook will be associated withis
- an input stream used to load the storage hook's data from.IOException
- if any error occurssave(DataOutputStream)
void save(DataOutputStream os) throws IOException
It is important that this method and the load(BaseData, DataInputStream)
method stay in sync. This method must be able to save data which the
load(BaseData, DataInputStream)
method can ready successfully.
os
- an output stream used to save the storage hook's data from.IOException
- if any error occursload(BaseData, DataInputStream)
void copy(StorageHook storageHook)
initialize(Dictionary)
method.storageHook
- the original storage hook to copy data out of.create(BaseData)
,
initialize(Dictionary)
void validate() throws IllegalArgumentException
IllegalArgumentException
- if the data is invalidDictionary<String,String> getManifest(boolean firstLoad) throws BundleException
firstLoad
- true if this is the very first time this manifest is being loaded.BundleException
boolean forgetStatusChange(int status)
BundleData.setStatus(int)
.
A base data will call this method for each configured storage hook it
is associated with until one storage hook returns true. If all configured storage
hooks return false then the BaseData will be marked dirty and will cause the
status to be persistently saved.status
- the new status of the base databoolean forgetStartLevelChange(int startlevel)
BundleData.setStartLevel(int)
.
A base data will call this method for each configured storage hook it
is associated with until one storage hook returns true. If all configured storage
hooks return false then the BaseData will be marked dirty and will cause the
start level to be persistently saved.startlevel
- the new startlevel of the base dataCopyright © 2007–2018 The Apache Software Foundation. All rights reserved.