net.sf.ant4eclipse.model.project
Class EclipseProject

java.lang.Object
  extended by net.sf.ant4eclipse.model.project.EclipseProject

public final class EclipseProject
extends java.lang.Object

Encapsultes a project. A project contains a workspace and is represented by a directory in this workspace. A project can have multiple natures and multiple roles.


Constructor Summary
EclipseProject(Workspace workspace, java.lang.String projectName)
          Creates a new instance of type project.
 
Method Summary
 void addBuildCommand(BuildCommand command)
          Adds the specified build command to the project.
 void addLinkedResource(LinkedResource linkedResource)
          Adds a new linked resource to the project.
 void addNature(ProjectNature nature)
          Adds the specified nature to the project.
 void addReferencedProject(java.lang.String referencedProject)
           
 void addRole(AbstractProjectRole role)
          Adds the specified role to the EclipseProject.
 boolean equals(java.lang.Object o)
          
 boolean exists()
          Returns whether this project exists.
 BuildCommand[] getBuildCommands()
          Returns the build commands of this project.
 java.io.File getChild(java.lang.String path)
          Returns the child of this project with the given path.
 java.io.File getChild(java.lang.String path, boolean relative)
          Returns the child of this project with the given path.
 java.lang.String getComment()
           
 CvsProjectRole getCvsProjectRole()
          Returns the cvs project role.
 java.io.File getFolder()
          Returns the folder that represents this project.
 JavaProjectRole getJavaProjectRole()
          Returns the java project role.
 LinkedResource getLinkedResource(java.lang.String name)
          Returns a specific LinkedResource instance.
 java.lang.String getName()
          Returns the name of the project
 ProjectNature[] getNatures()
          Returns the project natures of the project.
 java.lang.String[] getReferencedProjects()
          Returns a list of all referenced project names.
 AbstractProjectRole getRole(java.lang.Class projectRoleClass)
          Returns the role of the given type.
 AbstractProjectRole[] getRoles()
          Returns the roles of this project.
 java.lang.String getSpecifiedName()
           
 Workspace getWorkspace()
          Returns the workspace the project belongs to.
 boolean hasBuildCommand(BuildCommand command)
          Returns whether the specified build command is set or not.
 boolean hasBuildCommand(java.lang.String commandName)
          Returns whether the build command with the specified name is set or not.
 boolean hasChild(java.lang.String path)
          Returns whether this project has a child with the given path.
 boolean hasCvsProjectRole()
          Returns whether a cvs project role is set or not.
 int hashCode()
          
 boolean hasJavaProjectRole()
          Returns whether a java project role is set or not.
 boolean hasNature(ProjectNature nature)
          Returns whether the specified nature is set or not.
 boolean hasNature(java.lang.String natureName)
          Returns whether the nature with the specified name is set or not.
 boolean hasRole(java.lang.Class projectRoleClass)
          Returns whether the role of the given type is set or not.
 boolean isLinkedResource(java.lang.String name)
          Returns true if the supplied name refers to a linked resource.
 void setComment(java.lang.String comment)
           
 void setSpecifiedName(java.lang.String specifiedName)
           
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EclipseProject

public EclipseProject(Workspace workspace,
                      java.lang.String projectName)
Creates a new instance of type project.

Parameters:
workspace - the workspace
projectName - the name of the project
Method Detail

getSpecifiedName

public java.lang.String getSpecifiedName()
Returns:
Returns the specifiedName.

setSpecifiedName

public void setSpecifiedName(java.lang.String specifiedName)
Parameters:
specifiedName - The specifiedName to set.

getComment

public java.lang.String getComment()
Returns:
Returns the comment.

setComment

public void setComment(java.lang.String comment)
Parameters:
comment - The comment to set.

getName

public java.lang.String getName()
Returns the name of the project

Returns:
the name of the project

getFolder

public java.io.File getFolder()
Returns the folder that represents this project.

Returns:
Returns the folder that represents this project.

exists

public boolean exists()
Returns whether this project exists. A project exists if the underlying file exists and if it is an directory.

Returns:
Returns whether this project exists.

hasChild

public boolean hasChild(java.lang.String path)
Returns whether this project has a child with the given path.

Parameters:
path - the path of child
Returns:
Returns whether this project has a child with the given path.

