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. it is never a latest one.
|
java.util.Date |
getResolvedPublicationDate()
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.
|
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. one generated for a module not
actually having one.
|
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()
ModuleDescriptorEven 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 ModuleDescriptorpublic void setModuleArtifact(Artifact moduleArtifact)
public boolean isDefault()
ModuleDescriptorisDefault in interface ModuleDescriptorpublic void setPublicationDate(java.util.Date publicationDate)
public java.util.Date getPublicationDate()
ModuleDescriptornull if unknown in the descriptor itself.getPublicationDate in interface ModuleDescriptornull when not knwon.public void setResolvedPublicationDate(java.util.Date publicationDate)
ModuleDescriptorsetResolvedPublicationDate in interface ModuleDescriptorpublic java.util.Date getResolvedPublicationDate()
ModuleDescriptorgetResolvedPublicationDate in interface ModuleDescriptorpublic java.lang.String getRevision()
getRevision in interface ArtifactInfopublic void setModuleRevisionId(ModuleRevisionId revId)
public void setResolvedModuleRevisionId(ModuleRevisionId revId)
ModuleDescriptorsetResolvedModuleRevisionId in interface ModuleDescriptorpublic 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 ModuleDescriptorpublic ModuleRevisionId getResolvedModuleRevisionId()
ModuleDescriptorgetResolvedModuleRevisionId in interface ModuleDescriptorpublic java.lang.String getStatus()
getStatus in interface ModuleDescriptorpublic ExtendsDescriptor[] getInheritedDescriptors()
ModuleDescriptorgetInheritedDescriptors in interface ModuleDescriptorpublic Configuration[] getConfigurations()
ModuleDescriptorgetConfigurations in interface ModuleDescriptorpublic java.lang.String[] getConfigurationsNames()
getConfigurationsNames in interface ModuleDescriptorpublic java.lang.String[] getPublicConfigurationsNames()
getPublicConfigurationsNames in interface ModuleDescriptorpublic Configuration getConfiguration(java.lang.String confName)
getConfiguration in interface ModuleDescriptorpublic Artifact[] getArtifacts(java.lang.String conf)
getArtifacts in interface ModuleDescriptorpublic Artifact[] getAllArtifacts()
ModuleDescriptorgetAllArtifacts in interface ModuleDescriptorModuleDescriptor.getMetadataArtifact()public DependencyDescriptor[] getDependencies()
getDependencies in interface ModuleDescriptorpublic boolean dependsOn(VersionMatcher matcher, ModuleDescriptor md)
ModuleDescriptordependsOn in interface ModuleDescriptorpublic void toIvyFile(java.io.File destFile)
throws java.text.ParseException,
java.io.IOException
ModuleDescriptortoIvyFile in interface ModuleDescriptordestFile - the destination ivy filejava.text.ParseExceptionjava.io.IOExceptionpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic void setDefault(boolean b)
public void addConflictManager(ModuleId moduleId, PatternMatcher matcher, ConflictManager manager)
moduleId - matcher - resolverName - public ConflictManager getConflictManager(ModuleId moduleId)
ModuleDescriptornull if no
specific conflict manager is associated with the given module id in this module descriptor.getConflictManager in interface ModuleDescriptorpublic void addDependencyDescriptorMediator(ModuleId moduleId, PatternMatcher matcher, DependencyDescriptorMediator ddm)
public DependencyDescriptor mediate(DependencyDescriptor dd)
DependencyDescriptorMediatorDependencyDescriptor 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 DependencyDescriptorMediatordd - the dependency descriptor which should be mediated.DependencyDescriptor, or the original
DependencyDescriptor if no mediation is required by this ModuleDescriptor.public ModuleRules getAllDependencyDescriptorMediators()
ModuleDescriptorModuleDescriptor, as an
instance of ModuleRules.
All rules in the ModuleRules object returned are DependencyDescriptorMediator
.
getAllDependencyDescriptorMediators in interface ModuleDescriptorModuleDescriptor.public void addLicense(License license)
public License[] getLicenses()
ModuleDescriptorgetLicenses in interface ModuleDescriptorpublic java.lang.String getHomePage()
getHomePage in interface ModuleDescriptorpublic void setHomePage(java.lang.String homePage)
public java.lang.String getDescription()
getDescription in interface ModuleDescriptorpublic void setDescription(java.lang.String description)
public long getLastModified()
getLastModified in interface ModuleDescriptorgetLastModified in interface ArtifactInfopublic 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)
ExtendableItemgetAttribute in interface ExtendableItemattName - the name of the attribute to getpublic java.util.Map getAttributes()
ExtendableItemgetAttributes in interface ExtendableItempublic java.lang.String getExtraAttribute(java.lang.String attName)
ExtendableItemgetExtraAttribute in interface ExtendableItemattName - the name of the extra attribute to get. This name can be either qualified or
unqualified.public java.util.Map getExtraAttributes()
ExtendableItemgetExtraAttributes in interface ExtendableItemExtendableItem.getQualifiedExtraAttributes()public java.util.Map getQualifiedExtraAttributes()
ExtendableItemThe 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 ExtendableItemExtendableItem.getExtraAttributes()public ModuleDescriptorParser getParser()
ModuleDescriptorgetParser in interface ModuleDescriptorpublic Resource getResource()
ModuleDescriptorgetResource in interface ModuleDescriptorpublic void addExcludeRule(ExcludeRule rule)
public boolean canExclude()
ModuleDescriptorcanExclude in interface ModuleDescriptorpublic boolean doesExclude(java.lang.String[] moduleConfigurations,
ArtifactId artifactId)
doesExclude in interface ModuleDescriptorpublic ExcludeRule[] getAllExcludeRules()
ModuleDescriptorgetAllExcludeRules in interface ModuleDescriptorExcludeRule 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 ModuleDescriptorpublic 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()
ModuleDescriptorgetExtraInfo in interface ModuleDescriptorpublic java.util.List<ExtraInfoHolder> getExtraInfos()
ModuleDescriptorgetExtraInfos in interface ModuleDescriptorpublic void addExtraInfo(ExtraInfoHolder extraInfo)
public java.lang.String getExtraInfoContentByTagName(java.lang.String tagName)
ModuleDescriptorgetExtraInfoContentByTagName in interface ModuleDescriptorpublic ExtraInfoHolder getExtraInfoByTagName(java.lang.String tagName)
ModuleDescriptorgetExtraInfoByTagName in interface ModuleDescriptor