org.netbeans.modules.projectapi/1 1.9.22

org.netbeans.spi.project
Interface ProjectFactory


public interface ProjectFactory

Create in-memory projects from disk directories. Instances should be registered into default lookup.


Method Summary
 boolean isProject(FileObject projectDirectory)
          Test whether a given directory probably refers to a project recognized by this factory without actually trying to create it.
 Project loadProject(FileObject projectDirectory, ProjectState state)
          Create a project that resides on disk.
 void saveProject(Project project)
          Save a project to disk.
 

Method Detail

isProject

boolean isProject(FileObject projectDirectory)
Test whether a given directory probably refers to a project recognized by this factory without actually trying to create it.

Should be as fast as possible as it might be called sequentially on a lot of directories.

Need not be definite; it is permitted to return null or throw an exception from loadProject(org.openide.filesystems.FileObject, org.netbeans.spi.project.ProjectState) even when returning true from this method, in case the directory looked like a project directory but in fact had something wrong with it.

Will be called inside read access.

Parameters:
projectDirectory - a directory which might refer to a project
Returns:
true if this factory recognizes it

loadProject

Project loadProject(FileObject projectDirectory,
                    ProjectState state)
                    throws IOException
Create a project that resides on disk. If this factory does not in fact recognize the directory, it should just return null.

Will be called inside read access.

Do not do your own caching! The project manager caches projects for you, properly.

Do not attempt to recognize subdirectories of your project directory (just return null), unless they are distinct nested projects.

Parameters:
projectDirectory - some directory on disk
state - a callback permitting the project to indicate when it is modified
Returns:
a matching project implementation, or null if this factory does not recognize it
Throws:
IOException

saveProject

void saveProject(Project project)
                 throws IOException,
                        ClassCastException
Save a project to disk.

Will be called inside write access.

Parameters:
project - a project created with this factory's loadProject(org.openide.filesystems.FileObject, org.netbeans.spi.project.ProjectState) method
Throws:
IOException - if there is a problem saving
ClassCastException - if this factory did not create this project

org.netbeans.modules.projectapi/1 1.9.22

Built on July 11 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.