de.matthias_burbach.deputy.core.project
Class Project

java.lang.Object
  extended byde.matthias_burbach.deputy.core.project.Project
All Implemented Interfaces:
ProjectQualifier

public class Project
extends java.lang.Object
implements ProjectQualifier

Represents a Maven project object model (only the parts relevant for Deputy).

Author:
Matthias Burbach

Constructor Summary
Project()
           
 
Method Summary
 void addChangeListener(ProjectChangeListener listener)
          Adds a change listener to this project which will be notified when this project changed in defined ways.
 void addDependency(Project dependency)
          Adds a direct dependency to this project and notifies change listeners.
 void addDependencyPropertyList(java.lang.String dependencyArtifactId, java.util.List propertyXmlElements)
          Adds a list of properties for the artifact id to this project.
 void addDeprecatedDependency(Project deprecatedDependency)
          Adds a dependency stated literally in this project's project.xml but which was overruled by some other version of the same artifact.
 void addIndirectDependency(Project dependency)
          Adds an indirect dependency to this project.
 java.util.List getAllDependencies()
           
 java.lang.String getArtifactId()
           
 java.util.Map getClientCauses()
          Maps clients of type Project to their literal dependencies of type ProjectQualifier that caused the clientship during the application of the rules.
 java.util.List getClients()
           
 java.util.List getConflicts()
           
 java.lang.String getDefaultUrl()
           
 java.util.Iterator getDependencies()
           
 java.util.Map getDependencyCauses()
          Maps dependencies of type Project to the corresponding dependencies of type ProjectQualifier that caused the dependency during the application of the rules.
 java.util.List getDependencyPropertyList(java.lang.String dependencyArtifactId)
           
 Project getDependencyToSameArtifact(Project project)
           
 java.lang.String getGroupId()
           
 java.util.Iterator getIndirectDependencies()
           
 Project getIndirectDependencyToSameArtifact(Project project)
           
 java.lang.String getJar()
           
 java.lang.Integer getMajorVersion()
          Tries to split off the numerical major version from the version.
 java.lang.Integer getMicroVersion()
          Tries to split off the numerical micro version from the version after the second dot in the version string.
 java.lang.Integer getMinorVersion()
          Tries to split off the numerical minor version from the version between the first and the second dot in the version string.
 java.lang.String getName()
           
 RuleSet getRuleSet()
           
 java.lang.String getType()
           
 java.lang.String getUrl()
           
 java.lang.String getVersion()
           
 boolean hasDependency(Project project)
           
 boolean hasDependencyToSameArtifact(Project project)
           
 boolean hasDirectOrIndirectDependency(Project project)
           
 boolean hasIndirectDependency(Project project)
           
 boolean hasIndirectDependencyToSameArtifact(Project project)
           
 boolean isAssembly()
           
 boolean isRootProject()
           
 void removeChangeListener(ProjectChangeListener listener)
          Removes a change listener from this project.
 void removeDependency(Project dependency)
          Removes a direct dependency from this project and notifies change listeners.
 void removeIndirectDependency(Project dependency)
          Removes the indirect dependency and notifies change listeners.
 void setArtifactId(java.lang.String artifactId)
           
 void setAssembly(boolean assembly)
           
 void setGroupId(java.lang.String groupId)
           
 void setIndirectDependencies(java.util.List indirectDependencies)
           
 void setJar(java.lang.String jar)
           
 void setName(java.lang.String name)
           
 void setRootProject(boolean rootProject)
           
 void setRuleSet(RuleSet ruleSet)
           
 void setType(java.lang.String type)
           
 void setUrl(java.lang.String url)
           
 void setVersion(java.lang.String version)
           
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Project

public Project()
Method Detail

getClientCauses

public java.util.Map getClientCauses()
Maps clients of type Project to their literal dependencies of type ProjectQualifier that caused the clientship during the application of the rules. If there is no mapping the project caused itself.

Returns:
The map described. Maybe empty but not null.

getDependencyCauses

public java.util.Map getDependencyCauses()
Maps dependencies of type Project to the corresponding dependencies of type ProjectQualifier that caused the dependency during the application of the rules. If there is no mapping the project caused itself.