getChild

public java.io.File getChild(java.lang.String path)
Returns the child of this project with the given path.

Parameters:
path - The child which shall be returned.
Returns:
Returns the child of this project with the given path.

getChild

public java.io.File getChild(java.lang.String path,
                             boolean relative)
Returns the child of this project with the given path.

Parameters:
path - The child which shall be returned.
relative - true <=> Create a relative location.
Returns:
Returns the child of this project with the given path.

addNature

public void addNature(ProjectNature nature)
Adds the specified nature to the project.

Parameters:
nature - the nature to add.

hasNature

public boolean hasNature(java.lang.String natureName)
Returns whether the nature with the specified name is set or not.

Parameters:
natureName -
Returns:
Returns whether the nature with the specified name is set or not.

hasNature

public boolean hasNature(ProjectNature nature)
Returns whether the specified nature is set or not.

Parameters:
nature -
Returns:
Returns whether the specified nature is set or not.

getNatures

public ProjectNature[] getNatures()
Returns the project natures of the project.

Returns:
Returns the project natures of the project.

addReferencedProject

public void addReferencedProject(java.lang.String referencedProject)
Parameters:
referencedProject -

getReferencedProjects

public java.lang.String[] getReferencedProjects()
Returns a list of all referenced project names.

Returns:
A list of all reference project names.

addRole

public void addRole(AbstractProjectRole role)
Adds the specified role to the EclipseProject.

Parameters:
role - Adds the specified role to the EclipseProject.

hasRole

public boolean hasRole(java.lang.Class projectRoleClass)
Returns whether the role of the given type is set or not.

Parameters:
projectRoleClass -
Returns:
Returns whether the role of the given type is set or not.

getRole

public AbstractProjectRole getRole(java.lang.Class projectRoleClass)
Returns the role of the given type. If the role is not set, an exception will be thrown.

Parameters:
projectRoleClass -
Returns:
Returns the role of the given type. If the role is not set, an exception will be thrown.

getRoles

public AbstractProjectRole[] getRoles()
Returns the roles of this project.

Returns:
Returns the roles of this project.

addBuildCommand

public void addBuildCommand(BuildCommand command)
Adds the specified build command to the project.

Parameters:
command - the specified build command to the project.

hasBuildCommand

public boolean hasBuildCommand(java.lang.String commandName)
Returns whether the build command with the specified name is set or not.

Parameters:
commandName -
Returns:
Returns whether the build command with the specified name is set or not.

hasBuildCommand

public boolean hasBuildCommand(BuildCommand command)
Returns whether the specified build command is set or not.

Parameters:
command - The command name that has to be tested.
Returns:
Returns whether the specified build command is set or not.

getBuildCommands

public BuildCommand[] getBuildCommands()
Returns the build commands of this project.

Returns:
Returns the build commands of this project.

addLinkedResource

public void addLinkedResource(LinkedResource linkedResource)
Adds a new linked resource to the project.

Parameters:
linkedResource - the linked resource to add.

getLinkedResource

public LinkedResource getLinkedResource(java.lang.String name)
Returns a specific LinkedResource instance.

Parameters:
name - The name of the desired LinkedResource instance.
Returns:
The desired LinkedResource instance.

isLinkedResource

public boolean isLinkedResource(java.lang.String name)
Returns true if the supplied name refers to a linked resource.

Parameters:
name - The name of a potential linked resource.
Returns:
true <=> The name applies to a specific linked resource.

getWorkspace

public Workspace getWorkspace()
Returns the workspace the project belongs to.

Returns:
Returns the workspace the project belongs to.

getJavaProjectRole

public JavaProjectRole getJavaProjectRole()
Returns the java project role. If a java project role is not set, an exception will be thrown.

Returns:
Returns the java project role.

hasJavaProjectRole

public boolean hasJavaProjectRole()
Returns whether a java project role is set or not.

Returns:
Returns whether a java project role is set or not.

getCvsProjectRole

public CvsProjectRole getCvsProjectRole()
Returns the cvs project role. If a cvs project role is not set, an exception will be thrown.

Returns:
Returns the cvs project role.

hasCvsProjectRole

public boolean hasCvsProjectRole()
Returns whether a cvs project role is set or not.

Returns:
Returns whether a cvs project role is set or not.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object