Class ObrCleanRepo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    @Mojo(name="clean",
          requiresProject=false,
          defaultPhase=CLEAN)
    public class ObrCleanRepo
    extends org.apache.maven.plugin.AbstractMojo
    Clean an OBR repository by finding and removing missing resources.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.apache.maven.artifact.repository.ArtifactRepository localRepository
      Local Repository.
      private java.lang.String obrRepository
      OBR Repository.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      ObrCleanRepo()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private org.w3c.dom.Element cleanDocument​(org.w3c.dom.Element elem)
      Analyze the given XML tree (DOM of the repository file) and remove missing resources.
      void execute()  
      private javax.xml.parsers.DocumentBuilder initConstructor()
      Initialize the document builder from Xerces.
      private org.w3c.dom.Document parseFile​(java.io.File file, javax.xml.parsers.DocumentBuilder constructor)
      Open an XML file.
      private void writeToFile​(java.net.URI outputFilename, org.w3c.dom.Node treeToBeWrite)
      write a Node in a xml file.
      • Methods inherited from class org.apache.maven.plugin.AbstractMojo

        getLog, getPluginContext, setLog, setPluginContext
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • obrRepository

        @Parameter(property="obrRepository")
        private java.lang.String obrRepository
        OBR Repository.
      • localRepository

        @Parameter(defaultValue="${localRepository}",
                   readonly=true,
                   required=true)
        private org.apache.maven.artifact.repository.ArtifactRepository localRepository
        Local Repository.
    • Constructor Detail

      • ObrCleanRepo

        public ObrCleanRepo()
    • Method Detail

      • execute

        public void execute()
      • cleanDocument

        private org.w3c.dom.Element cleanDocument​(org.w3c.dom.Element elem)
        Analyze the given XML tree (DOM of the repository file) and remove missing resources.
        Parameters:
        elem - : the input XML tree
        Returns:
        the cleaned XML tree
      • initConstructor

        private javax.xml.parsers.DocumentBuilder initConstructor()
                                                           throws org.apache.maven.plugin.MojoExecutionException
        Initialize the document builder from Xerces.
        Returns:
        DocumentBuilder ready to create new document
        Throws:
        org.apache.maven.plugin.MojoExecutionException - : occurs when the instantiation of the document builder fails
      • parseFile

        private org.w3c.dom.Document parseFile​(java.io.File file,
                                               javax.xml.parsers.DocumentBuilder constructor)
                                        throws org.apache.maven.plugin.MojoExecutionException
        Open an XML file.
        Parameters:
        file - : XML file path
        constructor - DocumentBuilder get from xerces
        Returns:
        Document which describes this file
        Throws:
        org.apache.maven.plugin.MojoExecutionException - occurs when the given file cannot be opened or is a valid XML file.
      • writeToFile

        private void writeToFile​(java.net.URI outputFilename,
                                 org.w3c.dom.Node treeToBeWrite)
                          throws org.apache.maven.plugin.MojoExecutionException
        write a Node in a xml file.
        Parameters:
        outputFilename - URI to the output file
        treeToBeWrite - Node root of the tree to be write in file
        Throws:
        org.apache.maven.plugin.MojoExecutionException - if the plugin failed