Class ObrCleanRepo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.felix.obrplugin.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 Details

    • obrRepository

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

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

    • ObrCleanRepo

      public ObrCleanRepo()
  • Method Details

    • execute

      public void execute()
    • cleanDocument

      private Element cleanDocument(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 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 Document parseFile(File file, 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(URI outputFilename, 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