Forge - Parent 1.4.2-SNAPSHOT

org.jboss.forge.maven.facets
Class MavenDependencyFacet

java.lang.Object
  extended by org.jboss.forge.project.facets.BaseFacet
      extended by org.jboss.forge.maven.facets.MavenDependencyFacet
All Implemented Interfaces:
Facet, DependencyFacet

@Dependent
@Alias(value="forge.maven.MavenDependencyFacet")
@RequiresFacet(value=MavenCoreFacet.class)
public class MavenDependencyFacet
extends BaseFacet
implements DependencyFacet, Facet

Author:
Lincoln Baxter, III

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.forge.project.facets.DependencyFacet
DependencyFacet.KnownRepository
 
Field Summary
 
Fields inherited from class org.jboss.forge.project.facets.BaseFacet
project
 
Constructor Summary
MavenDependencyFacet(DependencyResolver resolver, EventBus bus)
           
 
Method Summary
 void addDirectDependency(Dependency dep)
          Add the given Dependency to this Project's immediate list of dependencies.
 void addDirectManagedDependency(Dependency dep)
          Add the given managed Dependency to this Project's immediate list of managed dependencies.
 void addManagedDependency(Dependency manDep)
          Add the given managed Dependency to this Project's immediate list of managed dependencies.
 void addRepository(DependencyFacet.KnownRepository repository)
          Add a DependencyFacet.KnownRepository to the project build system.
 void addRepository(String name, String url)
          Add a repository to the project build system.
 List<Dependency> getDependencies()
          Return an immutable list of all direct Dependencies contained within this project.
 List<Dependency> getDependenciesInScopes(ScopeType... scopes)
          Get a list of this Project's dependencies of the given ScopeType..
 Dependency getDirectDependency(Dependency dependency)
          Attempt to locate the given Dependency, if it exists in the Project direct dependency list, and return it.
 List<Dependency> getEffectiveDependencies()
          Return an immutable list of all Dependencies contained anywhere within this project's dependency hierarchy.
 List<Dependency> getEffectiveDependenciesInScopes(ScopeType... scopes)
          Get a list of this Project's dependencies of the given ScopeType, from anywhere in the dependency hierarchy.
 Dependency getEffectiveDependency(Dependency manDep)
          Attempt to locate the given Dependency, if it exists anywhere in the Project dependency hierarchy, and return it.
 Dependency getEffectiveManagedDependency(Dependency manDep)
          Searches Project and returns a managed dependency matching the given Dependency at any level of the project hierarchy; return null otherwise.
 List<Dependency> getManagedDependencies()
          Return an immutable list of all direct managed Dependencies contained within this project.
 Dependency getManagedDependency(Dependency manDep)
          Attempt to locate the given managed Dependency, if it exists in the Project, and return it.
 Map<String,String> getProperties()
          Return a list of all build dependency properties.(Build properties such, as ${my.version}, can be used anywhere in a dependency, and will be expanded during building to their property value.)
 String getProperty(String name)
          Get a build property by name.
 List<DependencyRepository> getRepositories()
          Get the list of repositories for which this project is currently configured to use in dependency resolution.
 boolean hasDirectDependency(Dependency dependency)
          Return true if this Project contains a dependency matching the given Dependency; return false otherwise.
 boolean hasDirectManagedDependency(Dependency managedDependency)
          Return true if this Project contains a managed dependency matching the given Dependency; return false otherwise.
 boolean hasEffectiveDependency(Dependency dependency)
          Return true if the given Dependency exists anywhere in the project dependency hierarchy.
 boolean hasEffectiveManagedDependency(Dependency manDep)
          Return true if this Project contains a managed dependency matching the given Dependency at any level of the project hierarchy; return false otherwise.
 boolean hasRepository(DependencyFacet.KnownRepository repository)
          Return true if the given DependencyFacet.KnownRepository is already registered in this project's build system.
 boolean hasRepository(String url)
          Return true if the given repository URL is already registered in this project's build system.
 boolean install()
          Perform necessary setup for this Facet to be considered installed in the given Project.
 boolean isInstalled()
          Return true if the Facet is available for the given Project, false if otherwise.
 void removeDependency(Dependency dep)
          Remove the given Dependency from this facet's Project.
 void removeManagedDependency(Dependency manDep)
          Remove the given managed Dependency from this facet's Project.
 String removeProperty(String name)
          Remove a build property by name.
 DependencyRepository removeRepository(String url)
          Remove the given DependencyRepository from the current project.
 List<Dependency> resolveAvailableVersions(Dependency dep)
          Given a Dependency with a populated groupId, versionId, and version range, identify the available artifacts in all known repositories for this project.
 List<Dependency> resolveAvailableVersions(DependencyQuery query)
          Using the given DependencyQuery, identify and resolve all matching Dependency results in configured DependencyRepository instances for this Project.
 List<Dependency> resolveAvailableVersions(String gavs)
          Given a groupid:versionid:version-range, identify and resolve all matching artifacts in all known DependencyRepository instances for this Project.
 Dependency resolveProperties(Dependency dependency)
          Resolve properties in the given dependency, converting them to their actual values.
 void setProperty(String name, String value)
          Set a build dependency property.
 
