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

## org.objectstyle.cayenne.project
Class Project

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

Direct Known Subclasses:
  ApplicationProject, DataMapProject, PartialProject

    public abstract class Project

extends java.lang.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:
  Andrei Adamchik

Field Summary
`static java.lang.String` | `CURRENT_PROJECT_VERSION`
`protected java.util.List` | `files`
`protected boolean` | `modified`
`protected java.io.File` | `projectDir`
`protected java.util.List` | `upgradeMessages`

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

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

See Also:
  Constant Field Values

### projectDir

    protected java.io.File projectDir

### files

    protected java.util.List files

### upgradeMessages

    protected java.util.List upgradeMessages

### modified

    protected boolean modified

Constructor Detail

### Project

    protected Project()

Since:
  1.2

### Project

    public Project(java.io.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(java.io.File projectFile)

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

### initialize

    protected void initialize(java.io.File projectFile)

  Since:
    1.2

### postInitialize

    protected void postInitialize(java.io.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.

### isUpgradeNeeded

    public boolean isUpgradeNeeded()

  Returns true if the project needs to be upgraded.

### getUpgradeMessages

    public java.util.List 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 java.util.List buildFileList()

  Creates a list of project files.

### getValidator

    public Validator getValidator()

  Creates an instance of Validator for validating this project.

### findFile

    public ProjectFile findFile(java.lang.Object obj)

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

### resolveFile

    public java.io.File resolveFile(java.lang.String symbolicName)

  Returns a canonical file built from symbolic name.

### resolveSymbolicName

    public java.lang.String resolveSymbolicName(java.io.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 java.io.File getProjectDirectory()

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

### setProjectDirectory

    public void setProjectDirectory(java.io.File dir)

### getMainFile

    public java.io.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(java.lang.Object obj)

### getChildren

    public abstract java.util.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 java.util.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(java.util.List filesToSave,
                               java.util.List wrappedObjects)
                        throws ProjectException

  Throws:
    `ProjectException`

### processSave

    protected void processSave(java.util.List modifiedFiles)
                        throws ProjectException

  Saves a list of modified files to temporary files.

  Throws:
    `ProjectException`

### processDelete

    protected void processDelete(java.util.List existingObjects,
                                 java.util.List savedFiles)

### deleteFile

    protected boolean deleteFile(java.io.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 | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2006 ObjectStyle.org All Rights Reserved.