Class ObrRemoteClean

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

    @Mojo(name="remote-clean",
          requiresProject=false,
          defaultPhase=CLEAN)
    public final class ObrRemoteClean
    extends org.apache.maven.plugin.AbstractMojo
    Clean a remote repository file. It just looks for every resources and check that pointed file exists.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.regex.Pattern ALT_REPO_SYNTAX_PATTERN  
      private java.lang.String altDeploymentRepository
      Alternative deployment repository.
      private org.apache.maven.artifact.repository.ArtifactRepository deploymentRepository  
      private boolean ignoreLock
      When true, ignore remote locking.
      private boolean interactive  
      private org.apache.maven.artifact.manager.WagonManager m_wagonManager
      The Wagon manager.
      private java.lang.String obrDeploymentRepository
      OBR specific deployment repository.
      private java.lang.String obrRepository
      Local OBR Repository.
      private java.lang.String prefixUrl
      Optional public URL prefix for the remote repository.
      private org.apache.maven.project.MavenProject project
      The Maven project.
      private java.lang.String remoteOBR
      Remote OBR Repository.
      private org.apache.maven.settings.Settings settings
      Local Maven settings.
      private java.util.List supportedProjectTypes
      Project types which this plugin supports.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      ObrRemoteClean()  
    • 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 void openRepositoryConnection​(RemoteFileManager remoteFile)  
      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

      • ignoreLock

        @Parameter(property="ignoreLock")
        private boolean ignoreLock
        When true, ignore remote locking.
      • prefixUrl

        @Parameter(property="prefixUrl")
        private java.lang.String prefixUrl
        Optional public URL prefix for the remote repository.
      • remoteOBR

        @Parameter(property="remoteOBR",
                   defaultValue="NONE")
        private java.lang.String remoteOBR
        Remote OBR Repository.
      • obrRepository

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

        @Parameter
        private java.util.List supportedProjectTypes
        Project types which this plugin supports.
      • deploymentRepository

        @Parameter(defaultValue="${project.distributionManagementArtifactRepository}",
                   readonly=true)
        private org.apache.maven.artifact.repository.ArtifactRepository deploymentRepository
      • altDeploymentRepository

        @Parameter(property="altDeploymentRepository")
        private java.lang.String altDeploymentRepository
        Alternative deployment repository. Format: id::layout::url
      • obrDeploymentRepository

        @Parameter(property="obrDeploymentRepository")
        private java.lang.String obrDeploymentRepository
        OBR specific deployment repository. Format: id::layout::url
      • interactive

        @Parameter(defaultValue="${settings.interactiveMode}",
                   readonly=true)
        private boolean interactive
      • project

        @Parameter(defaultValue="${project}",
                   readonly=true,
                   required=true)
        private org.apache.maven.project.MavenProject project
        The Maven project.
      • settings

        @Parameter(defaultValue="${settings}",
                   readonly=true,
                   required=true)
        private org.apache.maven.settings.Settings settings
        Local Maven settings.
      • m_wagonManager

        @Component
        private org.apache.maven.artifact.manager.WagonManager m_wagonManager
        The Wagon manager.
      • ALT_REPO_SYNTAX_PATTERN

        private static final java.util.regex.Pattern ALT_REPO_SYNTAX_PATTERN
    • Constructor Detail

      • ObrRemoteClean

        public ObrRemoteClean()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • openRepositoryConnection

        private void openRepositoryConnection​(RemoteFileManager remoteFile)
                                       throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • 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. This method ask the user before deleting the resources from the repository.
        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
        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