Returns:
The map described. Maybe empty but not null.

getGroupId

public java.lang.String getGroupId()
Specified by:
getGroupId in interface ProjectQualifier
Returns:
The group id of this project.

setGroupId

public void setGroupId(java.lang.String groupId)
Parameters:
groupId - The group id of this project.

getArtifactId

public java.lang.String getArtifactId()
Specified by:
getArtifactId in interface ProjectQualifier
Returns:
The artifact id of this project.

setArtifactId

public void setArtifactId(java.lang.String artifactId)
Parameters:
artifactId - The artifact id of this project.

getVersion

public java.lang.String getVersion()
Specified by:
getVersion in interface ProjectQualifier
Returns:
The version of this project.

setVersion

public void setVersion(java.lang.String version)
Parameters:
version - The version of this project.

getType

public java.lang.String getType()
Returns:
The type of this project. This is a non-standard element in the project.xml. Its value is one of 'jar', 'war', ejb', 'dll'. It is optional and defaults to 'jar'.

setType

public void setType(java.lang.String type)
Parameters:
type - The type of this project. This is a non-standard element in the project.xml. Its value is one of 'jar', 'war', ejb', 'dll'. It is optional and defaults to 'jar'.

getJar

public java.lang.String getJar()
Returns:
The name of jar file if it doesn't respect the <artifactId>-<version>.jar pattern.

setJar

public void setJar(java.lang.String jar)
Parameters:
jar - The name of jar file if it doesn't respect the <artifactId>-<version>.jar pattern.

isRootProject

public boolean isRootProject()
Returns:
Whether this project is the root of the dependency graph currently opened in Deputy. If so, it is the project which can be edited and changed by rules to update and save its dependencies.

setRootProject

public void setRootProject(boolean rootProject)
Parameters:
rootProject - Whether this project is the root of the dependency graph currently opened in Deputy. If so, it is the project which can be edited and changed by rules to update and save its dependencies.

getUrl

public java.lang.String getUrl()
Returns:
The optional URL of this project's homepage.

getDefaultUrl

public java.lang.String getDefaultUrl()
Returns:
The default URL of this project's homepage.

setUrl

public void setUrl(java.lang.String url)
Parameters:
url - The optional URL of this project's homepage.

getName

public java.lang.String getName()
Returns:
The optional name of this project (for display purposes and the like).

setName

public void setName(java.lang.String name)
Parameters:
name - The optional name of this project (for display purposes and the like).

getMajorVersion

public java.lang.Integer getMajorVersion()
Tries to split off the numerical major version from the version. The major version is defined to be the numerical prefix of the version up to the first dot in the version or the whole version if it is an integer without any dots.

Returns:
The major version part of the version string or null if parsing this fails.

getMinorVersion

public java.lang.Integer getMinorVersion()
Tries to split off the numerical minor version from the version between the first and the second dot in the version string. If the version is literally only a major version and nothing more, the minor version defaults to 0.

Returns:
The minor version part of the version string or null if parsing this fails.

getMicroVersion

public java.lang.Integer getMicroVersion()
Tries to split off the numerical micro version from the version after the second dot in the version string. The micro version either extends up to the third dot, if it exists, or up to the end of the version.
If the version is literally only a major version and nothing more, or a major version, a dot and a minor version and nothing more, the micro version defaults to 0.

Returns:
The micro version part of the version string or null if parsing this fails.

getRuleSet

public RuleSet getRuleSet()
Returns:
The rule set of this project.

setRuleSet

public void setRuleSet(RuleSet ruleSet)
Parameters:
ruleSet - The rule set of this project.

isAssembly

public boolean isAssembly()
Returns:
true whether this project is an assembly for which indirect dependencies need to be persisted in the project.xml.

setAssembly

public void setAssembly(boolean assembly)
Parameters:
assembly - true whether this project is an assembly for which indirect dependencies need to be persisted in the project.xml.

hasDependency

public boolean hasDependency(Project project)
Parameters:
project - The project to check.
Returns:
true if this project has a dependency to the project passed in.