Methods inherited from class org.jboss.forge.project.facets.BaseFacet
equals, getProject, hashCode, setProject, uninstall
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.forge.project.Facet
getProject, setProject, uninstall
 

Constructor Detail

MavenDependencyFacet

@Inject
public MavenDependencyFacet(DependencyResolver resolver,
                                   EventBus bus)
Method Detail

isInstalled

public boolean isInstalled()
Description copied from interface: Facet
Return true if the Facet is available for the given Project, false if otherwise.

Specified by:
isInstalled in interface Facet

install

public boolean install()
Description copied from interface: Facet
Perform necessary setup for this Facet to be considered installed in the given Project. This method should NOT register the facet; facet registration is handled by the project if installation is successful.

Specified by:
install in interface Facet
Returns:
true if installation was successful, false if not.

addDirectDependency

public void addDirectDependency(Dependency dep)
Description copied from interface: DependencyFacet
Add the given Dependency to this Project's immediate list of dependencies. This method does not check for existence of dependencies in the hierarchy, instead, directly adds or replaces a direct dependency.

See also: DependencyBuilder.

Specified by:
addDirectDependency in interface DependencyFacet

hasDirectDependency

public boolean hasDirectDependency(Dependency dependency)
Description copied from interface: DependencyFacet
Return true if this Project contains a dependency matching the given Dependency; return false otherwise. This method ignores Dependency.getScopeType()

See also: DependencyBuilder.

Notice: This method checks only the immediate project dependencies, meaning that if a dependency is declared somewhere else in the hierarchy, it will not be detected by this method, even though by #hasDependency(Dependency) may return true.

Specified by:
hasDirectDependency in interface DependencyFacet

removeDependency

public void removeDependency(Dependency dep)
Description copied from interface: DependencyFacet
Remove the given Dependency from this facet's Project. This method ignores Dependency.getScopeType()

See also: DependencyBuilder.

Notice: This method operates only the immediate project dependencies, meaning that if a dependency is declared somewhere else in the hierarchy, it will not be removable by this method. You should call DependencyFacet.hasDirectDependency(Dependency) first in order to check if the dependency exists in this projects immediate dependencies.

Specified by:
removeDependency in interface DependencyFacet

getDependencies

