org.apache.ivy.core.module.descriptor

Class DefaultDependencyDescriptor

public class DefaultDependencyDescriptor extends Object implements DependencyDescriptor

This class can be used as the default implementation for DependencyDescriptor. It implements required methods and enables to fill dependency information with the addDependencyConfiguration method.
Constructor Summary
DefaultDependencyDescriptor(ModuleDescriptor md, ModuleRevisionId mrid, boolean force, boolean changing, boolean transitive)
DefaultDependencyDescriptor(ModuleRevisionId mrid, boolean force)
DefaultDependencyDescriptor(ModuleRevisionId mrid, boolean force, boolean changing)
DefaultDependencyDescriptor(ModuleDescriptor md, ModuleRevisionId mrid, ModuleRevisionId dynamicConstraint, boolean force, boolean changing, boolean transitive)
Method Summary
voidaddDependencyArtifact(String masterConf, DependencyArtifactDescriptor dad)
voidaddDependencyConfiguration(String masterConf, String depConf)
voidaddExcludeRule(String masterConf, ExcludeRule rule)
voidaddIncludeRule(String masterConf, IncludeRule rule)
DependencyDescriptorasSystem()
booleancanExclude()
Returns true if this descriptor contains any exclusion rule
DependencyDescriptorclone(ModuleRevisionId revision)
booleandoesExclude(String[] moduleConfigurations, ArtifactId artifactId)
only works when namespace is properly set.
DependencyArtifactDescriptor[]getAllDependencyArtifacts()
ExcludeRule[]getAllExcludeRules()
IncludeRule[]getAllIncludeRules()
StringgetAttribute(String attName)
MapgetAttributes()
DependencyArtifactDescriptor[]getDependencyArtifacts(String moduleConfiguration)
DependencyArtifactDescriptor[]getDependencyArtifacts(String[] moduleConfigurations)
String[]getDependencyConfigurations(String moduleConfiguration)
String[]getDependencyConfigurations(String moduleConfiguration, String requestedConfiguration)
Return the dependency configurations mapped to the given moduleConfiguration, actually resolved because of the given requestedConfiguration Usually requestedConfiguration and moduleConfiguration are the same, except when a conf extends another, then the moduleConfiguration is the configuration currently resolved (the extended one), and requestedConfiguration is the one actually requested initially (the extending one).
String[]getDependencyConfigurations(String[] moduleConfigurations)
ModuleIdgetDependencyId()
ModuleRevisionIdgetDependencyRevisionId()
ModuleRevisionIdgetDynamicConstraintDependencyRevisionId()
ExcludeRule[]getExcludeRules(String moduleConfiguration)
ExcludeRule[]getExcludeRules(String[] moduleConfigurations)
StringgetExtraAttribute(String attName)
MapgetExtraAttributes()
IncludeRule[]getIncludeRules(String moduleConfiguration)
IncludeRule[]getIncludeRules(String[] moduleConfigurations)
String[]getModuleConfigurations()
NamespacegetNamespace()
ModuleRevisionIdgetParentRevisionId()
MapgetQualifiedExtraAttributes()
booleanisChanging()
booleanisForce()
booleanisTransitive()
protected static StringreplaceFallbackConfigurationPattern(Pattern pattern, String conf, String moduleConfiguration)
Replaces fallback patterns with correct values if fallback pattern exists.
protected static StringreplaceSelfFallbackPattern(String conf, String moduleConfiguration)
protected static StringreplaceThisFallbackPattern(String conf, String requestedConfiguration)
StringtoString()
static DependencyDescriptortransformInstance(DependencyDescriptor dd, Namespace ns)
Transforms the given dependency descriptor of the given namespace and return a new dependency descriptor in the system namespace.
static DefaultDependencyDescriptortransformInstance(DependencyDescriptor dd, NamespaceTransformer t, boolean fromSystem)
Transforms a dependency descriptor using the given transformer.

Constructor Detail

DefaultDependencyDescriptor

public DefaultDependencyDescriptor(ModuleDescriptor md, ModuleRevisionId mrid, boolean force, boolean changing, boolean transitive)

DefaultDependencyDescriptor

public DefaultDependencyDescriptor(ModuleRevisionId mrid, boolean force)

DefaultDependencyDescriptor

public DefaultDependencyDescriptor(ModuleRevisionId mrid, boolean force, boolean changing)

DefaultDependencyDescriptor

public DefaultDependencyDescriptor(ModuleDescriptor md, ModuleRevisionId mrid, ModuleRevisionId dynamicConstraint, boolean force, boolean changing, boolean transitive)

Method Detail

addDependencyArtifact

