Package org.apache.felix.obrplugin
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 Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.maven.artifact.repository.ArtifactRepository
Local Repository.private String
OBR Repository.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Element
cleanDocument
(Element elem) Analyze the given XML tree (DOM of the repository file) and remove missing resources.void
execute()
private DocumentBuilder
Initialize the document builder from Xerces.private Document
parseFile
(File file, DocumentBuilder constructor) Open an XML file.private void
writeToFile
(URI outputFilename, Node treeToBeWrite) write a Node in a xml file.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
obrRepository
OBR Repository. -
localRepository
@Parameter(defaultValue="${localRepository}", readonly=true, required=true) private org.apache.maven.artifact.repository.ArtifactRepository localRepositoryLocal Repository.
-
-
Constructor Details
-
ObrCleanRepo
public ObrCleanRepo()
-
-
Method Details
-
execute
public void execute() -
cleanDocument
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
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 pathconstructor
- 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 filetreeToBeWrite
- Node root of the tree to be write in file- Throws:
org.apache.maven.plugin.MojoExecutionException
- if the plugin failed
-