Class DefaultModuleDescriptor

    • Constructor Detail

      • DefaultModuleDescriptor

        public DefaultModuleDescriptor​(ModuleRevisionId id,
                                       java.lang.String status,
                                       java.util.Date pubDate)
      • DefaultModuleDescriptor

        public DefaultModuleDescriptor​(ModuleRevisionId id,
                                       java.lang.String status,
                                       java.util.Date pubDate,
                                       boolean isDefault)
      • DefaultModuleDescriptor

        public DefaultModuleDescriptor​(ModuleDescriptorParser parser,
                                       Resource res)
        IMPORTANT : at least call setModuleRevisionId and setResolvedPublicationDate with instances created by this constructor !
        Parameters:
        parser - ModuleDescriptorParser
        res - Resource
    • Method Detail

      • transformInstance

        public 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. 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 - ModuleDescriptor
        ns - Namespace
        Returns:
        ModuleDescriptor
      • getMetadataArtifact

        public Artifact 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 interface ModuleDescriptor
        Returns:
        the Artifact representing this module descriptor itself.
      • setModuleArtifact

        public void setModuleArtifact​(Artifact moduleArtifact)
      • isDefault

        public boolean isDefault()
        Specified by:
        isDefault in interface ModuleDescriptor
        Returns:
        true if this descriptor is a default one, i.e. one generated for a module not actually having one.
      • setPublicationDate

        public void setPublicationDate​(java.util.Date publicationDate)
      • getPublicationDate

        public java.util.Date getPublicationDate()
        Specified by:
        getPublicationDate in interface ModuleDescriptor
        Returns:
        the publication date or null when not known in the descriptor itself.
      • setResolvedPublicationDate

        public void setResolvedPublicationDate​(java.util.Date publicationDate)
        Description copied from interface: ModuleDescriptor
        This method update the resolved publication date
        Specified by:
        setResolvedPublicationDate in interface ModuleDescriptor
        Parameters:
        publicationDate - Date
      • getResolvedPublicationDate

        public java.util.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 interface ModuleDescriptor
        Returns:
        Date
      • setModuleRevisionId

        public void setModuleRevisionId​(ModuleRevisionId revId)
      • setStatus

        public void setStatus​(java.lang.String status)
      • addInheritedDescriptor

        public void addInheritedDescriptor​(ExtendsDescriptor descriptor)
      • addConfiguration

        public void addConfiguration​(Configuration conf)
      • addArtifact

        public 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
        Parameters:
        conf - ditto
        artifact - ditto
      • getResolvedModuleRevisionId

        public ModuleRevisionId getResolvedModuleRevisionId()
        Specified by:
        getResolvedModuleRevisionId in interface ModuleDescriptor
        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
      • getInheritedDescriptors

        public ExtendsDescriptor[] getInheritedDescriptors()
        Specified by:
        getInheritedDescriptors in interface ModuleDescriptor
        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

        public Configuration[] getConfigurations()
        Specified by:
        getConfigurations in interface ModuleDescriptor
        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).
      • getConfiguration

        public Configuration getConfiguration​(java.lang.String confName)
        Specified by:
        getConfiguration in interface ModuleDescriptor
        Parameters:
        confName - String
        Returns:
        the configuration object with the given name in the current module descriptor, null if not found.
      • dependsOn

        public boolean dependsOn​(VersionMatcher matcher,
                                 ModuleDescriptor md)
        Specified by:
        dependsOn in interface ModuleDescriptor
        Parameters:
        matcher - VersionMatcher
        md - ModuleDescriptor
        Returns:
        true if the module described by this descriptor depends directly upon the given module descriptor
      • toIvyFile

        public void toIvyFile​(java.io.File destFile)
                       throws java.text.ParseException,
                              java.io.IOException
        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 interface ModuleDescriptor
        Parameters:
        destFile - the destination ivy file
        Throws:
        java.text.ParseException - if something goes wrong
        java.io.IOException - if something goes wrong
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • setDefault

        public void setDefault​(boolean b)
      • addConflictManager

        public void addConflictManager​(ModuleId moduleId,
                                       PatternMatcher matcher,
                                       ConflictManager manager)
        regular expressions as explained in Pattern class may be used in ModuleId organisation and name
        Parameters:
        moduleId - ditto
        matcher - PatternMatcher
        manager - ConflictManager
      • getConflictManager

        public ConflictManager getConflictManager​(ModuleId moduleId)
        Specified by:
        getConflictManager in interface ModuleDescriptor
        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.
      • addLicense

        public void addLicense​(License license)
      • setHomePage

        public void setHomePage​(java.lang.String homePage)
      • setDescription

        public void setDescription​(java.lang.String description)
      • setLastModified

        public void setLastModified​(long lastModified)
      • getNamespace

        public Namespace getNamespace()
      • isNamespaceUseful

        public boolean isNamespaceUseful()
      • setNamespace

        public void setNamespace​(Namespace ns)
      • 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

        public java.lang.String getDefaultConf()
      • setDefaultConf

        public void setDefaultConf​(java.lang.String defaultConf)
      • getDefaultConfMapping

        public java.lang.String getDefaultConfMapping()
      • setDefaultConfMapping

        public void setDefaultConfMapping​(java.lang.String defaultConfMapping)
      • setMappingOverride

        public void setMappingOverride​(boolean override)
      • isMappingOverride

        public boolean isMappingOverride()
      • getAttribute

        public java.lang.String getAttribute​(java.lang.String attName)
        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 interface ExtendableItem
        Parameters:
        attName - the name of the attribute to get
        Returns:
        the value of the attribute, null if the attribute doesn't exist
      • getAttributes

        public java.util.Map<java.lang.String,​java.lang.String> 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 interface ExtendableItem
        Returns:
        A Map instance containing all the attributes and their values.
      • getExtraAttribute

        public java.lang.String getExtraAttribute​(java.lang.String attName)
        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 interface ExtendableItem
        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

        public java.util.Map<java.lang.String,​java.lang.String> 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 interface ExtendableItem
        Returns:
        A Map instance containing all the extra attributes and their values.
        See Also:
        ExtendableItem.getQualifiedExtraAttributes()
      • getQualifiedExtraAttributes

        public java.util.Map<java.lang.String,​java.lang.String> 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 interface ExtendableItem
        Returns:
        A Map instance containing all the extra attributes and their values.
        See Also:
        ExtendableItem.getExtraAttributes()
      • getResource

        public Resource getResource()
        Specified by:
        getResource in interface ModuleDescriptor
        Returns:
        the resource being the source of this module descriptor, null if no resource corresponds to this module descriptor.
      • addExcludeRule

        public void addExcludeRule​(ExcludeRule rule)
      • canExclude

        public boolean canExclude()
        Specified by:
        canExclude in interface ModuleDescriptor
        Returns:
        true if this descriptor contains any exclusion rule.
      • doesExclude

        public boolean doesExclude​(java.lang.String[] moduleConfigurations,
                                   ArtifactId artifactId)
        Only works when namespace is properly set. The behaviour is not specified if namespace is not set.
        Specified by:
        doesExclude in interface ModuleDescriptor
        Parameters:
        moduleConfigurations - String[]
        artifactId - ditto
        Returns:
        boolean
      • getAllExcludeRules

        public ExcludeRule[] 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 interface ModuleDescriptor
        Returns:
        an array of all ExcludeRule this module descriptor currently holds.
      • getExcludeRules

        public ExcludeRule[] getExcludeRules​(java.lang.String[] moduleConfigurations)
      • getExtraAttributesNamespaces

        public java.util.Map<java.lang.String,​java.lang.String> getExtraAttributesNamespaces()
        Specified by:
        getExtraAttributesNamespaces in interface ModuleDescriptor
        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

        public void addExtraAttributeNamespace​(java.lang.String prefix,
                                               java.lang.String namespace)
      • addExtraInfo

        @Deprecated
        public void addExtraInfo​(java.lang.String infoKey,
                                 java.lang.String value)
        Deprecated.
      • getExtraInfo

        @Deprecated
        public java.util.Map<java.lang.String,​java.lang.String> getExtraInfo()
        Deprecated.
        Specified by:
        getExtraInfo in interface ModuleDescriptor
        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

        public java.util.List<ExtraInfoHolder> getExtraInfos()
        Specified by:
        getExtraInfos in interface ModuleDescriptor
        Returns:
        a list of extras infos (tag name, attributes and content). All the tags except the description are given.
      • getExtraInfoContentByTagName

        public java.lang.String getExtraInfoContentByTagName​(java.lang.String tagName)
        Specified by:
        getExtraInfoContentByTagName in interface ModuleDescriptor
        Parameters:
        tagName - String
        Returns:
        content from first extrainfo matching with given tag name.