Class DataTypeArchiveDB

    • Field Detail

      • ARCHIVE_INFO

        public static final java.lang.String ARCHIVE_INFO
        Name of data type archive information property list
        See Also:
        Constant Field Values
      • ARCHIVE_SETTINGS

        public static final java.lang.String ARCHIVE_SETTINGS
        Name of data type archive settings property list
        See Also:
        Constant Field Values
      • DATE_CREATED

        public static final java.lang.String DATE_CREATED
        Name of date created property
        See Also:
        Constant Field Values
      • CREATED_WITH_GHIDRA_VERSION

        public static final java.lang.String CREATED_WITH_GHIDRA_VERSION
        Name of Ghidra version property
        See Also:
        Constant Field Values
      • JANUARY_1_1970

        public static final java.util.Date JANUARY_1_1970
        A date from January 1, 1970
    • Constructor Detail

      • DataTypeArchiveDB

        public DataTypeArchiveDB​(DomainFolder folder,
                                 java.lang.String name,
                                 java.lang.Object consumer)
                          throws java.io.IOException,
                                 DuplicateNameException,
                                 InvalidNameException
        Constructs a new DataTypeArchiveDB within a project folder.
        Parameters:
        folder - folder within which the project archive will be created
        name - the name of the data type archive
        consumer - the object that is using this data type archive.
        Throws:
        java.io.IOException - if there is an error accessing the database.
        InvalidNameException
        DuplicateNameException
      • DataTypeArchiveDB

        public DataTypeArchiveDB​(DBHandle dbh,
                                 int openMode,
                                 TaskMonitor monitor,
                                 java.lang.Object consumer)
                          throws java.io.IOException,
                                 VersionException,
                                 CancelledException
        Constructs a new DataTypeArchiveDB
        Parameters:
        dbh - a handle to an open data type archive database.
        openMode - one of: READ_ONLY: the original database will not be modified UPDATE: the database can be written to. UPGRADE: the database is upgraded to the latest schema as it is opened.
        monitor - TaskMonitor that allows the open to be canceled.
        consumer - the object that keeping the program open.
        Throws:
        java.io.IOException - if an error accessing the database occurs.
        VersionException - if database version does not match implementation, UPGRADE may be possible.
        CancelledException - if instantiation is canceled by monitor
    • Method Detail

      • getCreationDate

        public java.util.Date getCreationDate()
        Description copied from interface: DataTypeArchive
        Returns the creation date of this data type archive. existed, then Jan 1, 1970 is returned.
        Specified by:
        getCreationDate in interface DataTypeArchive
        Returns:
        the creation date of this data type archive
        See Also:
        Program.getCreationDate()
      • getDefaultPointerSize

        public int getDefaultPointerSize()
        Description copied from interface: DataTypeArchive
        Gets the default pointer size as it may be stored within the data type archive.
        Specified by:
        getDefaultPointerSize in interface DataTypeArchive
        Returns:
        default pointer size.
        See Also:
        ghidra.program.model.listing.Program#getDefaultStoredPointerSize()
      • getChanges

        public ghidra.program.database.DataTypeArchiveDBChangeSet getChanges()
        Description copied from interface: DataTypeArchive
        Get the data type archive changes since the last save as a set of addresses.
        Specified by:
        getChanges in interface DataTypeArchive
        Returns:
        set of changed addresses within program.
        See Also:
        Program.getChanges()
      • dataTypeChanged

        public void dataTypeChanged​(long dataTypeID,
                                    int type,
                                    java.lang.Object oldValue,
                                    java.lang.Object newValue)
        notification the a data type has changed
        Parameters:
        dataTypeID - the id of the data type that changed.
        type - the type of the change (moved, renamed, etc.)
        oldValue - the old data type.
        newValue - the new data type.
      • dataTypeAdded

        public void dataTypeAdded​(long dataTypeID,
                                  int type,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)
        Notification that a data type was added.
        Parameters:
        dataTypeID - the id if the data type that was added.
        type - should always be DATATYPE_ADDED
        oldValue - always null
        newValue - the data type added.
      • categoryChanged

        public void categoryChanged​(long categoryID,
                                    int type,
                                    java.lang.Object oldValue,
                                    java.lang.Object newValue)
        Notification that a category was changed.
        Parameters:
        categoryID - the id of the data type that was added.
        type - the type of changed
        oldValue - old value depends on the type.
        newValue - new value depends on the type.
      • categoryAdded

        public void categoryAdded​(long categoryID,
                                  int type,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)
        Notification that a category was added.
        Parameters:
        categoryID - the id of the data type that was added.
        type - the type of changed (should always be CATEGORY_ADDED)
        oldValue - always null
        newValue - new value depends on the type.
      • setChanged

        public void setChanged​(int type,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)
        Mark the state this Data Type Archive as having changed and generate the event. Any or all parameters may be null.
        Specified by:
        setChanged in interface DataTypeArchive
        Specified by:
        setChanged in interface DataTypeArchiveChangeManager
        Parameters:
        type - event type
        oldValue - original value
        newValue - new value
      • setObjChanged

        public void setObjChanged​(int type,
                                  java.lang.Object affectedObj,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)
        Mark the state of a Program as having changed and generate the event. Any or all parameters may be null. NOTE: ChangeSet data will not be updated since this a very generic change not related to a specific address.
        Specified by:
        setObjChanged in interface DataTypeArchive
        Specified by:
        setObjChanged in interface DataTypeArchiveChangeManager
        Parameters:
        type - event type
        affectedObj - object that is the subject of the event
        oldValue - original value or an Object that is related to the event
        newValue - new value or an Object that is related to the the event
      • clearCache

        protected void clearCache​(boolean all)
        Overrides:
        clearCache in class DomainObjectAdapterDB
        See Also:
        ghidra.framework.data.DomainObjectAdapterDB#clearCache()
      • getMetadata

        public java.util.Map<java.lang.String,​java.lang.String> getMetadata()
        Description copied from interface: DomainObject
        Returns a map containing all the stored metadata associated with this domain object. The map contains key,value pairs and are ordered by their insertion order.
        Specified by:
        getMetadata in interface DomainObject
        Overrides:
        getMetadata in class DomainObjectAdapter
        Returns:
        a map containing all the stored metadata associated with this domain object.
      • updateMetadata

        protected void updateMetadata()
                               throws java.io.IOException
        Description copied from class: DomainObjectAdapterDB
        This method is called before a save, saveAs, or saveToPackedFile to update common meta data
        Overrides:
        updateMetadata in class DomainObjectAdapterDB
        Throws:
        java.io.IOException