Class DefaultModuleDescriptor
java.lang.Object
org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor
- All Implemented Interfaces:
DependencyDescriptorMediator
,ModuleDescriptor
,ArtifactInfo
,ExtendableItem
- Direct Known Subclasses:
DefaultWorkspaceModuleDescriptor
,PomModuleDescriptorBuilder.PomModuleDescriptor
-
Field Summary
Fields inherited from interface org.apache.ivy.core.module.descriptor.ModuleDescriptor
CALLER_ALL_CONFIGURATION, DEFAULT_CONFIGURATION
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultModuleDescriptor
(ModuleRevisionId id, String status, Date pubDate) DefaultModuleDescriptor
(ModuleRevisionId id, String status, Date pubDate, boolean isDefault) DefaultModuleDescriptor
(ModuleDescriptorParser parser, Resource res) IMPORTANT : at least call setModuleRevisionId and setResolvedPublicationDate with instances created by this constructor ! -
Method Summary
Modifier and TypeMethodDescriptionvoid
addArtifact
(String conf, Artifact artifact) Artifact configurations are not used since added artifact may not be entirely completed, so its configurations data may not be accuratevoid
void
addConflictManager
(ModuleId moduleId, PatternMatcher matcher, ConflictManager manager) regular expressions as explained in Pattern class may be used in ModuleId organisation and namevoid
addDependency
(DependencyDescriptor dependency) void
addDependencyDescriptorMediator
(ModuleId moduleId, PatternMatcher matcher, DependencyDescriptorMediator ddm) void
addExcludeRule
(ExcludeRule rule) void
addExtraAttributeNamespace
(String prefix, String namespace) void
addExtraInfo
(String infoKey, String value) Deprecated.void
addExtraInfo
(ExtraInfoHolder extraInfo) void
addInheritedDescriptor
(ExtendsDescriptor descriptor) void
addLicense
(License license) boolean
void
check()
Throws an exception if the module descriptor is inconsistent.boolean
dependsOn
(VersionMatcher matcher, ModuleDescriptor md) boolean
doesExclude
(String[] moduleConfigurations, ArtifactId artifactId) Only works when namespace is properly set.boolean
Artifact[]
Module Descriptor exclude rules are used to exclude (usually transitive) dependencies for the whole module.Artifact[]
getArtifacts
(String conf) getAttribute
(String attName) Gets the value of an attribute Can be used to access the value of a standard attribute (like organisation, revision) or of an extra attribute.Returns a Map of all attributes of this extendable item, including standard and extra ones.getConfiguration
(String confName) String[]
getConflictManager
(ModuleId moduleId) getExcludeRules
(String[] moduleConfigurations) getExtraAttribute
(String attName) Gets the value of an extra attribute Can be used only to access the value of an extra attribute, not a standard one (like organisation, revision)Returns a Map of all extra attributes of this extendable item.Deprecated.getExtraInfoByTagName
(String tagName) getExtraInfoContentByTagName
(String tagName) long
License[]
Even though the module descriptor is never described as a published artifact of a module in the module descriptor itself, it is often useful to consider it as any other artifact of the module.String[]
Returns a Map of all extra attributes of this extendable item.The publication date of the module revision should be the date at which it has been published, i.e.int
hashCode()
boolean
boolean
boolean
Mediates the givenDependencyDescriptor
according to thisModuleDescriptor
.static DefaultModuleDescriptor
newBasicInstance
(ModuleRevisionId mrid, Date publicationDate) static DefaultModuleDescriptor
newCallerInstance
(ModuleRevisionId[] mrids, boolean transitive, boolean changing) static DefaultModuleDescriptor
newCallerInstance
(ModuleRevisionId mrid, String[] confs, boolean transitive, boolean changing) static DefaultModuleDescriptor
static DefaultModuleDescriptor
newDefaultInstance
(ModuleRevisionId mrid, DependencyArtifactDescriptor[] artifacts) void
setDefault
(boolean b) void
setDefaultConf
(String defaultConf) void
setDefaultConfMapping
(String defaultConfMapping) void
setDescription
(String description) void
setHomePage
(String homePage) void
setLastModified
(long lastModified) void
setMappingOverride
(boolean override) void
setModuleArtifact
(Artifact moduleArtifact) void
void
void
setPublicationDate
(Date publicationDate) void
This method updates the resolved module revision idvoid
setResolvedPublicationDate
(Date publicationDate) This method update the resolved publication datevoid
void
Writes this module descriptor as an ivy file.toString()
static ModuleDescriptor
Transforms the given module descriptor of the given namespace and return a new module descriptor in the system namespace.
-
Constructor Details
-
DefaultModuleDescriptor
-
DefaultModuleDescriptor
-
DefaultModuleDescriptor
IMPORTANT : at least call setModuleRevisionId and setResolvedPublicationDate with instances created by this constructor !- Parameters:
parser
- ModuleDescriptorParserres
- Resource
-
-
Method Details
-
newDefaultInstance
-
newCallerInstance
public static DefaultModuleDescriptor newCallerInstance(ModuleRevisionId mrid, String[] confs, boolean transitive, boolean changing) -
newCallerInstance
public static DefaultModuleDescriptor newCallerInstance(ModuleRevisionId[] mrids, boolean transitive, boolean changing) -
newDefaultInstance
public static DefaultModuleDescriptor newDefaultInstance(ModuleRevisionId mrid, DependencyArtifactDescriptor[] artifacts) -
newBasicInstance
-
transformInstance
Transforms the given module descriptor of the given namespace and return a new module descriptor in the system namespace. Note that dependency exclude rules are not converted in system namespace, because they aren't transformable (the namespace lacks the ability to convert regular expressions)- Parameters:
md
- ModuleDescriptorns
- Namespace- Returns:
- ModuleDescriptor
-
getMetadataArtifact
Description copied from interface:ModuleDescriptor
Even though the module descriptor is never described as a published artifact of a module in the module descriptor itself, it is often useful to consider it as any other artifact of the module. This method allows to access to the Artifact object representing this module descriptor for this purpose.- Specified by:
getMetadataArtifact
in interfaceModuleDescriptor
- Returns:
- the Artifact representing this module descriptor itself.
-
setModuleArtifact
-
isDefault
public boolean isDefault()- Specified by:
isDefault
in interfaceModuleDescriptor
- Returns:
- true if this descriptor is a default one, i.e. one generated for a module not actually having one.
-
setPublicationDate
-
getPublicationDate
- Specified by:
getPublicationDate
in interfaceModuleDescriptor
- Returns:
- the publication date or null when not known in the descriptor itself.
-
setResolvedPublicationDate
Description copied from interface:ModuleDescriptor
This method update the resolved publication date- Specified by:
setResolvedPublicationDate
in interfaceModuleDescriptor
- Parameters:
publicationDate
- Date
-
getResolvedPublicationDate
Description copied from interface:ModuleDescriptor
The publication date of the module revision should be the date at which it has been published, i.e. in general the date of any of its published artifacts, since all published artifact of a module should follow the same publishing cycle.- Specified by:
getResolvedPublicationDate
in interfaceModuleDescriptor
- Returns:
- Date
-
getRevision
- Specified by:
getRevision
in interfaceArtifactInfo
-
setModuleRevisionId
-
setResolvedModuleRevisionId
Description copied from interface:ModuleDescriptor
This method updates the resolved module revision id- Specified by:
setResolvedModuleRevisionId
in interfaceModuleDescriptor
- Parameters:
revId
- ModuleRevisionId
-
setStatus
-
addInheritedDescriptor
-
addDependency
-
addConfiguration
-
addArtifact
Artifact configurations are not used since added artifact may not be entirely completed, so its configurations data may not be accurate- Parameters:
conf
- dittoartifact
- ditto
-
getModuleRevisionId
- Specified by:
getModuleRevisionId
in interfaceModuleDescriptor
-
getResolvedModuleRevisionId
- Specified by:
getResolvedModuleRevisionId
in interfaceModuleDescriptor
- Returns:
- the resolved module revision id; it is never the latest one. If the revision has not been resolved, a null revision should be returned by getRevision() of the returned ModuleRevisionId. This revision must be the same as the module descriptor resolved revision id unless no module descriptor is defined
-
getStatus
- Specified by:
getStatus
in interfaceModuleDescriptor
-
getInheritedDescriptors
- Specified by:
getInheritedDescriptors
in interfaceModuleDescriptor
- Returns:
- the list of parent descriptors imported via an <extends> element. Only directly imported descriptors are included; the parent's parents are not included.
-
getConfigurations
- Specified by:
getConfigurations
in interfaceModuleDescriptor
- Returns:
- all the configurations declared by this module as an array. This array is never empty (a 'default' conf is assumed when none is declared in the ivy file).
-
getConfigurationsNames
- Specified by:
getConfigurationsNames
in interfaceModuleDescriptor
-
getPublicConfigurationsNames
- Specified by:
getPublicConfigurationsNames
in interfaceModuleDescriptor
-
getConfiguration
- Specified by:
getConfiguration
in interfaceModuleDescriptor
- Parameters:
confName
- String- Returns:
- the configuration object with the given name in the current module descriptor, null if not found.
-
getArtifacts
- Specified by:
getArtifacts
in interfaceModuleDescriptor
-
getAllArtifacts
- Specified by:
getAllArtifacts
in interfaceModuleDescriptor
- Returns:
- all published artifacts of this module, excluding the artifact corresponding to the module descriptor.
- See Also:
-
getDependencies
- Specified by:
getDependencies
in interfaceModuleDescriptor
- Returns:
- The dependencies of the module. If there are no dependencies return an empty array (non null)
-
dependsOn
- Specified by:
dependsOn
in interfaceModuleDescriptor
- Parameters:
matcher
- VersionMatchermd
- ModuleDescriptor- Returns:
- true if the module described by this descriptor depends directly upon the given module descriptor
-
toIvyFile
Description copied from interface:ModuleDescriptor
Writes this module descriptor as an ivy file. If this descriptor was obtained through the parsing of an ivy file, it should keep the layout of the file the most possible similar to the original one.- Specified by:
toIvyFile
in interfaceModuleDescriptor
- Parameters:
destFile
- the destination ivy file- Throws:
ParseException
- if something goes wrongIOException
- if something goes wrong
-
hashCode
public int hashCode() -
equals
-
toString
-
setDefault
public void setDefault(boolean b) -
addConflictManager
regular expressions as explained in Pattern class may be used in ModuleId organisation and name- Parameters:
moduleId
- dittomatcher
- PatternMatchermanager
- ConflictManager
-
getConflictManager
- Specified by:
getConflictManager
in interfaceModuleDescriptor
- Parameters:
moduleId
- ModuleId- Returns:
- the conflict manager to use for the given ModuleId, or null if no specific conflict manager is associated with the given module id in this module descriptor.
-
addDependencyDescriptorMediator
public void addDependencyDescriptorMediator(ModuleId moduleId, PatternMatcher matcher, DependencyDescriptorMediator ddm) -
mediate
Description copied from interface:DependencyDescriptorMediator
Mediates the givenDependencyDescriptor
according to thisModuleDescriptor
.This method gives the opportunity to a ModuleDescriptor to override dependency version information of any of its transitive dependencies, since it is called by dependency resolvers before actually resolving a dependency.
- Specified by:
mediate
in interfaceDependencyDescriptorMediator
- Parameters:
dd
- the dependency descriptor which should be mediated.- Returns:
- the mediated
DependencyDescriptor
, or the originalDependencyDescriptor
if no mediation is required by this ModuleDescriptor.
-
getAllDependencyDescriptorMediators
- Specified by:
getAllDependencyDescriptorMediators
in interfaceModuleDescriptor
- Returns:
- all the
DependencyDescriptorMediator
s used by thisModuleDescriptor
, as an instance ofModuleRules
.
-
addLicense
-
getLicenses
- Specified by:
getLicenses
in interfaceModuleDescriptor
- Returns:
- the licenses of the module described by this descriptor
-
getHomePage
- Specified by:
getHomePage
in interfaceModuleDescriptor
-
setHomePage
-
getDescription
- Specified by:
getDescription
in interfaceModuleDescriptor
-
setDescription
-
getLastModified
public long getLastModified()- Specified by:
getLastModified
in interfaceArtifactInfo
- Specified by:
getLastModified
in interfaceModuleDescriptor
-
setLastModified
public void setLastModified(long lastModified) -
getNamespace
-
isNamespaceUseful
public boolean isNamespaceUseful() -
setNamespace
-
check
public void check()Throws an exception if the module descriptor is inconsistent. For the moment, only extended configurations existence and cycles are checked -
getDefaultConf
-
setDefaultConf
-
getDefaultConfMapping
-
setDefaultConfMapping
-
setMappingOverride
public void setMappingOverride(boolean override) -
isMappingOverride
public boolean isMappingOverride() -
getAttribute
Description copied from interface:ExtendableItem
Gets the value of an attribute Can be used to access the value of a standard attribute (like organisation, revision) or of an extra attribute.- Specified by:
getAttribute
in interfaceExtendableItem
- Parameters:
attName
- the name of the attribute to get- Returns:
- the value of the attribute, null if the attribute doesn't exist
-
getAttributes
Description copied from interface:ExtendableItem
Returns a Map of all attributes of this extendable item, including standard and extra ones. The Map keys are attribute names as Strings, and values are corresponding attribute values (as String too). Extra attributes are included in unqualified form only.- Specified by:
getAttributes
in interfaceExtendableItem
- Returns:
- A Map instance containing all the attributes and their values.
-
getExtraAttribute
Description copied from interface:ExtendableItem
Gets the value of an extra attribute Can be used only to access the value of an extra attribute, not a standard one (like organisation, revision)- Specified by:
getExtraAttribute
in interfaceExtendableItem
- Parameters:
attName
- the name of the extra attribute to get. This name can be either qualified or unqualified.- Returns:
- the value of the attribute, null if the attribute doesn't exist
-
getExtraAttributes
Description copied from interface:ExtendableItem
Returns a Map of all extra attributes of this extendable item. The Map keys are unqualified attribute names as Strings, and values are corresponding attribute values (as String too)- Specified by:
getExtraAttributes
in interfaceExtendableItem
- Returns:
- A Map instance containing all the extra attributes and their values.
- See Also:
-
getQualifiedExtraAttributes
Description copied from interface:ExtendableItem
Returns a Map of all extra attributes of this extendable item.The Map keys are qualified attribute names as Strings, and values are corresponding attribute values (as String too).
An attribute name is qualified with a namespace exactly the same way xml attributes are qualified. Thus qualified attribute names are of the form
prefix:name
- Specified by:
getQualifiedExtraAttributes
in interfaceExtendableItem
- Returns:
- A Map instance containing all the extra attributes and their values.
- See Also:
-
getParser
- Specified by:
getParser
in interfaceModuleDescriptor
- Returns:
- the ModuleDescriptorParser used to parse this module descriptor, null is no parser was used.
-
getResource
- Specified by:
getResource
in interfaceModuleDescriptor
- Returns:
- the resource being the source of this module descriptor, null if no resource corresponds to this module descriptor.
-
addExcludeRule
-
canExclude
public boolean canExclude()- Specified by:
canExclude
in interfaceModuleDescriptor
- Returns:
- true if this descriptor contains any exclusion rule.
-
doesExclude
Only works when namespace is properly set. The behaviour is not specified if namespace is not set.- Specified by:
doesExclude
in interfaceModuleDescriptor
- Parameters:
moduleConfigurations
- String[]artifactId
- ditto- Returns:
- boolean
-
getAllExcludeRules
Description copied from interface:ModuleDescriptor
Module Descriptor exclude rules are used to exclude (usually transitive) dependencies for the whole module.- Specified by:
getAllExcludeRules
in interfaceModuleDescriptor
- Returns:
- an array of all
ExcludeRule
this module descriptor currently holds.
-
getExcludeRules
-
getExtraAttributesNamespaces
- Specified by:
getExtraAttributesNamespaces
in interfaceModuleDescriptor
- Returns:
- the list of xml namespaces used by extra attributes, as Map from prefix to namespace URIs. The returned list is never null, it is empty when no extra attribute is used or if extra attributes are used without xml namespaces
-
addExtraAttributeNamespace
-
addExtraInfo
Deprecated. -
getExtraInfo
Deprecated.- Specified by:
getExtraInfo
in interfaceModuleDescriptor
- Returns:
- the custom info provided in the info tag. All the tags except the description are given. The key is the name of the tag, the value is its content.
-
getExtraInfos
- Specified by:
getExtraInfos
in interfaceModuleDescriptor
- Returns:
- a list of extras infos (tag name, attributes and content). All the tags except the description are given.
-
addExtraInfo
-
getExtraInfoContentByTagName
- Specified by:
getExtraInfoContentByTagName
in interfaceModuleDescriptor
- Parameters:
tagName
- String- Returns:
- content from first extrainfo matching with given tag name.
-
getExtraInfoByTagName
- Specified by:
getExtraInfoByTagName
in interfaceModuleDescriptor
- Parameters:
tagName
- String- Returns:
- first extrainfo matching with given tag name.
-