public void addDependencyArtifact(String masterConf, DependencyArtifactDescriptor dad)

addDependencyConfiguration

public void addDependencyConfiguration(String masterConf, String depConf)

addExcludeRule

public void addExcludeRule(String masterConf, ExcludeRule rule)

addIncludeRule

public void addIncludeRule(String masterConf, IncludeRule rule)

asSystem

public DependencyDescriptor asSystem()

canExclude

public boolean canExclude()
Returns true if this descriptor contains any exclusion rule

Returns:

clone

public DependencyDescriptor clone(ModuleRevisionId revision)

doesExclude

public boolean doesExclude(String[] moduleConfigurations, ArtifactId artifactId)
only works when namespace is properly set. The behaviour is not specified if namespace is not set

getAllDependencyArtifacts

public DependencyArtifactDescriptor[] getAllDependencyArtifacts()

getAllExcludeRules

public ExcludeRule[] getAllExcludeRules()

getAllIncludeRules

public IncludeRule[] getAllIncludeRules()

getAttribute

public String getAttribute(String attName)

getAttributes

public Map getAttributes()

getDependencyArtifacts

public DependencyArtifactDescriptor[] getDependencyArtifacts(String moduleConfiguration)

getDependencyArtifacts

public DependencyArtifactDescriptor[] getDependencyArtifacts(String[] moduleConfigurations)

getDependencyConfigurations

public String[] getDependencyConfigurations(String moduleConfiguration)

getDependencyConfigurations

public String[] getDependencyConfigurations(String moduleConfiguration, String requestedConfiguration)
Return the dependency configurations mapped to the given moduleConfiguration, actually resolved because of the given requestedConfiguration Usually requestedConfiguration and moduleConfiguration are the same, except when a conf extends another, then the moduleConfiguration is the configuration currently resolved (the extended one), and requestedConfiguration is the one actually requested initially (the extending one). Both moduleConfiguration and requestedConfiguration are configurations of the caller, the array returned is composed of the required configurations of the dependency described by this descriptor.

getDependencyConfigurations

public String[] getDependencyConfigurations(String[] moduleConfigurations)

getDependencyId

public ModuleId getDependencyId()

getDependencyRevisionId

public ModuleRevisionId getDependencyRevisionId()

getDynamicConstraintDependencyRevisionId

public ModuleRevisionId getDynamicConstraintDependencyRevisionId()

getExcludeRules

public ExcludeRule[] getExcludeRules(String moduleConfiguration)

getExcludeRules

public ExcludeRule[] getExcludeRules(String[] moduleConfigurations)

getExtraAttribute

public String getExtraAttribute(String attName)

getExtraAttributes

public Map getExtraAttributes()

getIncludeRules

public IncludeRule[] getIncludeRules(String moduleConfiguration)

getIncludeRules

public IncludeRule[] getIncludeRules(String[] moduleConfigurations)

getModuleConfigurations

public String[] getModuleConfigurations()

getNamespace

public Namespace getNamespace()

getParentRevisionId

public ModuleRevisionId getParentRevisionId()

getQualifiedExtraAttributes

public Map getQualifiedExtraAttributes()

isChanging

public boolean isChanging()

isForce

public boolean isForce()

isTransitive

public boolean isTransitive()

replaceFallbackConfigurationPattern

protected static String replaceFallbackConfigurationPattern(Pattern pattern, String conf, String moduleConfiguration)
Replaces fallback patterns with correct values if fallback pattern exists.

Parameters: pattern pattern to look for conf configuration mapping from dependency element moduleConfiguration module's configuration to use for replacement

Returns: Replaced string if pattern matched. Otherwise null.

replaceSelfFallbackPattern

protected static String replaceSelfFallbackPattern(String conf, String moduleConfiguration)

replaceThisFallbackPattern

protected static String replaceThisFallbackPattern(String conf, String requestedConfiguration)

toString

public String toString()

transformInstance

public static DependencyDescriptor transformInstance(DependencyDescriptor dd, Namespace ns)
Transforms the given dependency descriptor of the given namespace and return a new dependency descriptor in the system namespace. Note that exclude rules are not converted in system namespace, because they aren't transformable (the name space hasn't the ability to convert regular expressions). However, method doesExclude will work with system artifacts.

Parameters: dd ns

Returns:

transformInstance

public static DefaultDependencyDescriptor transformInstance(DependencyDescriptor dd, NamespaceTransformer t, boolean fromSystem)
Transforms a dependency descriptor using the given transformer. Note that no namespace info will be attached to the transformed dependency descriptor, so calling doesExclude is not recommended (doesExclude only works when namespace is properly set)

Parameters: dd t

Returns: