Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.project
Class Project

    java.lang.Object
      org.apache.cayenne.project.Project

Direct Known Subclasses:
  ApplicationProject, DataMapProject, PartialProject

    public abstract class Project

extends Object

Describes a model of Cayenne project. Project is a set of files in the filesystem describing storing Cayenne DataMaps, DataNodes and other information.

Project has a project directory, which is a canonical directory. All project files are relative to the project directory.

Author:
  Andrus Adamchik

Field Summary
`static String` | `CURRENT_PROJECT_VERSION`
`protected List<ProjectFile>` | `files`
`protected boolean` | `modified`
`protected File` | `projectDir`
`protected List<String>` | `upgradeMessages`
`protected int` | `upgradeStatus`

Constructor Summary
`protected` | `Project()`
`` | `Project(File projectFile)` Constructor for Project.

Method Summary
`List<ProjectFile>` | `buildFileList()` Creates a list of project files.
`abstract void` | `checkForUpgrades()` Determines whether the project needs to be upgraded.
`static Project` | `createProject(File projectFile)` Factory method to create the right project type given project file.
`protected boolean` | `deleteFile(File f)`
`ProjectFile` | `findFile(Object obj)` Looks up and returns a file wrapper for a project object.
`abstract List` | `getChildren()` Returns a list of first-level children of the project.
`abstract ConfigStatus` | `getLoadStatus()`
`File` | `getMainFile()` Returns a canonical form of a main file associated with this project.
`File` | `getProjectDirectory()` Returns project directory.
`List<String>` | `getUpgradeMessages()` Returns a list of upgrade messages.
`int` | `getUpgradeStatus()` Returns project upgrade status.
`Validator` | `getValidator()` Creates an instance of Validator for validating this project.
`boolean` | `hasRenamedFiles()` Returns true is project has renamed files.
`protected void` | `initialize(File projectFile)`
`boolean` | `isLocationUndefined()` Returns true if project location is not defined.
`boolean` | `isModified()` Returns `true` if the project is modified.
`protected void` | `postInitialize(File projectFile)` Finished project initialization.
`protected void` | `prepareSave(List<ProjectFile> filesToSave, List<Object> wrappedObjects)`
`protected void` | `processDelete(List<Object> existingObjects, List<File> savedFiles)`
`protected void` | `processSave(List<ProjectFile> modifiedFiles)` Saves a list of modified files to temporary files.
`abstract ProjectFile` | `projectFileForObject(Object obj)`
`File` | `resolveFile(String symbolicName)` Returns a canonical file built from symbolic name.
`String` | `resolveSymbolicName(File file)` Returns a "symbolic" name of a file.
`void` | `save()` Saves project.
`void` | `setModified(boolean modified)` Updates "modified" state of the project.
`void` | `setProjectDirectory(File dir)`
`Iterator` | `treeNodes()` Returns an Iterator over project tree of objects.
`abstract void` | `upgrade()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### CURRENT_PROJECT_VERSION

    public static final String CURRENT_PROJECT_VERSION

See Also:
  Constant Field Values

### projectDir

    protected File projectDir

### files

    protected List<ProjectFile> files

### upgradeStatus

    protected int upgradeStatus

### upgradeMessages

    protected List<String> upgradeMessages

### modified

    protected boolean modified

Constructor Detail

### Project

    protected Project()

Since:
  1.2

### Project

    public Project(File projectFile)

  Constructor for Project. `projectFile` must denote a file (existent or non-existent) in an existing directory. If projectFile has no parent directory, current directory is assumed.

Method Detail

### createProject

    public static Project createProject(File projectFile)

  Factory method to create the right project type given project file.

### initialize

    protected void initialize(File projectFile)

  Since:
    1.2

### postInitialize

    protected void postInitialize(File projectFile)

  Finished project initialization. Called from constructor. Default implementation builds a file list and checks for upgrades.

### isLocationUndefined

    public boolean isLocationUndefined()

  Returns true if project location is not defined. For instance, when project was created in memory and is not tied to a file yet.

### getUpgradeStatus

    public int getUpgradeStatus()

  Returns project upgrade status. "0" means project version matches the framework version, "-1" means project is older than the framework, "+1" means the framework is older than the project.

  Since:
    2.0

### getUpgradeMessages

    public List<String> getUpgradeMessages()

  Returns a list of upgrade messages.

### hasRenamedFiles

    public boolean hasRenamedFiles()

  Returns true is project has renamed files. This is useful when converting from older versions of the modeler projects.

### buildFileList

    public List<ProjectFile> buildFileList()

  Creates a list of project files.

### getValidator

    public Validator getValidator()

  Creates an instance of Validator for validating this project.

### findFile

    public ProjectFile findFile(Object obj)

  Looks up and returns a file wrapper for a project object. Returns null if no file exists.

### resolveFile

    public File resolveFile(String symbolicName)

  Returns a canonical file built from symbolic name.

### resolveSymbolicName

    public String resolveSymbolicName(File file)

  Returns a "symbolic" name of a file. Returns null if file is invalid. Symbolic name is a string path of a file relative to the project directory. It is built in a platform independent fashion.

### getProjectDirectory

    public File getProjectDirectory()

  Returns project directory. This is a directory where project file is located.

### setProjectDirectory

    public void setProjectDirectory(File dir)

### getMainFile

    public File getMainFile()

  Returns a canonical form of a main file associated with this project.

### getLoadStatus

    public abstract ConfigStatus getLoadStatus()

  Returns:
    An object describing failures in the loaded project.

### projectFileForObject

    public abstract ProjectFile projectFileForObject(Object obj)

### getChildren

    public abstract List getChildren()

  Returns a list of first-level children of the project.

### checkForUpgrades

    public abstract void checkForUpgrades()

  Determines whether the project needs to be upgraded. Populates internal list of upgrade messages with discovered information.

### treeNodes

    public Iterator treeNodes()

  Returns an Iterator over project tree of objects.

### upgrade

    public abstract void upgrade()
                          throws ProjectException

  Throws:
    `ProjectException`
  Since:
    1.1

### save

    public void save()
              throws ProjectException

  Saves project. All currently existing files are updated, without checking for modifications. New files are created as needed, unused files are deleted.

  Throws:
    `ProjectException`

### prepareSave

    protected void prepareSave(List<ProjectFile> filesToSave,
                               List<Object> wrappedObjects)
                        throws ProjectException

  Throws:
    `ProjectException`

### processSave

    protected void processSave(List<ProjectFile> modifiedFiles)
                        throws ProjectException

  Saves a list of modified files to temporary files.

  Throws:
    `ProjectException`

### processDelete

    protected void processDelete(List<Object> existingObjects,
                                 List<File> savedFiles)

### deleteFile

    protected boolean deleteFile(File f)

### isModified

    public boolean isModified()

  Returns `true` if the project is modified.

### setModified

    public void setModified(boolean modified)

  Updates "modified" state of the project.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2008 Apache Cayenne. All Rights Reserved.