public List<Dependency> getDependencies()
Description copied from interface: DependencyFacet
Return an immutable list of all direct Dependencies contained within this project. (i.e.: all dependencies for which DependencyFacet.hasDirectDependency(Dependency) returns true;

Specified by:
getDependencies in interface DependencyFacet

getDirectDependency

public Dependency getDirectDependency(Dependency dependency)
Description copied from interface: DependencyFacet
Attempt to locate the given Dependency, if it exists in the Project direct dependency list, and return it.

See also: DependencyBuilder. See also: DependencyFacet.hasDirectDependency(Dependency).

Notice: This method checks only the immediate project dependencies, meaning that if a dependency is declared somewhere else in the hierarchy, it will not be detected by this method, even though by #hasDependency(Dependency) may return true.

Specified by:
getDirectDependency in interface DependencyFacet
Returns:

hasEffectiveDependency

public boolean hasEffectiveDependency(Dependency dependency)
Description copied from interface: DependencyFacet
Return true if the given Dependency exists anywhere in the project dependency hierarchy. See also: DependencyBuilder. See also: DependencyFacet.getEffectiveDependency(Dependency).

Specified by:
hasEffectiveDependency in interface DependencyFacet

getEffectiveDependency

public Dependency getEffectiveDependency(Dependency manDep)
Description copied from interface: DependencyFacet
Attempt to locate the given Dependency, if it exists anywhere in the Project dependency hierarchy, and return it.

See also: DependencyBuilder. See also: DependencyFacet.hasEffectiveDependency(Dependency).

Specified by:
getEffectiveDependency in interface DependencyFacet
Returns:

getEffectiveDependencies

public List<Dependency> getEffectiveDependencies()
Description copied from interface: DependencyFacet
Return an immutable list of all Dependencies contained anywhere within this project's dependency hierarchy. (i.e.: all dependencies for which DependencyFacet.hasEffectiveDependency(Dependency) returns true;

Specified by:
getEffectiveDependencies in interface DependencyFacet

addManagedDependency

public void addManagedDependency(Dependency manDep)
Description copied from interface: DependencyFacet
Add the given managed Dependency to this Project's immediate list of managed dependencies. This method first calls DependencyFacet.hasEffectiveManagedDependency(Dependency) before making changes to the managed dependency list.

See also: DependencyBuilder.

Specified by:
addManagedDependency in interface DependencyFacet

addDirectManagedDependency

public void addDirectManagedDependency(Dependency dep)
Description copied from interface: DependencyFacet
Add the given managed Dependency to this Project's immediate list of managed dependencies. This method does not check for existence of managed dependencies in the hierarchy, instead, directly adds or replaces a direct managed dependency.

See also: DependencyBuilder.

Specified by:
addDirectManagedDependency in interface DependencyFacet

hasEffectiveManagedDependency

public boolean hasEffectiveManagedDependency(Dependency manDep)
Description copied from interface: DependencyFacet
Return true if this Project contains a managed dependency matching the given Dependency at any level of the project hierarchy; return false otherwise. This method ignores Dependency.getScopeType()

See also: DependencyBuilder.

Notice: This method checks the entire project managed dependency structure, meaning that if a managed dependency is declared somewhere else in the hierarchy, it will not be detected by #hasManagedDependency(Dependency) and will not be removable via DependencyFacet.removeManagedDependency(Dependency).

Specified by:
hasEffectiveManagedDependency in interface DependencyFacet

getEffectiveManagedDependency

public Dependency getEffectiveManagedDependency(Dependency manDep)
Description copied from interface: DependencyFacet
Searches Project and returns a managed dependency matching the given Dependency at any level of the project hierarchy; return null otherwise. This method ignores Dependency.getScopeType()

See also: DependencyBuilder.

Notice: This method checks the entire project managed dependency structure, meaning that if a managed dependency is declared somewhere else in the hierarchy, it will not be detected by DependencyFacet.getManagedDependency(Dependency) and will not be removable via DependencyFacet.removeManagedDependency(Dependency).

Specified by:
getEffectiveManagedDependency in interface DependencyFacet

hasDirectManagedDependency

public boolean hasDirectManagedDependency(Dependency managedDependency)
Description copied from interface: DependencyFacet
Return true if this Project contains a managed dependency matching the given Dependency; return false otherwise. This method ignores Dependency.getScopeType()

See also: DependencyBuilder.

Notice: This method checks only the immediate project managed dependencies, meaning that if a managed dependency is declared somewhere else in the hierarchy, it will not be detected by this method, even though DependencyFacet.hasEffectiveManagedDependency(Dependency) may return true.

Specified by:
hasDirectManagedDependency in interface DependencyFacet

removeManagedDependency

public void removeManagedDependency(Dependency manDep)
Description copied from interface: DependencyFacet
Remove the given managed Dependency from this facet's Project. This method ignores Dependency.getScopeType()

See also: DependencyBuilder.

Notice: This method operates only the immediate project managed dependencies, meaning that if a managed dependency is declared somewhere else in the hierarchy, it will not be removable by this method. You should call #hasManagedDependency(Dependency) first in order to check if the managed dependency exists in this projects immediate managed dependencies.

Specified by:
removeManagedDependency in interface DependencyFacet

getManagedDependencies

public List<Dependency> getManagedDependencies()
Description copied from interface: DependencyFacet
Return an immutable list of all direct managed Dependencies contained within this project. (i.e.: all managed dependencies for which ManagedDependencyFacet#hasManagedDependency(Dependency) returns true;

Specified by:
getManagedDependencies in interface DependencyFacet

getManagedDependency

public Dependency getManagedDependency(Dependency manDep)
Description copied from interface: DependencyFacet
Attempt to locate the given managed Dependency, if it exists in the Project, and return it.

See also: DependencyBuilder. See also: DependencyFacet.hasEffectiveManagedDependency(Dependency).

Specified by:
getManagedDependency in interface DependencyFacet
Returns:

getProperties

public Map<String,String> getProperties()
Description copied from interface: DependencyFacet
Return a list of all build dependency properties.(Build properties such, as ${my.version}, can be used anywhere in a dependency, and will be expanded during building to their property value.)

Specified by:
getProperties in interface DependencyFacet

setProperty

public void setProperty(String name,
                        String value)
Description copied from interface: DependencyFacet
Set a build dependency property. (Build properties, such as ${my.version}, can be used anywhere in a dependency, and will be expanded during building to their property value.)

Specified by:
setProperty in interface DependencyFacet

getProperty

public String getProperty(String name)
Description copied from interface: DependencyFacet
Get a build property by name. (Build properties, such as ${my.version}, can be used anywhere in a dependency, and will be expanded during building to their property value.)

Specified by:
getProperty in interface DependencyFacet

resolveProperties

public Dependency resolveProperties(Dependency dependency)
Description copied from interface: DependencyFacet
Resolve properties in the given dependency, converting them to their actual values.

Specified by:
resolveProperties in interface DependencyFacet

removeProperty

public String removeProperty(String name)
Description copied from interface: DependencyFacet
Remove a build property by name. (Build properties, such as ${my.version}, can be used anywhere in a dependency, and will be expanded during building to their property value.)

Specified by:
removeProperty in interface DependencyFacet

resolveAvailableVersions

public List<Dependency> resolveAvailableVersions(String gavs)
Description copied from interface: DependencyFacet
Given a groupid:versionid:version-range, identify and resolve all matching artifacts in all known DependencyRepository instances for this Project. By default, SNAPSHOT versions are excluded. For example:

dependencyFacet.resolveAvailableVersions("org.jboss.forge:example:[1.0.0,]");
dependencyFacet.resolveAvailableVersions("org.jboss.forge:example:[1.0.0,)");
dependencyFacet.resolveAvailableVersions("org.jboss.forge:example:(1.0.0,3.0.0]");
dependencyFacet.resolveAvailableVersions("org.jboss.forge:example:[1.0.0,3.0.0]");

For more comprehensive resolution features, see DependencyFacet.resolveAvailableVersions(DependencyQuery) or DependencyResolver

Specified by:
resolveAvailableVersions in interface DependencyFacet

resolveAvailableVersions

public List<Dependency> resolveAvailableVersions(Dependency dep)
Description copied from interface: DependencyFacet
Given a Dependency with a populated groupId, versionId, and version range, identify the available artifacts in all known repositories for this project. By default, SNAPSHOT versions are excluded. See DependencyFacet.resolveAvailableVersions(String). For more comprehensive resolution features, see DependencyResolver

Specified by:
resolveAvailableVersions in interface DependencyFacet

resolveAvailableVersions

public List<Dependency> resolveAvailableVersions(DependencyQuery query)
Description copied from interface: DependencyFacet
Using the given DependencyQuery, identify and resolve all matching Dependency results in configured DependencyRepository instances for this Project. See also, DependencyFacet.resolveAvailableVersions(String) and DependencyFacet.resolveAvailableVersions(Dependency)

Specified by:
resolveAvailableVersions in interface DependencyFacet

addRepository

public void addRepository(String name,
                          String url)
Description copied from interface: DependencyFacet
Add a repository to the project build system. This is where dependencies can be found, downloaded, and installed to the project build script.

Specified by:
addRepository in interface DependencyFacet

addRepository

public void addRepository(DependencyFacet.KnownRepository repository)
Description copied from interface: DependencyFacet
Add a DependencyFacet.KnownRepository to the project build system. This is where dependencies can be found, downloaded, and installed to the project build script.

Specified by:
addRepository in interface DependencyFacet

getRepositories

public List<DependencyRepository> getRepositories()
Description copied from interface: DependencyFacet
Get the list of repositories for which this project is currently configured to use in dependency resolution.

Specified by:
getRepositories in interface DependencyFacet

hasRepository

public boolean hasRepository(String url)
Description copied from interface: DependencyFacet
Return true if the given repository URL is already registered in this project's build system.

Specified by:
hasRepository in interface DependencyFacet

hasRepository

public boolean hasRepository(DependencyFacet.KnownRepository repository)
Description copied from interface: DependencyFacet
Return true if the given DependencyFacet.KnownRepository is already registered in this project's build system.

Specified by:
hasRepository in interface DependencyFacet

removeRepository

public DependencyRepository removeRepository(String url)
Description copied from interface: DependencyFacet
Remove the given DependencyRepository from the current project. Return true if the repository was removed; return false otherwise. Return the removed repository, or null if no repository was removed.

Specified by:
removeRepository in interface DependencyFacet

getDependenciesInScopes

public List<Dependency> getDependenciesInScopes(ScopeType... scopes)
Description copied from interface: DependencyFacet
Get a list of this Project's dependencies of the given ScopeType.. See also: DependencyBuilder. See also: #getDependency(Dependency).

Specified by:
getDependenciesInScopes in interface DependencyFacet

getEffectiveDependenciesInScopes

public List<Dependency> getEffectiveDependenciesInScopes(ScopeType... scopes)
Description copied from interface: DependencyFacet
Get a list of this Project's dependencies of the given ScopeType, from anywhere in the dependency hierarchy. See also: DependencyBuilder. See also: DependencyFacet.getEffectiveDependency(Dependency).

Specified by:
getEffectiveDependenciesInScopes in interface DependencyFacet

Forge - Parent 1.4.2-SNAPSHOT

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.