Class DefaultProject

  • All Implemented Interfaces:
    Project

    public class DefaultProject
    extends java.lang.Object
    implements Project
    Implementation for a Project.
    • Constructor Detail

      • DefaultProject

        protected DefaultProject​(DefaultProjectManager projectManager,
                                 ProjectLocator projectLocator,
                                 RepositoryAdapter repository)
                          throws java.io.IOException,
                                 LockException
        Constructor for creating a New project
        Parameters:
        projectManager - the manager of this project
        projectLocator - location and name of project
        repository - shared repository associated with the new project. Can be null for non-shared projects
        Throws:
        java.io.IOException - if I/O error occurs.
        LockException - if unable to establish project lock
      • DefaultProject

        protected DefaultProject​(DefaultProjectManager projectManager,
                                 ProjectLocator projectLocator,
                                 boolean resetOwner)
                          throws java.io.IOException,
                                 NotOwnerException,
                                 LockException
        Constructor for opening a project.
        Parameters:
        projectManager - the manager of this project
        projectLocator - location and name of project
        resetOwner - if true, set the owner to the current user
        Throws:
        java.io.FileNotFoundException - project directory not found
        java.io.IOException - if I/O error occurs.
        NotOwnerException - if userName is not the owner of the project.
        LockException - if unable to establish project lock
      • DefaultProject

        protected DefaultProject​(DefaultProjectManager projectManager,
                                 GhidraURLConnection connection)
                          throws java.io.IOException
        Constructor for opening a URL-based project
        Parameters:
        connection - project connection
        Throws:
        java.io.IOException - if I/O error occurs.
    • Method Detail

      • getProjectManager

        public ProjectManager getProjectManager()
        Description copied from interface: Project
        Returns the project manager of this project.
        Specified by:
        getProjectManager in interface Project
        Returns:
        the project manager of this project.
      • addProjectView

        public ProjectData addProjectView​(java.net.URL url)
                                   throws java.io.IOException,
                                          java.net.MalformedURLException
        Description copied from interface: Project
        Add the given project URL to this project's list project views. The project view allows users to look at data files from another project.
        Specified by:
        addProjectView in interface Project
        Parameters:
        url - identifier for the project view
        Returns:
        project data for this view
        Throws:
        java.io.IOException - if I/O error occurs or if project/repository not found
        java.net.MalformedURLException - if projectURL is invalid
      • removeProjectView

        public void removeProjectView​(java.net.URL url)
        Remove the view from this project.
        Specified by:
        removeProjectView in interface Project
        Parameters:
        url - identifier for the project
      • getName

        public java.lang.String getName()
        Description copied from interface: Project
        Convenience method to get the name of this project.
        Specified by:
        getName in interface Project
      • hasChanged

        public boolean hasChanged()
        Description copied from interface: Project
        Return whether the project configuration has changed.
        Specified by:
        hasChanged in interface Project
      • getRepository

        public RepositoryAdapter getRepository()
        Description copied from interface: Project
        Get the repository that this project is associated with.
        Specified by:
        getRepository in interface Project
        Returns:
        null if the project is not associated with a remote repository
      • close

        public void close()
        Description copied from interface: Project
        Close the project.
        Specified by:
        close in interface Project
      • isClosed

        public boolean isClosed()
        Description copied from interface: Project
        Returns whether this project instance has been closed
        Specified by:
        isClosed in interface Project
      • saveSessionTools

        public boolean saveSessionTools()
        Description copied from interface: Project
        Saves any tools that are associated with the opened project when the project is closed.
        Specified by:
        saveSessionTools in interface Project
        Returns:
        True if the save was not cancelled.
      • restore

        public void restore()
        Description copied from interface: Project
        Restore this project's state.
        Specified by:
        restore in interface Project
      • save

        public void save()
        Description copied from interface: Project
        Save the project and the list of project views.
        Specified by:
        save in interface Project
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • saveToolTemplate

        public void saveToolTemplate​(java.lang.String tag,
                                     ToolTemplate template)
        Description copied from interface: Project
        Save the given tool template as part of the project.
        Specified by:
        saveToolTemplate in interface Project
        Parameters:
        tag - ID or name for the tool template
        template - template to save
      • getToolTemplate

        public ToolTemplate getToolTemplate​(java.lang.String tag)
        Description copied from interface: Project
        Get the tool template with the given tag.
        Specified by:
        getToolTemplate in interface Project
        Parameters:
        tag - ID or name for the tool template to get
        Returns:
        tool template
      • getOpenData

        public java.util.List<DomainFile> getOpenData()
        Description copied from interface: Project
        Get list of domain files that are open.
        Specified by:
        getOpenData in interface Project
        Returns:
        the files; empty if no files
      • getProjectData

        public ProjectData getProjectData()
        Description copied from interface: Project
        Get the root domain data folder in the project.
        Specified by:
        getProjectData in interface Project
      • setSaveableData

        public void setSaveableData​(java.lang.String key,
                                    SaveState saveState)
        Description copied from interface: Project
        Allows the user to store data related to the project.
        Specified by:
        setSaveableData in interface Project
        Parameters:
        key - A value used to store and lookup saved data
        saveState - a container of data that will be written out when persisted
      • getProjectData

        public ProjectData getProjectData​(ProjectLocator locator)
        Description copied from interface: Project
        Returns the Project Data for the given Project locator. The Project locator must be either the current active project or an currently open project view.
        Specified by:
        getProjectData in interface Project
      • getProjectData

        public ProjectData getProjectData​(java.net.URL url)
        Description copied from interface: Project
        Returns the Project Data for the given Project URL. The Project URL must correspond to the current active project or an currently open project view.
        Specified by:
        getProjectData in interface Project
      • getViewedProjectData

        public ProjectData[] getViewedProjectData()
        Description copied from interface: Project
        Get the project data for other projects that are currently being viewed.
        Specified by:
        getViewedProjectData in interface Project
        Returns:
        zero length array if there are no viewed projects open
      • releaseFiles

        public void releaseFiles​(java.lang.Object consumer)
        Description copied from interface: Project
        Releases all DomainObjects used by the given consumer
        Specified by:
        releaseFiles in interface Project
        Parameters:
        consumer - object no longer using any DomainObjects.