hasDependencyToSameArtifact

public boolean hasDependencyToSameArtifact(Project project)
Parameters:
project - The project to check.
Returns:
true if this project has a dependency to the same artifact represented by the project passed in.

getDependencyToSameArtifact

public Project getDependencyToSameArtifact(Project project)
Parameters:
project - Holds the artifact to find the dependency for.
Returns:
The dependency with the same artifact id as the project passed in has or null.

getDependencies

public java.util.Iterator getDependencies()
Returns:
All direct dependencies of type Project of this project.

addDependency

public void addDependency(Project dependency)
Adds a direct dependency to this project and notifies change listeners.

Parameters:
dependency - The dependency to add.

removeDependency

public void removeDependency(Project dependency)
Removes a direct dependency from this project and notifies change listeners.

Parameters:
dependency - The dependency to remove.

hasIndirectDependency

public boolean hasIndirectDependency(Project project)
Parameters:
project - The project to check if it is an indirect dependency.
Returns:
true if the project passed in is an indirect dependency of this project.

hasIndirectDependencyToSameArtifact

public boolean hasIndirectDependencyToSameArtifact(Project project)
Parameters:
project - Holds the artifact to check the dependency for.
Returns:
true if this project has an indirect dependency to the same artifact as the project passed in has.

getIndirectDependencyToSameArtifact

public Project getIndirectDependencyToSameArtifact(Project project)
Parameters:
project - Holds the artifact to find the indirect dependency for.
Returns:
The indirect dependency with the same artifact id as the project passed in has or null.

getIndirectDependencies

public java.util.Iterator getIndirectDependencies()
Returns:
The indirect dependencies of type Project.

addIndirectDependency

public void addIndirectDependency(Project dependency)
Adds an indirect dependency to this project. Does not notify change listeners (is not needed because a user will never directly add such a dependency through the user interface).

Parameters:
dependency - The indirect dependency to add.

removeIndirectDependency

public void removeIndirectDependency(Project dependency)
Removes the indirect dependency and notifies change listeners.

Parameters:
dependency - The dependency to remove.

setIndirectDependencies

public void setIndirectDependencies(java.util.List indirectDependencies)
Parameters:
indirectDependencies - The list of indirect dependencies of type Project.

hasDirectOrIndirectDependency

public boolean hasDirectOrIndirectDependency(Project project)
Parameters:
project - The dependency to check for.
Returns:
true if this project has a direct or indirect dependency to the project passed in.

addDeprecatedDependency

public void addDeprecatedDependency(Project deprecatedDependency)
Adds a dependency stated literally in this project's project.xml but which was overruled by some other version of the same artifact.

Parameters:
deprecatedDependency - The dependency to add.

getAllDependencies

public java.util.List getAllDependencies()
Returns:
The merged and globally sorted list of both the direct and the indirect dependencies of this project. Elements of the list are of type Project.

getClients

public java.util.List getClients()
Returns:
The projects of type Project which depend on this project.

getConflicts

public java.util.List getConflicts()
Returns:
The version conflicts in the dependency graph that roots in this project.

addDependencyPropertyList

public void addDependencyPropertyList(java.lang.String dependencyArtifactId,
                                      java.util.List propertyXmlElements)
Adds a list of properties for the artifact id to this project.

Parameters:
dependencyArtifactId - The artifact id of the dependency that has these properties defined in this project's POM file.
propertyXmlElements - The list of associated properties of type Element.

getDependencyPropertyList

public java.util.List getDependencyPropertyList(java.lang.String dependencyArtifactId)
Parameters:
dependencyArtifactId - The artifact id of the dependency to retrieve properties for.
Returns:
A list of properties of type Element or null.

addChangeListener

public void addChangeListener(ProjectChangeListener listener)
Adds a change listener to this project which will be notified when this project changed in defined ways.

Parameters:
listener - The listener to add.

removeChangeListener

public void removeChangeListener(ProjectChangeListener listener)
Removes a change listener from this project.

Parameters:
listener - The listener to remove.

toString

public java.lang.String toString()



Copyright © 2005-2007 . All Rights Reserved.