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.AbstractMojoClean an OBR repository by finding and removing missing resources.
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.maven.artifact.repository.ArtifactRepositorylocalRepositoryLocal Repository.private java.lang.StringobrRepositoryOBR Repository.
-
Constructor Summary
Constructors Constructor Description ObrCleanRepo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private org.w3c.dom.ElementcleanDocument(org.w3c.dom.Element elem)Analyze the given XML tree (DOM of the repository file) and remove missing resources.voidexecute()private javax.xml.parsers.DocumentBuilderinitConstructor()Initialize the document builder from Xerces.private org.w3c.dom.DocumentparseFile(java.io.File file, javax.xml.parsers.DocumentBuilder constructor)Open an XML file.private voidwriteToFile(java.net.URI outputFilename, org.w3c.dom.Node treeToBeWrite)write a Node in a xml file.
-
-
-
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 localRepositoryLocal Repository.
-
-
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.MojoExecutionExceptionInitialize 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.MojoExecutionExceptionOpen 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(java.net.URI outputFilename, org.w3c.dom.Node treeToBeWrite) throws org.apache.maven.plugin.MojoExecutionExceptionwrite 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
-
-