public class DefaultModuleDescriptor extends java.lang.Object implements ModuleDescriptor
CALLER_ALL_CONFIGURATION, DEFAULT_CONFIGURATION
Constructor and Description |
---|
DefaultModuleDescriptor(ModuleDescriptorParser parser,
Resource res)
IMPORTANT : at least call setModuleRevisionId and setResolvedPublicationDate with instances
created by this constructor !
|
DefaultModuleDescriptor(ModuleRevisionId id,
java.lang.String status,
java.util.Date pubDate) |
DefaultModuleDescriptor(ModuleRevisionId id,
java.lang.String status,
java.util.Date pubDate,
boolean isDefault) |
Modifier and Type | Method and Description |
---|---|
void |
addArtifact(java.lang.String conf,
Artifact artifact)
Artifact configurations are not used since added artifact may not be entirely completed, so
its configurations data may not be accurate
|
void |
addConfiguration(Configuration conf) |
void |
addConflictManager(ModuleId moduleId,
PatternMatcher matcher,
ConflictManager manager)
regular expressions as explained in Pattern class may be used in ModuleId organisation and
name
|
void |
addDependency(DependencyDescriptor dependency) |
void |
addDependencyDescriptorMediator(ModuleId moduleId,
PatternMatcher matcher,
DependencyDescriptorMediator ddm) |
void |
addExcludeRule(ExcludeRule rule) |
void |
addExtraAttributeNamespace(java.lang.String prefix,
java.lang.String namespace) |
void |
addExtraInfo(ExtraInfoHolder extraInfo) |
void |
addExtraInfo(java.lang.String infoKey,
java.lang.String value)
Deprecated.
|
void |
addInheritedDescriptor(ExtendsDescriptor descriptor) |
void |
addLicense(License license) |
boolean |
canExclude()
Returns true if this descriptor contains any exclusion rule
|
void |
check()
Throws an exception if the module descriptor is inconsistent For the moment, only extended
configurations existence and cycles are checked
|
boolean |
dependsOn(VersionMatcher matcher,
ModuleDescriptor md)
Returns true if the module described by this descriptor dependes directly upon the given
module descriptor
|
boolean |
doesExclude(java.lang.String[] moduleConfigurations,
ArtifactId artifactId)
only works when namespace is properly set.
|
boolean |
equals(java.lang.Object obj) |
Artifact[] |
getAllArtifacts()
Returns all artifacts of this module, excluding the artifact corresponding to the module
descriptor.
|
ModuleRules |
getAllDependencyDescriptorMediators()
Returns all the dependency descriptor mediators used by this
ModuleDescriptor , as an
instance of ModuleRules . |
ExcludeRule[] |
getAllExcludeRules()
Returns an array of all the exclude rules this module descriptor currently holds.
|
Artifact[] |
getArtifacts(java.lang.String conf) |
java.lang.String |
getAttribute(java.lang.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.
|
java.util.Map |
getAttributes()
Returns a Map of all attributes of this extendable item, including standard and extra ones.
|
Configuration |
getConfiguration(java.lang.String confName)
Returns the configuration object with the given name in the current module descriptor, null
if not found.
|
Configuration[] |
getConfigurations()
Returns all the configurations declared by this module as an array.
|
java.lang.String[] |
getConfigurationsNames() |
ConflictManager |
getConflictManager(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. |
java.lang.String |
getDefaultConf() |
java.lang.String |
getDefaultConfMapping() |
DependencyDescriptor[] |
getDependencies() |
java.lang.String |
getDescription() |
ExcludeRule[] |
getExcludeRules(java.lang.String[] moduleConfigurations) |
java.lang.String |
getExtraAttribute(java.lang.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)
|
java.util.Map |
getExtraAttributes()
Returns a Map of all extra attributes of this extendable item.
|
java.util.Map |
getExtraAttributesNamespaces()
Returns the list of xml namespaces used by extra attributes, as Map from prefix to namespace
URIs.
|
java.util.Map<java.lang.String,java.lang.String> |
getExtraInfo()
Deprecated.
|
ExtraInfoHolder |
getExtraInfoByTagName(java.lang.String tagName)
Returns first extrainfo matching with given tag name
|
java.lang.String |
getExtraInfoContentByTagName(java.lang.String tagName)
Returns content from first extrainfo matching with given tag name
|
java.util.List<ExtraInfoHolder> |
getExtraInfos()
Returns a list of extras infos (tag name, attributes and content).
|
java.lang.String |
getHomePage() |
ExtendsDescriptor[] |
getInheritedDescriptors()
Get the list of parent descriptors imported via an <extends> element.
|
long |
getLastModified() |
License[] |
getLicenses()
Returns the licenses of the module described by this descriptor
|
Artifact |
getMetadataArtifact()
Returns the Artifact representing this module descriptor itself.
|
ModuleRevisionId |
getModuleRevisionId() |
Namespace |
getNamespace() |
ModuleDescriptorParser |
getParser()
The ModuleDescriptorParser used to parse this module descriptor, null is no parser was used.
|
java.util.Date |
getPublicationDate()
May be
null if unknown in the descriptor itself. |
java.lang.String[] |
getPublicConfigurationsNames() |
java.util.Map |
getQualifiedExtraAttributes()
Returns a Map of all extra attributes of this extendable item.
|
ModuleRevisionId |
getResolvedModuleRevisionId()
The module revision id returned here is the resolved one, i.e.
|
java.util.Date |
getResolvedPublicationDate()
The publication date of the module revision should be the date at which it has been
published, i.e.
|
Resource |
getResource()
The resource being the source of this module descriptor, null if no resource corresponds to
this module descriptor
|
java.lang.String |
getRevision() |
java.lang.String |
getStatus() |
int |
hashCode() |
boolean |
isDefault()
Returns true if this descriptor is a default one, i.e.
|
boolean |
isMappingOverride() |
boolean |
isNamespaceUseful() |
DependencyDescriptor |
mediate(DependencyDescriptor dd)
Mediates the given
DependencyDescriptor according to this ModuleDescriptor . |
static DefaultModuleDescriptor |
newBasicInstance(ModuleRevisionId mrid,
java.util.Date publicationDate) |
static DefaultModuleDescriptor |
newCallerInstance(ModuleRevisionId[] mrid,
boolean transitive,
boolean changing) |
static DefaultModuleDescriptor |
newCallerInstance(ModuleRevisionId mrid,
java.lang.String[] confs,
boolean transitive,
boolean changing) |
static DefaultModuleDescriptor |
newDefaultInstance(ModuleRevisionId mrid) |
static DefaultModuleDescriptor |
newDefaultInstance(ModuleRevisionId mrid,
DependencyArtifactDescriptor[] artifacts) |
void |
setDefault(boolean b) |
void |
setDefaultConf(java.lang.String defaultConf) |
void |
setDefaultConfMapping(java.lang.String defaultConfMapping) |
void |
setDescription(java.lang.String description) |
void |
setHomePage(java.lang.String homePage) |
void |
setLastModified(long lastModified) |
void |
setMappingOverride(boolean override) |
void |
setModuleArtifact(Artifact moduleArtifact) |
void |
setModuleRevisionId(ModuleRevisionId revId) |
void |
setNamespace(Namespace ns) |
void |
setPublicationDate(java.util.Date publicationDate) |
void |
setResolvedModuleRevisionId(ModuleRevisionId revId)
This method update the resolved module revision id
|
void |
setResolvedPublicationDate(java.util.Date publicationDate)
This method update the resolved publication date
|
void |
setStatus(java.lang.String status) |
void |
toIvyFile(java.io.File destFile)
Writes this module descriptor as an ivy file.
|
java.lang.String |
toString() |
static ModuleDescriptor |
transformInstance(ModuleDescriptor md,
Namespace ns)
Transforms the given module descriptor of the given namespace and return a new module
descriptor in the system namespace.
|
public DefaultModuleDescriptor(ModuleRevisionId id, java.lang.String status, java.util.Date pubDate)
public DefaultModuleDescriptor(ModuleRevisionId id, java.lang.String status, java.util.Date pubDate, boolean isDefault)
public DefaultModuleDescriptor(ModuleDescriptorParser parser, Resource res)
public static DefaultModuleDescriptor newDefaultInstance(ModuleRevisionId mrid)
public static DefaultModuleDescriptor newCallerInstance(ModuleRevisionId mrid, java.lang.String[] confs, boolean transitive, boolean changing)
public static DefaultModuleDescriptor newCallerInstance(ModuleRevisionId[] mrid, boolean transitive, boolean changing)
public static DefaultModuleDescriptor newDefaultInstance(ModuleRevisionId mrid, DependencyArtifactDescriptor[] artifacts)
public static DefaultModuleDescriptor newBasicInstance(ModuleRevisionId mrid, java.util.Date publicationDate)
public static ModuleDescriptor transformInstance(ModuleDescriptor md, Namespace ns)
md
- ns
- public Artifact getMetadataArtifact()
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.
getMetadataArtifact
in interface ModuleDescriptor
public void setModuleArtifact(Artifact moduleArtifact)
public boolean isDefault()
ModuleDescriptor
isDefault
in interface ModuleDescriptor
public void setPublicationDate(java.util.Date publicationDate)
public java.util.Date getPublicationDate()
ModuleDescriptor
null
if unknown in the descriptor itself.getPublicationDate
in interface ModuleDescriptor
null
when not knwon.public void setResolvedPublicationDate(java.util.Date publicationDate)
ModuleDescriptor
setResolvedPublicationDate
in interface ModuleDescriptor
public java.util.Date getResolvedPublicationDate()
ModuleDescriptor
getResolvedPublicationDate
in interface ModuleDescriptor
public java.lang.String getRevision()
getRevision
in interface ArtifactInfo
public void setModuleRevisionId(ModuleRevisionId revId)
public void setResolvedModuleRevisionId(ModuleRevisionId revId)
ModuleDescriptor
setResolvedModuleRevisionId
in interface ModuleDescriptor
public void setStatus(java.lang.String status)
public void addInheritedDescriptor(ExtendsDescriptor descriptor)
public void addDependency(DependencyDescriptor dependency)
public void addConfiguration(Configuration conf)
public void addArtifact(java.lang.String conf, Artifact artifact)
conf
- artifact
- public ModuleRevisionId getModuleRevisionId()
getModuleRevisionId
in interface ModuleDescriptor
public ModuleRevisionId getResolvedModuleRevisionId()
ModuleDescriptor
getResolvedModuleRevisionId
in interface ModuleDescriptor
public java.lang.String getStatus()
getStatus
in interface ModuleDescriptor
public ExtendsDescriptor[] getInheritedDescriptors()
ModuleDescriptor
getInheritedDescriptors
in interface ModuleDescriptor
public Configuration[] getConfigurations()
ModuleDescriptor
getConfigurations
in interface ModuleDescriptor
public java.lang.String[] getConfigurationsNames()
getConfigurationsNames
in interface ModuleDescriptor
public java.lang.String[] getPublicConfigurationsNames()
getPublicConfigurationsNames
in interface ModuleDescriptor
public Configuration getConfiguration(java.lang.String confName)
getConfiguration
in interface ModuleDescriptor
public Artifact[] getArtifacts(java.lang.String conf)
getArtifacts
in interface ModuleDescriptor
public Artifact[] getAllArtifacts()
ModuleDescriptor
getAllArtifacts
in interface ModuleDescriptor
ModuleDescriptor.getMetadataArtifact()
public DependencyDescriptor[] getDependencies()
getDependencies
in interface ModuleDescriptor
public boolean dependsOn(VersionMatcher matcher, ModuleDescriptor md)
ModuleDescriptor
dependsOn
in interface ModuleDescriptor
public void toIvyFile(java.io.File destFile) throws java.text.ParseException, java.io.IOException
ModuleDescriptor
toIvyFile
in interface ModuleDescriptor
destFile
- the destination ivy filejava.text.ParseException
java.io.IOException
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public void setDefault(boolean b)
public void addConflictManager(ModuleId moduleId, PatternMatcher matcher, ConflictManager manager)
moduleId
- matcher
- resolverName
- public ConflictManager getConflictManager(ModuleId moduleId)
ModuleDescriptor
null
if no
specific conflict manager is associated with the given module id in this module descriptor.getConflictManager
in interface ModuleDescriptor
public void addDependencyDescriptorMediator(ModuleId moduleId, PatternMatcher matcher, DependencyDescriptorMediator ddm)
public DependencyDescriptor mediate(DependencyDescriptor dd)
DependencyDescriptorMediator
DependencyDescriptor
according to this ModuleDescriptor
.
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.
mediate
in interface DependencyDescriptorMediator
dd
- the dependency descriptor which should be mediated.DependencyDescriptor
, or the original
DependencyDescriptor
if no mediation is required by this ModuleDescriptor.public ModuleRules getAllDependencyDescriptorMediators()
ModuleDescriptor
ModuleDescriptor
, as an
instance of ModuleRules
.
All rules in the ModuleRules
object returned are DependencyDescriptorMediator
.
getAllDependencyDescriptorMediators
in interface ModuleDescriptor
ModuleDescriptor
.public void addLicense(License license)
public License[] getLicenses()
ModuleDescriptor
getLicenses
in interface ModuleDescriptor
public java.lang.String getHomePage()
getHomePage
in interface ModuleDescriptor
public void setHomePage(java.lang.String homePage)
public java.lang.String getDescription()
getDescription
in interface ModuleDescriptor
public void setDescription(java.lang.String description)
public long getLastModified()
getLastModified
in interface ModuleDescriptor
getLastModified
in interface ArtifactInfo
public void setLastModified(long lastModified)
public Namespace getNamespace()
public boolean isNamespaceUseful()
public void setNamespace(Namespace ns)
public void check()
public java.lang.String getDefaultConf()
public void setDefaultConf(java.lang.String defaultConf)
public java.lang.String getDefaultConfMapping()
public void setDefaultConfMapping(java.lang.String defaultConfMapping)
public void setMappingOverride(boolean override)
public boolean isMappingOverride()
public java.lang.String getAttribute(java.lang.String attName)
ExtendableItem
getAttribute
in interface ExtendableItem
attName
- the name of the attribute to getpublic java.util.Map getAttributes()
ExtendableItem
getAttributes
in interface ExtendableItem
public java.lang.String getExtraAttribute(java.lang.String attName)
ExtendableItem
getExtraAttribute
in interface ExtendableItem
attName
- the name of the extra attribute to get. This name can be either qualified or
unqualified.public java.util.Map getExtraAttributes()
ExtendableItem
getExtraAttributes
in interface ExtendableItem
ExtendableItem.getQualifiedExtraAttributes()
public java.util.Map getQualifiedExtraAttributes()
ExtendableItem
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
getQualifiedExtraAttributes
in interface ExtendableItem
ExtendableItem.getExtraAttributes()
public ModuleDescriptorParser getParser()
ModuleDescriptor
getParser
in interface ModuleDescriptor
public Resource getResource()
ModuleDescriptor
getResource
in interface ModuleDescriptor
public void addExcludeRule(ExcludeRule rule)
public boolean canExclude()
ModuleDescriptor
canExclude
in interface ModuleDescriptor
public boolean doesExclude(java.lang.String[] moduleConfigurations, ArtifactId artifactId)
doesExclude
in interface ModuleDescriptor
public ExcludeRule[] getAllExcludeRules()
ModuleDescriptor
getAllExcludeRules
in interface ModuleDescriptor
ExcludeRule
this module descriptor holdspublic ExcludeRule[] getExcludeRules(java.lang.String[] moduleConfigurations)
public java.util.Map getExtraAttributesNamespaces()
ModuleDescriptor
The returned list is never null
, it is empty when no extra attribute is used or
if extra attributes are used without xml namespaces
getExtraAttributesNamespaces
in interface ModuleDescriptor
public void addExtraAttributeNamespace(java.lang.String prefix, java.lang.String namespace)
@Deprecated public void addExtraInfo(java.lang.String infoKey, java.lang.String value)
@Deprecated public java.util.Map<java.lang.String,java.lang.String> getExtraInfo()
ModuleDescriptor
getExtraInfo
in interface ModuleDescriptor
public java.util.List<ExtraInfoHolder> getExtraInfos()
ModuleDescriptor
getExtraInfos
in interface ModuleDescriptor
public void addExtraInfo(ExtraInfoHolder extraInfo)
public java.lang.String getExtraInfoContentByTagName(java.lang.String tagName)
ModuleDescriptor
getExtraInfoContentByTagName
in interface ModuleDescriptor
public ExtraInfoHolder getExtraInfoByTagName(java.lang.String tagName)
ModuleDescriptor
getExtraInfoByTagName
in interface ModuleDescriptor