Class DBPropertyMapManager
- java.lang.Object
-
- ghidra.program.database.properties.DBPropertyMapManager
-
- All Implemented Interfaces:
ManagerDB
,PropertyMapManager
public class DBPropertyMapManager extends java.lang.Object implements PropertyMapManager, ManagerDB
Manages generic address keyed properties.
-
-
Constructor Summary
Constructors Constructor Description DBPropertyMapManager(DBHandle handle, ChangeManager changeMgr, AddressMap addrMap, int openMode, Lock lock, TaskMonitor monitor)
Constructs a new DBPropertyMapManager
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IntPropertyMap
createIntPropertyMap(java.lang.String propertyName)
Creates a new IntPropertyMap with the given name.LongPropertyMap
createLongPropertyMap(java.lang.String propertyName)
Creates a new LongPropertyMap with the given name.ObjectPropertyMap
createObjectPropertyMap(java.lang.String propertyName, java.lang.Class<? extends Saveable> objectClass)
Creates a new ObjectPropertyMap with the given name.StringPropertyMap
createStringPropertyMap(java.lang.String propertyName)
Creates a new StringPropertyMap with the given name.VoidPropertyMap
createVoidPropertyMap(java.lang.String propertyName)
Creates a new VoidPropertyMap with the given name.void
deleteAddressRange(Address startAddr, Address endAddr, TaskMonitor monitor)
Delete all objects which have been applied to the address range startAddr to endAddr and update the database accordingly.IntPropertyMap
getIntPropertyMap(java.lang.String propertyName)
Returns the IntPropertyMap associated with the given name.LongPropertyMap
getLongPropertyMap(java.lang.String propertyName)
Returns the LongPropertyMap associated with the given name.ObjectPropertyMap
getObjectPropertyMap(java.lang.String propertyName)
Returns the ObjectPropertyMap associated with the given name.PropertyMap
getPropertyMap(java.lang.String propertyName)
Returns the PropertyMap with the given name or null if no PropertyMap exists with that name.StringPropertyMap
getStringPropertyMap(java.lang.String propertyName)
Returns the StringPropertyMap associated with the given name.VoidPropertyMap
getVoidPropertyMap(java.lang.String propertyName)
Returns the VoidPropertyMap associated with the given name.void
invalidateCache(boolean all)
Clears all data caches.void
moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor)
Move all objects within an address range to a new location.void
programReady(int openMode, int currentRevision, TaskMonitor monitor)
Callback from program made to each manager after the program has completed initialization.java.util.Iterator<java.lang.String>
propertyManagers()
Returns an iterator over the names of all existing PropertyMangers.void
removeAll(Address addr)
Removes any property at the given address from all defined PropertyManagers.void
removeAll(Address startAddr, Address endAddr, TaskMonitor monitor)
Removes all properties in the given range from all user defined PropertyMaps.boolean
removePropertyMap(java.lang.String propertyName)
Removes the PropertyMap with the given name.void
setProgram(ProgramDB program)
Callback from program used to indicate all manager have been created.
-
-
-
Constructor Detail
-
DBPropertyMapManager
public DBPropertyMapManager(DBHandle handle, ChangeManager changeMgr, AddressMap addrMap, int openMode, Lock lock, TaskMonitor monitor) throws java.io.IOException, VersionException, CancelledException
Constructs a new DBPropertyMapManager- Parameters:
handle
- the database handlechangeMgr
- the change manageraddrMap
- the address mapopenMode
- the program open mode.lock
- the program synchronization lockmonitor
- the task monitor- Throws:
java.io.IOException
VersionException
CancelledException
-
-
Method Detail
-
setProgram
public void setProgram(ProgramDB program)
Description copied from interface:ManagerDB
Callback from program used to indicate all manager have been created. When this method is invoked, all managers have been instantiated but may not be fully initialized.- Specified by:
setProgram
in interfaceManagerDB
- Parameters:
program
- the program is set when all the initializations have been completed.- See Also:
ManagerDB.setProgram(ghidra.program.database.ProgramDB)
-
programReady
public void programReady(int openMode, int currentRevision, TaskMonitor monitor) throws java.io.IOException, CancelledException
Description copied from interface:ManagerDB
Callback from program made to each manager after the program has completed initialization. This method may be used by managers to perform additional upgrading which may have been deferred.- Specified by:
programReady
in interfaceManagerDB
- Parameters:
openMode
- the mode that the program is being opened.currentRevision
- current program revision. If openMode is UPGRADE, this value reflects the pre-upgrade value.monitor
- the task monitor to use in any upgrade operations.- Throws:
java.io.IOException
- if a database io error occurs.CancelledException
- if the user cancelled the operation via the task monitor.- See Also:
ManagerDB.programReady(int, int, ghidra.util.task.TaskMonitor)
-
invalidateCache
public void invalidateCache(boolean all) throws java.io.IOException
Description copied from interface:ManagerDB
Clears all data caches.- Specified by:
invalidateCache
in interfaceManagerDB
- Parameters:
all
- if false, some managers may not need to update their cache if they can tell that its not necessary. If this flag is true, then all managers should clear their cache no matter what.- Throws:
java.io.IOException
- if a database io error occurs.- See Also:
ManagerDB.invalidateCache(boolean)
-
createIntPropertyMap
public IntPropertyMap createIntPropertyMap(java.lang.String propertyName) throws DuplicateNameException
Creates a new IntPropertyMap with the given name.- Specified by:
createIntPropertyMap
in interfacePropertyMapManager
- Parameters:
propertyName
- the name of the property to create.- Throws:
DuplicateNameException
- thrown if a PropertyMap already exists with that name.
-
createLongPropertyMap
public LongPropertyMap createLongPropertyMap(java.lang.String propertyName) throws DuplicateNameException
Creates a new LongPropertyMap with the given name.- Specified by:
createLongPropertyMap
in interfacePropertyMapManager
- Parameters:
propertyName
- the name of the property to create.- Throws:
DuplicateNameException
- thrown if a PropertyMap already exists with that name.
-
createStringPropertyMap
public StringPropertyMap createStringPropertyMap(java.lang.String propertyName) throws DuplicateNameException
Creates a new StringPropertyMap with the given name.- Specified by:
createStringPropertyMap
in interfacePropertyMapManager
- Parameters:
propertyName
- the name of the property to create.- Throws:
DuplicateNameException
- thrown if a PropertyMap already exists with that name.
-
createObjectPropertyMap
public ObjectPropertyMap createObjectPropertyMap(java.lang.String propertyName, java.lang.Class<? extends Saveable> objectClass) throws DuplicateNameException
Creates a new ObjectPropertyMap with the given name.- Specified by:
createObjectPropertyMap
in interfacePropertyMapManager
- Parameters:
propertyName
- the name of the property to create.objectClass
- the class of the objects that will be stored in the property.- Throws:
DuplicateNameException
- thrown if a PropertyMap already exists with that name.
-
createVoidPropertyMap
public VoidPropertyMap createVoidPropertyMap(java.lang.String propertyName) throws DuplicateNameException
Creates a new VoidPropertyMap with the given name.- Specified by:
createVoidPropertyMap
in interfacePropertyMapManager
- Parameters:
propertyName
- the name of the property to create.- Throws:
DuplicateNameException
- thrown if a PropertyMap already exists with that name.
-
getPropertyMap
public PropertyMap getPropertyMap(java.lang.String propertyName)
Returns the PropertyMap with the given name or null if no PropertyMap exists with that name.- Specified by:
getPropertyMap
in interfacePropertyMapManager
- Parameters:
propertyName
- the name of the property to retrieve.
-
getIntPropertyMap
public IntPropertyMap getIntPropertyMap(java.lang.String propertyName)
Returns the IntPropertyMap associated with the given name.- Specified by:
getIntPropertyMap
in interfacePropertyMapManager
- Parameters:
propertyName
- the name of the property to retrieve.- Throws:
TypeMismatchException
- if a propertyMap named propertyName exists but is not an IntPropertyMap.
-
getLongPropertyMap
public LongPropertyMap getLongPropertyMap(java.lang.String propertyName)
Returns the LongPropertyMap associated with the given name.- Specified by:
getLongPropertyMap
in interfacePropertyMapManager
- Parameters:
propertyName
- the name of the property to retrieve.- Throws:
TypeMismatchException
- if a propertyMap named propertyName exists but is not an LongPropertyMap.
-
getStringPropertyMap
public StringPropertyMap getStringPropertyMap(java.lang.String propertyName)
Returns the StringPropertyMap associated with the given name.- Specified by:
getStringPropertyMap
in interfacePropertyMapManager
- Parameters:
propertyName
- the name of the property to retrieve.- Throws:
TypeMismatchException
- if a propertyMap named propertyName exists but is not a StringPropertyMap.
-
getObjectPropertyMap
public ObjectPropertyMap getObjectPropertyMap(java.lang.String propertyName)
Returns the ObjectPropertyMap associated with the given name.- Specified by:
getObjectPropertyMap
in interfacePropertyMapManager
- Parameters:
propertyName
- the name of the property to retrieve.- Throws:
TypeMismatchException
- if a propertyMap named propertyName exists but is not an ObjectPropertyMap.
-
getVoidPropertyMap
public VoidPropertyMap getVoidPropertyMap(java.lang.String propertyName)
Returns the VoidPropertyMap associated with the given name.- Specified by:
getVoidPropertyMap
in interfacePropertyMapManager
- Parameters:
propertyName
- the name of the property to retrieve.- Throws:
TypeMismatchException
- if a propertyMap named propertyName exists but is not a VoidPropertyMap.
-
removePropertyMap
public boolean removePropertyMap(java.lang.String propertyName)
Removes the PropertyMap with the given name.- Specified by:
removePropertyMap
in interfacePropertyMapManager
- Parameters:
propertyName
- the name of the property to remove.- Returns:
- true if a PropertyMap with that name was found (and removed)
-
propertyManagers
public java.util.Iterator<java.lang.String> propertyManagers()
Returns an iterator over the names of all existing PropertyMangers.- Specified by:
propertyManagers
in interfacePropertyMapManager
-
removeAll
public void removeAll(Address addr)
Removes any property at the given address from all defined PropertyManagers.- Specified by:
removeAll
in interfacePropertyMapManager
- Parameters:
addr
- the address at which to remove all properties.
-
removeAll
public void removeAll(Address startAddr, Address endAddr, TaskMonitor monitor) throws CancelledException
Description copied from interface:PropertyMapManager
Removes all properties in the given range from all user defined PropertyMaps.- Specified by:
removeAll
in interfacePropertyMapManager
- Parameters:
startAddr
- the first address in the range of addresses where propertie values are to be removed.endAddr
- the last address in the range of addresses where propertie values are to be removed.monitor
- monitors progress- Throws:
CancelledException
- if the user cancelled the operation.- See Also:
PropertyMapManager.removeAll(ghidra.program.model.address.Address, ghidra.program.model.address.Address, ghidra.util.task.TaskMonitor)
-
moveAddressRange
public void moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor) throws CancelledException
Description copied from interface:ManagerDB
Move all objects within an address range to a new location.- Specified by:
moveAddressRange
in interfaceManagerDB
- Parameters:
fromAddr
- the first address of the range to be moved.toAddr
- the address where to the range is to be moved.length
- the number of addresses to move.monitor
- the task monitor to use in any upgrade operations.- Throws:
CancelledException
- if the user cancelled the operation via the task monitor.- See Also:
ManagerDB.moveAddressRange(ghidra.program.model.address.Address, ghidra.program.model.address.Address, long, ghidra.util.task.TaskMonitor)
-
deleteAddressRange
public void deleteAddressRange(Address startAddr, Address endAddr, TaskMonitor monitor) throws CancelledException
Description copied from interface:ManagerDB
Delete all objects which have been applied to the address range startAddr to endAddr and update the database accordingly.- Specified by:
deleteAddressRange
in interfaceManagerDB
- Parameters:
startAddr
- the first address in the range.endAddr
- the last address in the range.monitor
- the task monitor to use in any upgrade operations.- Throws:
CancelledException
- if the user cancelled the operation via the task monitor.- See Also:
ManagerDB.deleteAddressRange(ghidra.program.model.address.Address, ghidra.program.model.address.Address, ghidra.util.task.TaskMonitor)
-
-